| #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]]; |
| }; |
| |
| void main_1(constant buf0& x_34, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7, thread QuicksortObject* const tint_symbol_8, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) { |
| int x_90 = 0; |
| int x_91 = 0; |
| int x_92 = 0; |
| int x_93 = 0; |
| int x_94 = 0; |
| int x_95 = 0; |
| int x_96 = 0; |
| int x_97 = 0; |
| int x_98 = 0; |
| int x_99 = 0; |
| int x_100 = 0; |
| int x_101 = 0; |
| int x_102 = 0; |
| tint_array_wrapper x_103 = {}; |
| int x_104 = 0; |
| int x_105 = 0; |
| int x_106 = 0; |
| int i_2 = 0; |
| float2 uv = 0.0f; |
| float3 color = 0.0f; |
| float4 const x_107 = *(tint_symbol_6); |
| *(tint_symbol_7) = ((x_107 + 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_114 = i_2; |
| if ((x_114 < 10)) { |
| } else { |
| break; |
| } |
| int const x_117 = i_2; |
| int const x_118 = i_2; |
| (*(tint_symbol_8)).numbers.arr[x_117] = (10 - x_118); |
| int const x_121 = i_2; |
| int const x_122 = i_2; |
| int const x_124 = (*(tint_symbol_8)).numbers.arr[x_122]; |
| int const x_125 = i_2; |
| int const x_127 = (*(tint_symbol_8)).numbers.arr[x_125]; |
| (*(tint_symbol_8)).numbers.arr[x_121] = (x_124 * x_127); |
| { |
| int const x_130 = i_2; |
| i_2 = (x_130 + 1); |
| } |
| } |
| x_100 = 0; |
| x_101 = 9; |
| x_102 = -1; |
| int const x_132 = x_102; |
| int const x_133 = (x_132 + 1); |
| x_102 = x_133; |
| int const x_134 = x_100; |
| x_103.arr[x_133] = x_134; |
| int const x_136 = x_102; |
| int const x_137 = (x_136 + 1); |
| x_102 = x_137; |
| int const x_138 = x_101; |
| x_103.arr[x_137] = x_138; |
| while (true) { |
| int const x_144 = x_102; |
| if ((x_144 >= 0)) { |
| } else { |
| break; |
| } |
| int const x_147 = x_102; |
| x_102 = (x_147 - 1); |
| int const x_150 = x_103.arr[x_147]; |
| x_101 = x_150; |
| int const x_151 = x_102; |
| x_102 = (x_151 - 1); |
| int const x_154 = x_103.arr[x_151]; |
| x_100 = x_154; |
| int const x_155 = x_100; |
| x_105 = x_155; |
| int const x_156 = x_101; |
| x_106 = x_156; |
| int const x_157 = x_106; |
| int const x_159 = (*(tint_symbol_8)).numbers.arr[x_157]; |
| x_92 = x_159; |
| int const x_160 = x_105; |
| x_93 = (x_160 - 1); |
| int const x_162 = x_105; |
| x_94 = x_162; |
| while (true) { |
| int const x_167 = x_94; |
| int const x_168 = x_106; |
| if ((x_167 <= (x_168 - 1))) { |
| } else { |
| break; |
| } |
| int const x_172 = x_94; |
| int const x_174 = (*(tint_symbol_8)).numbers.arr[x_172]; |
| int const x_175 = x_92; |
| if ((x_174 <= x_175)) { |
| int const x_179 = x_93; |
| x_93 = (x_179 + 1); |
| int const x_181 = x_93; |
| x_95 = x_181; |
| int const x_182 = x_94; |
| x_96 = x_182; |
| int const x_183 = x_95; |
| int const x_185 = (*(tint_symbol_8)).numbers.arr[x_183]; |
| x_91 = x_185; |
| int const x_186 = x_95; |
| int const x_187 = x_96; |
| int const x_189 = (*(tint_symbol_8)).numbers.arr[x_187]; |
| (*(tint_symbol_8)).numbers.arr[x_186] = x_189; |
| int const x_191 = x_96; |
| int const x_192 = x_91; |
| (*(tint_symbol_8)).numbers.arr[x_191] = x_192; |
| } |
| { |
| int const x_194 = x_94; |
| x_94 = (x_194 + 1); |
| } |
| } |
| int const x_196 = x_93; |
| x_97 = (x_196 + 1); |
| int const x_198 = x_106; |
| x_98 = x_198; |
| int const x_199 = x_97; |
| int const x_201 = (*(tint_symbol_8)).numbers.arr[x_199]; |
| x_90 = x_201; |
| int const x_202 = x_97; |
| int const x_203 = x_98; |
| int const x_205 = (*(tint_symbol_8)).numbers.arr[x_203]; |
| (*(tint_symbol_8)).numbers.arr[x_202] = x_205; |
| int const x_207 = x_98; |
| int const x_208 = x_90; |
| (*(tint_symbol_8)).numbers.arr[x_207] = x_208; |
| int const x_210 = x_93; |
| x_99 = (x_210 + 1); |
| int const x_212 = x_99; |
| x_104 = x_212; |
| int const x_213 = x_104; |
| int const x_215 = x_100; |
| if (((x_213 - 1) > x_215)) { |
| int const x_219 = x_102; |
| int const x_220 = (x_219 + 1); |
| x_102 = x_220; |
| int const x_221 = x_100; |
| x_103.arr[x_220] = x_221; |
| int const x_223 = x_102; |
| int const x_224 = (x_223 + 1); |
| x_102 = x_224; |
| int const x_225 = x_104; |
| x_103.arr[x_224] = (x_225 - 1); |
| } |
| int const x_228 = x_104; |
| int const x_230 = x_101; |
| if (((x_228 + 1) < x_230)) { |
| int const x_234 = x_102; |
| int const x_235 = (x_234 + 1); |
| x_102 = x_235; |
| int const x_236 = x_104; |
| x_103.arr[x_235] = (x_236 + 1); |
| int const x_239 = x_102; |
| int const x_240 = (x_239 + 1); |
| x_102 = x_240; |
| int const x_241 = x_101; |
| x_103.arr[x_240] = x_241; |
| } |
| } |
| float4 const x_243 = *(tint_symbol_7); |
| float2 const x_246 = x_34.resolution; |
| uv = (float2(x_243.x, x_243.y) / x_246); |
| color = float3(1.0f, 2.0f, 3.0f); |
| int const x_249 = (*(tint_symbol_8)).numbers.arr[0]; |
| float const x_252 = color.x; |
| color.x = (x_252 + float(x_249)); |
| float const x_256 = uv.x; |
| if ((x_256 > 0.25f)) { |
| int const x_261 = (*(tint_symbol_8)).numbers.arr[1]; |
| float const x_264 = color.x; |
| color.x = (x_264 + float(x_261)); |
| } |
| float const x_268 = uv.x; |
| if ((x_268 > 0.5f)) { |
| int const x_273 = (*(tint_symbol_8)).numbers.arr[2]; |
| float const x_276 = color.y; |
| color.y = (x_276 + float(x_273)); |
| } |
| float const x_280 = uv.x; |
| if ((x_280 > 0.75f)) { |
| int const x_285 = (*(tint_symbol_8)).numbers.arr[3]; |
| float const x_288 = color.z; |
| color.z = (x_288 + float(x_285)); |
| } |
| int const x_292 = (*(tint_symbol_8)).numbers.arr[4]; |
| float const x_295 = color.y; |
| color.y = (x_295 + float(x_292)); |
| float const x_299 = uv.y; |
| if ((x_299 > 0.25f)) { |
| int const x_304 = (*(tint_symbol_8)).numbers.arr[5]; |
| float const x_307 = color.x; |
| color.x = (x_307 + float(x_304)); |
| } |
| float const x_311 = uv.y; |
| if ((x_311 > 0.5f)) { |
| int const x_316 = (*(tint_symbol_8)).numbers.arr[6]; |
| float const x_319 = color.y; |
| color.y = (x_319 + float(x_316)); |
| } |
| float const x_323 = uv.y; |
| if ((x_323 > 0.75f)) { |
| int const x_328 = (*(tint_symbol_8)).numbers.arr[7]; |
| float const x_331 = color.z; |
| color.z = (x_331 + float(x_328)); |
| } |
| int const x_335 = (*(tint_symbol_8)).numbers.arr[8]; |
| float const x_338 = color.z; |
| color.z = (x_338 + float(x_335)); |
| float const x_342 = uv.x; |
| float const x_344 = uv.y; |
| if ((fabs((x_342 - x_344)) < 0.25f)) { |
| int const x_351 = (*(tint_symbol_8)).numbers.arr[9]; |
| float const x_354 = color.x; |
| color.x = (x_354 + float(x_351)); |
| } |
| float3 const x_357 = color; |
| float3 const x_358 = normalize(x_357); |
| *(tint_symbol_9) = float4(x_358.x, x_358.y, x_358.z, 1.0f); |
| float4 const x_363 = *(tint_symbol_6); |
| *(tint_symbol_10) = x_363; |
| 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_11 = 0.0f; |
| thread float4 tint_symbol_12 = 0.0f; |
| thread QuicksortObject tint_symbol_13 = {}; |
| thread float4 tint_symbol_14 = 0.0f; |
| thread float4 tint_symbol_15 = 0.0f; |
| float4 const x_GLF_pos_param = tint_symbol_1.x_GLF_pos_param; |
| tint_symbol_11 = x_GLF_pos_param; |
| main_1(x_34, &(tint_symbol_11), &(tint_symbol_12), &(tint_symbol_13), &(tint_symbol_14), &(tint_symbol_15)); |
| main_out const tint_symbol_4 = {.frag_color_1=tint_symbol_14, .gl_Position=tint_symbol_15}; |
| 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_16) { |
| int temp = 0; |
| int const x_366 = *(i); |
| int const x_368 = (*(tint_symbol_16)).numbers.arr[x_366]; |
| temp = x_368; |
| int const x_369 = *(i); |
| int const x_370 = *(j); |
| int const x_372 = (*(tint_symbol_16)).numbers.arr[x_370]; |
| (*(tint_symbol_16)).numbers.arr[x_369] = x_372; |
| int const x_374 = *(j); |
| int const x_375 = temp; |
| (*(tint_symbol_16)).numbers.arr[x_374] = x_375; |
| return; |
| } |
| |
| int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_17) { |
| 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_378 = *(h); |
| int const x_380 = (*(tint_symbol_17)).numbers.arr[x_378]; |
| pivot = x_380; |
| int const x_381 = *(l); |
| i_1 = (x_381 - 1); |
| int const x_383 = *(l); |
| j_1 = x_383; |
| while (true) { |
| int const x_388 = j_1; |
| int const x_389 = *(h); |
| if ((x_388 <= (x_389 - 1))) { |
| } else { |
| break; |
| } |
| int const x_393 = j_1; |
| int const x_395 = (*(tint_symbol_17)).numbers.arr[x_393]; |
| int const x_396 = pivot; |
| if ((x_395 <= x_396)) { |
| int const x_400 = i_1; |
| i_1 = (x_400 + 1); |
| int const x_402 = i_1; |
| param = x_402; |
| int const x_403 = j_1; |
| param_1 = x_403; |
| swap_i1_i1_(&(param), &(param_1), tint_symbol_17); |
| } |
| { |
| int const x_405 = j_1; |
| j_1 = (x_405 + 1); |
| } |
| } |
| int const x_407 = i_1; |
| param_2 = (x_407 + 1); |
| int const x_409 = *(h); |
| param_3 = x_409; |
| swap_i1_i1_(&(param_2), &(param_3), tint_symbol_17); |
| int const x_411 = i_1; |
| return (x_411 + 1); |
| } |
| |
| 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_414 = top; |
| int const x_415 = (x_414 + 1); |
| top = x_415; |
| int const x_416 = l_1; |
| stack.arr[x_415] = x_416; |
| int const x_418 = top; |
| int const x_419 = (x_418 + 1); |
| top = x_419; |
| int const x_420 = h_1; |
| stack.arr[x_419] = x_420; |
| while (true) { |
| int const x_426 = top; |
| if ((x_426 >= 0)) { |
| } else { |
| break; |
| } |
| int const x_429 = top; |
| top = (x_429 - 1); |
| int const x_432 = stack.arr[x_429]; |
| h_1 = x_432; |
| int const x_433 = top; |
| top = (x_433 - 1); |
| int const x_436 = stack.arr[x_433]; |
| l_1 = x_436; |
| int const x_437 = l_1; |
| param_4 = x_437; |
| int const x_438 = h_1; |
| param_5 = x_438; |
| int const x_439 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_18); |
| p = x_439; |
| int const x_440 = p; |
| int const x_442 = l_1; |
| if (((x_440 - 1) > x_442)) { |
| int const x_446 = top; |
| int const x_447 = (x_446 + 1); |
| top = x_447; |
| int const x_448 = l_1; |
| stack.arr[x_447] = x_448; |
| int const x_450 = top; |
| int const x_451 = (x_450 + 1); |
| top = x_451; |
| int const x_452 = p; |
| stack.arr[x_451] = (x_452 - 1); |
| } |
| int const x_455 = p; |
| int const x_457 = h_1; |
| if (((x_455 + 1) < x_457)) { |
| int const x_461 = top; |
| int const x_462 = (x_461 + 1); |
| top = x_462; |
| int const x_463 = p; |
| stack.arr[x_462] = (x_463 + 1); |
| int const x_466 = top; |
| int const x_467 = (x_466 + 1); |
| top = x_467; |
| int const x_468 = h_1; |
| stack.arr[x_467] = x_468; |
| } |
| } |
| return; |
| } |
| |