// File: /workspace/github_c_makefile_star2_O0/MuvikLabs[P]runt/basic.c
// Function: rproc_load
static int rproc_load(runt_vm *vm, runt_ptr p)
{
    runt_stacklet *s;
    const char *str;
    const char *fname;
    char buf[1024];
    int pstate = RUNT_OFF;

    memset(buf, 0, 1024);
    s = runt_pop(vm);
    str = runt_to_string(s->p);
    pstate = runt_get_state(vm, RUNT_MODE_INTERACTIVE);


    /* Try and load runt file */

    sprintf(buf, "%s.rnt", str);

    /* remove load cell from cell pool */
    runt_cell_undo(vm);

    if(access(buf, F_OK) != -1) {
        fname = buf;
        return loader(vm, pstate, fname, s, load_dictionary);
    }

    /* maybe it is a plugin? */

    if(getenv("RUNT_PLUGIN_PATH") != NULL) {
        sprintf(buf, "%s/%s.so", getenv("RUNT_PLUGIN_PATH"), str);
    } else {
        sprintf(buf, "%s/.runt/plugins/%s.so", getenv("HOME"), str);
    }

    if(access(buf, F_OK) != -1) {
        fname = buf;
        return loader(vm, pstate, fname, s, runt_load_plugin);
    }

    /* try local plugin */

    sprintf(buf, "%s.so", str);

    if(access(buf, F_OK) != -1) {
        return loader(vm, pstate, buf, s, runt_load_plugin);
    }

    runt_print(vm, "Could not find '%s'\n", str);
    return RUNT_NOT_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x460, %rsp            # imm = 0x460
movq %rdi, -0x10(%rbp)
movl $0x4, -0x434(%rbp)
leaq -0x430(%rbp), %rdi
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x1090
movq -0x10(%rbp), %rdi
callq 0x22b0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x2630
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x1f00
movl %eax, -0x434(%rbp)
leaq -0x430(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x2e61(%rip), %rsi      # 0x95ea
movb $0x0, %al
callq 0x1170
movq -0x10(%rbp), %rdi
callq 0x45b0
leaq -0x430(%rbp), %rdi
xorl %esi, %esi
callq 0x1130
cmpl $-0x1, %eax
je 0x67dd
leaq -0x430(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movl -0x434(%rbp), %esi
movq -0x28(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq 0x19c0(%rip), %r8       # 0x8190
callq 0x8100
movl %eax, -0x4(%rbp)
jmp 0x690d
leaq 0x2e0d(%rip), %rdi      # 0x95f1
callq 0x1030
cmpq $0x0, %rax
je 0x6827
leaq -0x430(%rbp), %rax
movq %rax, -0x440(%rbp)
leaq 0x2ded(%rip), %rdi      # 0x95f1
callq 0x1030
movq -0x440(%rbp), %rdi
movq %rax, %rdx
movq -0x20(%rbp), %rcx
leaq 0x2de4(%rip), %rsi      # 0x9602
movb $0x0, %al
callq 0x1170
jmp 0x685d
leaq -0x430(%rbp), %rax
movq %rax, -0x448(%rbp)
leaq 0x2de6(%rip), %rdi      # 0x9622
callq 0x1030
movq -0x448(%rbp), %rdi
movq %rax, %rdx
movq -0x20(%rbp), %rcx
leaq 0x2db5(%rip), %rsi      # 0x960b
movb $0x0, %al
callq 0x1170
leaq -0x430(%rbp), %rdi
xorl %esi, %esi
callq 0x1130
cmpl $-0x1, %eax
je 0x689e
leaq -0x430(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movl -0x434(%rbp), %esi
movq -0x28(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq -0x2224(%rip), %r8      # 0x4670
callq 0x8100
movl %eax, -0x4(%rbp)
jmp 0x690d
leaq -0x430(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x2d55(%rip), %rsi      # 0x9605
movb $0x0, %al
callq 0x1170
leaq -0x430(%rbp), %rdi
xorl %esi, %esi
callq 0x1130
cmpl $-0x1, %eax
je 0x68f0
movq -0x10(%rbp), %rdi
movl -0x434(%rbp), %esi
leaq -0x430(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq -0x2276(%rip), %r8      # 0x4670
callq 0x8100
movl %eax, -0x4(%rbp)
jmp 0x690d
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq 0x2d28(%rip), %rsi      # 0x9627
movb $0x0, %al
callq 0x1f40
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x460, %rsp            # imm = 0x460
popq %rbp
retq
nopl (%rax)