// File: /workspace/github_c_makefile_star2_O0/MuvikLabs[P]runt/runt.c
// Function: runt_compile
runt_int runt_compile(runt_vm *vm, const char *str)
{
    runt_uint size = strlen(str);
    runt_uint pos = 0;
    runt_uint word_size = 0;
    runt_uint next = 0;
    runt_stacklet *s;
    runt_cell *tmp;
    runt_entry *entry;
    runt_ptr ptr;
    runt_uint c, m;
    float val = 0.0;

    runt_int rc = RUNT_OK;

    while(runt_tokenize(vm, str, size, &pos, &word_size, &next) == RUNT_CONTINUE)
    {
        switch(runt_lex(vm, str, pos, word_size)) {
            case RUNT_FLOAT:

                val = runt_atof(str, pos, word_size);
                if(!(vm->status & RUNT_MODE_INTERACTIVE)) {
                    if(runt_cell_new(vm, &tmp) == 0) return RUNT_NOT_OK;
                    /* this needs to happen after runt_new_cell */
                    s = runt_push(vm);
                    s->f = val;
                    s->t = RUNT_FLOAT;
                    runt_copy_float(vm, vm->f_cell, tmp);
                } else {
                    s = runt_push(vm);
                    s->f = val;
                    s->t = RUNT_FLOAT;
                }

                break;
            case RUNT_HEX:
                val = hex2flt(vm, str, pos, word_size);
                if(!(vm->status & RUNT_MODE_INTERACTIVE)) {
                    if(runt_cell_new(vm, &tmp) == 0) return RUNT_NOT_OK;
                    /* this needs to happen after runt_new_cell */
                    s = runt_push(vm);
                    s->f = val;
                    runt_copy_float(vm, vm->f_cell, tmp);
                } else {
                    s = runt_push(vm);
                    s->f = val;
                }
                break;
            case RUNT_STRING:
                if(runt_cell_new(vm, &tmp) == 0) return RUNT_NOT_OK;
                s = runt_push(vm);
                ptr = runt_mk_string(vm, &str[pos + 1], word_size - 2);
                s->p = ptr;
                runt_copy_string(vm, vm->s_cell, tmp);
                if(vm->status & RUNT_MODE_INTERACTIVE) {
                    s = runt_push(vm);
                    s->p = ptr;
                    s->t = RUNT_STRING;
                }
                break;
            case RUNT_WORD:
                if(runt_word_search(vm,
                            &str[pos + 1],
                            word_size - 1,
                            &entry) == RUNT_NOT_OK) {
                    runt_print(vm, "Could not find word '%*.*s'\n",
                               word_size - 1,
                               word_size - 1,
                               &str[pos + 1]);
                    return RUNT_NOT_OK;
                }
                if(!(vm->status & RUNT_MODE_INTERACTIVE)) {
                    if(runt_cell_new(vm, &tmp) == 0) return RUNT_NOT_OK;
                    s = runt_push(vm);
                    if(entry->cell->id > 0) {
                        s->f = entry->cell->id;
                        runt_copy_float(vm, vm->f_cell, tmp);
                    } else {
                        s->p = runt_mk_cptr(vm, entry->cell);
                        runt_copy_cell(vm, tmp);
                    }
                } else {
                    s = runt_push(vm);
                    s->f = entry->cell->id;
                    s->p = runt_mk_cptr(vm, entry->cell);
                }

                break;
            case RUNT_PROC:
                if(vm->status & RUNT_MODE_KEYWORD) {

                    if(str[pos] == '@' && word_size == 1) {
                        s = runt_peak(vm);
                        tmp = runt_to_cell(s->p);
                        runt_cell_clear(vm, tmp);
                        runt_entry_create(vm, tmp, &entry);
                        vm->anon = entry;
                    } else {
                        rc = runt_word_search(vm, &str[pos], word_size, &entry);

                        s = runt_peak(vm);
                        tmp = runt_to_cell(s->p);

                        if(rc == RUNT_OK) {
                            runt_print(vm,
                                "Word '%*.*s' previously defined\n",
                                word_size, word_size, &str[pos]);

                            /* on failure, break to interactive mode */
                            runt_set_state(vm, RUNT_MODE_KEYWORD, RUNT_OFF);
                            runt_set_state(vm, RUNT_MODE_INTERACTIVE, RUNT_ON);
                            return RUNT_NOT_OK;
                        } else {
                            c = runt_cell_pool_used(vm);
                            m = runt_memory_pool_used(vm);
                            entry = NULL;
                            runt_cell_clear(vm, tmp);
                            runt_entry_create(vm, tmp, &entry);
                            runt_word(vm, &str[pos], word_size, entry);
                            runt_word_last_defined(vm, entry, c - 1, m);
                        }
                    }

                    runt_set_state(vm, RUNT_MODE_KEYWORD, RUNT_OFF);
                    break;
                }

                if(runt_word_search(vm, &str[pos], word_size, &entry) == RUNT_OK) {
                    if(vm->status & RUNT_MODE_INTERACTIVE) {
                        if(runt_entry_exec(vm, entry) == RUNT_NOT_OK) {
                            runt_print(vm, "Error with word '%*.*s'\n",
                                    word_size, word_size, &str[pos]);
                            return RUNT_NOT_OK;
                        }

                    } else {
                        if(runt_cell_new(vm, &tmp) == 0) return RUNT_NOT_OK;
                        runt_entry_copy(vm, entry, tmp);
                    }
                } else {
                    /*TODO: cleaner error reporting */
                    runt_print(vm, "Could not find function '%*.*s'\n",
                            word_size, word_size, str + pos);
                    return RUNT_NOT_OK;
                }
                break;

            case RUNT_NIL:
                break;
            default:
                runt_print(vm, "UNKOWN TYPE\n");
        }
    }
    return RUNT_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1070
movl %eax, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x64(%rbp)
movl $0x1, -0x68(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
leaq -0x20(%rbp), %rcx
leaq -0x24(%rbp), %r8
leaq -0x28(%rbp), %r9
callq 0x34c0
cmpl $0x2, %eax
jne 0x4177
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x20(%rbp), %edx
movl -0x24(%rbp), %ecx
callq 0x3730
movl %eax, %ecx
movq %rcx, -0xb8(%rbp)
subl $0x8, %eax
ja 0x4160
movq -0xb8(%rbp), %rax
leaq 0x56b1(%rip), %rcx      # 0x919c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rdi
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0x3850
movss %xmm0, -0x64(%rbp)
movq -0x10(%rbp), %rax
movl 0x1158(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x3b77
movq -0x10(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1dc0
cmpl $0x0, %eax
jne 0x3b38
movl $0x0, -0x4(%rbp)
jmp 0x417e
movq -0x10(%rbp), %rdi
callq 0x21d0
movq %rax, -0x30(%rbp)
movss -0x64(%rbp), %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, 0x20(%rax)
movq -0x30(%rbp), %rax
movl $0x1, (%rax)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x1180(%rax), %rsi
movq -0x38(%rbp), %rdx
callq 0x4190
jmp 0x3b9c
movq -0x10(%rbp), %rdi
callq 0x21d0
movq %rax, -0x30(%rbp)
movss -0x64(%rbp), %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, 0x20(%rax)
movq -0x30(%rbp), %rax
movl $0x1, (%rax)
jmp 0x4172
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x20(%rbp), %edx
movl -0x24(%rbp), %ecx
callq 0x4210
movss %xmm0, -0x64(%rbp)
movq -0x10(%rbp), %rax
movl 0x1158(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x3c1e
movq -0x10(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1dc0
cmpl $0x0, %eax
jne 0x3be9
movl $0x0, -0x4(%rbp)
jmp 0x417e
movq -0x10(%rbp), %rdi
callq 0x21d0
movq %rax, -0x30(%rbp)
movss -0x64(%rbp), %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, 0x20(%rax)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x1180(%rax), %rsi
movq -0x38(%rbp), %rdx
callq 0x4190
jmp 0x3c39
movq -0x10(%rbp), %rdi
callq 0x21d0
movq %rax, -0x30(%rbp)
movss -0x64(%rbp), %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, 0x20(%rax)
jmp 0x4172
movq -0x10(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1dc0
cmpl $0x0, %eax
jne 0x3c5c
movl $0x0, -0x4(%rbp)
jmp 0x417e
movq -0x10(%rbp), %rdi
callq 0x21d0
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
addq %rax, %rdx
movl -0x24(%rbp), %ecx
subl $0x2, %ecx
leaq -0x80(%rbp), %rdi
callq 0x2670
movq -0x80(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x50(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x1188(%rax), %rsi
movq -0x38(%rbp), %rdx
callq 0x4370
movq -0x10(%rbp), %rax
movl 0x1158(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x3d1c
movq -0x10(%rbp), %rdi
callq 0x21d0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x50(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rax
movl $0x2, (%rax)
jmp 0x4172
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
addq %rax, %rsi
movl -0x24(%rbp), %edx
subl $0x1, %edx
leaq -0x40(%rbp), %rcx
callq 0x2e70
cmpl $0x0, %eax
jne 0x3d81
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %edx
subl $0x1, %edx
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movq -0x18(%rbp), %r8
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
addq %rax, %r8
leaq 0x56a2(%rip), %rsi      # 0x9410
movb $0x0, %al
callq 0x1f40
movl $0x0, -0x4(%rbp)
jmp 0x417e
movq -0x10(%rbp), %rax
movl 0x1158(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x3e5a
movq -0x10(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1dc0
cmpl $0x0, %eax
jne 0x3db5
movl $0x0, -0x4(%rbp)
jmp 0x417e
movq -0x10(%rbp), %rdi
callq 0x21d0
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x24(%rax)
jbe 0x3e01
movq -0x40(%rbp), %rax
movq (%rax), %rax
movl 0x24(%rax), %eax
cvtsi2ss %rax, %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, 0x20(%rax)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x1180(%rax), %rsi
movq -0x38(%rbp), %rdx
callq 0x4190
jmp 0x3e58
movq -0x30(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rax
movq (%rax), %rdx
leaq -0x98(%rbp), %rdi
callq 0x43d0
movq -0xc0(%rbp), %rax
movq -0x98(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x90(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x88(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x4400
jmp 0x3ec9
movq -0x10(%rbp), %rdi
callq 0x21d0
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movl 0x24(%rax), %eax
cvtsi2ss %rax, %xmm0
movq -0x30(%rbp), %rax
movss %xmm0, 0x20(%rax)
movq -0x30(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rax
movq (%rax), %rdx
leaq -0xb0(%rbp), %rdi
callq 0x43d0
movq -0xc8(%rbp), %rax
movq -0xb0(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0xa8(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0xa0(%rbp), %rcx
movq %rcx, 0x18(%rax)
jmp 0x4172
movq -0x10(%rbp), %rax
movl 0x1158(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x4093
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x40, %eax
jne 0x3f63
cmpl $0x1, -0x24(%rbp)
jne 0x3f63
movq -0x10(%rbp), %rdi
callq 0x1fe0
movq %rax, -0x30(%rbp)
movq -0x30(%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 0x2010
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x1d60
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x2b30
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x14a8(%rax)
jmp 0x407e
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x20(%rbp), %eax
addq %rax, %rsi
movl -0x24(%rbp), %edx
leaq -0x40(%rbp), %rcx
callq 0x2e70
movl %eax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1fe0
movq %rax, -0x30(%rbp)
movq -0x30(%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 0x2010
movq %rax, -0x38(%rbp)
cmpl $0x1, -0x68(%rbp)
jne 0x400e
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %edx
movl -0x24(%rbp), %ecx
movq -0x18(%rbp), %r8
movl -0x20(%rbp), %eax
addq %rax, %r8
leaq 0x5455(%rip), %rsi      # 0x942d
movb $0x0, %al
callq 0x1f40
movq -0x10(%rbp), %rdi
movl $0x4, %edx
movl %edx, %esi
callq 0x1550
movq -0x10(%rbp), %rdi
movl $0x2, %esi
movl $0x3, %edx
callq 0x1550
movl $0x0, -0x4(%rbp)
jmp 0x417e
movq -0x10(%rbp), %rdi
callq 0x33f0
movl %eax, -0x5c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3390
movl %eax, -0x60(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x1d60
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x2b30
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x20(%rbp), %eax
addq %rax, %rsi
movl -0x24(%rbp), %edx
movq -0x40(%rbp), %rcx
callq 0x2c50
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl -0x5c(%rbp), %edx
subl $0x1, %edx
movl -0x60(%rbp), %ecx
callq 0x4460
jmp 0x407e
movq -0x10(%rbp), %rdi
movl $0x4, %edx
movl %edx, %esi
callq 0x1550
jmp 0x4172
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x20(%rbp), %eax
addq %rax, %rsi
movl -0x24(%rbp), %edx
leaq -0x40(%rbp), %rcx
callq 0x2e70
cmpl $0x1, %eax
jne 0x4131
movq -0x10(%rbp), %rax
movl 0x1158(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x4103
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x2c20
cmpl $0x0, %eax
jne 0x4101
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %edx
movl -0x24(%rbp), %ecx
movq -0x18(%rbp), %r8
movl -0x20(%rbp), %eax
addq %rax, %r8
leaq 0x535d(%rip), %rsi      # 0x944e
movb $0x0, %al
callq 0x1f40
movl $0x0, -0x4(%rbp)
jmp 0x417e
jmp 0x412f
movq -0x10(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x1dc0
cmpl $0x0, %eax
jne 0x411e
movl $0x0, -0x4(%rbp)
jmp 0x417e
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x2be0
jmp 0x415c
movq -0x10(%rbp), %rdi
movl -0x24(%rbp), %edx
movl -0x24(%rbp), %ecx
movq -0x18(%rbp), %r8
movl -0x20(%rbp), %eax
addq %rax, %r8
leaq 0x531b(%rip), %rsi      # 0x9467
movb $0x0, %al
callq 0x1f40
movl $0x0, -0x4(%rbp)
jmp 0x417e
jmp 0x4172
jmp 0x4172
movq -0x10(%rbp), %rdi
leaq 0x531d(%rip), %rsi      # 0x9488
movb $0x0, %al
callq 0x1f40
jmp 0x3a93
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopw (%rax,%rax)