#include <metal_stdlib>

using namespace metal;
struct main_out {
  float4 x_GLF_color_1;
};
struct tint_symbol_1 {
  float4 x_GLF_color_1 [[color(0)]];
};

void main_1(thread float4* const tint_symbol_4) {
  float4 v = 0.0f;
  float4 const x_23 = v;
  v = float4(float2(1.0f, 1.0f).x, float2(1.0f, 1.0f).y, x_23.z, x_23.w);
  float4 const x_25 = v;
  v = float4(x_25.x, x_25.y, float2(2.0f, 2.0f).x, float2(2.0f, 2.0f).y);
  float4 const x_27 = v;
  if (all((x_27 == float4(1.0f, 1.0f, 2.0f, 2.0f)))) {
    *(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f);
  } else {
    *(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f);
  }
  return;
}

fragment tint_symbol_1 tint_symbol() {
  thread float4 tint_symbol_5 = 0.0f;
  main_1(&(tint_symbol_5));
  main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5};
  tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
  return tint_symbol_3;
}

