blob: 941121e54e958394b315fbc1bef31e91b92d0bc6 [file] [log] [blame]
#include <metal_stdlib>
using namespace metal;
struct buf0 {
/* 0x0000 */ packed_float2 injectionSwitch;
};
struct tint_array_wrapper {
int arr[10];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 [[color(0)]];
};
void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) {
int k = 0;
int i = 0;
int j = 0;
int i_1 = 0;
int const x_262 = *(from);
k = x_262;
int const x_263 = *(from);
i = x_263;
int const x_264 = *(mid);
j = (x_264 + 1);
while (true) {
int const x_270 = i;
int const x_271 = *(mid);
int const x_273 = j;
int const x_274 = *(to);
if (((x_270 <= x_271) && (x_273 <= x_274))) {
} else {
break;
}
int const x_278 = i;
int const x_280 = (*(tint_symbol_5)).arr[x_278];
int const x_281 = j;
int const x_283 = (*(tint_symbol_5)).arr[x_281];
if ((x_280 < x_283)) {
int const x_288 = k;
k = (x_288 + 1);
int const x_290 = i;
i = (x_290 + 1);
int const x_293 = (*(tint_symbol_5)).arr[x_290];
(*(tint_symbol_6)).arr[x_288] = x_293;
} else {
int const x_295 = k;
k = (x_295 + 1);
int const x_297 = j;
j = (x_297 + 1);
int const x_300 = (*(tint_symbol_5)).arr[x_297];
(*(tint_symbol_6)).arr[x_295] = x_300;
}
}
while (true) {
int const x_306 = i;
int const x_308 = i;
int const x_309 = *(mid);
if (((x_306 < 10) && (x_308 <= x_309))) {
} else {
break;
}
int const x_313 = k;
k = (x_313 + 1);
int const x_315 = i;
i = (x_315 + 1);
int const x_318 = (*(tint_symbol_5)).arr[x_315];
(*(tint_symbol_6)).arr[x_313] = x_318;
}
int const x_320 = *(from);
i_1 = x_320;
while (true) {
int const x_325 = i_1;
int const x_326 = *(to);
if ((x_325 <= x_326)) {
} else {
break;
}
int const x_329 = i_1;
int const x_330 = i_1;
int const x_332 = (*(tint_symbol_6)).arr[x_330];
(*(tint_symbol_5)).arr[x_329] = x_332;
{
int const x_334 = i_1;
i_1 = (x_334 + 1);
}
}
return;
}
void mergeSort_(thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) {
int low = 0;
int high = 0;
int m = 0;
int i_2 = 0;
int from_1 = 0;
int mid_1 = 0;
int to_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
low = 0;
high = 9;
m = 1;
while (true) {
int const x_341 = m;
int const x_342 = high;
if ((x_341 <= x_342)) {
} else {
break;
}
int const x_345 = low;
i_2 = x_345;
while (true) {
int const x_350 = i_2;
int const x_351 = high;
if ((x_350 < x_351)) {
} else {
break;
}
int const x_354 = i_2;
from_1 = x_354;
int const x_355 = i_2;
int const x_356 = m;
mid_1 = ((x_355 + x_356) - 1);
int const x_359 = i_2;
int const x_360 = m;
int const x_364 = high;
to_1 = min(((x_359 + (2 * x_360)) - 1), x_364);
int const x_366 = from_1;
param = x_366;
int const x_367 = mid_1;
param_1 = x_367;
int const x_368 = to_1;
param_2 = x_368;
merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8);
{
int const x_370 = m;
int const x_372 = i_2;
i_2 = (x_372 + (2 * x_370));
}
}
{
int const x_374 = m;
m = (2 * x_374);
}
}
return;
}
void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) {
int i_3 = 0;
int j_1 = 0;
float grey = 0.0f;
float const x_86 = x_28.injectionSwitch.x;
i_3 = int(x_86);
while (true) {
int const x_92 = i_3;
switch(x_92) {
case 9: {
int const x_122 = i_3;
(*(tint_symbol_9)).arr[x_122] = -5;
break;
}
case 8: {
int const x_120 = i_3;
(*(tint_symbol_9)).arr[x_120] = -4;
break;
}
case 7: {
int const x_118 = i_3;
(*(tint_symbol_9)).arr[x_118] = -3;
break;
}
case 6: {
int const x_116 = i_3;
(*(tint_symbol_9)).arr[x_116] = -2;
break;
}
case 5: {
int const x_114 = i_3;
(*(tint_symbol_9)).arr[x_114] = -1;
break;
}
case 4: {
int const x_112 = i_3;
(*(tint_symbol_9)).arr[x_112] = 0;
break;
}
case 3: {
int const x_110 = i_3;
(*(tint_symbol_9)).arr[x_110] = 1;
break;
}
case 2: {
int const x_108 = i_3;
(*(tint_symbol_9)).arr[x_108] = 2;
break;
}
case 1: {
int const x_106 = i_3;
(*(tint_symbol_9)).arr[x_106] = 3;
break;
}
case 0: {
int const x_104 = i_3;
(*(tint_symbol_9)).arr[x_104] = 4;
break;
}
default: {
break;
}
}
int const x_124 = i_3;
i_3 = (x_124 + 1);
{
int const x_126 = i_3;
if ((x_126 < 10)) {
} else {
break;
}
}
}
j_1 = 0;
while (true) {
int const x_132 = j_1;
bool const x_133 = (x_132 < 10);
float const x_135 = x_28.injectionSwitch.x;
if (!((x_135 <= 1.0f))) {
grey = 1.0f;
}
if (x_133) {
} else {
break;
}
int const x_140 = j_1;
int const x_141 = j_1;
int const x_143 = (*(tint_symbol_9)).arr[x_141];
(*(tint_symbol_10)).arr[x_140] = x_143;
{
int const x_145 = j_1;
j_1 = (x_145 + 1);
}
}
mergeSort_(tint_symbol_9, tint_symbol_10);
float const x_149 = (*(tint_symbol_11)).y;
if ((int(x_149) < 30)) {
int const x_156 = (*(tint_symbol_9)).arr[0];
grey = (0.5f + (float(x_156) / 10.0f));
} else {
float const x_161 = (*(tint_symbol_11)).y;
if ((int(x_161) < 60)) {
int const x_168 = (*(tint_symbol_9)).arr[1];
grey = (0.5f + (float(x_168) / 10.0f));
} else {
float const x_173 = (*(tint_symbol_11)).y;
if ((int(x_173) < 90)) {
int const x_180 = (*(tint_symbol_9)).arr[2];
grey = (0.5f + (float(x_180) / 10.0f));
} else {
float const x_185 = (*(tint_symbol_11)).y;
if ((int(x_185) < 120)) {
int const x_192 = (*(tint_symbol_9)).arr[3];
grey = (0.5f + (float(x_192) / 10.0f));
} else {
float const x_197 = (*(tint_symbol_11)).y;
if ((int(x_197) < 150)) {
discard_fragment();
} else {
float const x_204 = (*(tint_symbol_11)).y;
if ((int(x_204) < 180)) {
int const x_211 = (*(tint_symbol_9)).arr[5];
grey = (0.5f + (float(x_211) / 10.0f));
} else {
float const x_216 = (*(tint_symbol_11)).y;
if ((int(x_216) < 210)) {
int const x_223 = (*(tint_symbol_9)).arr[6];
grey = (0.5f + (float(x_223) / 10.0f));
} else {
float const x_228 = (*(tint_symbol_11)).y;
if ((int(x_228) < 240)) {
int const x_235 = (*(tint_symbol_9)).arr[7];
grey = (0.5f + (float(x_235) / 10.0f));
} else {
float const x_240 = (*(tint_symbol_11)).y;
bool guard233 = true;
if ((int(x_240) < 270)) {
int const x_247 = (*(tint_symbol_9)).arr[8];
grey = (0.5f + (float(x_247) / 10.0f));
guard233 = false;
} else {
if (guard233) {
float const x_252 = x_28.injectionSwitch.y;
if (!((0.0f < x_252))) {
guard233 = false;
}
if (guard233) {
discard_fragment();
}
}
}
}
}
}
}
}
}
}
}
float const x_255 = grey;
float3 const x_256 = float3(x_255, x_255, x_255);
*(tint_symbol_12) = float4(x_256.x, x_256.y, x_256.z, 1.0f);
return;
}
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) {
thread float4 tint_symbol_13 = 0.0f;
thread tint_array_wrapper tint_symbol_14 = {};
thread tint_array_wrapper tint_symbol_15 = {};
thread float4 tint_symbol_16 = 0.0f;
tint_symbol_13 = gl_FragCoord_param;
main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16));
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16};
tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
return tint_symbol_4;
}