dawn-cmake/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-flatte.../2-opt.wgsl.expected.msl

428 lines
12 KiB
Plaintext

#include <metal_stdlib>
using namespace metal;
struct buf0 {
/* 0x0000 */ packed_float2 injectionSwitch;
};
struct tint_array_wrapper {
int arr[10];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void merge_i1_i1_i1_(constant buf0& x_28, thread int* const from, thread int* const mid, thread int* const to, thread tint_array_wrapper* const tint_symbol_3, thread tint_array_wrapper* const tint_symbol_4) {
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 = as_type<int>((as_type<uint>(x_257) + as_type<uint>(1)));
while (true) {
int x_283 = 0;
int x_284 = 0;
int x_303 = 0;
int x_304 = 0;
int x_318 = 0;
int x_322 = 0;
int x_337 = 0;
int x_336 = 0;
int x_350 = 0;
int x_349 = 0;
int x_364 = 0;
int x_363 = 0;
int x_285_phi = 0;
int x_305_phi = 0;
int x_326_phi = 0;
int x_338_phi = 0;
int x_351_phi = 0;
int x_365_phi = 0;
if ((1.0f >= 0.0f)) {
} else {
continue;
}
int const x_264 = i;
int const x_265 = *(mid);
int const x_267 = j;
int const x_268 = *(to);
if (((x_264 <= x_265) && (x_267 <= x_268))) {
} else {
break;
}
int const x_272 = i;
int const x_274 = (*(tint_symbol_3)).arr[x_272];
int const x_275 = j;
int const x_277 = (*(tint_symbol_3)).arr[x_275];
bool const x_278 = (x_274 < x_277);
if (x_278) {
x_283 = k;
x_285_phi = x_283;
} else {
x_284 = 0;
x_285_phi = x_284;
}
int const x_285 = x_285_phi;
int const x_286 = as_type<int>((as_type<uint>(x_285) + as_type<uint>(1)));
if (x_278) {
k = x_286;
float const x_291 = x_28.injectionSwitch.x;
if (!((1.0f <= x_291))) {
} else {
continue;
}
}
float const x_295 = x_28.injectionSwitch.y;
if ((x_295 >= 0.0f)) {
} else {
continue;
}
int const x_298 = 0;
if (x_278) {
x_303 = i;
x_305_phi = x_303;
} else {
x_304 = 0;
x_305_phi = x_304;
}
int const x_305 = x_305_phi;
int const x_307 = select(x_298, x_305, x_278);
if (x_278) {
i = as_type<int>((as_type<uint>(x_307) + as_type<uint>(1)));
}
int const x_313 = 0;
if (x_278) {
x_318 = (*(tint_symbol_3)).arr[x_307];
float const x_320 = x_28.injectionSwitch.y;
x_326_phi = x_318;
if (!((0.0f <= x_320))) {
continue;
}
} else {
x_322 = 0;
float const x_324 = x_28.injectionSwitch.y;
x_326_phi = x_322;
if (!((x_324 < 0.0f))) {
} else {
continue;
}
}
int const x_326 = x_326_phi;
if (x_278) {
(*(tint_symbol_4)).arr[x_285] = select(x_313, x_326, x_278);
}
if (x_278) {
x_337 = 0;
x_338_phi = x_337;
} else {
x_336 = k;
x_338_phi = x_336;
}
int const x_338 = x_338_phi;
if (x_278) {
} else {
k = as_type<int>((as_type<uint>(x_338) + as_type<uint>(1)));
}
float const x_343 = x_28.injectionSwitch.x;
if (!((1.0f <= x_343))) {
} else {
continue;
}
if (x_278) {
x_350 = 0;
x_351_phi = x_350;
} else {
x_349 = j;
x_351_phi = x_349;
}
int const x_351 = x_351_phi;
int const x_353 = 0;
int const x_355 = select(x_351, x_353, x_278);
if (x_278) {
} else {
j = as_type<int>((as_type<uint>(x_355) + as_type<uint>(1)));
}
if (x_278) {
x_364 = 0;
x_365_phi = x_364;
} else {
x_363 = (*(tint_symbol_3)).arr[x_355];
x_365_phi = x_363;
}
int const x_365 = x_365_phi;
if (x_278) {
} else {
(*(tint_symbol_4)).arr[x_338] = x_365;
}
}
while (true) {
int const x_374 = i;
int const x_376 = i;
int const x_377 = *(mid);
if (((x_374 < 10) && (x_376 <= x_377))) {
} else {
break;
}
int const x_381 = k;
k = as_type<int>((as_type<uint>(x_381) + as_type<uint>(1)));
int const x_383 = i;
i = as_type<int>((as_type<uint>(x_383) + as_type<uint>(1)));
int const x_386 = (*(tint_symbol_3)).arr[x_383];
(*(tint_symbol_4)).arr[x_381] = x_386;
}
int const x_388 = *(from);
i_1 = x_388;
while (true) {
int const x_393 = i_1;
int const x_394 = *(to);
if ((x_393 <= x_394)) {
} else {
break;
}
int const x_397 = i_1;
int const x_398 = i_1;
int const x_400 = (*(tint_symbol_4)).arr[x_398];
(*(tint_symbol_3)).arr[x_397] = x_400;
{
int const x_402 = i_1;
i_1 = as_type<int>((as_type<uint>(x_402) + as_type<uint>(1)));
}
}
return;
}
void mergeSort_(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_5, thread tint_array_wrapper* const tint_symbol_6) {
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_409 = m;
int const x_410 = high;
if ((x_409 <= x_410)) {
} else {
break;
}
int const x_413 = low;
i_2 = x_413;
while (true) {
int const x_418 = i_2;
int const x_419 = high;
if ((x_418 < x_419)) {
} else {
break;
}
int const x_422 = i_2;
from_1 = x_422;
int const x_423 = i_2;
int const x_424 = m;
mid_1 = as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_423) + as_type<uint>(x_424)))) - as_type<uint>(1)));
int const x_427 = i_2;
int const x_428 = m;
int const x_432 = high;
to_1 = min(as_type<int>((as_type<uint>(as_type<int>((as_type<uint>(x_427) + as_type<uint>(as_type<int>((as_type<uint>(2) * as_type<uint>(x_428))))))) - as_type<uint>(1))), x_432);
int const x_434 = from_1;
param = x_434;
int const x_435 = mid_1;
param_1 = x_435;
int const x_436 = to_1;
param_2 = x_436;
merge_i1_i1_i1_(x_28, &(param), &(param_1), &(param_2), tint_symbol_5, tint_symbol_6);
{
int const x_438 = m;
int const x_440 = i_2;
i_2 = as_type<int>((as_type<uint>(x_440) + as_type<uint>(as_type<int>((as_type<uint>(2) * as_type<uint>(x_438))))));
}
}
{
int const x_442 = m;
m = as_type<int>((as_type<uint>(2) * as_type<uint>(x_442)));
}
}
return;
}
void main_1(constant buf0& x_28, thread tint_array_wrapper* const tint_symbol_7, thread tint_array_wrapper* const tint_symbol_8, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) {
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_7)).arr[x_124] = -5;
break;
}
case 8: {
int const x_122 = i_3;
(*(tint_symbol_7)).arr[x_122] = -4;
break;
}
case 7: {
int const x_120 = i_3;
(*(tint_symbol_7)).arr[x_120] = -3;
break;
}
case 6: {
int const x_118 = i_3;
(*(tint_symbol_7)).arr[x_118] = -2;
break;
}
case 5: {
int const x_116 = i_3;
(*(tint_symbol_7)).arr[x_116] = -1;
break;
}
case 4: {
int const x_114 = i_3;
(*(tint_symbol_7)).arr[x_114] = 0;
break;
}
case 3: {
int const x_112 = i_3;
(*(tint_symbol_7)).arr[x_112] = 1;
break;
}
case 2: {
int const x_110 = i_3;
(*(tint_symbol_7)).arr[x_110] = 2;
break;
}
case 1: {
int const x_108 = i_3;
(*(tint_symbol_7)).arr[x_108] = 3;
break;
}
case 0: {
int const x_106 = i_3;
(*(tint_symbol_7)).arr[x_106] = 4;
break;
}
default: {
break;
}
}
int const x_126 = i_3;
i_3 = as_type<int>((as_type<uint>(x_126) + as_type<uint>(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_7)).arr[x_138];
(*(tint_symbol_8)).arr[x_137] = x_140;
{
int const x_142 = j_1;
j_1 = as_type<int>((as_type<uint>(x_142) + as_type<uint>(1)));
}
}
mergeSort_(x_28, tint_symbol_7, tint_symbol_8);
float const x_146 = (*(tint_symbol_9)).y;
if ((int(x_146) < 30)) {
int const x_153 = (*(tint_symbol_7)).arr[0];
grey = (0.5f + (float(x_153) / 10.0f));
} else {
float const x_158 = (*(tint_symbol_9)).y;
if ((int(x_158) < 60)) {
int const x_165 = (*(tint_symbol_7)).arr[1];
grey = (0.5f + (float(x_165) / 10.0f));
} else {
float const x_170 = (*(tint_symbol_9)).y;
if ((int(x_170) < 90)) {
int const x_177 = (*(tint_symbol_7)).arr[2];
grey = (0.5f + (float(x_177) / 10.0f));
} else {
float const x_182 = (*(tint_symbol_9)).y;
if ((int(x_182) < 120)) {
int const x_189 = (*(tint_symbol_7)).arr[3];
grey = (0.5f + (float(x_189) / 10.0f));
} else {
float const x_194 = (*(tint_symbol_9)).y;
if ((int(x_194) < 150)) {
discard_fragment();
} else {
float const x_201 = (*(tint_symbol_9)).y;
if ((int(x_201) < 180)) {
int const x_208 = (*(tint_symbol_7)).arr[5];
grey = (0.5f + (float(x_208) / 10.0f));
} else {
float const x_213 = (*(tint_symbol_9)).y;
if ((int(x_213) < 210)) {
int const x_220 = (*(tint_symbol_7)).arr[6];
grey = (0.5f + (float(x_220) / 10.0f));
} else {
float const x_225 = (*(tint_symbol_9)).y;
if ((int(x_225) < 240)) {
int const x_232 = (*(tint_symbol_7)).arr[7];
grey = (0.5f + (float(x_232) / 10.0f));
} else {
float const x_237 = (*(tint_symbol_9)).y;
if ((int(x_237) < 270)) {
int const x_244 = (*(tint_symbol_7)).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_10) = float4(x_249.x, x_249.y, x_249.z, 1.0f);
return;
}
main_out tint_symbol_inner(constant buf0& x_28, float4 gl_FragCoord_param, thread float4* const tint_symbol_11, thread tint_array_wrapper* const tint_symbol_12, thread tint_array_wrapper* const tint_symbol_13, thread float4* const tint_symbol_14) {
*(tint_symbol_11) = gl_FragCoord_param;
main_1(x_28, tint_symbol_12, tint_symbol_13, tint_symbol_11, tint_symbol_14);
main_out const tint_symbol_2 = {.x_GLF_color_1=*(tint_symbol_14)};
return tint_symbol_2;
}
fragment tint_symbol_1 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_28 [[buffer(0)]]) {
thread float4 tint_symbol_15 = 0.0f;
thread tint_array_wrapper tint_symbol_16 = {};
thread tint_array_wrapper tint_symbol_17 = {};
thread float4 tint_symbol_18 = 0.0f;
main_out const inner_result = tint_symbol_inner(x_28, gl_FragCoord_param, &(tint_symbol_15), &(tint_symbol_16), &(tint_symbol_17), &(tint_symbol_18));
tint_symbol_1 wrapper_result = {};
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}