| #include <metal_stdlib> |
| |
| using namespace metal; |
| struct buf0 { |
| /* 0x0000 */ packed_float2 injectionSwitch; |
| }; |
| struct buf1 { |
| /* 0x0000 */ packed_float2 resolution; |
| }; |
| 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_256 = *(from); |
| k = x_256; |
| int const x_257 = *(from); |
| i = x_257; |
| int const x_258 = *(mid); |
| j = as_type<int>((as_type<uint>(x_258) + as_type<uint>(1))); |
| while (true) { |
| int const x_264 = i; |
| int const x_265 = *(mid); |
| int const x_267 = j; |
| int const x_268 = *(to); |
| if (((x_264 <= x_265) & (x_267 <= x_268))) { |
| } else { |
| break; |
| } |
| int const x_272 = i; |
| int const x_274 = (*(tint_symbol_3)).arr[x_272]; |
| int const x_275 = j; |
| int const x_277 = (*(tint_symbol_3)).arr[x_275]; |
| if ((x_274 < x_277)) { |
| int const x_282 = k; |
| k = as_type<int>((as_type<uint>(x_282) + as_type<uint>(1))); |
| int const x_284 = i; |
| i = as_type<int>((as_type<uint>(x_284) + as_type<uint>(1))); |
| int const x_287 = (*(tint_symbol_3)).arr[x_284]; |
| (*(tint_symbol_4)).arr[x_282] = x_287; |
| } else { |
| int const x_289 = k; |
| k = as_type<int>((as_type<uint>(x_289) + as_type<uint>(1))); |
| int const x_291 = j; |
| j = as_type<int>((as_type<uint>(x_291) + as_type<uint>(1))); |
| int const x_294 = (*(tint_symbol_3)).arr[x_291]; |
| (*(tint_symbol_4)).arr[x_289] = x_294; |
| } |
| } |
| while (true) { |
| if (!((256.0f < 1.0f))) { |
| } else { |
| continue; |
| } |
| int const x_301 = i; |
| int const x_303 = i; |
| int const x_304 = *(mid); |
| if (((x_301 < 10) & (x_303 <= x_304))) { |
| } else { |
| break; |
| } |
| int const x_309 = k; |
| k = as_type<int>((as_type<uint>(x_309) + as_type<uint>(1))); |
| int const x_311 = i; |
| i = as_type<int>((as_type<uint>(x_311) + as_type<uint>(1))); |
| int const x_314 = (*(tint_symbol_3)).arr[x_311]; |
| (*(tint_symbol_4)).arr[x_309] = x_314; |
| } |
| int const x_316 = *(from); |
| i_1 = x_316; |
| while (true) { |
| int const x_321 = i_1; |
| int const x_322 = *(to); |
| if ((x_321 <= x_322)) { |
| } else { |
| break; |
| } |
| int const x_325 = i_1; |
| int const x_326 = i_1; |
| int const x_328 = (*(tint_symbol_4)).arr[x_326]; |
| (*(tint_symbol_3)).arr[x_325] = x_328; |
| { |
| int const x_330 = i_1; |
| i_1 = as_type<int>((as_type<uint>(x_330) + as_type<uint>(1))); |
| } |
| } |
| return; |
| } |
| |
| void mergeSort_(thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) { |
| 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_337 = m; |
| int const x_338 = high; |
| if ((x_337 <= x_338)) { |
| } else { |
| break; |
| } |
| int const x_341 = low; |
| i_2 = x_341; |
| while (true) { |
| int const x_346 = i_2; |
| int const x_347 = high; |
| if ((x_346 < x_347)) { |
| } else { |
| break; |
| } |
| int const x_350 = i_2; |
| from_1 = x_350; |
| int const x_351 = i_2; |
| int const x_352 = m; |
| mid_1 = as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_351) + as_type<uint>(x_352)))) - as_type<uint>(1))); |
| int const x_355 = i_2; |
| int const x_356 = m; |
| int const x_360 = high; |
| to_1 = min(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_355) + as_type<uint>(as_type<int>((as_type<uint>(2) * as_type<uint>(x_356))))))) - as_type<uint>(1))), x_360); |
| int const x_362 = from_1; |
| param = x_362; |
| int const x_363 = mid_1; |
| param_1 = x_363; |
| int const x_364 = to_1; |
| param_2 = x_364; |
| merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_5, tint_symbol_6); |
| { |
| int const x_366 = m; |
| int const x_368 = i_2; |
| i_2 = as_type<int>((as_type<uint>(x_368) + as_type<uint>(as_type<int>((as_type<uint>(2) * as_type<uint>(x_366)))))); |
| } |
| } |
| { |
| int const x_370 = m; |
| m = as_type<int>((as_type<uint>(2) * as_type<uint>(x_370))); |
| } |
| } |
| 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 i_3 = 0; |
| int j_1 = 0; |
| float grey = 0.0f; |
| float const x_89 = x_28.injectionSwitch.x; |
| i_3 = int(x_89); |
| while (true) { |
| int const x_95 = i_3; |
| switch(x_95) { |
| case 9: { |
| int const x_125 = i_3; |
| (*(tint_symbol_7)).arr[x_125] = -5; |
| break; |
| } |
| case 8: { |
| int const x_123 = i_3; |
| (*(tint_symbol_7)).arr[x_123] = -4; |
| break; |
| } |
| case 7: { |
| int const x_121 = i_3; |
| (*(tint_symbol_7)).arr[x_121] = -3; |
| break; |
| } |
| case 6: { |
| int const x_119 = i_3; |
| (*(tint_symbol_7)).arr[x_119] = -2; |
| break; |
| } |
| case 5: { |
| int const x_117 = i_3; |
| (*(tint_symbol_7)).arr[x_117] = -1; |
| break; |
| } |
| case 4: { |
| int const x_115 = i_3; |
| (*(tint_symbol_7)).arr[x_115] = 0; |
| break; |
| } |
| case 3: { |
| int const x_113 = i_3; |
| (*(tint_symbol_7)).arr[x_113] = 1; |
| break; |
| } |
| case 2: { |
| int const x_111 = i_3; |
| (*(tint_symbol_7)).arr[x_111] = 2; |
| break; |
| } |
| case 1: { |
| int const x_109 = i_3; |
| (*(tint_symbol_7)).arr[x_109] = 3; |
| break; |
| } |
| case 0: { |
| int const x_107 = i_3; |
| (*(tint_symbol_7)).arr[x_107] = 4; |
| break; |
| } |
| default: { |
| break; |
| } |
| } |
| int const x_127 = i_3; |
| i_3 = as_type<int>((as_type<uint>(x_127) + as_type<uint>(1))); |
| { |
| int const x_129 = i_3; |
| if ((x_129 < 10)) { |
| } else { |
| break; |
| } |
| } |
| } |
| j_1 = 0; |
| while (true) { |
| int const x_135 = j_1; |
| if ((x_135 < 10)) { |
| } else { |
| break; |
| } |
| int const x_138 = j_1; |
| int const x_139 = j_1; |
| int const x_141 = (*(tint_symbol_7)).arr[x_139]; |
| (*(tint_symbol_8)).arr[x_138] = x_141; |
| { |
| int const x_143 = j_1; |
| j_1 = as_type<int>((as_type<uint>(x_143) + as_type<uint>(1))); |
| } |
| } |
| mergeSort_(tint_symbol_7, tint_symbol_8); |
| float const x_147 = (*(tint_symbol_9)).y; |
| if ((int(x_147) < 30)) { |
| int const x_154 = (*(tint_symbol_7)).arr[0]; |
| grey = (0.5f + (float(x_154) / 10.0f)); |
| } else { |
| float const x_159 = (*(tint_symbol_9)).y; |
| if ((int(x_159) < 60)) { |
| int const x_166 = (*(tint_symbol_7)).arr[1]; |
| grey = (0.5f + (float(x_166) / 10.0f)); |
| } else { |
| float const x_171 = (*(tint_symbol_9)).y; |
| if ((int(x_171) < 90)) { |
| int const x_178 = (*(tint_symbol_7)).arr[2]; |
| grey = (0.5f + (float(x_178) / 10.0f)); |
| } else { |
| float const x_183 = (*(tint_symbol_9)).y; |
| if ((int(x_183) < 120)) { |
| int const x_190 = (*(tint_symbol_7)).arr[3]; |
| grey = (0.5f + (float(x_190) / 10.0f)); |
| } else { |
| float const x_195 = (*(tint_symbol_9)).y; |
| if ((int(x_195) < 150)) { |
| discard_fragment(); |
| } else { |
| float const x_202 = (*(tint_symbol_9)).y; |
| if ((int(x_202) < 180)) { |
| int const x_209 = (*(tint_symbol_7)).arr[5]; |
| grey = (0.5f + (float(x_209) / 10.0f)); |
| } else { |
| float const x_214 = (*(tint_symbol_9)).y; |
| if ((int(x_214) < 210)) { |
| int const x_221 = (*(tint_symbol_7)).arr[6]; |
| grey = (0.5f + (float(x_221) / 10.0f)); |
| } else { |
| float const x_226 = (*(tint_symbol_9)).y; |
| if ((int(x_226) < 240)) { |
| int const x_233 = (*(tint_symbol_7)).arr[7]; |
| grey = (0.5f + (float(x_233) / 10.0f)); |
| } else { |
| float const x_238 = (*(tint_symbol_9)).y; |
| if ((int(x_238) < 270)) { |
| int const x_245 = (*(tint_symbol_7)).arr[8]; |
| grey = (0.5f + (float(x_245) / 10.0f)); |
| } else { |
| discard_fragment(); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| float const x_249 = grey; |
| float3 const x_250 = float3(x_249, x_249, x_249); |
| *(tint_symbol_10) = float4(x_250.x, x_250.y, x_250.z, 1.0f); |
| return; |
| } |
| |
| main_out tint_symbol_inner(constant buf0& x_28, float4 gl_FragCoord_param, thread float4* const tint_symbol_11, thread tint_array_wrapper* const tint_symbol_12, thread tint_array_wrapper* const tint_symbol_13, thread float4* const tint_symbol_14) { |
| *(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_2 = {.x_GLF_color_1=*(tint_symbol_14)}; |
| return tint_symbol_2; |
| } |
| |
| fragment tint_symbol_1 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { |
| thread float4 tint_symbol_15 = 0.0f; |
| thread tint_array_wrapper tint_symbol_16 = {}; |
| thread tint_array_wrapper tint_symbol_17 = {}; |
| thread float4 tint_symbol_18 = 0.0f; |
| main_out const inner_result = tint_symbol_inner(x_28, gl_FragCoord_param, &(tint_symbol_15), &(tint_symbol_16), &(tint_symbol_17), &(tint_symbol_18)); |
| tint_symbol_1 wrapper_result = {}; |
| wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1; |
| return wrapper_result; |
| } |
| |