blob: 12cf733cc634d19a9321e67885faa1baa68943fc [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_302 = *(from);
k = x_302;
int const x_303 = *(from);
i = x_303;
int const x_304 = *(mid);
j = (x_304 + 1);
while (true) {
int const x_310 = i;
int const x_311 = *(mid);
int const x_313 = j;
int const x_314 = *(to);
if (((x_310 <= x_311) & (x_313 <= x_314))) {
} else {
break;
}
int const x_318 = i;
int const x_320 = (*(tint_symbol_5)).arr[x_318];
int const x_321 = j;
int const x_323 = (*(tint_symbol_5)).arr[x_321];
if ((x_320 < x_323)) {
int const x_328 = k;
k = (x_328 + 1);
int const x_330 = i;
i = (x_330 + 1);
int const x_333 = (*(tint_symbol_5)).arr[x_330];
(*(tint_symbol_6)).arr[x_328] = x_333;
} else {
int const x_335 = k;
k = (x_335 + 1);
int const x_337 = j;
j = (x_337 + 1);
int const x_340 = (*(tint_symbol_5)).arr[x_337];
(*(tint_symbol_6)).arr[x_335] = x_340;
}
}
while (true) {
int const x_346 = i;
int const x_348 = i;
int const x_349 = *(mid);
if (((x_346 < 10) & (x_348 <= x_349))) {
} else {
break;
}
int const x_353 = k;
k = (x_353 + 1);
int const x_355 = i;
i = (x_355 + 1);
int const x_358 = (*(tint_symbol_5)).arr[x_355];
(*(tint_symbol_6)).arr[x_353] = x_358;
}
int const x_360 = *(from);
i_1 = x_360;
while (true) {
int const x_365 = i_1;
int const x_366 = *(to);
if ((x_365 <= x_366)) {
} else {
break;
}
int const x_369 = i_1;
int const x_370 = i_1;
int const x_372 = (*(tint_symbol_6)).arr[x_370];
(*(tint_symbol_5)).arr[x_369] = x_372;
{
int const x_374 = i_1;
i_1 = (x_374 + 1);
}
}
return;
}
void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) {
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_7)).arr[x_132] = -5;
break;
}
case 8: {
int const x_130 = i_3;
(*(tint_symbol_7)).arr[x_130] = -4;
break;
}
case 7: {
int const x_128 = i_3;
(*(tint_symbol_7)).arr[x_128] = -3;
break;
}
case 6: {
int const x_126 = i_3;
(*(tint_symbol_7)).arr[x_126] = -2;
break;
}
case 5: {
int const x_124 = i_3;
(*(tint_symbol_7)).arr[x_124] = -1;
break;
}
case 4: {
int const x_122 = i_3;
(*(tint_symbol_7)).arr[x_122] = 0;
break;
}
case 3: {
int const x_120 = i_3;
(*(tint_symbol_7)).arr[x_120] = 1;
break;
}
case 2: {
int const x_118 = i_3;
(*(tint_symbol_7)).arr[x_118] = 2;
break;
}
case 1: {
int const x_116 = i_3;
(*(tint_symbol_7)).arr[x_116] = 3;
break;
}
case 0: {
int const x_114 = i_3;
(*(tint_symbol_7)).arr[x_114] = 4;
break;
}
default: {
break;
}
}
int const x_134 = i_3;
i_3 = (x_134 + 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_7)).arr[x_146];
(*(tint_symbol_8)).arr[x_145] = x_148;
{
int const x_150 = j_1;
j_1 = (x_150 + 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;
x_89 = ((x_170 + x_171) - 1);
int const x_174 = x_91;
int const x_175 = x_92;
int const x_179 = x_93;
x_88 = min(((x_174 + (2 * x_175)) - 1), x_179);
int const x_181 = x_90;
x_87 = x_181;
int const x_182 = x_89;
x_86 = x_182;
int const x_183 = x_88;
x_85 = x_183;
merge_i1_i1_i1_(&(x_87), &(x_86), &(x_85), tint_symbol_7, tint_symbol_8);
{
int const x_185 = x_92;
int const x_187 = x_91;
x_91 = (x_187 + (2 * x_185));
}
}
{
int const x_189 = x_92;
x_92 = (2 * x_189);
}
}
float const x_193 = (*(tint_symbol_9)).y;
if ((int(x_193) < 30)) {
int const x_200 = (*(tint_symbol_7)).arr[0];
grey = (0.5f + (float(x_200) / 10.0f));
} else {
float const x_205 = (*(tint_symbol_9)).y;
if ((int(x_205) < 60)) {
int const x_212 = (*(tint_symbol_7)).arr[1];
grey = (0.5f + (float(x_212) / 10.0f));
} else {
float const x_217 = (*(tint_symbol_9)).y;
if ((int(x_217) < 90)) {
int const x_224 = (*(tint_symbol_7)).arr[2];
grey = (0.5f + (float(x_224) / 10.0f));
} else {
float const x_229 = (*(tint_symbol_9)).y;
if ((int(x_229) < 120)) {
int const x_236 = (*(tint_symbol_7)).arr[3];
grey = (0.5f + (float(x_236) / 10.0f));
} else {
float const x_241 = (*(tint_symbol_9)).y;
if ((int(x_241) < 150)) {
discard_fragment();
} else {
float const x_248 = (*(tint_symbol_9)).y;
if ((int(x_248) < 180)) {
int const x_255 = (*(tint_symbol_7)).arr[5];
grey = (0.5f + (float(x_255) / 10.0f));
} else {
float const x_260 = (*(tint_symbol_9)).y;
if ((int(x_260) < 210)) {
int const x_267 = (*(tint_symbol_7)).arr[6];
grey = (0.5f + (float(x_267) / 10.0f));
} else {
float const x_272 = (*(tint_symbol_9)).y;
if ((int(x_272) < 240)) {
int const x_279 = (*(tint_symbol_7)).arr[7];
grey = (0.5f + (float(x_279) / 10.0f));
} else {
float const x_284 = (*(tint_symbol_9)).y;
if ((int(x_284) < 270)) {
int const x_291 = (*(tint_symbol_7)).arr[8];
grey = (0.5f + (float(x_291) / 10.0f));
} else {
discard_fragment();
}
}
}
}
}
}
}
}
}
float const x_295 = grey;
float3 const x_296 = float3(x_295, x_295, x_295);
*(tint_symbol_10) = float4(x_296.x, x_296.y, x_296.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_11 = 0.0f;
thread tint_array_wrapper tint_symbol_12 = {};
thread tint_array_wrapper tint_symbol_13 = {};
thread float4 tint_symbol_14 = 0.0f;
tint_symbol_11 = gl_FragCoord_param;
main_1(x_28, &(tint_symbol_12), &(tint_symbol_13), &(tint_symbol_11), &(tint_symbol_14));
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_14};
tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
return tint_symbol_4;
}
void mergeSort_(thread tint_array_wrapper* const tint_symbol_15, thread tint_array_wrapper* const tint_symbol_16) {
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_381 = m;
int const x_382 = high;
if ((x_381 <= x_382)) {
} else {
break;
}
int const x_385 = low;
i_2 = x_385;
while (true) {
int const x_390 = i_2;
int const x_391 = high;
if ((x_390 < x_391)) {
} else {
break;
}
int const x_394 = i_2;
from_1 = x_394;
int const x_395 = i_2;
int const x_396 = m;
mid_1 = ((x_395 + x_396) - 1);
int const x_399 = i_2;
int const x_400 = m;
int const x_404 = high;
to_1 = min(((x_399 + (2 * x_400)) - 1), x_404);
int const x_406 = from_1;
param = x_406;
int const x_407 = mid_1;
param_1 = x_407;
int const x_408 = to_1;
param_2 = x_408;
merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_15, tint_symbol_16);
{
int const x_410 = m;
int const x_412 = i_2;
i_2 = (x_412 + (2 * x_410));
}
}
{
int const x_414 = m;
m = (2 * x_414);
}
}
return;
}