1SKIP: FAILED
2
3struct QuicksortObject {
4  int numbers[10];
5};
6
7static QuicksortObject obj = (QuicksortObject)0;
8static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
9cbuffer cbuffer_x_30 : register(b0, space0) {
10  uint4 x_30[1];
11};
12
13void swap_i1_i1_(inout int i, inout int j) {
14  int temp = 0;
15  const int x_92 = i;
16  const int x_94 = obj.numbers[x_92];
17  temp = x_94;
18  const int x_95 = i;
19  const int x_96 = j;
20  const int x_98 = obj.numbers[x_96];
21  obj.numbers[x_95] = x_98;
22  const int x_100 = j;
23  obj.numbers[x_100] = temp;
24  return;
25}
26
27int performPartition_i1_i1_(inout int l, inout int h) {
28  int pivot = 0;
29  int i_1 = 0;
30  int j_1 = 0;
31  int param = 0;
32  int param_1 = 0;
33  int param_2 = 0;
34  int param_3 = 0;
35  const int x_104 = h;
36  const int x_106 = obj.numbers[x_104];
37  pivot = x_106;
38  const int x_107 = l;
39  i_1 = (x_107 - 1);
40  const int x_109 = l;
41  j_1 = x_109;
42  [loop] while (true) {
43    const int x_114 = j_1;
44    const int x_115 = h;
45    if ((x_114 <= (x_115 - 1))) {
46    } else {
47      break;
48    }
49    const int x_121 = obj.numbers[j_1];
50    if ((x_121 <= pivot)) {
51      i_1 = (i_1 + 1);
52      param = i_1;
53      param_1 = j_1;
54      swap_i1_i1_(param, param_1);
55    }
56    {
57      j_1 = (j_1 + 1);
58    }
59  }
60  param_2 = (i_1 + 1);
61  const int x_135 = h;
62  param_3 = x_135;
63  swap_i1_i1_(param_2, param_3);
64  return (i_1 + 1);
65}
66
67void quicksort_() {
68  int l_1 = 0;
69  int h_1 = 0;
70  int top = 0;
71  int stack[10] = (int[10])0;
72  int p = 0;
73  int param_4 = 0;
74  int param_5 = 0;
75  l_1 = 0;
76  h_1 = 9;
77  top = -1;
78  const int x_141 = (top + 1);
79  top = x_141;
80  stack[x_141] = l_1;
81  const int x_145 = (top + 1);
82  top = x_145;
83  stack[x_145] = h_1;
84  [loop] while (true) {
85    if ((top >= 0)) {
86    } else {
87      break;
88    }
89    const int x_155 = top;
90    top = (x_155 - 1);
91    const int x_158 = stack[x_155];
92    h_1 = x_158;
93    const int x_159 = top;
94    top = (x_159 - 1);
95    const int x_162 = stack[x_159];
96    l_1 = x_162;
97    param_4 = l_1;
98    param_5 = h_1;
99    const int x_165 = performPartition_i1_i1_(param_4, param_5);
100    p = x_165;
101    if (((p - 1) > l_1)) {
102      const int x_173 = (top + 1);
103      top = x_173;
104      stack[x_173] = l_1;
105      const int x_177 = (top + 1);
106      top = x_177;
107      stack[x_177] = (p - 1);
108    }
109    if (((p + 1) < h_1)) {
110      const int x_188 = (top + 1);
111      top = x_188;
112      stack[x_188] = (p + 1);
113      const int x_193 = (top + 1);
114      top = x_193;
115      stack[x_193] = h_1;
116    }
117  }
118  return;
119}
120
121void main_1() {
122  int i_2 = 0;
123  i_2 = 0;
124  {
125    [loop] for(; (i_2 < 10); i_2 = (i_2 + 1)) {
126      obj.numbers[i_2] = (10 - i_2);
127      const int x_71 = i_2;
128      const int x_74 = obj.numbers[i_2];
129      const int x_77 = obj.numbers[i_2];
130      obj.numbers[x_71] = (x_74 * x_77);
131    }
132  }
133  quicksort_();
134  const int x_84 = obj.numbers[0];
135  const int x_86 = obj.numbers[4];
136  if ((x_84 < x_86)) {
137    x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
138  } else {
139    x_GLF_color = float4(0.0f, 1.0f, 0.0f, 1.0f);
140  }
141  return;
142}
143
144struct main_out {
145  float4 x_GLF_color_1;
146};
147struct tint_symbol {
148  float4 x_GLF_color_1 : SV_Target0;
149};
150
151main_out main_inner() {
152  main_1();
153  const main_out tint_symbol_1 = {x_GLF_color};
154  return tint_symbol_1;
155}
156
157tint_symbol main() {
158  const main_out inner_result = main_inner();
159  tint_symbol wrapper_result = (tint_symbol)0;
160  wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
161  return wrapper_result;
162}
163C:\src\tint\test\Shader@0x000001BEDA24CD50(124,7-22): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
164C:\src\tint\test\Shader@0x000001BEDA24CD50(123,12-45): error X3531: can't unroll loops marked with loop attribute
165
166