// File: /workspace/github_c_makefile_star2_O3/mahrr[P]raven/src/vm.c
// Function: register_natives
static void register_natives(VM* vm) {
    vm->allocator.gc_off = true;

#define Register(name, arity_min, arity_max)                                                        \
    do {                                                                                            \
        RavCFunction *func = object_cfunction(&vm->allocator, native_##name, arity_min, arity_max); \
        RavString *name_string = object_string(&vm->allocator, #name, strlen(#name));               \
        table_set(&vm->globals, name_string, Obj_Value(func));                                      \
    } while (false)

    Register(import,  1, 1);
    Register(assert,  1, 2);
    Register(print,   0, PARAMS_LIMIT); // variadic
    Register(println, 0, PARAMS_LIMIT); // variadic
    Register(len,     1, 1);
    Register(push,    2, PARAMS_LIMIT); // variadic
    Register(pop,     1, 1);
    Register(insert,  3, 3);
    Register(remove,  2, 2);

#undef Register
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb $0x1, 0x40(%rdi)
leaq 0x19a9(%rip), %rsi      # 0x429d
movl $0x1, %edx
movl $0x1, %ecx
callq 0x5379
movq %rax, %r15
leaq 0x87ab(%rip), %rsi      # 0xb0b8
movq %rbx, %rdi
movl $0x6, %edx
callq 0x4fd0
leaq 0x40c70(%rbx), %r14
movabsq $-0x4000000000000, %r12 # imm = 0xFFFC000000000000
orq %r12, %r15
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x4c93
leaq 0x1c2e(%rip), %rsi      # 0x4571
movq %rbx, %rdi
movl $0x1, %edx
movl $0x2, %ecx
callq 0x5379
movq %rax, %r15
leaq 0x8760(%rip), %rsi      # 0xb0bf
movq %rbx, %rdi
movl $0x6, %edx
callq 0x4fd0
orq %r12, %r15
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x4c93
leaq 0x1cae(%rip), %rsi      # 0x4632
movq %rbx, %rdi
xorl %edx, %edx
movl $0x100, %ecx            # imm = 0x100
callq 0x5379
movq %rax, %r15
leaq 0x8729(%rip), %rsi      # 0xb0c6
movq %rbx, %rdi
movl $0x5, %edx
callq 0x4fd0
orq %r12, %r15
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x4c93
leaq 0x1cbf(%rip), %rsi      # 0x4681
movq %rbx, %rdi
xorl %edx, %edx
movl $0x100, %ecx            # imm = 0x100
callq 0x5379
movq %rax, %r15
leaq 0x86f1(%rip), %rsi      # 0xb0cc
movq %rbx, %rdi
movl $0x7, %edx
callq 0x4fd0
orq %r12, %r15
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x4c93
leaq 0x1cda(%rip), %rsi      # 0x46da
movq %rbx, %rdi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x5379
movq %rax, %r15
leaq 0x86b8(%rip), %rsi      # 0xb0d4
movq %rbx, %rdi
movl $0x3, %edx
callq 0x4fd0
orq %r12, %r15
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x4c93
leaq 0x1d2c(%rip), %rsi      # 0x476d
movq %rbx, %rdi
movl $0x2, %edx
movl $0x100, %ecx            # imm = 0x100
callq 0x5379
movq %rax, %r15
leaq 0x867b(%rip), %rsi      # 0xb0d8
movq %rbx, %rdi
movl $0x4, %edx
callq 0x4fd0
orq %r12, %r15
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x4c93
leaq 0x1dda(%rip), %rsi      # 0x485c
movq %rbx, %rdi
movl $0x1, %edx
movl $0x1, %ecx
callq 0x5379
movq %rax, %r15
leaq 0x863f(%rip), %rsi      # 0xb0dd
movq %rbx, %rdi
movl $0x3, %edx
callq 0x4fd0
orq %r12, %r15
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x4c93
leaq 0x1e1d(%rip), %rsi      # 0x48e0
movq %rbx, %rdi
movl $0x3, %edx
movl $0x3, %ecx
callq 0x5379
movq %rax, %r15
leaq 0x8602(%rip), %rsi      # 0xb0e1
movq %rbx, %rdi
movl $0x6, %edx
callq 0x4fd0
orq %r12, %r15
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x4c93
leaq 0x1e78(%rip), %rsi      # 0x497c
movq %rbx, %rdi
movl $0x2, %edx
movl $0x2, %ecx
callq 0x5379
movq %rax, %r15
leaq 0x85c8(%rip), %rsi      # 0xb0e8
movq %rbx, %rdi
movl $0x6, %edx
callq 0x4fd0
orq %r12, %r15
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4c93