355 lines
11 KiB
Plaintext
355 lines
11 KiB
Plaintext
#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_3, thread tint_array_wrapper* const tint_symbol_4) {
|
|
int k = 0;
|
|
int i = 0;
|
|
int j = 0;
|
|
int i_1 = 0;
|
|
int const x_260 = *(from);
|
|
k = x_260;
|
|
int const x_261 = *(from);
|
|
i = x_261;
|
|
int const x_262 = *(mid);
|
|
j = as_type<int>((as_type<uint>(x_262) + as_type<uint>(1)));
|
|
while (true) {
|
|
int const x_268 = i;
|
|
int const x_269 = *(mid);
|
|
int const x_271 = j;
|
|
int const x_272 = *(to);
|
|
if (((x_268 <= x_269) & (x_271 <= x_272))) {
|
|
} else {
|
|
break;
|
|
}
|
|
int const x_276 = i;
|
|
int const x_278 = (*(tint_symbol_3)).arr[x_276];
|
|
int const x_279 = j;
|
|
int const x_281 = (*(tint_symbol_3)).arr[x_279];
|
|
if ((x_278 < x_281)) {
|
|
int const x_286 = k;
|
|
k = as_type<int>((as_type<uint>(x_286) + as_type<uint>(1)));
|
|
int const x_288 = i;
|
|
i = as_type<int>((as_type<uint>(x_288) + as_type<uint>(1)));
|
|
int const x_291 = (*(tint_symbol_3)).arr[x_288];
|
|
(*(tint_symbol_4)).arr[x_286] = x_291;
|
|
} else {
|
|
int const x_293 = k;
|
|
k = as_type<int>((as_type<uint>(x_293) + as_type<uint>(1)));
|
|
int const x_295 = j;
|
|
j = as_type<int>((as_type<uint>(x_295) + as_type<uint>(1)));
|
|
int const x_298 = (*(tint_symbol_3)).arr[x_295];
|
|
(*(tint_symbol_4)).arr[x_293] = x_298;
|
|
}
|
|
}
|
|
while (true) {
|
|
int const x_304 = i;
|
|
int const x_306 = i;
|
|
int const x_307 = *(mid);
|
|
if (((x_304 < 10) & (x_306 <= x_307))) {
|
|
} else {
|
|
break;
|
|
}
|
|
int const x_311 = k;
|
|
k = as_type<int>((as_type<uint>(x_311) + as_type<uint>(1)));
|
|
int const x_313 = i;
|
|
i = as_type<int>((as_type<uint>(x_313) + as_type<uint>(1)));
|
|
int const x_316 = (*(tint_symbol_3)).arr[x_313];
|
|
(*(tint_symbol_4)).arr[x_311] = x_316;
|
|
}
|
|
int const x_318 = *(from);
|
|
i_1 = x_318;
|
|
while (true) {
|
|
int const x_323 = i_1;
|
|
int const x_324 = *(to);
|
|
if ((x_323 <= x_324)) {
|
|
} else {
|
|
break;
|
|
}
|
|
int const x_327 = i_1;
|
|
int const x_328 = i_1;
|
|
int const x_330 = (*(tint_symbol_4)).arr[x_328];
|
|
(*(tint_symbol_3)).arr[x_327] = x_330;
|
|
{
|
|
int const x_332 = i_1;
|
|
i_1 = as_type<int>((as_type<uint>(x_332) + as_type<uint>(1)));
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
int func_i1_i1_(thread int* const m, thread int* const high, thread float4* const tint_symbol_5) {
|
|
int x = 0;
|
|
int x_335 = 0;
|
|
int x_336 = 0;
|
|
float const x_338 = (*(tint_symbol_5)).x;
|
|
if ((x_338 >= 0.0f)) {
|
|
if (false) {
|
|
int const x_346 = *(high);
|
|
x_336 = as_type<int>((as_type<uint>(x_346) << as_type<uint>(0)));
|
|
} else {
|
|
x_336 = 4;
|
|
}
|
|
int const x_348 = x_336;
|
|
x_335 = as_type<int>((as_type<uint>(1) << as_type<uint>(x_348)));
|
|
} else {
|
|
x_335 = 1;
|
|
}
|
|
int const x_350 = x_335;
|
|
x = x_350;
|
|
int const x_351 = x;
|
|
x = (x_351 >> as_type<uint>(4));
|
|
int const x_353 = *(m);
|
|
int const x_355 = *(m);
|
|
int const x_357 = *(m);
|
|
int const x_359 = x;
|
|
return clamp(as_type<int>((as_type<uint>(2) * as_type<uint>(x_353))), as_type<int>((as_type<uint>(2) * as_type<uint>(x_355))), (as_type<int>((as_type<uint>(2) * as_type<uint>(x_357))) / x_359));
|
|
}
|
|
|
|
void mergeSort_(thread tint_array_wrapper* const tint_symbol_6, thread tint_array_wrapper* const tint_symbol_7, thread float4* const tint_symbol_8) {
|
|
int low = 0;
|
|
int high_1 = 0;
|
|
int m_1 = 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;
|
|
int param_3 = 0;
|
|
int param_4 = 0;
|
|
low = 0;
|
|
high_1 = 9;
|
|
m_1 = 1;
|
|
while (true) {
|
|
int const x_367 = m_1;
|
|
int const x_368 = high_1;
|
|
if ((x_367 <= x_368)) {
|
|
} else {
|
|
break;
|
|
}
|
|
int const x_371 = low;
|
|
i_2 = x_371;
|
|
while (true) {
|
|
int const x_376 = i_2;
|
|
int const x_377 = high_1;
|
|
if ((x_376 < x_377)) {
|
|
} else {
|
|
break;
|
|
}
|
|
int const x_380 = i_2;
|
|
from_1 = x_380;
|
|
int const x_381 = i_2;
|
|
int const x_382 = m_1;
|
|
mid_1 = as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_381) + as_type<uint>(x_382)))) - as_type<uint>(1)));
|
|
int const x_385 = i_2;
|
|
int const x_386 = m_1;
|
|
int const x_390 = high_1;
|
|
to_1 = min(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_385) + as_type<uint>(as_type<int>((as_type<uint>(2) * as_type<uint>(x_386))))))) - as_type<uint>(1))), x_390);
|
|
int const x_392 = from_1;
|
|
param = x_392;
|
|
int const x_393 = mid_1;
|
|
param_1 = x_393;
|
|
int const x_394 = to_1;
|
|
param_2 = x_394;
|
|
merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_6, tint_symbol_7);
|
|
{
|
|
int const x_396 = m_1;
|
|
param_3 = x_396;
|
|
int const x_397 = high_1;
|
|
param_4 = x_397;
|
|
int const x_398 = func_i1_i1_(&(param_3), &(param_4), tint_symbol_8);
|
|
int const x_399 = i_2;
|
|
i_2 = as_type<int>((as_type<uint>(x_399) + as_type<uint>(x_398)));
|
|
}
|
|
}
|
|
{
|
|
int const x_401 = m_1;
|
|
m_1 = as_type<int>((as_type<uint>(2) * as_type<uint>(x_401)));
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
|
|
void main_1(constant buf0& x_34, 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_93 = x_34.injectionSwitch.x;
|
|
i_3 = int(x_93);
|
|
while (true) {
|
|
int const x_99 = i_3;
|
|
switch(x_99) {
|
|
case 9: {
|
|
int const x_129 = i_3;
|
|
(*(tint_symbol_9)).arr[x_129] = -5;
|
|
break;
|
|
}
|
|
case 8: {
|
|
int const x_127 = i_3;
|
|
(*(tint_symbol_9)).arr[x_127] = -4;
|
|
break;
|
|
}
|
|
case 7: {
|
|
int const x_125 = i_3;
|
|
(*(tint_symbol_9)).arr[x_125] = -3;
|
|
break;
|
|
}
|
|
case 6: {
|
|
int const x_123 = i_3;
|
|
(*(tint_symbol_9)).arr[x_123] = -2;
|
|
break;
|
|
}
|
|
case 5: {
|
|
int const x_121 = i_3;
|
|
(*(tint_symbol_9)).arr[x_121] = -1;
|
|
break;
|
|
}
|
|
case 4: {
|
|
int const x_119 = i_3;
|
|
(*(tint_symbol_9)).arr[x_119] = 0;
|
|
break;
|
|
}
|
|
case 3: {
|
|
int const x_117 = i_3;
|
|
(*(tint_symbol_9)).arr[x_117] = 1;
|
|
break;
|
|
}
|
|
case 2: {
|
|
int const x_115 = i_3;
|
|
(*(tint_symbol_9)).arr[x_115] = 2;
|
|
break;
|
|
}
|
|
case 1: {
|
|
int const x_113 = i_3;
|
|
(*(tint_symbol_9)).arr[x_113] = 3;
|
|
break;
|
|
}
|
|
case 0: {
|
|
int const x_111 = i_3;
|
|
(*(tint_symbol_9)).arr[x_111] = 4;
|
|
break;
|
|
}
|
|
default: {
|
|
break;
|
|
}
|
|
}
|
|
int const x_131 = i_3;
|
|
i_3 = as_type<int>((as_type<uint>(x_131) + as_type<uint>(1)));
|
|
{
|
|
int const x_133 = i_3;
|
|
if ((x_133 < 10)) {
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
j_1 = 0;
|
|
while (true) {
|
|
int const x_139 = j_1;
|
|
if ((x_139 < 10)) {
|
|
} else {
|
|
break;
|
|
}
|
|
int const x_142 = j_1;
|
|
int const x_143 = j_1;
|
|
int const x_145 = (*(tint_symbol_9)).arr[x_143];
|
|
(*(tint_symbol_10)).arr[x_142] = x_145;
|
|
{
|
|
int const x_147 = j_1;
|
|
j_1 = as_type<int>((as_type<uint>(x_147) + as_type<uint>(1)));
|
|
}
|
|
}
|
|
mergeSort_(tint_symbol_9, tint_symbol_10, tint_symbol_11);
|
|
float const x_151 = (*(tint_symbol_11)).y;
|
|
if ((int(x_151) < 30)) {
|
|
int const x_158 = (*(tint_symbol_9)).arr[0];
|
|
grey = (0.5f + (float(x_158) / 10.0f));
|
|
} else {
|
|
float const x_163 = (*(tint_symbol_11)).y;
|
|
if ((int(x_163) < 60)) {
|
|
int const x_170 = (*(tint_symbol_9)).arr[1];
|
|
grey = (0.5f + (float(x_170) / 10.0f));
|
|
} else {
|
|
float const x_175 = (*(tint_symbol_11)).y;
|
|
if ((int(x_175) < 90)) {
|
|
int const x_182 = (*(tint_symbol_9)).arr[2];
|
|
grey = (0.5f + (float(x_182) / 10.0f));
|
|
} else {
|
|
float const x_187 = (*(tint_symbol_11)).y;
|
|
if ((int(x_187) < 120)) {
|
|
int const x_194 = (*(tint_symbol_9)).arr[3];
|
|
grey = (0.5f + (float(x_194) / 10.0f));
|
|
} else {
|
|
float const x_199 = (*(tint_symbol_11)).y;
|
|
if ((int(x_199) < 150)) {
|
|
discard_fragment();
|
|
} else {
|
|
float const x_206 = (*(tint_symbol_11)).y;
|
|
if ((int(x_206) < 180)) {
|
|
int const x_213 = (*(tint_symbol_9)).arr[5];
|
|
grey = (0.5f + (float(x_213) / 10.0f));
|
|
} else {
|
|
float const x_218 = (*(tint_symbol_11)).y;
|
|
if ((int(x_218) < 210)) {
|
|
int const x_225 = (*(tint_symbol_9)).arr[6];
|
|
grey = (0.5f + (float(x_225) / 10.0f));
|
|
} else {
|
|
float const x_230 = (*(tint_symbol_11)).y;
|
|
if ((int(x_230) < 240)) {
|
|
int const x_237 = (*(tint_symbol_9)).arr[7];
|
|
grey = (0.5f + (float(x_237) / 10.0f));
|
|
} else {
|
|
float const x_242 = (*(tint_symbol_11)).y;
|
|
if ((int(x_242) < 270)) {
|
|
int const x_249 = (*(tint_symbol_9)).arr[8];
|
|
grey = (0.5f + (float(x_249) / 10.0f));
|
|
} else {
|
|
discard_fragment();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
float const x_253 = grey;
|
|
float3 const x_254 = float3(x_253, x_253, x_253);
|
|
*(tint_symbol_12) = float4(x_254.x, x_254.y, x_254.z, 1.0f);
|
|
return;
|
|
}
|
|
|
|
main_out tint_symbol_inner(constant buf0& x_34, float4 gl_FragCoord_param, thread float4* const tint_symbol_13, thread tint_array_wrapper* const tint_symbol_14, thread tint_array_wrapper* const tint_symbol_15, thread float4* const tint_symbol_16) {
|
|
*(tint_symbol_13) = gl_FragCoord_param;
|
|
main_1(x_34, tint_symbol_14, tint_symbol_15, tint_symbol_13, tint_symbol_16);
|
|
main_out const tint_symbol_2 = {.x_GLF_color_1=*(tint_symbol_16)};
|
|
return tint_symbol_2;
|
|
}
|
|
|
|
fragment tint_symbol_1 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_34 [[buffer(0)]]) {
|
|
thread float4 tint_symbol_17 = 0.0f;
|
|
thread tint_array_wrapper tint_symbol_18 = {};
|
|
thread tint_array_wrapper tint_symbol_19 = {};
|
|
thread float4 tint_symbol_20 = 0.0f;
|
|
main_out const inner_result = tint_symbol_inner(x_34, gl_FragCoord_param, &(tint_symbol_17), &(tint_symbol_18), &(tint_symbol_19), &(tint_symbol_20));
|
|
tint_symbol_1 wrapper_result = {};
|
|
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
|
|
return wrapper_result;
|
|
}
|
|
|