#include <metal_stdlib>

using namespace metal;
void g(int a, float b, float c, uint d) {
}

struct In {
  float4 pos;
};

struct tint_symbol_1 {
  uint4 fbf_0 [[color(0)]];
  int4 fbf_2 [[color(2)]];
  float4 uv [[user(locn0)]];
};

void f_inner(int4 fbf_2, In in, float4 uv, uint4 fbf_0) {
  g(fbf_2[2], in.pos[0], uv[0], fbf_0[1]);
}

fragment void f(float4 pos [[position]], tint_symbol_1 tint_symbol [[stage_in]]) {
  In const tint_symbol_2 = {.pos=pos};
  f_inner(tint_symbol.fbf_2, tint_symbol_2, tint_symbol.uv, tint_symbol.fbf_0);
  return;
}

