#include <metal_stdlib>
using namespace metal;
struct tint_module_vars_struct {
  device float2* prevent_dce;
};
struct vertex_main_outputs {
  float4 tint_symbol [[position]];
};

void sin_fc8bc4(tint_module_vars_struct tint_module_vars) {
  float2 res = float2(1.0f);
  (*tint_module_vars.prevent_dce) = res;
}
float4 vertex_main_inner(tint_module_vars_struct tint_module_vars) {
  sin_fc8bc4(tint_module_vars);
  return float4(0.0f);
}
fragment void fragment_main(device float2* prevent_dce [[buffer(0)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce};
  sin_fc8bc4(tint_module_vars);
}
kernel void compute_main(device float2* prevent_dce [[buffer(0)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce};
  sin_fc8bc4(tint_module_vars);
}
vertex vertex_main_outputs vertex_main(device float2* prevent_dce [[buffer(0)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce};
  return vertex_main_outputs{.tint_symbol=vertex_main_inner(tint_module_vars)};
}
