| #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_2 { |
| 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_5, thread tint_array_wrapper* const tint_symbol_6) { |
| int k = 0; |
| int i = 0; |
| int j = 0; |
| int i_1 = 0; |
| int const x_262 = *(from); |
| k = x_262; |
| int const x_263 = *(from); |
| i = x_263; |
| int const x_264 = *(mid); |
| j = as_type<int>((as_type<uint>(x_264) + as_type<uint>(1))); |
| while (true) { |
| int const x_270 = i; |
| int const x_271 = *(mid); |
| int const x_273 = j; |
| int const x_274 = *(to); |
| if (((x_270 <= x_271) && (x_273 <= x_274))) { |
| } else { |
| break; |
| } |
| int const x_278 = i; |
| int const x_280 = (*(tint_symbol_5)).arr[x_278]; |
| int const x_281 = j; |
| int const x_283 = (*(tint_symbol_5)).arr[x_281]; |
| if ((x_280 < x_283)) { |
| int const x_288 = k; |
| k = as_type<int>((as_type<uint>(x_288) + as_type<uint>(1))); |
| int const x_290 = i; |
| i = as_type<int>((as_type<uint>(x_290) + as_type<uint>(1))); |
| int const x_293 = (*(tint_symbol_5)).arr[x_290]; |
| (*(tint_symbol_6)).arr[x_288] = x_293; |
| } else { |
| int const x_295 = k; |
| k = as_type<int>((as_type<uint>(x_295) + as_type<uint>(1))); |
| int const x_297 = j; |
| j = as_type<int>((as_type<uint>(x_297) + as_type<uint>(1))); |
| int const x_300 = (*(tint_symbol_5)).arr[x_297]; |
| (*(tint_symbol_6)).arr[x_295] = x_300; |
| } |
| } |
| while (true) { |
| int const x_306 = i; |
| int const x_308 = i; |
| int const x_309 = *(mid); |
| if (((x_306 < 10) && (x_308 <= x_309))) { |
| } else { |
| break; |
| } |
| int const x_313 = k; |
| k = as_type<int>((as_type<uint>(x_313) + as_type<uint>(1))); |
| int const x_315 = i; |
| i = as_type<int>((as_type<uint>(x_315) + as_type<uint>(1))); |
| int const x_318 = (*(tint_symbol_5)).arr[x_315]; |
| (*(tint_symbol_6)).arr[x_313] = x_318; |
| } |
| int const x_320 = *(from); |
| i_1 = x_320; |
| while (true) { |
| int const x_325 = i_1; |
| int const x_326 = *(to); |
| if ((x_325 <= x_326)) { |
| } else { |
| break; |
| } |
| int const x_329 = i_1; |
| int const x_330 = i_1; |
| int const x_332 = (*(tint_symbol_6)).arr[x_330]; |
| (*(tint_symbol_5)).arr[x_329] = x_332; |
| { |
| int const x_334 = i_1; |
| i_1 = as_type<int>((as_type<uint>(x_334) + as_type<uint>(1))); |
| } |
| } |
| return; |
| } |
| |
| void mergeSort_(thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) { |
| 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_341 = m; |
| int const x_342 = high; |
| if ((x_341 <= x_342)) { |
| } else { |
| break; |
| } |
| int const x_345 = low; |
| i_2 = x_345; |
| while (true) { |
| int const x_350 = i_2; |
| int const x_351 = high; |
| if ((x_350 < x_351)) { |
| } else { |
| break; |
| } |
| int const x_354 = i_2; |
| from_1 = x_354; |
| int const x_355 = i_2; |
| int const x_356 = m; |
| mid_1 = as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_355) + as_type<uint>(x_356)))) - as_type<uint>(1))); |
| int const x_359 = i_2; |
| int const x_360 = m; |
| int const x_364 = high; |
| to_1 = min(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_359) + as_type<uint>(as_type<int>((as_type<uint>(2) * as_type<uint>(x_360))))))) - as_type<uint>(1))), x_364); |
| int const x_366 = from_1; |
| param = x_366; |
| int const x_367 = mid_1; |
| param_1 = x_367; |
| int const x_368 = to_1; |
| param_2 = x_368; |
| merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8); |
| { |
| int const x_370 = m; |
| int const x_372 = i_2; |
| i_2 = as_type<int>((as_type<uint>(x_372) + as_type<uint>(as_type<int>((as_type<uint>(2) * as_type<uint>(x_370)))))); |
| } |
| } |
| { |
| int const x_374 = m; |
| m = as_type<int>((as_type<uint>(2) * as_type<uint>(x_374))); |
| } |
| } |
| return; |
| } |
| |
| void main_1(constant buf0& x_28, 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; |
| int int_i = 0; |
| float const x_85 = x_28.injectionSwitch.x; |
| i_3 = int(x_85); |
| while (true) { |
| int const x_91 = i_3; |
| switch(x_91) { |
| case 9: { |
| int const x_121 = i_3; |
| (*(tint_symbol_9)).arr[x_121] = -5; |
| break; |
| } |
| case 8: { |
| int const x_119 = i_3; |
| (*(tint_symbol_9)).arr[x_119] = -4; |
| break; |
| } |
| case 7: { |
| int const x_117 = i_3; |
| (*(tint_symbol_9)).arr[x_117] = -3; |
| break; |
| } |
| case 6: { |
| int const x_115 = i_3; |
| (*(tint_symbol_9)).arr[x_115] = -2; |
| break; |
| } |
| case 5: { |
| int const x_113 = i_3; |
| (*(tint_symbol_9)).arr[x_113] = -1; |
| break; |
| } |
| case 4: { |
| int const x_111 = i_3; |
| (*(tint_symbol_9)).arr[x_111] = 0; |
| break; |
| } |
| case 3: { |
| int const x_109 = i_3; |
| (*(tint_symbol_9)).arr[x_109] = 1; |
| break; |
| } |
| case 2: { |
| int const x_107 = i_3; |
| (*(tint_symbol_9)).arr[x_107] = 2; |
| break; |
| } |
| case 1: { |
| int const x_105 = i_3; |
| (*(tint_symbol_9)).arr[x_105] = 3; |
| break; |
| } |
| case 0: { |
| int const x_103 = i_3; |
| (*(tint_symbol_9)).arr[x_103] = 4; |
| break; |
| } |
| default: { |
| break; |
| } |
| } |
| int const x_123 = i_3; |
| i_3 = as_type<int>((as_type<uint>(x_123) + as_type<uint>(1))); |
| { |
| int const x_125 = i_3; |
| if ((x_125 < 10)) { |
| } else { |
| break; |
| } |
| } |
| } |
| j_1 = 0; |
| while (true) { |
| int const x_131 = j_1; |
| if ((x_131 < 10)) { |
| } else { |
| break; |
| } |
| int const x_134 = j_1; |
| int const x_135 = j_1; |
| int const x_137 = (*(tint_symbol_9)).arr[x_135]; |
| (*(tint_symbol_10)).arr[x_134] = x_137; |
| { |
| int const x_139 = j_1; |
| j_1 = as_type<int>((as_type<uint>(x_139) + as_type<uint>(1))); |
| } |
| } |
| mergeSort_(tint_symbol_9, tint_symbol_10); |
| float const x_143 = (*(tint_symbol_11)).y; |
| if ((int(x_143) < 30)) { |
| int const x_150 = (*(tint_symbol_9)).arr[0]; |
| grey = (0.5f + (float(x_150) / 10.0f)); |
| } else { |
| float const x_155 = (*(tint_symbol_11)).y; |
| if ((int(x_155) < 60)) { |
| int const x_162 = (*(tint_symbol_9)).arr[1]; |
| grey = (0.5f + (float(x_162) / 10.0f)); |
| } else { |
| float const x_167 = (*(tint_symbol_11)).y; |
| if ((int(x_167) < 90)) { |
| int const x_174 = (*(tint_symbol_9)).arr[2]; |
| grey = (0.5f + (float(x_174) / 10.0f)); |
| } else { |
| float const x_179 = (*(tint_symbol_11)).y; |
| if ((int(x_179) < 120)) { |
| int const x_186 = (*(tint_symbol_9)).arr[3]; |
| grey = (0.5f + (float(x_186) / 10.0f)); |
| } else { |
| float const x_191 = (*(tint_symbol_11)).y; |
| if ((int(x_191) < 150)) { |
| int_i = 1; |
| while (true) { |
| int const x_201 = int_i; |
| float const x_203 = x_28.injectionSwitch.x; |
| if ((x_201 > int(x_203))) { |
| } else { |
| break; |
| } |
| discard_fragment(); |
| } |
| } else { |
| float const x_208 = (*(tint_symbol_11)).y; |
| if ((int(x_208) < 180)) { |
| int const x_215 = (*(tint_symbol_9)).arr[5]; |
| grey = (0.5f + (float(x_215) / 10.0f)); |
| } else { |
| float const x_220 = (*(tint_symbol_11)).y; |
| if ((int(x_220) < 210)) { |
| int const x_227 = (*(tint_symbol_9)).arr[6]; |
| grey = (0.5f + (float(x_227) / 10.0f)); |
| } else { |
| float const x_232 = (*(tint_symbol_11)).y; |
| if ((int(x_232) < 240)) { |
| int const x_239 = (*(tint_symbol_9)).arr[7]; |
| grey = (0.5f + (float(x_239) / 10.0f)); |
| } else { |
| float const x_244 = (*(tint_symbol_11)).y; |
| if ((int(x_244) < 270)) { |
| int const x_251 = (*(tint_symbol_9)).arr[8]; |
| grey = (0.5f + (float(x_251) / 10.0f)); |
| } else { |
| discard_fragment(); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| float const x_255 = grey; |
| float3 const x_256 = float3(x_255, x_255, x_255); |
| *(tint_symbol_12) = float4(x_256.x, x_256.y, x_256.z, 1.0f); |
| return; |
| } |
| |
| fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) { |
| thread float4 tint_symbol_13 = 0.0f; |
| thread tint_array_wrapper tint_symbol_14 = {}; |
| thread tint_array_wrapper tint_symbol_15 = {}; |
| thread float4 tint_symbol_16 = 0.0f; |
| tint_symbol_13 = gl_FragCoord_param; |
| main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16)); |
| main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16}; |
| tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; |
| return tint_symbol_4; |
| } |
| |