aboutsummaryrefslogtreecommitdiff
path: root/tests/performance/21_memory_copy.sy
blob: 6f1583aeb96557def9be351aa70e1377c7922fac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
void my_memcpy(int dst[], int src[], int n) {
    int i = 0;
    while (i < n) {
        dst[i] = src[i];
        i = i + 1;
    }
}

const int N = 1000000;
int temp1[N];
int temp2[N];

int main() {
    int i = 0;
    while (i < N) {
        temp1[i] = i;
        i = i + 1;
    }
    my_memcpy(temp2, temp1, N);

    i = 0;
    int j = 0;
    while (i < N) {
        if (temp2[i] > j) {
            j = temp2[i];
        }
        i = i + 1;
    }
    putint(j);
    return 0;
}