#include <metal_stdlib>

using namespace metal;
struct buf0 {
  /* 0x0000 */ packed_float2 resolution;
};
struct tint_array_wrapper {
  float4 arr[8];
};
struct tint_array_wrapper_1 {
  float4 arr[16];
};
struct main_out {
  float4 x_GLF_color_1;
};
struct tint_symbol_2 {
  float4 x_GLF_color_1 [[color(0)]];
};

void main_1(constant buf0& x_6, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11) {
  tint_array_wrapper x_81 = {.arr={float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}};
  tint_array_wrapper x_82 = {};
  tint_array_wrapper x_83 = {};
  tint_array_wrapper x_84 = {};
  tint_array_wrapper_1 x_85 = {};
  float4 x_95 = 0.0f;
  float4 x_95_phi = 0.0f;
  int x_98_phi = 0;
  tint_array_wrapper const tint_symbol_4 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}};
  x_81 = tint_symbol_4;
  tint_array_wrapper const x_86 = x_81;
  float4 const x_87 = *(tint_symbol_10);
  float2 const x_90 = x_6.resolution;
  float2 const x_93 = floor(((float2(x_87.x, x_87.y) / x_90) * 32.0f));
  x_95_phi = float4(0.5f, 0.5f, 1.0f, 1.0f);
  x_98_phi = 0;
  while (true) {
    float4 x_143 = 0.0f;
    int x_99 = 0;
    bool x_127_phi = false;
    float4 x_96_phi = 0.0f;
    x_95 = x_95_phi;
    int const x_98 = x_98_phi;
    if ((x_98 < 8)) {
    } else {
      break;
    }
    float4 x_104 = 0.0f;
    x_82 = x_86;
    x_104 = x_82.arr[x_98];
    switch(0u) {
      default: {
        float const x_107 = x_93.x;
        float const x_108 = x_104.x;
        if ((x_107 < x_108)) {
          x_127_phi = false;
          break;
        }
        float const x_112 = x_93.y;
        float const x_113 = x_104.y;
        if ((x_112 < x_113)) {
          x_127_phi = false;
          break;
        }
        if ((x_107 > (x_108 + x_104.z))) {
          x_127_phi = false;
          break;
        }
        if ((x_112 > (x_113 + x_104.w))) {
          x_127_phi = false;
          break;
        }
        x_127_phi = true;
        break;
      }
    }
    bool const x_127 = x_127_phi;
    x_96_phi = x_95;
    if (x_127) {
      tint_array_wrapper const tint_symbol_5 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}};
      x_83 = tint_symbol_5;
      float const x_131 = x_83.arr[x_98].x;
      tint_array_wrapper const tint_symbol_6 = {.arr={float4(4.0f, 4.0f, 20.0f, 4.0f), float4(4.0f, 4.0f, 4.0f, 20.0f), float4(4.0f, 20.0f, 20.0f, 4.0f), float4(20.0f, 4.0f, 4.0f, 8.0f), float4(8.0f, 6.0f, 4.0f, 2.0f), float4(2.0f, 12.0f, 2.0f, 4.0f), float4(16.0f, 2.0f, 4.0f, 4.0f), float4(12.0f, 22.0f, 4.0f, 4.0f)}};
      x_84 = tint_symbol_6;
      float const x_134 = x_84.arr[x_98].y;
      tint_array_wrapper const x_135 = x_81;
      tint_array_wrapper const tint_symbol_7 = {.arr={float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f)}};
      x_81 = tint_symbol_7;
      x_81 = x_135;
      tint_array_wrapper_1 const tint_symbol_8 = {.arr={float4(0.0f, 0.0f, 0.0f, 1.0f), float4(0.5f, 0.0f, 0.0f, 1.0f), float4(0.0f, 0.5f, 0.0f, 1.0f), float4(0.5f, 0.5f, 0.0f, 1.0f), float4(0.0f, 0.0f, 0.5f, 1.0f), float4(0.5f, 0.0f, 0.5f, 1.0f), float4(0.0f, 0.5f, 0.5f, 1.0f), float4(0.5f, 0.5f, 0.5f, 1.0f), float4(0.0f, 0.0f, 0.0f, 1.0f), float4(1.0f, 0.0f, 0.0f, 1.0f), float4(0.0f, 1.0f, 0.0f, 1.0f), float4(1.0f, 1.0f, 0.0f, 1.0f), float4(0.0f, 0.0f, 1.0f, 1.0f), float4(1.0f, 0.0f, 1.0f, 1.0f), float4(0.0f, 1.0f, 1.0f, 1.0f), float4(1.0f, 1.0f, 1.0f, 1.0f)}};
      x_85 = tint_symbol_8;
      x_143 = x_85.arr[((((int(x_131) * int(x_134)) + (x_98 * 9)) + 11) % 16)];
      x_96_phi = x_143;
    }
    float4 const x_96 = x_96_phi;
    {
      x_99 = (x_98 + 1);
      x_95_phi = x_96;
      x_98_phi = x_99;
    }
  }
  *(tint_symbol_11) = x_95;
  return;
}

fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_6 [[buffer(0)]]) {
  thread float4 tint_symbol_12 = 0.0f;
  thread float4 tint_symbol_13 = 0.0f;
  tint_symbol_12 = gl_FragCoord_param;
  main_1(x_6, &(tint_symbol_12), &(tint_symbol_13));
  main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_13};
  tint_symbol_2 const tint_symbol_9 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
  return tint_symbol_9;
}