#include <iostream>
#include <cstdint>
void f()
{
std::cout << "foo\n";
}
int main()
{
void(*fptr)(void) = f;
void(**fptrptr)() = &fptr;
std::uintptr_t addr = reinterpret_cast<std::uintptr_t>(fptrptr);
addr -= 4;
(
(void(*)(void)) // cast to function pointer the following value
(
*( // obtain the value pointed to by the following
(std::uintptr_t*)( // cast to intptr_t pointer
addr+4 // add 4 to the integer
)
)
)
)(); // invoke the function pointer
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGludD4Kdm9pZCBmKCkKewogICAgc3RkOjpjb3V0IDw8ICJmb29cbiI7Cn0KaW50IG1haW4oKQp7CiAgIHZvaWQoKmZwdHIpKHZvaWQpID0gZjsKICAgdm9pZCgqKmZwdHJwdHIpKCkgPSAmZnB0cjsKICAgc3RkOjp1aW50cHRyX3QgYWRkciA9IHJlaW50ZXJwcmV0X2Nhc3Q8c3RkOjp1aW50cHRyX3Q+KGZwdHJwdHIpOwogICBhZGRyIC09IDQ7CgogICAoCiAgICAgICh2b2lkKCopKHZvaWQpKSAvLyBjYXN0IHRvIGZ1bmN0aW9uIHBvaW50ZXIgdGhlIGZvbGxvd2luZyB2YWx1ZQogICAgICAoCiAgICAgICAgKiggLy8gb2J0YWluIHRoZSB2YWx1ZSBwb2ludGVkIHRvIGJ5IHRoZSBmb2xsb3dpbmcKICAgICAgICAgIChzdGQ6OnVpbnRwdHJfdCopKCAvLyBjYXN0IHRvIGludHB0cl90IHBvaW50ZXIKICAgICAgICAgICAgYWRkcis0IC8vIGFkZCA0IHRvIHRoZSBpbnRlZ2VyCiAgICAgICAgICAgKQogICAgICAgICApCiAgICAgICkKICAgKSgpOyAvLyBpbnZva2UgdGhlIGZ1bmN0aW9uIHBvaW50ZXIKfQo=