dawn-cmake/test/vk-gl-cts/graphicsfuzz/spv-double-branch-to-same-b.../1.wgsl.expected.msl

329 lines
8.5 KiB
Plaintext

#include <metal_stdlib>
using namespace metal;
struct buf0 {
/* 0x0000 */ packed_float2 injectionSwitch;
};
struct buf1 {
/* 0x0000 */ packed_float2 resolution;
};
struct tint_array_wrapper {
int arr[10];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 [[color(0)]];
};
void merge_i1_i1_i1_(thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) {
int k = 0;
int i = 0;
int j = 0;
int i_1 = 0;
int const x_255 = *(from);
k = x_255;
int const x_256 = *(from);
i = x_256;
int const x_257 = *(mid);
j = (x_257 + 1);
while (true) {
int const x_263 = i;
int const x_264 = *(mid);
int const x_266 = j;
int const x_267 = *(to);
if (((x_263 <= x_264) && (x_266 <= x_267))) {
} else {
break;
}
int const x_271 = i;
int const x_273 = (*(tint_symbol_5)).arr[x_271];
int const x_274 = j;
int const x_276 = (*(tint_symbol_5)).arr[x_274];
if ((x_273 < x_276)) {
int const x_281 = k;
k = (x_281 + 1);
int const x_283 = i;
i = (x_283 + 1);
int const x_286 = (*(tint_symbol_5)).arr[x_283];
(*(tint_symbol_6)).arr[x_281] = x_286;
} else {
int const x_288 = k;
k = (x_288 + 1);
int const x_290 = j;
j = (x_290 + 1);
int const x_293 = (*(tint_symbol_5)).arr[x_290];
(*(tint_symbol_6)).arr[x_288] = x_293;
}
}
while (true) {
int const x_299 = i;
int const x_301 = i;
int const x_302 = *(mid);
if (((x_299 < 10) && (x_301 <= x_302))) {
} else {
break;
}
int const x_306 = k;
k = (x_306 + 1);
int const x_308 = i;
i = (x_308 + 1);
int const x_311 = (*(tint_symbol_5)).arr[x_308];
(*(tint_symbol_6)).arr[x_306] = x_311;
}
int const x_313 = *(from);
i_1 = x_313;
while (true) {
int const x_318 = i_1;
int const x_319 = *(to);
if ((x_318 <= x_319)) {
} else {
break;
}
int const x_322 = i_1;
int const x_323 = i_1;
int const x_325 = (*(tint_symbol_6)).arr[x_323];
(*(tint_symbol_5)).arr[x_322] = x_325;
{
int const x_327 = i_1;
i_1 = (x_327 + 1);
}
}
return;
}
void mergeSort_(thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8) {
int low = 0;
int high = 0;
int m = 0;
int i_2 = 0;
int from_1 = 0;
int mid_1 = 0;
int to_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
low = 0;
high = 9;
m = 1;
while (true) {
int const x_334 = m;
int const x_335 = high;
if ((x_334 <= x_335)) {
} else {
break;
}
int const x_338 = low;
i_2 = x_338;
while (true) {
int const x_343 = i_2;
int const x_344 = high;
if ((x_343 < x_344)) {
} else {
break;
}
int const x_347 = i_2;
from_1 = x_347;
int const x_348 = i_2;
int const x_349 = m;
mid_1 = ((x_348 + x_349) - 1);
int const x_352 = i_2;
int const x_353 = m;
int const x_357 = high;
to_1 = min(((x_352 + (2 * x_353)) - 1), x_357);
int const x_359 = from_1;
param = x_359;
int const x_360 = mid_1;
param_1 = x_360;
int const x_361 = to_1;
param_2 = x_361;
merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8);
{
int const x_363 = m;
int const x_365 = i_2;
i_2 = (x_365 + (2 * x_363));
}
}
{
int const x_367 = m;
m = (2 * x_367);
}
}
return;
}
void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_9, thread tint_array_wrapper* const tint_symbol_10, thread float4* const tint_symbol_11, thread float4* const tint_symbol_12) {
int i_3 = 0;
int j_1 = 0;
float grey = 0.0f;
float const x_88 = x_28.injectionSwitch.x;
i_3 = int(x_88);
while (true) {
int const x_94 = i_3;
switch(x_94) {
case 9: {
int const x_124 = i_3;
(*(tint_symbol_9)).arr[x_124] = -5;
if (true) {
} else {
{
int const x_128 = i_3;
if ((x_128 < 10)) {
} else {
break;
}
}
continue;
}
break;
}
case 8: {
int const x_122 = i_3;
(*(tint_symbol_9)).arr[x_122] = -4;
break;
}
case 7: {
int const x_120 = i_3;
(*(tint_symbol_9)).arr[x_120] = -3;
break;
}
case 6: {
int const x_118 = i_3;
(*(tint_symbol_9)).arr[x_118] = -2;
break;
}
case 5: {
int const x_116 = i_3;
(*(tint_symbol_9)).arr[x_116] = -1;
break;
}
case 4: {
int const x_114 = i_3;
(*(tint_symbol_9)).arr[x_114] = 0;
break;
}
case 3: {
int const x_112 = i_3;
(*(tint_symbol_9)).arr[x_112] = 1;
break;
}
case 2: {
int const x_110 = i_3;
(*(tint_symbol_9)).arr[x_110] = 2;
break;
}
case 1: {
int const x_108 = i_3;
(*(tint_symbol_9)).arr[x_108] = 3;
break;
}
case 0: {
int const x_106 = i_3;
(*(tint_symbol_9)).arr[x_106] = 4;
break;
}
default: {
break;
}
}
int const x_126 = i_3;
i_3 = (x_126 + 1);
{
int const x_128 = i_3;
if ((x_128 < 10)) {
} else {
break;
}
}
}
j_1 = 0;
while (true) {
int const x_134 = j_1;
if ((x_134 < 10)) {
} else {
break;
}
int const x_137 = j_1;
int const x_138 = j_1;
int const x_140 = (*(tint_symbol_9)).arr[x_138];
(*(tint_symbol_10)).arr[x_137] = x_140;
{
int const x_142 = j_1;
j_1 = (x_142 + 1);
}
}
mergeSort_(tint_symbol_9, tint_symbol_10);
float const x_146 = (*(tint_symbol_11)).y;
if ((int(x_146) < 30)) {
int const x_153 = (*(tint_symbol_9)).arr[0];
grey = (0.5f + (float(x_153) / 10.0f));
} else {
float const x_158 = (*(tint_symbol_11)).y;
if ((int(x_158) < 60)) {
int const x_165 = (*(tint_symbol_9)).arr[1];
grey = (0.5f + (float(x_165) / 10.0f));
} else {
float const x_170 = (*(tint_symbol_11)).y;
if ((int(x_170) < 90)) {
int const x_177 = (*(tint_symbol_9)).arr[2];
grey = (0.5f + (float(x_177) / 10.0f));
} else {
float const x_182 = (*(tint_symbol_11)).y;
if ((int(x_182) < 120)) {
int const x_189 = (*(tint_symbol_9)).arr[3];
grey = (0.5f + (float(x_189) / 10.0f));
} else {
float const x_194 = (*(tint_symbol_11)).y;
if ((int(x_194) < 150)) {
discard_fragment();
} else {
float const x_201 = (*(tint_symbol_11)).y;
if ((int(x_201) < 180)) {
int const x_208 = (*(tint_symbol_9)).arr[5];
grey = (0.5f + (float(x_208) / 10.0f));
} else {
float const x_213 = (*(tint_symbol_11)).y;
if ((int(x_213) < 210)) {
int const x_220 = (*(tint_symbol_9)).arr[6];
grey = (0.5f + (float(x_220) / 10.0f));
} else {
float const x_225 = (*(tint_symbol_11)).y;
if ((int(x_225) < 240)) {
int const x_232 = (*(tint_symbol_9)).arr[7];
grey = (0.5f + (float(x_232) / 10.0f));
} else {
float const x_237 = (*(tint_symbol_11)).y;
if ((int(x_237) < 270)) {
int const x_244 = (*(tint_symbol_9)).arr[8];
grey = (0.5f + (float(x_244) / 10.0f));
} else {
discard_fragment();
}
}
}
}
}
}
}
}
}
float const x_248 = grey;
float3 const x_249 = float3(x_248, x_248, x_248);
*(tint_symbol_12) = float4(x_249.x, x_249.y, x_249.z, 1.0f);
return;
}
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) {
thread float4 tint_symbol_13 = 0.0f;
thread tint_array_wrapper tint_symbol_14 = {};
thread tint_array_wrapper tint_symbol_15 = {};
thread float4 tint_symbol_16 = 0.0f;
tint_symbol_13 = gl_FragCoord_param;
main_1(x_28, &(tint_symbol_14), &(tint_symbol_15), &(tint_symbol_13), &(tint_symbol_16));
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_16};
tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
return tint_symbol_4;
}