#include <metal_stdlib>

using namespace metal;
void bitcast_2421c8(device float2* const tint_symbol_1) {
  float2 res = float2(1.40129846e-45f);
  *(tint_symbol_1) = res;
}

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

float4 vertex_main_inner(device float2* const tint_symbol_2) {
  bitcast_2421c8(tint_symbol_2);
  return float4(0.0f);
}

vertex tint_symbol vertex_main(device float2* 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 float2* tint_symbol_4 [[buffer(0)]]) {
  bitcast_2421c8(tint_symbol_4);
  return;
}

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

