#include <metal_stdlib>

using namespace metal;
int3 quadBroadcast_0e0e6e() {
  int3 arg_0 = int3(1);
  int3 res = quad_broadcast(arg_0,1u);
  return res;
}

fragment void fragment_main(device packed_int3* tint_symbol [[buffer(0)]]) {
  *(tint_symbol) = packed_int3(quadBroadcast_0e0e6e());
  return;
}

kernel void compute_main(device packed_int3* tint_symbol_1 [[buffer(0)]]) {
  *(tint_symbol_1) = packed_int3(quadBroadcast_0e0e6e());
  return;
}

