blob: 74407693785cea095eb9dd05356de36a5362d8d2 [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_144 = false;
float const x_146 = (*(tint_symbol_3)).y;
float const x_148 = x_9.resolution.y;
if ((x_146 < (x_148 / 2.0f))) {
float const x_154 = *(a);
float const x_155 = *(b);
x_144 = (x_154 > x_155);
} else {
float const x_157 = *(a);
float const x_158 = *(b);
x_144 = (x_157 < x_158);
}
bool const x_160 = x_144;
return x_160;
}
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_56 = i;
if ((x_56 < 10)) {
} else {
break;
}
int const x_59 = i;
int const x_60 = i;
float const x_64 = x_13.injectionSwitch.y;
data.arr[x_59] = (float(as_type<int>((as_type<uint>(10) - as_type<uint>(x_60)))) * x_64);
{
int const x_67 = i;
i = as_type<int>((as_type<uint>(x_67) + as_type<uint>(1)));
}
}
i_1 = 0;
while (true) {
int const x_73 = i_1;
if ((x_73 < 9)) {
} else {
break;
}
j = 0;
while (true) {
int const x_80 = j;
if ((x_80 < 10)) {
} else {
break;
}
int const x_83 = j;
int const x_84 = i_1;
if ((x_83 < as_type<int>((as_type<uint>(x_84) + as_type<uint>(1))))) {
{
int const x_110 = j;
j = as_type<int>((as_type<uint>(x_110) + as_type<uint>(1)));
}
continue;
}
int const x_89 = i_1;
int const x_90 = j;
float const x_92 = data.arr[x_89];
param = x_92;
float const x_94 = data.arr[x_90];
param_1 = x_94;
bool const x_95 = checkSwap_f1_f1_(x_9, &(param), &(param_1), tint_symbol_4);
doSwap = x_95;
bool const x_96 = doSwap;
if (x_96) {
int const x_99 = i_1;
float const x_101 = data.arr[x_99];
temp = x_101;
int const x_102 = i_1;
int const x_103 = j;
float const x_105 = data.arr[x_103];
data.arr[x_102] = x_105;
int const x_107 = j;
float const x_108 = temp;
data.arr[x_107] = x_108;
}
{
int const x_110 = j;
j = as_type<int>((as_type<uint>(x_110) + as_type<uint>(1)));
}
}
{
int const x_112 = i_1;
i_1 = as_type<int>((as_type<uint>(x_112) + as_type<uint>(1)));
}
}
float const x_115 = (*(tint_symbol_4)).x;
float const x_117 = x_9.resolution.x;
if ((x_115 < (x_117 / 2.0f))) {
float const x_124 = data.arr[0];
float const x_127 = data.arr[5];
float const x_130 = data.arr[9];
*(tint_symbol_5) = float4((x_124 / 10.0f), (x_127 / 10.0f), (x_130 / 10.0f), 1.0f);
} else {
float const x_134 = data.arr[5];
float const x_137 = data.arr[9];
float const x_140 = data.arr[0];
*(tint_symbol_5) = float4((x_134 / 10.0f), (x_137 / 10.0f), (x_140 / 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;
}