Include stdlib.h for atoi().
[libfirm] / ir / be / test / am_test2.c
index 2e628a7..fb1534f 100644 (file)
@@ -1,16 +1,18 @@
 #include <stdio.h>
+#include <stdlib.h>
 
 int arr[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
 
 int sum(int from, int to) {
-       int i, res = 0;
+       int i, res = 0, res2 = 666;
        int len = to - from;
 
        for(i = 0; i < len; ++i) {
-               res += arr[from + i];
+               res  += arr[from + i];
+               res2 -= arr[i];
        }
 
-       return res;
+       return res ^ res2;
 }
 
 int main(int argc, char **argv) {
@@ -19,6 +21,6 @@ int main(int argc, char **argv) {
        if(argc > 1)
                to = atoi(argv[1]);
 
-       printf("Sum: %d\n", sum(from, to));
+       printf("Res: %d\n", sum(from, to));
        return 0;
 }