#pragma once

// 3 because 3 arguments to the call, get it??
static inline long syscall3(long n, long a, long b, long c) {
    long ret;

    __asm__ volatile (
        "int $0x80"
        : "=a"(ret)
        : "a"(n), "D"(a), "S"(b), "d"(c)
        : "memory"
    );

    return ret;
}

static inline void write(int fd, const char* buf, long len) {
    syscall3(1, fd, (long)buf, len);
}

static inline void exit(int code) {
    __asm__ volatile (
        "int $0x80"
        :
        : "a"(60), "D"(code)
        : "memory"
    );

    for (;;);
}