blob: 51be36d6687dbff4b58eb517686368302ef6f7d4 [file] [log] [blame]
#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_8, thread tint_array_wrapper* const tint_symbol_9, thread float4* const tint_symbol_10) {
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_59 = *(tint_symbol_8);
float2 const x_62 = x_7.resolution;
pos = (float2(x_59.x, x_59.y) / x_62);
float const x_65 = pos.x;
float const x_69 = pos.y;
ipos = int2(int((x_65 * 16.0f)), int((x_69 * 16.0f)));
i = 0;
while (true) {
int const x_77 = i;
if ((x_77 < 256)) {
} else {
break;
}
int const x_80 = i;
(*(tint_symbol_9)).arr[x_80] = 0;
{
int const x_82 = i;
i = as_type<int>((as_type<uint>(x_82) + as_type<uint>(1)));
}
}
p = int2(0, 0);
canwalk = true;
v = 0;
while (true) {
bool x_104 = false;
bool x_124 = false;
bool x_144 = false;
bool x_164 = false;
bool x_105_phi = false;
bool x_125_phi = false;
bool x_145_phi = false;
bool x_165_phi = false;
int const x_88 = v;
v = as_type<int>((as_type<uint>(x_88) + as_type<uint>(1)));
directions = 0;
int const x_91 = p.x;
bool const x_92 = (x_91 > 0);
x_105_phi = x_92;
if (x_92) {
int const x_96 = p.x;
int const x_99 = p.y;
int const x_103 = (*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_96) - as_type<uint>(2)))) + as_type<uint>(as_type<int>((as_type<uint>(x_99) * as_type<uint>(16))))))];
x_104 = (x_103 == 0);
x_105_phi = x_104;
}
bool const x_105 = x_105_phi;
if (x_105) {
int const x_108 = directions;
directions = as_type<int>((as_type<uint>(x_108) + as_type<uint>(1)));
}
int const x_111 = p.y;
bool const x_112 = (x_111 > 0);
x_125_phi = x_112;
if (x_112) {
int const x_116 = p.x;
int const x_118 = p.y;
int const x_123 = (*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(x_116) + as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_118) - as_type<uint>(2)))) * as_type<uint>(16))))))];
x_124 = (x_123 == 0);
x_125_phi = x_124;
}
bool const x_125 = x_125_phi;
if (x_125) {
int const x_128 = directions;
directions = as_type<int>((as_type<uint>(x_128) + as_type<uint>(1)));
}
int const x_131 = p.x;
bool const x_132 = (x_131 < 14);
x_145_phi = x_132;
if (x_132) {
int const x_136 = p.x;
int const x_139 = p.y;
int const x_143 = (*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_136) + as_type<uint>(2)))) + as_type<uint>(as_type<int>((as_type<uint>(x_139) * as_type<uint>(16))))))];
x_144 = (x_143 == 0);
x_145_phi = x_144;
}
bool const x_145 = x_145_phi;
if (x_145) {
int const x_148 = directions;
directions = as_type<int>((as_type<uint>(x_148) + as_type<uint>(1)));
}
int const x_151 = p.y;
bool const x_152 = (x_151 < 14);
x_165_phi = x_152;
if (x_152) {
int const x_156 = p.x;
int const x_158 = p.y;
int const x_163 = (*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(x_156) + as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_158) + as_type<uint>(2)))) * as_type<uint>(16))))))];
x_164 = (x_163 == 0);
x_165_phi = x_164;
}
bool const x_165 = x_165_phi;
if (x_165) {
int const x_168 = directions;
directions = as_type<int>((as_type<uint>(x_168) + as_type<uint>(1)));
}
bool x_229 = false;
bool x_242 = false;
bool x_281 = false;
int x_288 = 0;
int x_289 = 0;
int x_295 = 0;
int x_296 = 0;
tint_array_wrapper x_303 = {};
tint_array_wrapper x_304 = {};
int x_315 = 0;
int x_316 = 0;
bool x_359 = false;
bool x_372 = false;
bool x_411 = false;
bool x_424 = false;
bool x_230_phi = false;
bool x_243_phi = false;
bool x_282_phi = false;
int x_290_phi = 0;
int x_297_phi = 0;
tint_array_wrapper x_305_phi = {};
int x_317_phi = 0;
bool x_360_phi = false;
bool x_373_phi = false;
bool x_412_phi = false;
bool x_425_phi = false;
int const x_170 = directions;
if ((x_170 == 0)) {
canwalk = false;
i = 0;
while (true) {
int const x_179 = i;
if ((x_179 < 8)) {
} else {
break;
}
j = 0;
while (true) {
int const x_186 = j;
if ((x_186 < 8)) {
} else {
break;
}
int const x_189 = j;
int const x_191 = i;
int const x_196 = (*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_189) * as_type<uint>(2)))) + as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_191) * as_type<uint>(2)))) * as_type<uint>(16))))))];
if ((x_196 == 0)) {
int const x_200 = j;
p.x = as_type<int>((as_type<uint>(x_200) * as_type<uint>(2)));
int const x_203 = i;
p.y = as_type<int>((as_type<uint>(x_203) * as_type<uint>(2)));
canwalk = true;
}
{
int const x_206 = j;
j = as_type<int>((as_type<uint>(x_206) + as_type<uint>(1)));
}
}
{
int const x_208 = i;
i = as_type<int>((as_type<uint>(x_208) + as_type<uint>(1)));
}
}
int const x_211 = p.x;
int const x_213 = p.y;
(*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(x_211) + as_type<uint>(as_type<int>((as_type<uint>(x_213) * as_type<uint>(16))))))] = 1;
} else {
int const x_217 = v;
int const x_218 = directions;
d = (x_217 % x_218);
int const x_220 = directions;
int const x_221 = v;
v = as_type<int>((as_type<uint>(x_221) + as_type<uint>(x_220)));
int const x_223 = d;
bool const x_224 = (x_223 >= 0);
x_230_phi = x_224;
if (x_224) {
int const x_228 = p.x;
x_229 = (x_228 > 0);
x_230_phi = x_229;
}
bool const x_230 = x_230_phi;
x_243_phi = x_230;
if (x_230) {
int const x_234 = p.x;
int const x_237 = p.y;
int const x_241 = (*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_234) - as_type<uint>(2)))) + as_type<uint>(as_type<int>((as_type<uint>(x_237) * as_type<uint>(16))))))];
x_242 = (x_241 == 0);
x_243_phi = x_242;
}
bool const x_243 = x_243_phi;
if (x_243) {
int const x_246 = d;
d = as_type<int>((as_type<uint>(x_246) - as_type<uint>(1)));
int const x_249 = p.x;
int const x_251 = p.y;
(*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(x_249) + as_type<uint>(as_type<int>((as_type<uint>(x_251) * as_type<uint>(16))))))] = 1;
int const x_256 = p.x;
int const x_259 = p.y;
(*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_256) - as_type<uint>(1)))) + as_type<uint>(as_type<int>((as_type<uint>(x_259) * as_type<uint>(16))))))] = 1;
int const x_264 = p.x;
int const x_267 = p.y;
(*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_264) - as_type<uint>(2)))) + as_type<uint>(as_type<int>((as_type<uint>(x_267) * as_type<uint>(16))))))] = 1;
int const x_272 = p.x;
p.x = as_type<int>((as_type<uint>(x_272) - as_type<uint>(2)));
}
int const x_275 = d;
bool const x_276 = (x_275 >= 0);
x_282_phi = x_276;
if (x_276) {
int const x_280 = p.y;
x_281 = (x_280 > 0);
x_282_phi = x_281;
}
bool const x_282 = x_282_phi;
if (x_282) {
x_288 = p.x;
x_290_phi = x_288;
} else {
x_289 = 0;
x_290_phi = x_289;
}
int const x_290 = x_290_phi;
if (x_282) {
x_295 = p.y;
x_297_phi = x_295;
} else {
x_296 = 0;
x_297_phi = x_296;
}
int const x_297 = x_297_phi;
int const x_299 = as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_297) - as_type<uint>(2)))) * as_type<uint>(16)));
if (x_282) {
x_303 = *(tint_symbol_9);
x_305_phi = x_303;
} else {
tint_array_wrapper const tint_symbol_4 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
*(tint_symbol_9) = tint_symbol_5;
}
if (x_282) {
*(tint_symbol_9) = x_305;
}
if (x_282) {
x_315 = (*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(x_290) + as_type<uint>(x_299)))];
x_317_phi = x_315;
} else {
x_316 = 0;
x_317_phi = x_316;
}
int const x_317 = x_317_phi;
bool const x_318 = (x_317 == 0);
if (select(x_282, x_318, x_282)) {
int const x_323 = d;
d = as_type<int>((as_type<uint>(x_323) - as_type<uint>(1)));
int const x_326 = p.x;
int const x_328 = p.y;
(*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(x_326) + as_type<uint>(as_type<int>((as_type<uint>(x_328) * as_type<uint>(16))))))] = 1;
int const x_333 = p.x;
int const x_335 = p.y;
(*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(x_333) + as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_335) - as_type<uint>(1)))) * as_type<uint>(16))))))] = 1;
int const x_341 = p.x;
int const x_343 = p.y;
tint_array_wrapper const x_345 = *(tint_symbol_9);
tint_array_wrapper const tint_symbol_6 = {.arr={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
*(tint_symbol_9) = tint_symbol_6;
*(tint_symbol_9) = x_345;
(*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(x_341) + as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_343) - as_type<uint>(2)))) * as_type<uint>(16))))))] = 1;
int const x_350 = p.y;
p.y = as_type<int>((as_type<uint>(x_350) - as_type<uint>(2)));
}
int const x_353 = d;
bool const x_354 = (x_353 >= 0);
x_360_phi = x_354;
if (x_354) {
int const x_358 = p.x;
x_359 = (x_358 < 14);
x_360_phi = x_359;
}
bool const x_360 = x_360_phi;
x_373_phi = x_360;
if (x_360) {
int const x_364 = p.x;
int const x_367 = p.y;
int const x_371 = (*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_364) + as_type<uint>(2)))) + as_type<uint>(as_type<int>((as_type<uint>(x_367) * as_type<uint>(16))))))];
x_372 = (x_371 == 0);
x_373_phi = x_372;
}
bool const x_373 = x_373_phi;
if (x_373) {
int const x_376 = d;
d = as_type<int>((as_type<uint>(x_376) - as_type<uint>(1)));
int const x_379 = p.x;
int const x_381 = p.y;
(*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(x_379) + as_type<uint>(as_type<int>((as_type<uint>(x_381) * as_type<uint>(16))))))] = 1;
int const x_386 = p.x;
int const x_389 = p.y;
(*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_386) + as_type<uint>(1)))) + as_type<uint>(as_type<int>((as_type<uint>(x_389) * as_type<uint>(16))))))] = 1;
int const x_394 = p.x;
int const x_397 = p.y;
(*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_394) + as_type<uint>(2)))) + as_type<uint>(as_type<int>((as_type<uint>(x_397) * as_type<uint>(16))))))] = 1;
int const x_402 = p.x;
p.x = as_type<int>((as_type<uint>(x_402) + as_type<uint>(2)));
}
int const x_405 = d;
bool const x_406 = (x_405 >= 0);
x_412_phi = x_406;
if (x_406) {
int const x_410 = p.y;
x_411 = (x_410 < 14);
x_412_phi = x_411;
}
bool const x_412 = x_412_phi;
x_425_phi = x_412;
if (x_412) {
int const x_416 = p.x;
int const x_418 = p.y;
int const x_423 = (*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(x_416) + as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_418) + as_type<uint>(2)))) * as_type<uint>(16))))))];
x_424 = (x_423 == 0);
x_425_phi = x_424;
}
bool const x_425 = x_425_phi;
if (x_425) {
int const x_428 = d;
d = as_type<int>((as_type<uint>(x_428) - as_type<uint>(1)));
int const x_431 = p.x;
int const x_433 = p.y;
(*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(x_431) + as_type<uint>(as_type<int>((as_type<uint>(x_433) * as_type<uint>(16))))))] = 1;
int const x_438 = p.x;
int const x_440 = p.y;
(*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(x_438) + as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_440) + as_type<uint>(1)))) * as_type<uint>(16))))))] = 1;
int const x_446 = p.x;
int const x_448 = p.y;
(*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(x_446) + as_type<uint>(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_448) + as_type<uint>(2)))) * as_type<uint>(16))))))] = 1;
int const x_454 = p.y;
p.y = as_type<int>((as_type<uint>(x_454) + as_type<uint>(2)));
}
}
int const x_458 = ipos.y;
int const x_461 = ipos.x;
int const x_464 = (*(tint_symbol_9)).arr[as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_458) * as_type<uint>(16)))) + as_type<uint>(x_461)))];
if ((x_464 == 1)) {
*(tint_symbol_10) = float4(1.0f, 1.0f, 1.0f, 1.0f);
return;
}
{
bool const x_468 = canwalk;
if (x_468) {
} else {
break;
}
}
}
*(tint_symbol_10) = 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_11 = 0.0f;
thread tint_array_wrapper tint_symbol_12 = {};
thread float4 tint_symbol_13 = 0.0f;
tint_symbol_11 = gl_FragCoord_param;
main_1(x_7, &(tint_symbol_11), &(tint_symbol_12), &(tint_symbol_13));
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_13};
tint_symbol_2 const tint_symbol_7 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
return tint_symbol_7;
}