aboutsummaryrefslogtreecommitdiff
path: root/tests/sysy_lvX/loop_unroll.sy
blob: a814a8339e72ecf1fbc7f227158fe55f7fcb82e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
void test(int n) {
    int i, j;
    
    i = 0;
    j = 0;
    while (i < n) {
        j = j + i;
        i = i + 1;
    }
    putint(j);
    putch(10);
}

int main() {
    test(-1);
    test(0);
    test(1);
    test(2);
    test(100);
    test(101);
    return 0;
}