#include <inttypes.h>
#include <unistd.h>
#include <stdio.h>
#define __USE_GNU
#include <signal.h>

extern char label[];

static void sigfpe_handler(int signum, siginfo_t *siginfo, void *context) {
    ucontext_t *ucontext = (ucontext_t *)context;
    ucontext->uc_mcontext.gregs[REG_RIP] = (greg_t)label;
}

const int zero = 0;

int main() {
    struct sigaction act = {
        .sa_sigaction = sigfpe_handler,
        .sa_flags = SA_SIGINFO
    };
    sigaction(SIGFPE, &act, NULL);

    int what = 10 / zero;

    asm volatile("label:");
    printf("Hello from the dead!\n");
}
