#include <metal_stdlib>

using namespace metal;
void sign_5d283a(device packed_half3* const tint_symbol_1) {
  half3 res = half3(1.0h);
  *(tint_symbol_1) = packed_half3(res);
}

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

float4 vertex_main_inner(device packed_half3* const tint_symbol_2) {
  sign_5d283a(tint_symbol_2);
  return float4(0.0f);
}

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

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

