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 {
|
|
|
|
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_158 = *(data);
|
|
|
|
(*(node)).data = x_158;
|
|
|
|
(*(node)).leftIndex = -1;
|
|
|
|
(*(node)).rightIndex = -1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-08-04 22:15:28 +00:00
|
|
|
void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_3) {
|
2021-07-23 13:10:12 +00:00
|
|
|
int baseIndex = 0;
|
|
|
|
BST param = {};
|
|
|
|
int param_1 = 0;
|
|
|
|
BST param_2 = {};
|
|
|
|
int param_3 = 0;
|
|
|
|
baseIndex = 0;
|
|
|
|
while (true) {
|
|
|
|
int const x_167 = baseIndex;
|
|
|
|
int const x_168 = *(treeIndex);
|
|
|
|
if ((x_167 <= x_168)) {
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
int const x_171 = *(data_1);
|
|
|
|
int const x_172 = baseIndex;
|
2021-08-04 22:15:28 +00:00
|
|
|
int const x_174 = (*(tint_symbol_3)).arr[x_172].data;
|
2021-07-23 13:10:12 +00:00
|
|
|
if ((x_171 <= x_174)) {
|
|
|
|
int const x_179 = baseIndex;
|
2021-08-04 22:15:28 +00:00
|
|
|
int const x_181 = (*(tint_symbol_3)).arr[x_179].leftIndex;
|
2021-07-23 13:10:12 +00:00
|
|
|
if ((x_181 == -1)) {
|
|
|
|
int const x_186 = baseIndex;
|
|
|
|
int const x_187 = *(treeIndex);
|
2021-08-04 22:15:28 +00:00
|
|
|
(*(tint_symbol_3)).arr[x_186].leftIndex = x_187;
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_189 = *(treeIndex);
|
2021-08-04 22:15:28 +00:00
|
|
|
BST const x_191 = (*(tint_symbol_3)).arr[x_189];
|
2021-07-23 13:10:12 +00:00
|
|
|
param = x_191;
|
|
|
|
int const x_192 = *(data_1);
|
|
|
|
param_1 = x_192;
|
|
|
|
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1));
|
|
|
|
BST const x_194 = param;
|
2021-08-04 22:15:28 +00:00
|
|
|
(*(tint_symbol_3)).arr[x_189] = x_194;
|
2021-07-23 13:10:12 +00:00
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
int const x_196 = baseIndex;
|
2021-08-04 22:15:28 +00:00
|
|
|
int const x_198 = (*(tint_symbol_3)).arr[x_196].leftIndex;
|
2021-07-23 13:10:12 +00:00
|
|
|
baseIndex = x_198;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
int const x_199 = baseIndex;
|
2021-08-04 22:15:28 +00:00
|
|
|
int const x_201 = (*(tint_symbol_3)).arr[x_199].rightIndex;
|
2021-07-23 13:10:12 +00:00
|
|
|
if ((x_201 == -1)) {
|
|
|
|
int const x_206 = baseIndex;
|
|
|
|
int const x_207 = *(treeIndex);
|
2021-08-04 22:15:28 +00:00
|
|
|
(*(tint_symbol_3)).arr[x_206].rightIndex = x_207;
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_209 = *(treeIndex);
|
2021-08-04 22:15:28 +00:00
|
|
|
BST const x_211 = (*(tint_symbol_3)).arr[x_209];
|
2021-07-23 13:10:12 +00:00
|
|
|
param_2 = x_211;
|
|
|
|
int const x_212 = *(data_1);
|
|
|
|
param_3 = x_212;
|
|
|
|
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3));
|
|
|
|
BST const x_214 = param_2;
|
2021-08-04 22:15:28 +00:00
|
|
|
(*(tint_symbol_3)).arr[x_209] = x_214;
|
2021-07-23 13:10:12 +00:00
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
int const x_216 = baseIndex;
|
2021-08-04 22:15:28 +00:00
|
|
|
int const x_218 = (*(tint_symbol_3)).arr[x_216].rightIndex;
|
2021-07-23 13:10:12 +00:00
|
|
|
baseIndex = x_218;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-08-04 22:15:28 +00:00
|
|
|
int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_4) {
|
2021-07-23 13:10:12 +00:00
|
|
|
int index = 0;
|
|
|
|
BST currentNode = {};
|
|
|
|
int x_220 = 0;
|
|
|
|
index = 0;
|
|
|
|
while (true) {
|
|
|
|
int const x_225 = index;
|
|
|
|
if ((x_225 != -1)) {
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
int const x_228 = index;
|
2021-08-04 22:15:28 +00:00
|
|
|
BST const x_230 = (*(tint_symbol_4)).arr[x_228];
|
2021-07-23 13:10:12 +00:00
|
|
|
currentNode = x_230;
|
|
|
|
int const x_232 = currentNode.data;
|
|
|
|
int const x_233 = *(target);
|
|
|
|
if ((x_232 == x_233)) {
|
|
|
|
int const x_237 = *(target);
|
|
|
|
return x_237;
|
|
|
|
}
|
|
|
|
int const x_238 = *(target);
|
|
|
|
int const x_240 = currentNode.data;
|
|
|
|
if ((x_238 > x_240)) {
|
|
|
|
int const x_246 = currentNode.rightIndex;
|
|
|
|
x_220 = x_246;
|
|
|
|
} else {
|
|
|
|
int const x_248 = currentNode.leftIndex;
|
|
|
|
x_220 = x_248;
|
|
|
|
}
|
|
|
|
int const x_249 = x_220;
|
|
|
|
index = x_249;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2021-08-04 22:15:28 +00:00
|
|
|
void main_1(thread tint_array_wrapper* const tint_symbol_5, thread float4* const tint_symbol_6) {
|
2021-07-23 13:10:12 +00:00
|
|
|
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 count = 0;
|
|
|
|
int i = 0;
|
|
|
|
int result = 0;
|
|
|
|
int param_24 = 0;
|
|
|
|
treeIndex_1 = 0;
|
2021-08-04 22:15:28 +00:00
|
|
|
BST const x_84 = (*(tint_symbol_5)).arr[0];
|
2021-07-23 13:10:12 +00:00
|
|
|
param_4 = x_84;
|
|
|
|
param_5 = 9;
|
|
|
|
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5));
|
|
|
|
BST const x_86 = param_4;
|
2021-08-04 22:15:28 +00:00
|
|
|
(*(tint_symbol_5)).arr[0] = x_86;
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_88 = treeIndex_1;
|
2021-07-30 18:59:06 +00:00
|
|
|
treeIndex_1 = as_type<int>((as_type<uint>(x_88) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_90 = treeIndex_1;
|
|
|
|
param_6 = x_90;
|
|
|
|
param_7 = 5;
|
2021-08-04 22:15:28 +00:00
|
|
|
insert_i1_i1_(&(param_6), &(param_7), tint_symbol_5);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_92 = treeIndex_1;
|
2021-07-30 18:59:06 +00:00
|
|
|
treeIndex_1 = as_type<int>((as_type<uint>(x_92) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_94 = treeIndex_1;
|
|
|
|
param_8 = x_94;
|
|
|
|
param_9 = 12;
|
2021-08-04 22:15:28 +00:00
|
|
|
insert_i1_i1_(&(param_8), &(param_9), tint_symbol_5);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_96 = treeIndex_1;
|
2021-07-30 18:59:06 +00:00
|
|
|
treeIndex_1 = as_type<int>((as_type<uint>(x_96) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_98 = treeIndex_1;
|
|
|
|
param_10 = x_98;
|
|
|
|
param_11 = 15;
|
2021-08-04 22:15:28 +00:00
|
|
|
insert_i1_i1_(&(param_10), &(param_11), tint_symbol_5);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_100 = treeIndex_1;
|
2021-07-30 18:59:06 +00:00
|
|
|
treeIndex_1 = as_type<int>((as_type<uint>(x_100) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_102 = treeIndex_1;
|
|
|
|
param_12 = x_102;
|
|
|
|
param_13 = 7;
|
2021-08-04 22:15:28 +00:00
|
|
|
insert_i1_i1_(&(param_12), &(param_13), tint_symbol_5);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_104 = treeIndex_1;
|
2021-07-30 18:59:06 +00:00
|
|
|
treeIndex_1 = as_type<int>((as_type<uint>(x_104) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_106 = treeIndex_1;
|
|
|
|
param_14 = x_106;
|
|
|
|
param_15 = 8;
|
2021-08-04 22:15:28 +00:00
|
|
|
insert_i1_i1_(&(param_14), &(param_15), tint_symbol_5);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_108 = treeIndex_1;
|
2021-07-30 18:59:06 +00:00
|
|
|
treeIndex_1 = as_type<int>((as_type<uint>(x_108) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_110 = treeIndex_1;
|
|
|
|
param_16 = x_110;
|
|
|
|
param_17 = 2;
|
2021-08-04 22:15:28 +00:00
|
|
|
insert_i1_i1_(&(param_16), &(param_17), tint_symbol_5);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_112 = treeIndex_1;
|
2021-07-30 18:59:06 +00:00
|
|
|
treeIndex_1 = as_type<int>((as_type<uint>(x_112) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_114 = treeIndex_1;
|
|
|
|
param_18 = x_114;
|
|
|
|
param_19 = 6;
|
2021-08-04 22:15:28 +00:00
|
|
|
insert_i1_i1_(&(param_18), &(param_19), tint_symbol_5);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_116 = treeIndex_1;
|
2021-07-30 18:59:06 +00:00
|
|
|
treeIndex_1 = as_type<int>((as_type<uint>(x_116) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_118 = treeIndex_1;
|
|
|
|
param_20 = x_118;
|
|
|
|
param_21 = 17;
|
2021-08-04 22:15:28 +00:00
|
|
|
insert_i1_i1_(&(param_20), &(param_21), tint_symbol_5);
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_120 = treeIndex_1;
|
2021-07-30 18:59:06 +00:00
|
|
|
treeIndex_1 = as_type<int>((as_type<uint>(x_120) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
int const x_122 = treeIndex_1;
|
|
|
|
param_22 = x_122;
|
|
|
|
param_23 = 13;
|
2021-08-04 22:15:28 +00:00
|
|
|
insert_i1_i1_(&(param_22), &(param_23), tint_symbol_5);
|
2021-07-23 13:10:12 +00:00
|
|
|
count = 0;
|
|
|
|
i = 0;
|
|
|
|
while (true) {
|
|
|
|
int const x_128 = i;
|
|
|
|
if ((x_128 < 20)) {
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
int const x_131 = i;
|
|
|
|
param_24 = x_131;
|
2021-08-04 22:15:28 +00:00
|
|
|
int const x_132 = search_i1_(&(param_24), tint_symbol_5);
|
2021-07-23 13:10:12 +00:00
|
|
|
result = x_132;
|
|
|
|
int const x_133 = i;
|
|
|
|
switch(x_133) {
|
|
|
|
case 2:
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
case 7:
|
|
|
|
case 8:
|
|
|
|
case 9:
|
|
|
|
case 12:
|
|
|
|
case 13:
|
|
|
|
case 15:
|
|
|
|
case 17: {
|
|
|
|
int const x_143 = result;
|
|
|
|
int const x_144 = i;
|
|
|
|
if ((x_143 == x_144)) {
|
|
|
|
int const x_148 = count;
|
2021-07-30 18:59:06 +00:00
|
|
|
count = as_type<int>((as_type<uint>(x_148) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
int const x_137 = result;
|
|
|
|
if ((x_137 == -1)) {
|
|
|
|
int const x_141 = count;
|
2021-07-30 18:59:06 +00:00
|
|
|
count = as_type<int>((as_type<uint>(x_141) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
{
|
|
|
|
int const x_150 = i;
|
2021-07-30 18:59:06 +00:00
|
|
|
i = as_type<int>((as_type<uint>(x_150) + as_type<uint>(1)));
|
2021-07-23 13:10:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
int const x_152 = count;
|
|
|
|
if ((x_152 == 20)) {
|
2021-08-04 22:15:28 +00:00
|
|
|
*(tint_symbol_6) = 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_6) = float4(0.0f, 0.0f, 1.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 tint_array_wrapper* const tint_symbol_7, thread float4* const tint_symbol_8) {
|
|
|
|
main_1(tint_symbol_7, tint_symbol_8);
|
|
|
|
main_out const tint_symbol_2 = {.x_GLF_color_1=*(tint_symbol_8)};
|
|
|
|
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 tint_array_wrapper tint_symbol_9 = {};
|
|
|
|
thread float4 tint_symbol_10 = 0.0f;
|
|
|
|
main_out const inner_result = tint_symbol_inner(&(tint_symbol_9), &(tint_symbol_10));
|
|
|
|
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
|
|
|
}
|
|
|
|
|