#include <metal_stdlib>

using namespace metal;
void bitcast_8318a8(device packed_uint3* const tint_symbol_1) {
  uint3 res = uint3(1u);
  *(tint_symbol_1) = packed_uint3(res);
}

struct tint_symbol {
  float4 value [[position]];
};

float4 vertex_main_inner(device packed_uint3* const tint_symbol_2) {
  bitcast_8318a8(tint_symbol_2);
  return float4(0.0f);
}

vertex tint_symbol vertex_main(device packed_uint3* tint_symbol_3 [[buffer(0)]]) {
  float4 const inner_result = vertex_main_inner(tint_symbol_3);
  tint_symbol wrapper_result = {};
  wrapper_result.value = inner_result;
  return wrapper_result;
}

fragment void fragment_main(device packed_uint3* tint_symbol_4 [[buffer(0)]]) {
  bitcast_8318a8(tint_symbol_4);
  return;
}

kernel void compute_main(device packed_uint3* tint_symbol_5 [[buffer(0)]]) {
  bitcast_8318a8(tint_symbol_5);
  return;
}

