Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define PREVIOUS_FRAME(x) (*(int *)(x + ((int *)__builtin_frame_address(1) - (int *)__builtin_frame_address(0))))
- void f(int x)
- {
- if (x > 0)
- {
- x = -x;
- printf("1\n");
- f(-2);
- }
- else
- {
- if (PREVIOUS_FRAME(&x) <= x)
- {
- printf("%i\n", -x);
- if (PREVIOUS_FRAME(&x) != x)
- f(PREVIOUS_FRAME(&x));
- }
- else
- {
- printf("%i\n", -(PREVIOUS_FRAME(&x) - 1));
- if (x != PREVIOUS_FRAME(&x) - 1)
- f(PREVIOUS_FRAME(&x) - 2);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement