| #include <metal_stdlib> |
| |
| using namespace metal; |
| struct buf0 { |
| /* 0x0000 */ packed_float2 resolution; |
| }; |
| struct tint_array_wrapper { |
| int arr[256]; |
| }; |
| struct main_out { |
| float4 x_GLF_color_1; |
| }; |
| struct tint_symbol_2 { |
| float4 x_GLF_color_1 [[color(0)]]; |
| }; |
| |
| void main_1(constant buf0& x_7, thread float4* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6, thread float4* const tint_symbol_7) { |
| float2 pos = 0.0f; |
| int2 ipos = 0; |
| int i = 0; |
| int2 p = 0; |
| bool canwalk = false; |
| int v = 0; |
| int directions = 0; |
| int j = 0; |
| int d = 0; |
| float4 const x_57 = *(tint_symbol_5); |
| float2 const x_60 = x_7.resolution; |
| pos = (float2(x_57.x, x_57.y) / x_60); |
| float const x_63 = pos.x; |
| float const x_67 = pos.y; |
| ipos = int2(int((x_63 * 16.0f)), int((x_67 * 16.0f))); |
| i = 0; |
| while (true) { |
| int const x_75 = i; |
| if ((x_75 < 256)) { |
| } else { |
| break; |
| } |
| int const x_78 = i; |
| (*(tint_symbol_6)).arr[x_78] = 0; |
| { |
| int const x_80 = i; |
| i = (x_80 + 1); |
| } |
| } |
| p = int2(0, 0); |
| canwalk = true; |
| v = 0; |
| while (true) { |
| bool x_102 = false; |
| bool x_122 = false; |
| bool x_142 = false; |
| bool x_162 = false; |
| bool x_103_phi = false; |
| bool x_123_phi = false; |
| bool x_143_phi = false; |
| bool x_163_phi = false; |
| int const x_86 = v; |
| v = (x_86 + 1); |
| directions = 0; |
| int const x_89 = p.x; |
| bool const x_90 = (x_89 > 0); |
| x_103_phi = x_90; |
| if (x_90) { |
| int const x_94 = p.x; |
| int const x_97 = p.y; |
| int const x_101 = (*(tint_symbol_6)).arr[((x_94 - 2) + (x_97 * 16))]; |
| x_102 = (x_101 == 0); |
| x_103_phi = x_102; |
| } |
| bool const x_103 = x_103_phi; |
| if (x_103) { |
| int const x_106 = directions; |
| directions = (x_106 + 1); |
| } |
| int const x_109 = p.y; |
| bool const x_110 = (x_109 > 0); |
| x_123_phi = x_110; |
| if (x_110) { |
| int const x_114 = p.x; |
| int const x_116 = p.y; |
| int const x_121 = (*(tint_symbol_6)).arr[(x_114 + ((x_116 - 2) * 16))]; |
| x_122 = (x_121 == 0); |
| x_123_phi = x_122; |
| } |
| bool const x_123 = x_123_phi; |
| if (x_123) { |
| int const x_126 = directions; |
| directions = (x_126 + 1); |
| } |
| int const x_129 = p.x; |
| bool const x_130 = (x_129 < 14); |
| x_143_phi = x_130; |
| if (x_130) { |
| int const x_134 = p.x; |
| int const x_137 = p.y; |
| int const x_141 = (*(tint_symbol_6)).arr[((x_134 + 2) + (x_137 * 16))]; |
| x_142 = (x_141 == 0); |
| x_143_phi = x_142; |
| } |
| bool const x_143 = x_143_phi; |
| if (x_143) { |
| int const x_146 = directions; |
| directions = (x_146 + 1); |
| } |
| int const x_149 = p.y; |
| bool const x_150 = (x_149 < 14); |
| x_163_phi = x_150; |
| if (x_150) { |
| int const x_154 = p.x; |
| int const x_156 = p.y; |
| int const x_161 = (*(tint_symbol_6)).arr[(x_154 + ((x_156 + 2) * 16))]; |
| x_162 = (x_161 == 0); |
| x_163_phi = x_162; |
| } |
| bool const x_163 = x_163_phi; |
| if (x_163) { |
| int const x_166 = directions; |
| directions = (x_166 + 1); |
| } |
| bool x_227 = false; |
| bool x_240 = false; |
| bool x_279 = false; |
| bool x_292 = false; |
| bool x_331 = false; |
| bool x_344 = false; |
| bool x_383 = false; |
| bool x_396 = false; |
| bool x_228_phi = false; |
| bool x_241_phi = false; |
| bool x_280_phi = false; |
| bool x_293_phi = false; |
| bool x_332_phi = false; |
| bool x_345_phi = false; |
| bool x_384_phi = false; |
| bool x_397_phi = false; |
| int const x_168 = directions; |
| if ((x_168 == 0)) { |
| canwalk = false; |
| i = 0; |
| while (true) { |
| int const x_177 = i; |
| if ((x_177 < 8)) { |
| } else { |
| break; |
| } |
| j = 0; |
| while (true) { |
| int const x_184 = j; |
| if ((x_184 < 8)) { |
| } else { |
| break; |
| } |
| int const x_187 = j; |
| int const x_189 = i; |
| int const x_194 = (*(tint_symbol_6)).arr[((x_187 * 2) + ((x_189 * 2) * 16))]; |
| if ((x_194 == 0)) { |
| int const x_198 = j; |
| p.x = (x_198 * 2); |
| int const x_201 = i; |
| p.y = (x_201 * 2); |
| canwalk = true; |
| } |
| { |
| int const x_204 = j; |
| j = (x_204 + 1); |
| } |
| } |
| { |
| int const x_206 = i; |
| i = (x_206 + 1); |
| } |
| } |
| int const x_209 = p.x; |
| int const x_211 = p.y; |
| (*(tint_symbol_6)).arr[(x_209 + (x_211 * 16))] = 1; |
| } else { |
| int const x_215 = v; |
| int const x_216 = directions; |
| d = (x_215 % x_216); |
| int const x_218 = directions; |
| int const x_219 = v; |
| v = (x_219 + x_218); |
| int const x_221 = d; |
| bool const x_222 = (x_221 >= 0); |
| x_228_phi = x_222; |
| if (x_222) { |
| int const x_226 = p.x; |
| x_227 = (x_226 > 0); |
| x_228_phi = x_227; |
| } |
| bool const x_228 = x_228_phi; |
| x_241_phi = x_228; |
| if (x_228) { |
| int const x_232 = p.x; |
| int const x_235 = p.y; |
| int const x_239 = (*(tint_symbol_6)).arr[((x_232 - 2) + (x_235 * 16))]; |
| x_240 = (x_239 == 0); |
| x_241_phi = x_240; |
| } |
| bool const x_241 = x_241_phi; |
| if (x_241) { |
| int const x_244 = d; |
| d = (x_244 - 1); |
| int const x_247 = p.x; |
| int const x_249 = p.y; |
| (*(tint_symbol_6)).arr[(x_247 + (x_249 * 16))] = 1; |
| int const x_254 = p.x; |
| int const x_257 = p.y; |
| (*(tint_symbol_6)).arr[((x_254 - 1) + (x_257 * 16))] = 1; |
| int const x_262 = p.x; |
| int const x_265 = p.y; |
| (*(tint_symbol_6)).arr[((x_262 - 2) + (x_265 * 16))] = 1; |
| int const x_270 = p.x; |
| p.x = (x_270 - 2); |
| } |
| int const x_273 = d; |
| bool const x_274 = (x_273 >= 0); |
| x_280_phi = x_274; |
| if (x_274) { |
| int const x_278 = p.y; |
| x_279 = (x_278 > 0); |
| x_280_phi = x_279; |
| } |
| bool const x_280 = x_280_phi; |
| x_293_phi = x_280; |
| if (x_280) { |
| int const x_284 = p.x; |
| int const x_286 = p.y; |
| int const x_291 = (*(tint_symbol_6)).arr[(x_284 + ((x_286 - 2) * 16))]; |
| x_292 = (x_291 == 0); |
| x_293_phi = x_292; |
| } |
| bool const x_293 = x_293_phi; |
| if (x_293) { |
| int const x_296 = d; |
| d = (x_296 - 1); |
| int const x_299 = p.x; |
| int const x_301 = p.y; |
| (*(tint_symbol_6)).arr[(x_299 + (x_301 * 16))] = 1; |
| int const x_306 = p.x; |
| int const x_308 = p.y; |
| (*(tint_symbol_6)).arr[(x_306 + ((x_308 - 1) * 16))] = 1; |
| int const x_314 = p.x; |
| int const x_316 = p.y; |
| (*(tint_symbol_6)).arr[(x_314 + ((x_316 - 2) * 16))] = 1; |
| int const x_322 = p.y; |
| p.y = (x_322 - 2); |
| } |
| int const x_325 = d; |
| bool const x_326 = (x_325 >= 0); |
| x_332_phi = x_326; |
| if (x_326) { |
| int const x_330 = p.x; |
| x_331 = (x_330 < 14); |
| x_332_phi = x_331; |
| } |
| bool const x_332 = x_332_phi; |
| x_345_phi = x_332; |
| if (x_332) { |
| int const x_336 = p.x; |
| int const x_339 = p.y; |
| int const x_343 = (*(tint_symbol_6)).arr[((x_336 + 2) + (x_339 * 16))]; |
| x_344 = (x_343 == 0); |
| x_345_phi = x_344; |
| } |
| bool const x_345 = x_345_phi; |
| if (x_345) { |
| int const x_348 = d; |
| d = (x_348 - 1); |
| int const x_351 = p.x; |
| int const x_353 = p.y; |
| (*(tint_symbol_6)).arr[(x_351 + (x_353 * 16))] = 1; |
| int const x_358 = p.x; |
| int const x_361 = p.y; |
| (*(tint_symbol_6)).arr[((x_358 + 1) + (x_361 * 16))] = 1; |
| int const x_366 = p.x; |
| int const x_369 = p.y; |
| (*(tint_symbol_6)).arr[((x_366 + 2) + (x_369 * 16))] = 1; |
| int const x_374 = p.x; |
| p.x = (x_374 + 2); |
| } |
| int const x_377 = d; |
| bool const x_378 = (x_377 >= 0); |
| x_384_phi = x_378; |
| if (x_378) { |
| int const x_382 = p.y; |
| x_383 = (x_382 < 14); |
| x_384_phi = x_383; |
| } |
| bool const x_384 = x_384_phi; |
| x_397_phi = x_384; |
| if (x_384) { |
| int const x_388 = p.x; |
| int const x_390 = p.y; |
| int const x_395 = (*(tint_symbol_6)).arr[(x_388 + ((x_390 + 2) * 16))]; |
| x_396 = (x_395 == 0); |
| x_397_phi = x_396; |
| } |
| bool const x_397 = x_397_phi; |
| if (x_397) { |
| int const x_400 = d; |
| d = (x_400 - 1); |
| int const x_403 = p.x; |
| int const x_405 = p.y; |
| (*(tint_symbol_6)).arr[(x_403 + (x_405 * 16))] = 1; |
| int const x_410 = p.x; |
| int const x_412 = p.y; |
| (*(tint_symbol_6)).arr[(x_410 + ((x_412 + 1) * 16))] = 1; |
| int const x_418 = p.x; |
| int const x_420 = p.y; |
| (*(tint_symbol_6)).arr[(x_418 + ((x_420 + 2) * 16))] = 1; |
| int const x_426 = p.y; |
| p.y = (x_426 + 2); |
| } |
| } |
| int const x_430 = ipos.y; |
| int const x_433 = ipos.x; |
| int const x_436 = (*(tint_symbol_6)).arr[((x_430 * 16) + x_433)]; |
| if ((x_436 == 1)) { |
| *(tint_symbol_7) = float4(1.0f, 1.0f, 1.0f, 1.0f); |
| return; |
| } |
| { |
| bool const x_440 = canwalk; |
| if (x_440) { |
| } else { |
| break; |
| } |
| } |
| } |
| *(tint_symbol_7) = float4(0.0f, 0.0f, 0.0f, 1.0f); |
| return; |
| } |
| |
| fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) { |
| thread float4 tint_symbol_8 = 0.0f; |
| thread tint_array_wrapper tint_symbol_9 = {}; |
| thread float4 tint_symbol_10 = 0.0f; |
| tint_symbol_8 = gl_FragCoord_param; |
| main_1(x_7, &(tint_symbol_8), &(tint_symbol_9), &(tint_symbol_10)); |
| main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_10}; |
| tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1}; |
| return tint_symbol_4; |
| } |
| |