SHOW:
|
|
- or go back to the newest paste.
1 | - | //*(&x + 8) = the value of x from the previous iteration |
1 | + | #define PREVIOUS_FRAME(x) (*(int *)(x + ((int *)__builtin_frame_address(1) - (int *)__builtin_frame_address(0)))) |
2 | void f(int x) | |
3 | { | |
4 | if (x > 0) | |
5 | { | |
6 | x = -x; | |
7 | printf("1\n"); | |
8 | f(-2); | |
9 | } | |
10 | else | |
11 | { | |
12 | - | if (*(&x + 8) <= x) |
12 | + | if (PREVIOUS_FRAME(&x) <= x) |
13 | { | |
14 | printf("%i\n", -x); | |
15 | - | if (*(&x + 8) != x) |
15 | + | if (PREVIOUS_FRAME(&x) != x) |
16 | - | f(*(&x + 8)); |
16 | + | f(PREVIOUS_FRAME(&x)); |
17 | } | |
18 | else | |
19 | { | |
20 | - | printf("%i\n", -(*(&x + 8) - 1)); |
20 | + | printf("%i\n", -(PREVIOUS_FRAME(&x) - 1)); |
21 | - | if (x != *(&x + 8) - 1) |
21 | + | if (x != PREVIOUS_FRAME(&x) - 1) |
22 | - | f(*(&x + 8) - 2); |
22 | + | f(PREVIOUS_FRAME(&x) - 2); |
23 | } | |
24 | } | |
25 | } |