#include <metal_stdlib>

using namespace metal;
int4 quadBroadcast_bed00b() {
  int4 res = quad_broadcast(int4(1),1u);
  return res;
}

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

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

