I see stack pointers (and frame pointers) declared as intptr_t* which makes no sense to me. These are all "just" pointers, so declare them as either void* or intptr_t or address
In the construct below, we could elide the cast if we had declared esp right in the first place?! intptr_t* esp; __asm__ __volatile__ ("mov %%"SPELL_REG_SP", %0":"=r"(esp):); return (address) esp;