#include <metal_stdlib>

using namespace metal;
uint3 subgroupBroadcast_34fa3d() {
  uint3 res = simd_broadcast(uint3(1u),ushort(1u));
  return res;
}

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

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

