Skip to content

Instantly share code, notes, and snippets.

@ranha
Created March 26, 2012 13:29
Show Gist options
  • Save ranha/2205050 to your computer and use it in GitHub Desktop.
Save ranha/2205050 to your computer and use it in GitHub Desktop.
azu
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int f();
int main();
void g();
int f(void)
{
if(
((void*)main <= __builtin_return_address(0)) &&
(__builtin_return_address(0) <= (void*)g))
puts("first call f");
if(
((uint64_t)main <= *(((uint64_t*)__builtin_frame_address(0)) + (49 * 4) + 1)) &&
(*(((uint64_t*)__builtin_frame_address(0)) + (49 * 4) + 1) <= (uint64_t)g)
)
{
return 101;
}
return 101 + f();
}
int main()
{
printf("%d\n",f());
return 0;
}
void g()
{
puts("dummy");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment