blob: 49f299eadb555139c93920b41e826e465e6a9c86 [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_1 {
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_4, thread tint_array_wrapper* const tint_symbol_5) {
int k = 0;
int i = 0;
int j = 0;
int i_1 = 0;
int const x_303 = *(from);
k = x_303;
int const x_304 = *(from);
i = x_304;
int const x_305 = *(mid);
j = as_type<int>((as_type<uint>(x_305) + as_type<uint>(1)));
while (true) {
int const x_311 = i;
int const x_312 = *(mid);
int const x_314 = j;
int const x_315 = *(to);
if (((x_311 <= x_312) && (x_314 <= x_315))) {
} else {
break;
}
int const x_319 = i;
int const x_321 = (*(tint_symbol_4)).arr[x_319];
int const x_322 = j;
int const x_324 = (*(tint_symbol_4)).arr[x_322];
if ((x_321 < x_324)) {
int const x_329 = k;
k = as_type<int>((as_type<uint>(x_329) + as_type<uint>(1)));
int const x_331 = i;
i = as_type<int>((as_type<uint>(x_331) + as_type<uint>(1)));
int const x_334 = (*(tint_symbol_4)).arr[x_331];
(*(tint_symbol_5)).arr[x_329] = x_334;
} else {
int const x_336 = k;
k = as_type<int>((as_type<uint>(x_336) + as_type<uint>(1)));
int const x_338 = j;
j = as_type<int>((as_type<uint>(x_338) + as_type<uint>(1)));
int const x_341 = (*(tint_symbol_4)).arr[x_338];
(*(tint_symbol_5)).arr[x_336] = x_341;
}
}
while (true) {
int const x_347 = i;
int const x_349 = i;
int const x_350 = *(mid);
if (((x_347 < 10) && (x_349 <= x_350))) {
} else {
break;
}
int const x_354 = k;
k = as_type<int>((as_type<uint>(x_354) + as_type<uint>(1)));
int const x_356 = i;
i = as_type<int>((as_type<uint>(x_356) + as_type<uint>(1)));
int const x_359 = (*(tint_symbol_4)).arr[x_356];
(*(tint_symbol_5)).arr[x_354] = x_359;
}
int const x_361 = *(from);
i_1 = x_361;
while (true) {
int const x_366 = i_1;
int const x_367 = *(to);
if ((x_366 <= x_367)) {
} else {
break;
}
int const x_370 = i_1;
int const x_371 = i_1;
int const x_373 = (*(tint_symbol_5)).arr[x_371];
(*(tint_symbol_4)).arr[x_370] = x_373;
{
int const x_375 = i_1;
i_1 = as_type<int>((as_type<uint>(x_375) + as_type<uint>(1)));
}
}
return;
}
void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_6, thread tint_array_wrapper* const tint_symbol_7, thread float4* const tint_symbol_8, thread float4* const tint_symbol_9) {
int x_85 = 0;
int x_86 = 0;
int x_87 = 0;
int x_88 = 0;
int x_89 = 0;
int x_90 = 0;
int x_91 = 0;
int x_92 = 0;
int x_93 = 0;
int x_94 = 0;
int i_3 = 0;
int j_1 = 0;
float grey = 0.0f;
float const x_96 = x_28.injectionSwitch.x;
i_3 = int(x_96);
while (true) {
int const x_102 = i_3;
switch(x_102) {
case 9: {
int const x_132 = i_3;
(*(tint_symbol_6)).arr[x_132] = -5;
break;
}
case 8: {
int const x_130 = i_3;
(*(tint_symbol_6)).arr[x_130] = -4;
break;
}
case 7: {
int const x_128 = i_3;
(*(tint_symbol_6)).arr[x_128] = -3;
break;
}
case 6: {
int const x_126 = i_3;
(*(tint_symbol_6)).arr[x_126] = -2;
break;
}
case 5: {
int const x_124 = i_3;
(*(tint_symbol_6)).arr[x_124] = -1;
break;
}
case 4: {
int const x_122 = i_3;
(*(tint_symbol_6)).arr[x_122] = 0;
break;
}
case 3: {
int const x_120 = i_3;
(*(tint_symbol_6)).arr[x_120] = 1;
break;
}
case 2: {
int const x_118 = i_3;
(*(tint_symbol_6)).arr[x_118] = 2;
break;
}
case 1: {
int const x_116 = i_3;
(*(tint_symbol_6)).arr[x_116] = 3;
break;
}
case 0: {
int const x_114 = i_3;
(*(tint_symbol_6)).arr[x_114] = 4;
break;
}
default: {
break;
}
}
int const x_134 = i_3;
i_3 = as_type<int>((as_type<uint>(x_134) + as_type<uint>(1)));
{
int const x_136 = i_3;
if ((x_136 < 10)) {
} else {
break;
}
}
}
j_1 = 0;
while (true) {
int const x_142 = j_1;
if ((x_142 < 10)) {
} else {
break;
}
int const x_145 = j_1;
int const x_146 = j_1;
int const x_148 = (*(tint_symbol_6)).arr[x_146];
(*(tint_symbol_7)).arr[x_145] = x_148;
{
int const x_150 = j_1;
j_1 = as_type<int>((as_type<uint>(x_150) + as_type<uint>(1)));
}
}
x_94 = 0;
x_93 = 9;
x_92 = 1;
while (true) {
int const x_156 = x_92;
int const x_157 = x_93;
if ((x_156 <= x_157)) {
} else {
break;
}
int const x_160 = x_94;
x_91 = x_160;
while (true) {
int const x_165 = x_91;
int const x_166 = x_93;
if ((x_165 < x_166)) {
} else {
break;
}
int const x_169 = x_91;
x_90 = x_169;
int const x_170 = x_91;
int const x_171 = x_92;
tint_array_wrapper const x_173 = *(tint_symbol_6);
tint_array_wrapper const tint_symbol_2 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
*(tint_symbol_6) = tint_symbol_2;
*(tint_symbol_6) = x_173;
x_89 = as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_170) + as_type<uint>(x_171)))) - as_type<uint>(1)));
int const x_175 = x_91;
int const x_176 = x_92;
int const x_180 = x_93;
x_88 = min(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_175) + as_type<uint>(as_type<int>((as_type<uint>(2) * as_type<uint>(x_176))))))) - as_type<uint>(1))), x_180);
int const x_182 = x_90;
x_87 = x_182;
int const x_183 = x_89;
x_86 = x_183;
int const x_184 = x_88;
x_85 = x_184;
merge_i1_i1_i1_(&(x_87), &(x_86), &(x_85), tint_symbol_6, tint_symbol_7);
{
int const x_186 = x_92;
int const x_188 = x_91;
x_91 = as_type<int>((as_type<uint>(x_188) + as_type<uint>(as_type<int>((as_type<uint>(2) * as_type<uint>(x_186))))));
}
}
{
int const x_190 = x_92;
x_92 = as_type<int>((as_type<uint>(2) * as_type<uint>(x_190)));
}
}
float const x_194 = (*(tint_symbol_8)).y;
if ((int(x_194) < 30)) {
int const x_201 = (*(tint_symbol_6)).arr[0];
grey = (0.5f + (float(x_201) / 10.0f));
} else {
float const x_206 = (*(tint_symbol_8)).y;
if ((int(x_206) < 60)) {
int const x_213 = (*(tint_symbol_6)).arr[1];
grey = (0.5f + (float(x_213) / 10.0f));
} else {
float const x_218 = (*(tint_symbol_8)).y;
if ((int(x_218) < 90)) {
int const x_225 = (*(tint_symbol_6)).arr[2];
grey = (0.5f + (float(x_225) / 10.0f));
} else {
float const x_230 = (*(tint_symbol_8)).y;
if ((int(x_230) < 120)) {
int const x_237 = (*(tint_symbol_6)).arr[3];
grey = (0.5f + (float(x_237) / 10.0f));
} else {
float const x_242 = (*(tint_symbol_8)).y;
if ((int(x_242) < 150)) {
discard_fragment();
} else {
float const x_249 = (*(tint_symbol_8)).y;
if ((int(x_249) < 180)) {
int const x_256 = (*(tint_symbol_6)).arr[5];
grey = (0.5f + (float(x_256) / 10.0f));
} else {
float const x_261 = (*(tint_symbol_8)).y;
if ((int(x_261) < 210)) {
int const x_268 = (*(tint_symbol_6)).arr[6];
grey = (0.5f + (float(x_268) / 10.0f));
} else {
float const x_273 = (*(tint_symbol_8)).y;
if ((int(x_273) < 240)) {
int const x_280 = (*(tint_symbol_6)).arr[7];
grey = (0.5f + (float(x_280) / 10.0f));
} else {
float const x_285 = (*(tint_symbol_8)).y;
if ((int(x_285) < 270)) {
int const x_292 = (*(tint_symbol_6)).arr[8];
grey = (0.5f + (float(x_292) / 10.0f));
} else {
discard_fragment();
}
}
}
}
}
}
}
}
}
float const x_296 = grey;
float3 const x_297 = float3(x_296, x_296, x_296);
*(tint_symbol_9) = float4(x_297.x, x_297.y, x_297.z, 1.0f);
return;
}
main_out tint_symbol_inner(constant buf0& x_28, float4 gl_FragCoord_param, thread float4* const tint_symbol_10, thread tint_array_wrapper* const tint_symbol_11, thread tint_array_wrapper* const tint_symbol_12, thread float4* const tint_symbol_13) {
*(tint_symbol_10) = gl_FragCoord_param;
main_1(x_28, tint_symbol_11, tint_symbol_12, tint_symbol_10, tint_symbol_13);
main_out const tint_symbol_3 = {.x_GLF_color_1=*(tint_symbol_13)};
return tint_symbol_3;
}
fragment tint_symbol_1 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) {
thread float4 tint_symbol_14 = 0.0f;
thread tint_array_wrapper tint_symbol_15 = {};
thread tint_array_wrapper tint_symbol_16 = {};
thread float4 tint_symbol_17 = 0.0f;
main_out const inner_result = tint_symbol_inner(x_28, gl_FragCoord_param, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_16), &(tint_symbol_17));
tint_symbol_1 wrapper_result = {};
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}
void mergeSort_(thread tint_array_wrapper* const tint_symbol_18, thread tint_array_wrapper* const tint_symbol_19) {
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_382 = m;
int const x_383 = high;
if ((x_382 <= x_383)) {
} else {
break;
}
int const x_386 = low;
i_2 = x_386;
while (true) {
int const x_391 = i_2;
int const x_392 = high;
if ((x_391 < x_392)) {
} else {
break;
}
int const x_395 = i_2;
from_1 = x_395;
int const x_396 = i_2;
int const x_397 = m;
mid_1 = as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_396) + as_type<uint>(x_397)))) - as_type<uint>(1)));
int const x_400 = i_2;
int const x_401 = m;
int const x_405 = high;
to_1 = min(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_400) + as_type<uint>(as_type<int>((as_type<uint>(2) * as_type<uint>(x_401))))))) - as_type<uint>(1))), x_405);
int const x_407 = from_1;
param = x_407;
int const x_408 = mid_1;
param_1 = x_408;
int const x_409 = to_1;
param_2 = x_409;
merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_18, tint_symbol_19);
{
int const x_411 = m;
int const x_413 = i_2;
i_2 = as_type<int>((as_type<uint>(x_413) + as_type<uint>(as_type<int>((as_type<uint>(2) * as_type<uint>(x_411))))));
}
}
{
int const x_415 = m;
m = as_type<int>((as_type<uint>(2) * as_type<uint>(x_415)));
}
}
return;
}