dawn-cmake/test/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fr.../1.spvasm.expected.msl

294 lines
7.7 KiB
Plaintext

#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_2 {
float4 x_GLF_color_1 [[color(0)]];
};
void makeTreeNode_struct_BST_i1_i1_i11_i1_(thread BST* const tree, thread int* const data) {
int const x_169 = *(data);
(*(tree)).data = x_169;
(*(tree)).leftIndex = -1;
(*(tree)).rightIndex = -1;
return;
}
void insert_i1_i1_(thread int* const treeIndex, thread int* const data_1, thread tint_array_wrapper* const tint_symbol_5) {
int baseIndex = 0;
BST param = {};
int param_1 = 0;
BST param_2 = {};
int param_3 = 0;
baseIndex = 0;
while (true) {
int const x_178 = baseIndex;
int const x_179 = *(treeIndex);
if ((x_178 <= x_179)) {
} else {
break;
}
int const x_182 = *(data_1);
int const x_183 = baseIndex;
int const x_185 = (*(tint_symbol_5)).arr[x_183].data;
if ((x_182 <= x_185)) {
int const x_190 = baseIndex;
int const x_192 = (*(tint_symbol_5)).arr[x_190].leftIndex;
if ((x_192 == -1)) {
int const x_197 = baseIndex;
int const x_198 = *(treeIndex);
(*(tint_symbol_5)).arr[x_197].leftIndex = x_198;
int const x_200 = *(treeIndex);
BST const x_202 = (*(tint_symbol_5)).arr[x_200];
param = x_202;
int const x_203 = *(data_1);
param_1 = x_203;
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param), &(param_1));
BST const x_205 = param;
(*(tint_symbol_5)).arr[x_200] = x_205;
return;
} else {
int const x_207 = baseIndex;
int const x_209 = (*(tint_symbol_5)).arr[x_207].leftIndex;
baseIndex = x_209;
continue;
}
return;
} else {
int const x_210 = baseIndex;
int const x_212 = (*(tint_symbol_5)).arr[x_210].rightIndex;
if ((x_212 == -1)) {
int const x_217 = baseIndex;
int const x_218 = *(treeIndex);
(*(tint_symbol_5)).arr[x_217].rightIndex = x_218;
int const x_220 = *(treeIndex);
BST const x_222 = (*(tint_symbol_5)).arr[x_220];
param_2 = x_222;
int const x_223 = *(data_1);
param_3 = x_223;
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_2), &(param_3));
BST const x_225 = param_2;
(*(tint_symbol_5)).arr[x_220] = x_225;
return;
} else {
int const x_227 = baseIndex;
int const x_229 = (*(tint_symbol_5)).arr[x_227].rightIndex;
baseIndex = x_229;
continue;
}
return;
}
return;
}
return;
}
int search_i1_(thread int* const target, thread tint_array_wrapper* const tint_symbol_6) {
int index = 0;
BST currentNode = {};
int x_231 = 0;
index = 0;
while (true) {
int const x_236 = index;
if ((x_236 != -1)) {
} else {
break;
}
int const x_239 = index;
BST const x_241 = (*(tint_symbol_6)).arr[x_239];
currentNode = x_241;
int const x_243 = currentNode.data;
int const x_244 = *(target);
if ((x_243 == x_244)) {
int const x_248 = *(target);
return x_248;
}
int const x_249 = *(target);
int const x_251 = currentNode.data;
if ((x_249 > x_251)) {
int const x_257 = currentNode.rightIndex;
x_231 = x_257;
} else {
int const x_259 = currentNode.leftIndex;
x_231 = x_259;
}
int const x_260 = x_231;
index = x_260;
}
return -1;
}
void main_1(thread tint_array_wrapper* const tint_symbol_7, thread float4* 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 count = 0;
int i = 0;
int result = 0;
int param_24 = 0;
treeIndex_1 = 0;
BST const x_88 = (*(tint_symbol_7)).arr[0];
param_4 = x_88;
param_5 = 9;
makeTreeNode_struct_BST_i1_i1_i11_i1_(&(param_4), &(param_5));
BST const x_90 = param_4;
(*(tint_symbol_7)).arr[0] = x_90;
int const x_92 = treeIndex_1;
treeIndex_1 = (x_92 + 1);
int const x_94 = treeIndex_1;
param_6 = x_94;
param_7 = 5;
insert_i1_i1_(&(param_6), &(param_7), tint_symbol_7);
int const x_96 = treeIndex_1;
treeIndex_1 = (x_96 + 1);
int const x_98 = treeIndex_1;
param_8 = x_98;
param_9 = 12;
insert_i1_i1_(&(param_8), &(param_9), tint_symbol_7);
int const x_100 = treeIndex_1;
treeIndex_1 = (x_100 + 1);
int const x_102 = treeIndex_1;
param_10 = x_102;
param_11 = 15;
insert_i1_i1_(&(param_10), &(param_11), tint_symbol_7);
int const x_104 = treeIndex_1;
treeIndex_1 = (x_104 + 1);
int const x_106 = treeIndex_1;
param_12 = x_106;
param_13 = 7;
insert_i1_i1_(&(param_12), &(param_13), tint_symbol_7);
int const x_108 = treeIndex_1;
treeIndex_1 = (x_108 + 1);
int const x_110 = treeIndex_1;
param_14 = x_110;
param_15 = 8;
insert_i1_i1_(&(param_14), &(param_15), tint_symbol_7);
int const x_112 = treeIndex_1;
treeIndex_1 = (x_112 + 1);
int const x_114 = treeIndex_1;
param_16 = x_114;
param_17 = 2;
insert_i1_i1_(&(param_16), &(param_17), tint_symbol_7);
int const x_116 = treeIndex_1;
treeIndex_1 = (x_116 + 1);
int const x_118 = treeIndex_1;
param_18 = x_118;
param_19 = 6;
insert_i1_i1_(&(param_18), &(param_19), tint_symbol_7);
int const x_120 = treeIndex_1;
treeIndex_1 = (x_120 + 1);
int const x_122 = treeIndex_1;
param_20 = x_122;
param_21 = 17;
insert_i1_i1_(&(param_20), &(param_21), tint_symbol_7);
int const x_124 = treeIndex_1;
treeIndex_1 = (x_124 + 1);
int const x_126 = treeIndex_1;
param_22 = x_126;
param_23 = 13;
insert_i1_i1_(&(param_22), &(param_23), tint_symbol_7);
count = 0;
i = 0;
while (true) {
int const x_132 = i;
if ((x_132 < 20)) {
} else {
break;
}
bool x_155 = false;
bool x_156_phi = false;
int const x_135 = i;
param_24 = x_135;
int const x_136 = search_i1_(&(param_24), tint_symbol_7);
result = x_136;
int const x_137 = i;
switch(x_137) {
case 2:
case 5:
case 6:
case 7:
case 8:
case 9:
case 12:
case 13:
case 15:
case 17: {
int const x_147 = result;
int const x_148 = i;
bool const x_149 = (x_147 == x_148);
x_156_phi = x_149;
if (!(x_149)) {
float const x_154 = (*(tint_symbol_8)).x;
x_155 = (x_154 < 0.0f);
x_156_phi = x_155;
}
bool const x_156 = x_156_phi;
if (x_156) {
int const x_159 = count;
count = (x_159 + 1);
}
break;
}
default: {
int const x_141 = result;
if ((x_141 == -1)) {
int const x_145 = count;
count = (x_145 + 1);
}
break;
}
}
{
int const x_161 = i;
i = (x_161 + 1);
}
}
int const x_163 = count;
if ((x_163 == 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_2 tint_symbol(float4 gl_FragCoord_param [[position]]) {
thread float4 tint_symbol_10 = 0.0f;
thread tint_array_wrapper tint_symbol_11 = {};
thread float4 tint_symbol_12 = 0.0f;
tint_symbol_10 = gl_FragCoord_param;
main_1(&(tint_symbol_11), &(tint_symbol_10), &(tint_symbol_12));
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_12};
tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
return tint_symbol_4;
}