#include <assert.h>
#include <errno.h>
#include <stdint.h>
#include <sys/mman.h>
int main(void) {
#if defined(__FreeBSD__) && defined(__x86_64__)
uintptr_t hint = 0x0f0000000000ULL;
const uintptr_t app_start = 0x000000000000ULL;
#elif defined(__x86_64__)
uintptr_t hint = 0x4f0000000000ULL;
const uintptr_t app_start = 0x600000000000ULL;
#elif defined(__loongarch_lp64)
uintptr_t hint = 0x4f0000000000ULL;
const uintptr_t app_start = 0x600000000000ULL;
#elif defined (__mips64)
uintptr_t hint = 0x4f00000000ULL;
const uintptr_t app_start = 0x6000000000ULL;
#elif defined (__powerpc64__)
uintptr_t hint = 0x2f0000000000ULL;
const uintptr_t app_start = 0x300000000000ULL;
#elif defined(__s390x__)
uintptr_t hint = 0x07f000000000ULL;
const uintptr_t app_start = 0x020000000000ULL;
#elif defined (__aarch64__)
uintptr_t hint = 0X0110000000000;
const uintptr_t app_start = 0x0ULL;
#endif
uintptr_t p = (uintptr_t)mmap(
(void *)hint, 4096, PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | (FIXED ? MAP_FIXED : 0), -1, 0);
if (FIXED)
assert(p == (uintptr_t)-1 && errno == EINVAL);
else
assert(p >= app_start);
return 0;
}