#include <metal_stdlib>

using namespace metal;
void normalize_7990f3(device half2* const tint_symbol_1) {
  half2 res = half2(0.70703125h);
  *(tint_symbol_1) = res;
}

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

float4 vertex_main_inner(device half2* const tint_symbol_2) {
  normalize_7990f3(tint_symbol_2);
  return float4(0.0f);
}

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

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

