1/*#pragma settings NoInline*/
2
3uniform half4 colorRed, colorGreen;
4
5struct S { float x; int y; };
6
7struct Nested { S a, b; };
8
9S returns_a_struct() {
10    S s;
11    s.x = 1;
12    s.y = 2;
13    return s;
14}
15
16S constructs_a_struct() {
17    return S(2, 3);
18}
19
20float accepts_a_struct(S s) {
21    return s.x + float(s.y);
22}
23
24void modifies_a_struct(inout S s) {
25    s.x++;
26    s.y++;
27}
28
29half4 main(float2 coords) {
30    S s = returns_a_struct();
31    float x = accepts_a_struct(s);
32    modifies_a_struct(s);
33
34    S expected = constructs_a_struct();
35
36    Nested n1, n2, n3;
37    n1.a = returns_a_struct();
38    n1.b = n1.a;
39    n2 = n1;
40    n3 = n2;
41    modifies_a_struct(n3.b);
42
43    bool valid = (x == 3) && (s.x == 2) && (s.y == 3) &&
44                 (s == expected) && (s == S(2, 3)) && (s != returns_a_struct()) &&
45                 (n1 == n2) && (n1 != n3) && (n3 == Nested(S(1, 2), S(2, 3)));
46    return valid ? colorGreen : colorRed;
47}
48