| #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 = (x_319 - 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 <= (x_327 - 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 = (x_338 + 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 = (x_353 + 1); |
| } |
| } |
| int const x_355 = i_1; |
| param_2 = (x_355 + 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 (x_372 + 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] = (10 - 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] = (x_115 * x_118); |
| { |
| int const x_121 = i_2; |
| i_2 = (x_121 + 1); |
| } |
| } |
| x_91 = 0; |
| x_92 = 9; |
| x_93 = -1; |
| int const x_123 = x_93; |
| int const x_124 = (x_123 + 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 = (x_127 + 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 = (x_138 - 1); |
| int const x_141 = x_94.arr[x_138]; |
| x_92 = x_141; |
| int const x_142 = x_93; |
| x_93 = (x_142 - 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 (((x_149 - 1) > x_151)) { |
| int const x_155 = x_93; |
| int const x_156 = (x_155 + 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 = (x_159 + 1); |
| x_93 = x_160; |
| int const x_161 = x_95; |
| x_94.arr[x_160] = (x_161 - 1); |
| } |
| int const x_164 = x_95; |
| int const x_166 = x_92; |
| if (((x_164 + 1) < x_166)) { |
| int const x_170 = x_93; |
| int const x_171 = (x_170 + 1); |
| x_93 = x_171; |
| int const x_172 = x_95; |
| x_94.arr[x_171] = (x_172 + 1); |
| int const x_175 = x_93; |
| int const x_176 = (x_175 + 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 = (x_376 + 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 = (x_380 + 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 = (x_391 - 1); |
| int const x_394 = stack.arr[x_391]; |
| h_1 = x_394; |
| int const x_395 = top; |
| top = (x_395 - 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 (((x_402 - 1) > x_404)) { |
| int const x_408 = top; |
| int const x_409 = (x_408 + 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 = (x_412 + 1); |
| top = x_413; |
| int const x_414 = p; |
| stack.arr[x_413] = (x_414 - 1); |
| } |
| int const x_417 = p; |
| int const x_419 = h_1; |
| if (((x_417 + 1) < x_419)) { |
| int const x_423 = top; |
| int const x_424 = (x_423 + 1); |
| top = x_424; |
| int const x_425 = p; |
| stack.arr[x_424] = (x_425 + 1); |
| int const x_428 = top; |
| int const x_429 = (x_428 + 1); |
| top = x_429; |
| int const x_430 = h_1; |
| stack.arr[x_429] = x_430; |
| } |
| } |
| return; |
| } |
| |