dawn-cmake/test/vk-gl-cts/graphicsfuzz/spv-stable-mergesort-dead-code/0.wgsl.expected.msl

315 lines
8.3 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_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_251 = *(from);
k = x_251;
int const x_252 = *(from);
i = x_252;
int const x_253 = *(mid);
j = (x_253 + 1);
while (true) {
int const x_259 = i;
int const x_260 = *(mid);
int const x_262 = j;
int const x_263 = *(to);
if (((x_259 <= x_260) && (x_262 <= x_263))) {
} else {
break;
}
int const x_267 = i;
int const x_269 = (*(tint_symbol_5)).arr[x_267];
int const x_270 = j;
int const x_272 = (*(tint_symbol_5)).arr[x_270];
if ((x_269 < x_272)) {
int const x_277 = k;
k = (x_277 + 1);
int const x_279 = i;
i = (x_279 + 1);
int const x_282 = (*(tint_symbol_5)).arr[x_279];
(*(tint_symbol_6)).arr[x_277] = x_282;
} else {
int const x_284 = k;
k = (x_284 + 1);
int const x_286 = j;
j = (x_286 + 1);
int const x_289 = (*(tint_symbol_5)).arr[x_286];
(*(tint_symbol_6)).arr[x_284] = x_289;
}
}
while (true) {
int const x_295 = i;
int const x_297 = i;
int const x_298 = *(mid);
if (((x_295 < 10) && (x_297 <= x_298))) {
} else {
break;
}
int const x_302 = k;
k = (x_302 + 1);
int const x_304 = i;
i = (x_304 + 1);
int const x_307 = (*(tint_symbol_5)).arr[x_304];
(*(tint_symbol_6)).arr[x_302] = x_307;
}
int const x_309 = *(from);
i_1 = x_309;
while (true) {
int const x_314 = i_1;
int const x_315 = *(to);
if ((x_314 <= x_315)) {
} else {
break;
}
int const x_318 = i_1;
int const x_319 = i_1;
int const x_321 = (*(tint_symbol_6)).arr[x_319];
(*(tint_symbol_5)).arr[x_318] = x_321;
{
int const x_323 = i_1;
i_1 = (x_323 + 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_330 = m;
int const x_331 = high;
if ((x_330 <= x_331)) {
} else {
break;
}
int const x_334 = low;
i_2 = x_334;
while (true) {
int const x_339 = i_2;
int const x_340 = high;
if ((x_339 < x_340)) {
} else {
break;
}
int const x_343 = i_2;
from_1 = x_343;
int const x_344 = i_2;
int const x_345 = m;
mid_1 = ((x_344 + x_345) - 1);
int const x_348 = i_2;
int const x_349 = m;
int const x_353 = high;
to_1 = min(((x_348 + (2 * x_349)) - 1), x_353);
int const x_355 = from_1;
param = x_355;
int const x_356 = mid_1;
param_1 = x_356;
int const x_357 = to_1;
param_2 = x_357;
merge_i1_i1_i1_(&(param), &(param_1), &(param_2), tint_symbol_7, tint_symbol_8);
{
int const x_359 = m;
int const x_361 = i_2;
i_2 = (x_361 + (2 * x_359));
}
}
{
int const x_363 = m;
m = (2 * x_363);
}
}
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_84 = x_28.injectionSwitch.x;
i_3 = int(x_84);
while (true) {
int const x_90 = i_3;
switch(x_90) {
case 9: {
int const x_120 = i_3;
(*(tint_symbol_9)).arr[x_120] = -5;
break;
}
case 8: {
int const x_118 = i_3;
(*(tint_symbol_9)).arr[x_118] = -4;
break;
}
case 7: {
int const x_116 = i_3;
(*(tint_symbol_9)).arr[x_116] = -3;
break;
}
case 6: {
int const x_114 = i_3;
(*(tint_symbol_9)).arr[x_114] = -2;
break;
}
case 5: {
int const x_112 = i_3;
(*(tint_symbol_9)).arr[x_112] = -1;
break;
}
case 4: {
int const x_110 = i_3;
(*(tint_symbol_9)).arr[x_110] = 0;
break;
}
case 3: {
int const x_108 = i_3;
(*(tint_symbol_9)).arr[x_108] = 1;
break;
}
case 2: {
int const x_106 = i_3;
(*(tint_symbol_9)).arr[x_106] = 2;
break;
}
case 1: {
int const x_104 = i_3;
(*(tint_symbol_9)).arr[x_104] = 3;
break;
}
case 0: {
int const x_102 = i_3;
(*(tint_symbol_9)).arr[x_102] = 4;
break;
}
default: {
break;
}
}
int const x_122 = i_3;
i_3 = (x_122 + 1);
{
int const x_124 = i_3;
if ((x_124 < 10)) {
} else {
break;
}
}
}
j_1 = 0;
while (true) {
int const x_130 = j_1;
if ((x_130 < 10)) {
} else {
break;
}
int const x_133 = j_1;
int const x_134 = j_1;
int const x_136 = (*(tint_symbol_9)).arr[x_134];
(*(tint_symbol_10)).arr[x_133] = x_136;
{
int const x_138 = j_1;
j_1 = (x_138 + 1);
}
}
mergeSort_(tint_symbol_9, tint_symbol_10);
float const x_142 = (*(tint_symbol_11)).y;
if ((int(x_142) < 30)) {
int const x_149 = (*(tint_symbol_9)).arr[0];
grey = (0.5f + (float(x_149) / 10.0f));
} else {
float const x_154 = (*(tint_symbol_11)).y;
if ((int(x_154) < 60)) {
int const x_161 = (*(tint_symbol_9)).arr[1];
grey = (0.5f + (float(x_161) / 10.0f));
} else {
float const x_166 = (*(tint_symbol_11)).y;
if ((int(x_166) < 90)) {
int const x_173 = (*(tint_symbol_9)).arr[2];
grey = (0.5f + (float(x_173) / 10.0f));
} else {
float const x_178 = (*(tint_symbol_11)).y;
if ((int(x_178) < 120)) {
int const x_185 = (*(tint_symbol_9)).arr[3];
grey = (0.5f + (float(x_185) / 10.0f));
} else {
float const x_190 = (*(tint_symbol_11)).y;
if ((int(x_190) < 150)) {
discard_fragment();
} else {
float const x_197 = (*(tint_symbol_11)).y;
if ((int(x_197) < 180)) {
int const x_204 = (*(tint_symbol_9)).arr[5];
grey = (0.5f + (float(x_204) / 10.0f));
} else {
float const x_209 = (*(tint_symbol_11)).y;
if ((int(x_209) < 210)) {
int const x_216 = (*(tint_symbol_9)).arr[6];
grey = (0.5f + (float(x_216) / 10.0f));
} else {
float const x_221 = (*(tint_symbol_11)).y;
if ((int(x_221) < 240)) {
int const x_228 = (*(tint_symbol_9)).arr[7];
grey = (0.5f + (float(x_228) / 10.0f));
} else {
float const x_233 = (*(tint_symbol_11)).y;
if ((int(x_233) < 270)) {
int const x_240 = (*(tint_symbol_9)).arr[8];
grey = (0.5f + (float(x_240) / 10.0f));
} else {
discard_fragment();
}
}
}
}
}
}
}
}
}
float const x_244 = grey;
float3 const x_245 = float3(x_244, x_244, x_244);
*(tint_symbol_12) = float4(x_245.x, x_245.y, x_245.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;
}