2021-07-23 13:10:12 +00:00
|
|
|
#include <metal_stdlib>
|
|
|
|
|
|
|
|
using namespace metal;
|
|
|
|
struct BST {
|
|
|
|
int data;
|
|
|
|
int leftIndex;
|
|
|
|
int rightIndex;
|
|
|
|
};
|
|
|
|
struct tint_array_wrapper {
|
|
|
|
int arr[10];
|
|
|
|
};
|
|
|
|
struct QuicksortObject {
|
|
|
|
tint_array_wrapper numbers;
|
|
|
|
};
|
|
|
|
struct buf0 {
|
|
|
|
/* 0x0000 */ packed_float2 injectionSwitch;
|
|
|
|
};
|
|
|
|
struct tint_array_wrapper_1 {
|
|
|
|
BST arr[10];
|
|
|
|
};
|
|
|
|
struct main_out {
|
|
|
|
float4 x_GLF_color_1;
|
|
|
|
};
|
|
|
|
struct tint_symbol_1 {
|
|
|
|
float4 x_GLF_color_1 [[color(0)]];
|
|
|
|
};
|
|
|
|
|
|
|
|
void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const node, thread int* const data) {
|
|
|
|
int const x_208 = *(data);
|
|
|
|
(*(node)).data = x_208;
|
|
|
|
(*(node)).leftIndex = -1;
|
|
|
|
(*(node)).rightIndex = -1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper_1* const tint_symbol_4) {
|
|
|
|
int baseIndex = 0;
|
|
|
|
BST param = {};
|
|
|
|
int param_1 = 0;
|
|
|
|
BST param_2 = {};
|
|
|
|
int param_3 = 0;
|
|
|
|
baseIndex = 0;
|
|
|
|
while (true) {
|
|
|
|
int const x_217 = baseIndex;
|
|
|
|
int const x_218 = *(treeIndex);
|
|
|
|
if ((x_217 <= x_218)) {
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
int const x_221 = *(data_1);
|
|
|
|
int const x_222 = baseIndex;
|
|
|
|
int const x_224 = (*(tint_symbol_4)).arr[x_222].data;
|
|
|
|
if ((x_221 <= x_224)) {
|
|
|
|
int const x_229 = baseIndex;
|
|
|
|
int const x_231 = (*(tint_symbol_4)).arr[x_229].leftIndex;
|
|
|
|
if ((x_231 == -1)) {
|
|
|
|
int const x_236 = baseIndex;
|
|
|
|
int const x_237 = *(treeIndex);
|
|
|
|
(*(tint_symbol_4)).arr[x_236].leftIndex = x_237;
|
|
|
|
int const x_239 = *(treeIndex);
|
|
|
|
BST const x_241 = (*(tint_symbol_4)).arr[x_239];
|
|
|
|
param = x_241;
|
|
|
|
int const x_242 = *(data_1);
|
|
|
|
param_1 = x_242;
|
|
|
|
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1));
|
|
|
|
BST const x_244 = param;
|
|
|
|
(*(tint_symbol_4)).arr[x_239] = x_244;
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
int const x_246 = baseIndex;
|
|
|
|
int const x_248 = (*(tint_symbol_4)).arr[x_246].leftIndex;
|
|
|
|
baseIndex = x_248;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
int const x_249 = baseIndex;
|
|
|
|
int const x_251 = (*(tint_symbol_4)).arr[x_249].rightIndex;
|
|
|
|
if ((x_251 == -1)) {
|
|
|
|
int const x_256 = baseIndex;
|
|
|
|
int const x_257 = *(treeIndex);
|
|
|
|
(*(tint_symbol_4)).arr[x_256].rightIndex = x_257;
|
|
|
|
int const x_259 = *(treeIndex);
|
|
|
|
BST const x_261 = (*(tint_symbol_4)).arr[x_259];
|
|
|
|
param_2 = x_261;
|
|
|
|
int const x_262 = *(data_1);
|
|
|
|
param_3 = x_262;
|
|
|
|
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3));
|
|
|
|
BST const x_264 = param_2;
|
|
|
|
(*(tint_symbol_4)).arr[x_259] = x_264;
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
int const x_266 = baseIndex;
|
|
|
|
int const x_268 = (*(tint_symbol_4)).arr[x_266].rightIndex;
|
|
|
|
baseIndex = x_268;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int identity_i1_(thread int* const a, thread QuicksortObject* const tint_symbol_5) {
|
|
|
|
int const x_202 = *(a);
|
|
|
|
int const x_203 = *(a);
|
|
|
|
(*(tint_symbol_5)).numbers.arr[x_202] = x_203;
|
|
|
|
int const x_206 = (*(tint_symbol_5)).numbers.arr[2];
|
|
|
|
return x_206;
|
|
|
|
}
|
|
|
|
|
|
|
|
int search_i1_(thread int* const target, thread tint_array_wrapper_1* const tint_symbol_6) {
|
|
|
|
int index = 0;
|
|
|
|
BST currentNode = {};
|
|
|
|
int x_270 = 0;
|
|
|
|
index = 0;
|
|
|
|
while (true) {
|
|
|
|
int const x_275 = index;
|
|
|
|
if ((x_275 != -1)) {
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
int const x_278 = index;
|
|
|
|
BST const x_280 = (*(tint_symbol_6)).arr[x_278];
|
|
|
|
currentNode = x_280;
|
|
|
|
int const x_282 = currentNode.data;
|
|
|
|
int const x_283 = *(target);
|
|
|
|
if ((x_282 == x_283)) {
|
|
|
|
int const x_287 = *(target);
|
|
|
|
return x_287;
|
|
|
|
}
|
|
|
|
int const x_288 = *(target);
|
|
|
|
int const x_290 = currentNode.data;
|
|
|
|
if ((x_288 > x_290)) {
|
|
|
|
int const x_296 = currentNode.rightIndex;
|
|
|
|
x_270 = x_296;
|
|
|
|
} else {
|
|
|
|
int const x_298 = currentNode.leftIndex;
|
|
|
|
x_270 = x_298;
|
|
|
|
}
|
|
|
|
int const x_299 = x_270;
|
|
|
|
index = x_299;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void main_1(constant buf0& x_50, thread tint_array_wrapper_1* const tint_symbol_7, thread QuicksortObject* const tint_symbol_8, thread float4* const tint_symbol_9) {
|
|
|
|
int treeIndex_1 = 0;
|
|
|
|
BST param_4 = {};
|
|
|
|
int param_5 = 0;
|
|
|
|
int param_6 = 0;
|
|
|
|
int param_7 = 0;
|
|
|
|
int param_8 = 0;
|
|
|
|
int param_9 = 0;
|
|
|
|
int param_10 = 0;
|
|
|
|
int param_11 = 0;
|
|
|
|
int param_12 = 0;
|
|
|
|
int param_13 = 0;
|
|
|
|
int param_14 = 0;
|
|
|
|
int param_15 = 0;
|
|
|
|
int param_16 = 0;
|
|
|
|
int param_17 = 0;
|
|
|
|
int param_18 = 0;
|
|
|
|
int param_19 = 0;
|
|
|
|
int param_20 = 0;
|
|
|
|
int param_21 = 0;
|
|
|
|
int param_22 = 0;
|
|
|
|
int param_23 = 0;
|
|
|
|
int pp = 0;
|
|
|
|
int looplimiter0 = 0;
|
|
|
|
int i = 0;
|
|
|
|
int param_24 = 0;
|
|
|
|
int count = 0;
|
|
|
|
int i_1 = 0;
|
|
|
|
int result = 0;
|
|
|
|
int param_25 = 0;
|
|
|
|
treeIndex_1 = 0;
|
|
|
|
BST const x_101 = (*(tint_symbol_7)).arr[0];
|
|
|
|
param_4 = x_101;
|
|
|
|
param_5 = 9;
|
|
|
|
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5));
|
|
|
|
BST const x_103 = param_4;
|
|
|
|
(*(tint_symbol_7)).arr[0] = x_103;
|
|
|
|
int const x_105 = treeIndex_1;
|
2021-07-30 08:22:58 +00:00
|
|
|
treeIndex_1 = (x_105 + 1);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_107 = treeIndex_1;
|
|
|
|
param_6 = x_107;
|
|
|
|
param_7 = 5;
|
|
|
|
insert_i1_i1_(&(param_6), &(param_7), tint_symbol_7);
|
|
|
|
int const x_109 = treeIndex_1;
|
2021-07-30 08:22:58 +00:00
|
|
|
treeIndex_1 = (x_109 + 1);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_111 = treeIndex_1;
|
|
|
|
param_8 = x_111;
|
|
|
|
param_9 = 12;
|
|
|
|
insert_i1_i1_(&(param_8), &(param_9), tint_symbol_7);
|
|
|
|
int const x_113 = treeIndex_1;
|
2021-07-30 08:22:58 +00:00
|
|
|
treeIndex_1 = (x_113 + 1);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_115 = treeIndex_1;
|
|
|
|
param_10 = x_115;
|
|
|
|
param_11 = 15;
|
|
|
|
insert_i1_i1_(&(param_10), &(param_11), tint_symbol_7);
|
|
|
|
int const x_117 = treeIndex_1;
|
2021-07-30 08:22:58 +00:00
|
|
|
treeIndex_1 = (x_117 + 1);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_119 = treeIndex_1;
|
|
|
|
param_12 = x_119;
|
|
|
|
param_13 = 7;
|
|
|
|
insert_i1_i1_(&(param_12), &(param_13), tint_symbol_7);
|
|
|
|
int const x_121 = treeIndex_1;
|
2021-07-30 08:22:58 +00:00
|
|
|
treeIndex_1 = (x_121 + 1);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_123 = treeIndex_1;
|
|
|
|
param_14 = x_123;
|
|
|
|
param_15 = 8;
|
|
|
|
insert_i1_i1_(&(param_14), &(param_15), tint_symbol_7);
|
|
|
|
int const x_125 = treeIndex_1;
|
2021-07-30 08:22:58 +00:00
|
|
|
treeIndex_1 = (x_125 + 1);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_127 = treeIndex_1;
|
|
|
|
param_16 = x_127;
|
|
|
|
param_17 = 2;
|
|
|
|
insert_i1_i1_(&(param_16), &(param_17), tint_symbol_7);
|
|
|
|
int const x_129 = treeIndex_1;
|
2021-07-30 08:22:58 +00:00
|
|
|
treeIndex_1 = (x_129 + 1);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_131 = treeIndex_1;
|
|
|
|
param_18 = x_131;
|
|
|
|
param_19 = 6;
|
|
|
|
insert_i1_i1_(&(param_18), &(param_19), tint_symbol_7);
|
|
|
|
int const x_133 = treeIndex_1;
|
2021-07-30 08:22:58 +00:00
|
|
|
treeIndex_1 = (x_133 + 1);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_135 = treeIndex_1;
|
|
|
|
param_20 = x_135;
|
|
|
|
param_21 = 17;
|
|
|
|
insert_i1_i1_(&(param_20), &(param_21), tint_symbol_7);
|
|
|
|
int const x_137 = treeIndex_1;
|
2021-07-30 08:22:58 +00:00
|
|
|
treeIndex_1 = (x_137 + 1);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_139 = treeIndex_1;
|
|
|
|
param_22 = x_139;
|
|
|
|
param_23 = 13;
|
|
|
|
insert_i1_i1_(&(param_22), &(param_23), tint_symbol_7);
|
|
|
|
pp = 0;
|
|
|
|
looplimiter0 = 0;
|
|
|
|
i = 0;
|
|
|
|
while (true) {
|
|
|
|
int const x_145 = i;
|
|
|
|
if ((x_145 < 10000)) {
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
int const x_148 = looplimiter0;
|
|
|
|
float const x_150 = x_50.injectionSwitch.y;
|
|
|
|
if ((x_148 >= int(x_150))) {
|
|
|
|
float const x_156 = x_50.injectionSwitch.y;
|
2021-07-30 08:22:58 +00:00
|
|
|
param_24 = (1 + int(x_156));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_159 = identity_i1_(&(param_24), tint_symbol_8);
|
|
|
|
pp = x_159;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
int const x_160 = looplimiter0;
|
2021-07-30 08:22:58 +00:00
|
|
|
looplimiter0 = (x_160 + 1);
|
2021-07-23 13:10:12 +00:00
|
|
|
{
|
|
|
|
int const x_162 = i;
|
2021-07-30 08:22:58 +00:00
|
|
|
i = (x_162 + 1);
|
2021-07-23 13:10:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
int const x_164 = pp;
|
|
|
|
if ((x_164 != 2)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
count = 0;
|
|
|
|
i_1 = 0;
|
|
|
|
while (true) {
|
|
|
|
int const x_172 = i_1;
|
|
|
|
if ((x_172 < 20)) {
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
int const x_175 = i_1;
|
|
|
|
param_25 = x_175;
|
|
|
|
int const x_176 = search_i1_(&(param_25), tint_symbol_7);
|
|
|
|
result = x_176;
|
|
|
|
int const x_177 = i_1;
|
|
|
|
switch(x_177) {
|
|
|
|
case 2:
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
case 7:
|
|
|
|
case 8:
|
|
|
|
case 9:
|
|
|
|
case 12:
|
|
|
|
case 13:
|
|
|
|
case 15:
|
|
|
|
case 17: {
|
|
|
|
int const x_187 = result;
|
|
|
|
int const x_188 = i_1;
|
|
|
|
if ((x_187 == x_188)) {
|
|
|
|
int const x_192 = count;
|
2021-07-30 08:22:58 +00:00
|
|
|
count = (x_192 + 1);
|
2021-07-23 13:10:12 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
int const x_181 = result;
|
|
|
|
if ((x_181 == -1)) {
|
|
|
|
int const x_185 = count;
|
2021-07-30 08:22:58 +00:00
|
|
|
count = (x_185 + 1);
|
2021-07-23 13:10:12 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
{
|
|
|
|
int const x_194 = i_1;
|
2021-07-30 08:22:58 +00:00
|
|
|
i_1 = (x_194 + 1);
|
2021-07-23 13:10:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
int const x_196 = count;
|
|
|
|
if ((x_196 == 20)) {
|
|
|
|
*(tint_symbol_9) = float4(1.0f, 0.0f, 0.0f, 1.0f);
|
|
|
|
} else {
|
|
|
|
*(tint_symbol_9) = float4(0.0f, 0.0f, 1.0f, 1.0f);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
fragment tint_symbol_1 tint_symbol(constant buf0& x_50 [[buffer(0)]]) {
|
|
|
|
thread tint_array_wrapper_1 tint_symbol_10 = {};
|
|
|
|
thread QuicksortObject tint_symbol_11 = {};
|
|
|
|
thread float4 tint_symbol_12 = 0.0f;
|
|
|
|
main_1(x_50, &(tint_symbol_10), &(tint_symbol_11), &(tint_symbol_12));
|
|
|
|
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_12};
|
|
|
|
tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
|
|
|
|
return tint_symbol_3;
|
|
|
|
}
|
|
|
|
|