2021-07-23 13:10:12 +00:00
|
|
|
#include <metal_stdlib>
|
|
|
|
|
|
|
|
using namespace metal;
|
|
|
|
struct tint_array_wrapper {
|
|
|
|
int arr[10];
|
|
|
|
};
|
|
|
|
struct QuicksortObject {
|
|
|
|
tint_array_wrapper numbers;
|
|
|
|
};
|
|
|
|
struct buf0 {
|
2021-08-23 21:45:23 +00:00
|
|
|
/* 0x0000 */ float2 resolution;
|
2021-07-23 13:10:12 +00:00
|
|
|
};
|
|
|
|
struct main_out {
|
|
|
|
float4 x_GLF_color_1;
|
|
|
|
};
|
|
|
|
struct tint_symbol_1 {
|
|
|
|
float4 x_GLF_color_1 [[color(0)]];
|
|
|
|
};
|
|
|
|
|
2021-08-04 22:15:28 +00:00
|
|
|
void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_3) {
|
2021-07-23 13:10:12 +00:00
|
|
|
int temp = 0;
|
|
|
|
int const x_92 = *(i);
|
2021-08-04 22:15:28 +00:00
|
|
|
int const x_94 = (*(tint_symbol_3)).numbers.arr[x_92];
|
2021-07-23 13:10:12 +00:00
|
|
|
temp = x_94;
|
|
|
|
int const x_95 = *(i);
|
|
|
|
int const x_96 = *(j);
|
2021-08-04 22:15:28 +00:00
|
|
|
int const x_98 = (*(tint_symbol_3)).numbers.arr[x_96];
|
|
|
|
(*(tint_symbol_3)).numbers.arr[x_95] = x_98;
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_100 = *(j);
|
|
|
|
int const x_101 = temp;
|
2021-08-04 22:15:28 +00:00
|
|
|
(*(tint_symbol_3)).numbers.arr[x_100] = x_101;
|
2021-07-23 13:10:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-08-04 22:15:28 +00:00
|
|
|
int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_4) {
|
2021-07-23 13:10:12 +00:00
|
|
|
int pivot = 0;
|
|
|
|
int i_1 = 0;
|
|
|
|
int j_1 = 0;
|
|
|
|
int param = 0;
|
|
|
|
int param_1 = 0;
|
|
|
|
int param_2 = 0;
|
|
|
|
int param_3 = 0;
|
|
|
|
int const x_104 = *(h);
|
2021-08-04 22:15:28 +00:00
|
|
|
int const x_106 = (*(tint_symbol_4)).numbers.arr[x_104];
|
2021-07-23 13:10:12 +00:00
|
|
|
pivot = x_106;
|
|
|
|
int const x_107 = *(l);
|
2021-07-30 18:59:06 +00:00
|
|
|
i_1 = as_type<int>((as_type<uint>(x_107) - as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_109 = *(l);
|
|
|
|
j_1 = x_109;
|
|
|
|
while (true) {
|
|
|
|
int const x_114 = j_1;
|
|
|
|
int const x_115 = *(h);
|
2021-07-30 18:59:06 +00:00
|
|
|
if ((x_114 <= as_type<int>((as_type<uint>(x_115) - as_type<uint>(1))))) {
|
2021-07-23 13:10:12 +00:00
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
int const x_119 = j_1;
|
2021-08-04 22:15:28 +00:00
|
|
|
int const x_121 = (*(tint_symbol_4)).numbers.arr[x_119];
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_122 = pivot;
|
|
|
|
if ((x_121 <= x_122)) {
|
|
|
|
int const x_126 = i_1;
|
2021-07-30 18:59:06 +00:00
|
|
|
i_1 = as_type<int>((as_type<uint>(x_126) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_128 = i_1;
|
|
|
|
param = x_128;
|
|
|
|
int const x_129 = j_1;
|
|
|
|
param_1 = x_129;
|
2021-08-04 22:15:28 +00:00
|
|
|
swap_i1_i1_(&(param), &(param_1), tint_symbol_4);
|
2021-07-23 13:10:12 +00:00
|
|
|
}
|
|
|
|
{
|
|
|
|
int const x_131 = j_1;
|
2021-07-30 18:59:06 +00:00
|
|
|
j_1 = as_type<int>((as_type<uint>(x_131) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
int const x_133 = i_1;
|
2021-07-30 18:59:06 +00:00
|
|
|
param_2 = as_type<int>((as_type<uint>(x_133) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_135 = *(h);
|
|
|
|
param_3 = x_135;
|
2021-08-04 22:15:28 +00:00
|
|
|
swap_i1_i1_(&(param_2), &(param_3), tint_symbol_4);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_137 = i_1;
|
2021-07-30 18:59:06 +00:00
|
|
|
return as_type<int>((as_type<uint>(x_137) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
}
|
|
|
|
|
2021-08-04 22:15:28 +00:00
|
|
|
void quicksort_(thread QuicksortObject* const tint_symbol_5) {
|
2021-07-23 13:10:12 +00:00
|
|
|
int l_1 = 0;
|
|
|
|
int h_1 = 0;
|
|
|
|
int top = 0;
|
|
|
|
tint_array_wrapper stack = {};
|
|
|
|
int p = 0;
|
|
|
|
int param_4 = 0;
|
|
|
|
int param_5 = 0;
|
|
|
|
l_1 = 0;
|
|
|
|
h_1 = 9;
|
|
|
|
top = -1;
|
|
|
|
int const x_140 = top;
|
2021-07-30 18:59:06 +00:00
|
|
|
int const x_141 = as_type<int>((as_type<uint>(x_140) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
top = x_141;
|
|
|
|
int const x_142 = l_1;
|
|
|
|
stack.arr[x_141] = x_142;
|
|
|
|
int const x_144 = top;
|
2021-07-30 18:59:06 +00:00
|
|
|
int const x_145 = as_type<int>((as_type<uint>(x_144) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
top = x_145;
|
|
|
|
int const x_146 = h_1;
|
|
|
|
stack.arr[x_145] = x_146;
|
|
|
|
while (true) {
|
|
|
|
int const x_152 = top;
|
|
|
|
if ((x_152 >= 0)) {
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
int const x_155 = top;
|
2021-07-30 18:59:06 +00:00
|
|
|
top = as_type<int>((as_type<uint>(x_155) - as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_158 = stack.arr[x_155];
|
|
|
|
h_1 = x_158;
|
|
|
|
int const x_159 = top;
|
2021-07-30 18:59:06 +00:00
|
|
|
top = as_type<int>((as_type<uint>(x_159) - as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_162 = stack.arr[x_159];
|
|
|
|
l_1 = x_162;
|
|
|
|
int const x_163 = l_1;
|
|
|
|
param_4 = x_163;
|
|
|
|
int const x_164 = h_1;
|
|
|
|
param_5 = x_164;
|
2021-08-04 22:15:28 +00:00
|
|
|
int const x_165 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_5);
|
2021-07-23 13:10:12 +00:00
|
|
|
p = x_165;
|
|
|
|
int const x_166 = p;
|
|
|
|
int const x_168 = l_1;
|
2021-07-30 18:59:06 +00:00
|
|
|
if ((as_type<int>((as_type<uint>(x_166) - as_type<uint>(1))) > x_168)) {
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_172 = top;
|
2021-07-30 18:59:06 +00:00
|
|
|
int const x_173 = as_type<int>((as_type<uint>(x_172) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
top = x_173;
|
|
|
|
int const x_174 = l_1;
|
|
|
|
stack.arr[x_173] = x_174;
|
|
|
|
int const x_176 = top;
|
2021-07-30 18:59:06 +00:00
|
|
|
int const x_177 = as_type<int>((as_type<uint>(x_176) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
top = x_177;
|
|
|
|
int const x_178 = p;
|
2021-07-30 18:59:06 +00:00
|
|
|
stack.arr[x_177] = as_type<int>((as_type<uint>(x_178) - as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
}
|
|
|
|
int const x_181 = p;
|
|
|
|
int const x_183 = h_1;
|
2021-07-30 18:59:06 +00:00
|
|
|
if ((as_type<int>((as_type<uint>(x_181) + as_type<uint>(1))) < x_183)) {
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_187 = top;
|
2021-07-30 18:59:06 +00:00
|
|
|
int const x_188 = as_type<int>((as_type<uint>(x_187) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
top = x_188;
|
|
|
|
int const x_189 = p;
|
2021-07-30 18:59:06 +00:00
|
|
|
stack.arr[x_188] = as_type<int>((as_type<uint>(x_189) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_192 = top;
|
2021-07-30 18:59:06 +00:00
|
|
|
int const x_193 = as_type<int>((as_type<uint>(x_192) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
top = x_193;
|
|
|
|
int const x_194 = h_1;
|
|
|
|
stack.arr[x_193] = x_194;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-08-04 22:15:28 +00:00
|
|
|
void main_1(thread QuicksortObject* const tint_symbol_6, thread float4* const tint_symbol_7) {
|
2021-07-23 13:10:12 +00:00
|
|
|
int i_2 = 0;
|
|
|
|
i_2 = 0;
|
|
|
|
while (true) {
|
|
|
|
int const x_64 = i_2;
|
|
|
|
if ((x_64 < 10)) {
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
int const x_67 = i_2;
|
|
|
|
int const x_68 = i_2;
|
2021-08-04 22:15:28 +00:00
|
|
|
(*(tint_symbol_6)).numbers.arr[x_67] = as_type<int>((as_type<uint>(10) - as_type<uint>(x_68)));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_71 = i_2;
|
|
|
|
int const x_72 = i_2;
|
2021-08-04 22:15:28 +00:00
|
|
|
int const x_74 = (*(tint_symbol_6)).numbers.arr[x_72];
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_75 = i_2;
|
2021-08-04 22:15:28 +00:00
|
|
|
int const x_77 = (*(tint_symbol_6)).numbers.arr[x_75];
|
|
|
|
(*(tint_symbol_6)).numbers.arr[x_71] = as_type<int>((as_type<uint>(x_74) * as_type<uint>(x_77)));
|
2021-07-23 13:10:12 +00:00
|
|
|
{
|
|
|
|
int const x_80 = i_2;
|
2021-07-30 18:59:06 +00:00
|
|
|
i_2 = as_type<int>((as_type<uint>(x_80) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-04 22:15:28 +00:00
|
|
|
quicksort_(tint_symbol_6);
|
|
|
|
int const x_84 = (*(tint_symbol_6)).numbers.arr[0];
|
|
|
|
int const x_86 = (*(tint_symbol_6)).numbers.arr[4];
|
2021-07-23 13:10:12 +00:00
|
|
|
if ((x_84 < x_86)) {
|
2021-08-04 22:15:28 +00:00
|
|
|
*(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f);
|
2021-07-23 13:10:12 +00:00
|
|
|
} else {
|
2021-08-04 22:15:28 +00:00
|
|
|
*(tint_symbol_7) = float4(0.0f, 1.0f, 0.0f, 1.0f);
|
2021-07-23 13:10:12 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-08-04 22:15:28 +00:00
|
|
|
main_out tint_symbol_inner(thread QuicksortObject* const tint_symbol_8, thread float4* const tint_symbol_9) {
|
|
|
|
main_1(tint_symbol_8, tint_symbol_9);
|
|
|
|
main_out const tint_symbol_2 = {.x_GLF_color_1=*(tint_symbol_9)};
|
|
|
|
return tint_symbol_2;
|
|
|
|
}
|
|
|
|
|
2021-07-23 13:10:12 +00:00
|
|
|
fragment tint_symbol_1 tint_symbol() {
|
2021-08-04 22:15:28 +00:00
|
|
|
thread QuicksortObject tint_symbol_10 = {};
|
|
|
|
thread float4 tint_symbol_11 = 0.0f;
|
|
|
|
main_out const inner_result = tint_symbol_inner(&(tint_symbol_10), &(tint_symbol_11));
|
|
|
|
tint_symbol_1 wrapper_result = {};
|
|
|
|
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
|
|
|
|
return wrapper_result;
|
2021-07-23 13:10:12 +00:00
|
|
|
}
|
|
|
|
|