#include <metal_stdlib>
using namespace metal;

struct FragOutput {
  float4 color;
  float4 blend;
};

struct FragInput {
  float4 a;
  float4 b;
};

struct frag_main_outputs {
  float4 FragOutput_color [[color(0)]] [[index(0)]];
  float4 FragOutput_blend [[color(0)]] [[index(1)]];
};

struct frag_main_inputs {
  float4 FragInput_a [[user(locn0)]];
  float4 FragInput_b [[user(locn1)]];
};

FragOutput frag_main_inner(FragInput in) {
  FragOutput output = {};
  output.color = in.a;
  output.blend = in.b;
  return output;
}

fragment frag_main_outputs frag_main(frag_main_inputs inputs [[stage_in]]) {
  FragOutput const v = frag_main_inner(FragInput{.a=inputs.FragInput_a, .b=inputs.FragInput_b});
  return frag_main_outputs{.FragOutput_color=v.color, .FragOutput_blend=v.blend};
}
