blob: c4cabb8f27e431fa5d6f8310a26864c1fd18e921 [file] [log] [blame]
#include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
int arr[10];
};
struct QuicksortObject {
tint_array_wrapper numbers;
};
struct buf0 {
/* 0x0000 */ packed_float2 resolution;
};
struct main_out {
float4 frag_color_1;
float4 gl_Position;
};
struct tint_symbol_2 {
float4 x_GLF_pos_param [[attribute(0)]];
};
struct tint_symbol_3 {
float4 frag_color_1 [[user(locn0)]];
float4 gl_Position [[position]];
};
int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_6) {
int x_314 = 0;
int x_315 = 0;
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
int const x_316 = *(h);
int const x_318 = (*(tint_symbol_6)).numbers.arr[x_316];
pivot = x_318;
int const x_319 = *(l);
i_1 = as_type<int>((as_type<uint>(x_319) - as_type<uint>(1)));
int const x_321 = *(l);
j_1 = x_321;
while (true) {
int const x_326 = j_1;
int const x_327 = *(h);
if ((x_326 <= as_type<int>((as_type<uint>(x_327) - as_type<uint>(1))))) {
} else {
break;
}
int const x_331 = j_1;
int const x_333 = (*(tint_symbol_6)).numbers.arr[x_331];
int const x_334 = pivot;
if ((x_333 <= x_334)) {
int const x_338 = i_1;
i_1 = as_type<int>((as_type<uint>(x_338) + as_type<uint>(1)));
int const x_340 = i_1;
param = x_340;
int const x_341 = j_1;
param_1 = x_341;
int const x_342 = param;
int const x_344 = (*(tint_symbol_6)).numbers.arr[x_342];
x_315 = x_344;
int const x_345 = param;
int const x_346 = param_1;
int const x_348 = (*(tint_symbol_6)).numbers.arr[x_346];
(*(tint_symbol_6)).numbers.arr[x_345] = x_348;
int const x_350 = param_1;
int const x_351 = x_315;
(*(tint_symbol_6)).numbers.arr[x_350] = x_351;
}
{
int const x_353 = j_1;
j_1 = as_type<int>((as_type<uint>(x_353) + as_type<uint>(1)));
}
}
int const x_355 = i_1;
param_2 = as_type<int>((as_type<uint>(x_355) + as_type<uint>(1)));
int const x_357 = *(h);
param_3 = x_357;
int const x_358 = param_2;
int const x_360 = (*(tint_symbol_6)).numbers.arr[x_358];
x_314 = x_360;
int const x_361 = param_2;
int const x_362 = param_3;
int const x_364 = (*(tint_symbol_6)).numbers.arr[x_362];
(*(tint_symbol_6)).numbers.arr[x_361] = x_364;
int const x_366 = param_3;
int const x_367 = x_314;
(*(tint_symbol_6)).numbers.arr[x_366] = x_367;
if (false) {
} else {
int const x_372 = i_1;
return as_type<int>((as_type<uint>(x_372) + as_type<uint>(1)));
}
return 0;
}
void main_1(constant buf0& x_34, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8, thread QuicksortObject* const tint_symbol_9, thread float4* const tint_symbol_10, thread float4* const tint_symbol_11) {
int x_91 = 0;
int x_92 = 0;
int x_93 = 0;
tint_array_wrapper x_94 = {};
int x_95 = 0;
int x_96 = 0;
int x_97 = 0;
int i_2 = 0;
float2 uv = 0.0f;
float3 color = 0.0f;
float4 const x_98 = *(tint_symbol_7);
*(tint_symbol_8) = ((x_98 + float4(1.0f, 1.0f, 0.0f, 0.0f)) * float4(128.0f, 128.0f, 1.0f, 1.0f));
i_2 = 0;
while (true) {
int const x_105 = i_2;
if ((x_105 < 10)) {
} else {
break;
}
int const x_108 = i_2;
int const x_109 = i_2;
(*(tint_symbol_9)).numbers.arr[x_108] = as_type<int>((as_type<uint>(10) - as_type<uint>(x_109)));
int const x_112 = i_2;
int const x_113 = i_2;
int const x_115 = (*(tint_symbol_9)).numbers.arr[x_113];
int const x_116 = i_2;
int const x_118 = (*(tint_symbol_9)).numbers.arr[x_116];
(*(tint_symbol_9)).numbers.arr[x_112] = as_type<int>((as_type<uint>(x_115) * as_type<uint>(x_118)));
{
int const x_121 = i_2;
i_2 = as_type<int>((as_type<uint>(x_121) + as_type<uint>(1)));
}
}
x_91 = 0;
x_92 = 9;
x_93 = -1;
int const x_123 = x_93;
int const x_124 = as_type<int>((as_type<uint>(x_123) + as_type<uint>(1)));
x_93 = x_124;
int const x_125 = x_91;
x_94.arr[x_124] = x_125;
int const x_127 = x_93;
int const x_128 = as_type<int>((as_type<uint>(x_127) + as_type<uint>(1)));
x_93 = x_128;
int const x_129 = x_92;
x_94.arr[x_128] = x_129;
while (true) {
int const x_135 = x_93;
if ((x_135 >= 0)) {
} else {
break;
}
int const x_138 = x_93;
x_93 = as_type<int>((as_type<uint>(x_138) - as_type<uint>(1)));
int const x_141 = x_94.arr[x_138];
x_92 = x_141;
int const x_142 = x_93;
x_93 = as_type<int>((as_type<uint>(x_142) - as_type<uint>(1)));
int const x_145 = x_94.arr[x_142];
x_91 = x_145;
int const x_146 = x_91;
x_96 = x_146;
int const x_147 = x_92;
x_97 = x_147;
int const x_148 = performPartition_i1_i1_(&(x_96), &(x_97), tint_symbol_9);
x_95 = x_148;
int const x_149 = x_95;
int const x_151 = x_91;
if ((as_type<int>((as_type<uint>(x_149) - as_type<uint>(1))) > x_151)) {
int const x_155 = x_93;
int const x_156 = as_type<int>((as_type<uint>(x_155) + as_type<uint>(1)));
x_93 = x_156;
int const x_157 = x_91;
x_94.arr[x_156] = x_157;
int const x_159 = x_93;
int const x_160 = as_type<int>((as_type<uint>(x_159) + as_type<uint>(1)));
x_93 = x_160;
int const x_161 = x_95;
x_94.arr[x_160] = as_type<int>((as_type<uint>(x_161) - as_type<uint>(1)));
}
int const x_164 = x_95;
int const x_166 = x_92;
if ((as_type<int>((as_type<uint>(x_164) + as_type<uint>(1))) < x_166)) {
int const x_170 = x_93;
int const x_171 = as_type<int>((as_type<uint>(x_170) + as_type<uint>(1)));
x_93 = x_171;
int const x_172 = x_95;
x_94.arr[x_171] = as_type<int>((as_type<uint>(x_172) + as_type<uint>(1)));
int const x_175 = x_93;
int const x_176 = as_type<int>((as_type<uint>(x_175) + as_type<uint>(1)));
x_93 = x_176;
int const x_177 = x_92;
x_94.arr[x_176] = x_177;
}
}
float4 const x_179 = *(tint_symbol_8);
float2 const x_182 = x_34.resolution;
uv = (float2(x_179.x, x_179.y) / x_182);
color = float3(1.0f, 2.0f, 3.0f);
int const x_185 = (*(tint_symbol_9)).numbers.arr[0];
float const x_188 = color.x;
color.x = (x_188 + float(x_185));
float const x_192 = uv.x;
if ((x_192 > 0.25f)) {
int const x_197 = (*(tint_symbol_9)).numbers.arr[1];
float const x_200 = color.x;
color.x = (x_200 + float(x_197));
}
float const x_204 = uv.x;
if ((x_204 > 0.5f)) {
int const x_209 = (*(tint_symbol_9)).numbers.arr[2];
float const x_212 = color.y;
color.y = (x_212 + float(x_209));
}
float const x_216 = uv.x;
if ((x_216 > 0.75f)) {
int const x_221 = (*(tint_symbol_9)).numbers.arr[3];
float const x_224 = color.z;
color.z = (x_224 + float(x_221));
}
int const x_228 = (*(tint_symbol_9)).numbers.arr[4];
float const x_231 = color.y;
color.y = (x_231 + float(x_228));
float const x_235 = uv.y;
if ((x_235 > 0.25f)) {
int const x_240 = (*(tint_symbol_9)).numbers.arr[5];
float const x_243 = color.x;
color.x = (x_243 + float(x_240));
}
float const x_247 = uv.y;
if ((x_247 > 0.5f)) {
int const x_252 = (*(tint_symbol_9)).numbers.arr[6];
float const x_255 = color.y;
color.y = (x_255 + float(x_252));
}
float const x_259 = uv.y;
if ((x_259 > 0.75f)) {
int const x_264 = (*(tint_symbol_9)).numbers.arr[7];
float const x_267 = color.z;
color.z = (x_267 + float(x_264));
}
int const x_271 = (*(tint_symbol_9)).numbers.arr[8];
float const x_274 = color.z;
color.z = (x_274 + float(x_271));
float const x_278 = uv.x;
float const x_280 = uv.y;
if ((fabs((x_278 - x_280)) < 0.25f)) {
int const x_287 = (*(tint_symbol_9)).numbers.arr[9];
float const x_290 = color.x;
color.x = (x_290 + float(x_287));
}
float3 const x_293 = color;
float3 const x_294 = normalize(x_293);
*(tint_symbol_10) = float4(x_294.x, x_294.y, x_294.z, 1.0f);
float4 const x_299 = *(tint_symbol_7);
*(tint_symbol_11) = x_299;
return;
}
vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant buf0& x_34 [[buffer(0)]]) {
thread float4 tint_symbol_12 = 0.0f;
thread float4 tint_symbol_13 = 0.0f;
thread QuicksortObject tint_symbol_14 = {};
thread float4 tint_symbol_15 = 0.0f;
thread float4 tint_symbol_16 = 0.0f;
float4 const x_GLF_pos_param = tint_symbol_1.x_GLF_pos_param;
tint_symbol_12 = x_GLF_pos_param;
main_1(x_34, &(tint_symbol_12), &(tint_symbol_13), &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_16));
main_out const tint_symbol_4 = {.frag_color_1=tint_symbol_15, .gl_Position=tint_symbol_16};
tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position};
return tint_symbol_5;
}
void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_17) {
int temp = 0;
int const x_302 = *(i);
int const x_304 = (*(tint_symbol_17)).numbers.arr[x_302];
temp = x_304;
int const x_305 = *(i);
int const x_306 = *(j);
int const x_308 = (*(tint_symbol_17)).numbers.arr[x_306];
(*(tint_symbol_17)).numbers.arr[x_305] = x_308;
int const x_310 = *(j);
int const x_311 = temp;
(*(tint_symbol_17)).numbers.arr[x_310] = x_311;
return;
}
void quicksort_(thread QuicksortObject* const tint_symbol_18) {
int l_1 = 0;
int h_1 = 0;
int top = 0;
tint_array_wrapper stack = {};
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
int const x_376 = top;
int const x_377 = as_type<int>((as_type<uint>(x_376) + as_type<uint>(1)));
top = x_377;
int const x_378 = l_1;
stack.arr[x_377] = x_378;
int const x_380 = top;
int const x_381 = as_type<int>((as_type<uint>(x_380) + as_type<uint>(1)));
top = x_381;
int const x_382 = h_1;
stack.arr[x_381] = x_382;
while (true) {
int const x_388 = top;
if ((x_388 >= 0)) {
} else {
break;
}
int const x_391 = top;
top = as_type<int>((as_type<uint>(x_391) - as_type<uint>(1)));
int const x_394 = stack.arr[x_391];
h_1 = x_394;
int const x_395 = top;
top = as_type<int>((as_type<uint>(x_395) - as_type<uint>(1)));
int const x_398 = stack.arr[x_395];
l_1 = x_398;
int const x_399 = l_1;
param_4 = x_399;
int const x_400 = h_1;
param_5 = x_400;
int const x_401 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_18);
p = x_401;
int const x_402 = p;
int const x_404 = l_1;
if ((as_type<int>((as_type<uint>(x_402) - as_type<uint>(1))) > x_404)) {
int const x_408 = top;
int const x_409 = as_type<int>((as_type<uint>(x_408) + as_type<uint>(1)));
top = x_409;
int const x_410 = l_1;
stack.arr[x_409] = x_410;
int const x_412 = top;
int const x_413 = as_type<int>((as_type<uint>(x_412) + as_type<uint>(1)));
top = x_413;
int const x_414 = p;
stack.arr[x_413] = as_type<int>((as_type<uint>(x_414) - as_type<uint>(1)));
}
int const x_417 = p;
int const x_419 = h_1;
if ((as_type<int>((as_type<uint>(x_417) + as_type<uint>(1))) < x_419)) {
int const x_423 = top;
int const x_424 = as_type<int>((as_type<uint>(x_423) + as_type<uint>(1)));
top = x_424;
int const x_425 = p;
stack.arr[x_424] = as_type<int>((as_type<uint>(x_425) + as_type<uint>(1)));
int const x_428 = top;
int const x_429 = as_type<int>((as_type<uint>(x_428) + as_type<uint>(1)));
top = x_429;
int const x_430 = h_1;
stack.arr[x_429] = x_430;
}
}
return;
}