#include <metal_stdlib>
using namespace metal;

struct VertexInputs0 {
  uint vertex_index;
  int loc0;
};

struct VertexInputs1 {
  uint loc1;
  float4 loc3;
};

struct tint_symbol_outputs {
  float4 tint_symbol_1 [[position]];
};

struct tint_symbol_inputs {
  int VertexInputs0_loc0 [[attribute(0)]];
  uint loc1 [[attribute(1)]];
  uint VertexInputs1_loc1 [[attribute(2)]];
  float4 VertexInputs1_loc3 [[attribute(3)]];
};

float4 tint_symbol_inner(VertexInputs0 inputs0, uint loc1, uint instance_index, VertexInputs1 inputs1) {
  uint const foo = (inputs0.vertex_index + instance_index);
  return float4(0.0f);
}

vertex tint_symbol_outputs tint_symbol(uint VertexInputs0_vertex_index [[vertex_id]], tint_symbol_inputs inputs [[stage_in]], uint instance_index [[instance_id]]) {
  VertexInputs0 const v = VertexInputs0{.vertex_index=VertexInputs0_vertex_index, .loc0=inputs.VertexInputs0_loc0};
  tint_symbol_outputs tint_wrapper_result = {};
  tint_wrapper_result.tint_symbol_1 = tint_symbol_inner(v, inputs.loc1, instance_index, VertexInputs1{.loc1=inputs.VertexInputs1_loc1, .loc3=inputs.VertexInputs1_loc3});
  return tint_wrapper_result;
}
