blob: dd5350a3b4e0b96fea7298d1c448e28f97fba6b4 [file] [log] [blame]
#include <metal_stdlib>
using namespace metal;
struct buf1 {
/* 0x0000 */ packed_float2 resolution;
};
struct buf0 {
/* 0x0000 */ packed_float2 injectionSwitch;
};
struct tint_array_wrapper {
float arr[10];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
bool checkSwap_f1_f1_(constant buf1& x_9, thread float* const a, thread float* const b, thread float4* const tint_symbol_3) {
bool x_147 = false;
float x_158 = 0.0f;
float x_159 = 0.0f;
float x_179 = 0.0f;
float x_178 = 0.0f;
float x_185 = 0.0f;
float x_184 = 0.0f;
float x_160_phi = 0.0f;
float x_180_phi = 0.0f;
float x_186_phi = 0.0f;
float const x_149 = (*(tint_symbol_3)).y;
float const x_151 = x_9.resolution.y;
bool const x_153 = (x_149 < (x_151 / 2.0f));
if (x_153) {
x_158 = *(a);
x_160_phi = x_158;
} else {
x_159 = 0.0f;
x_160_phi = x_159;
}
float x_166 = 0.0f;
float x_167 = 0.0f;
float x_168_phi = 0.0f;
float const x_160 = x_160_phi;
bool guard155 = true;
if (false) {
} else {
if (guard155) {
if (x_153) {
x_166 = *(b);
x_168_phi = x_166;
} else {
x_167 = 0.0f;
x_168_phi = x_167;
}
float const x_168 = x_168_phi;
bool const x_169 = (x_160 > x_168);
if (x_153) {
x_147 = x_169;
}
if (true) {
} else {
guard155 = false;
}
if (guard155) {
guard155 = false;
}
}
}
if (x_153) {
x_179 = 0.0f;
x_180_phi = x_179;
} else {
x_178 = *(a);
x_180_phi = x_178;
}
float const x_180 = x_180_phi;
if (x_153) {
x_185 = 0.0f;
x_186_phi = x_185;
} else {
x_184 = *(b);
x_186_phi = x_184;
}
float const x_186 = x_186_phi;
if (x_153) {
} else {
x_147 = (x_180 < x_186);
}
bool const x_191 = x_147;
return x_191;
}
void main_1(constant buf0& x_13, constant buf1& x_9, thread float4* const tint_symbol_4, thread float4* const tint_symbol_5) {
int i = 0;
tint_array_wrapper data = {};
int i_1 = 0;
int j = 0;
bool doSwap = false;
float param = 0.0f;
float param_1 = 0.0f;
float temp = 0.0f;
i = 0;
while (true) {
int const x_59 = i;
if ((x_59 < 10)) {
} else {
break;
}
int const x_62 = i;
int const x_63 = i;
float const x_67 = x_13.injectionSwitch.y;
data.arr[x_62] = (float(as_type<int>((as_type<uint>(10) - as_type<uint>(x_63)))) * x_67);
{
int const x_70 = i;
i = as_type<int>((as_type<uint>(x_70) + as_type<uint>(1)));
}
}
i_1 = 0;
while (true) {
int const x_76 = i_1;
if ((x_76 < 9)) {
} else {
break;
}
j = 0;
while (true) {
int const x_83 = j;
if ((x_83 < 10)) {
} else {
break;
}
int const x_86 = j;
int const x_87 = i_1;
if ((x_86 < as_type<int>((as_type<uint>(x_87) + as_type<uint>(1))))) {
{
int const x_113 = j;
j = as_type<int>((as_type<uint>(x_113) + as_type<uint>(1)));
}
continue;
}
int const x_92 = i_1;
int const x_93 = j;
float const x_95 = data.arr[x_92];
param = x_95;
float const x_97 = data.arr[x_93];
param_1 = x_97;
bool const x_98 = checkSwap_f1_f1_(x_9, &(param), &(param_1), tint_symbol_4);
doSwap = x_98;
bool const x_99 = doSwap;
if (x_99) {
int const x_102 = i_1;
float const x_104 = data.arr[x_102];
temp = x_104;
int const x_105 = i_1;
int const x_106 = j;
float const x_108 = data.arr[x_106];
data.arr[x_105] = x_108;
int const x_110 = j;
float const x_111 = temp;
data.arr[x_110] = x_111;
}
{
int const x_113 = j;
j = as_type<int>((as_type<uint>(x_113) + as_type<uint>(1)));
}
}
{
int const x_115 = i_1;
i_1 = as_type<int>((as_type<uint>(x_115) + as_type<uint>(1)));
}
}
float const x_118 = (*(tint_symbol_4)).x;
float const x_120 = x_9.resolution.x;
if ((x_118 < (x_120 / 2.0f))) {
float const x_127 = data.arr[0];
float const x_130 = data.arr[5];
float const x_133 = data.arr[9];
*(tint_symbol_5) = float4((x_127 / 10.0f), (x_130 / 10.0f), (x_133 / 10.0f), 1.0f);
} else {
float const x_137 = data.arr[5];
float const x_140 = data.arr[9];
float const x_143 = data.arr[0];
*(tint_symbol_5) = float4((x_137 / 10.0f), (x_140 / 10.0f), (x_143 / 10.0f), 1.0f);
}
return;
}
main_out tint_symbol_inner(constant buf0& x_13, constant buf1& x_9, float4 gl_FragCoord_param, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) {
*(tint_symbol_6) = gl_FragCoord_param;
main_1(x_13, x_9, tint_symbol_6, tint_symbol_7);
main_out const tint_symbol_2 = {.x_GLF_color_1=*(tint_symbol_7)};
return tint_symbol_2;
}
fragment tint_symbol_1 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_13 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) {
thread float4 tint_symbol_8 = 0.0f;
thread float4 tint_symbol_9 = 0.0f;
main_out const inner_result = tint_symbol_inner(x_13, x_9, gl_FragCoord_param, &(tint_symbol_8), &(tint_symbol_9));
tint_symbol_1 wrapper_result = {};
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}