// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/asm.c
// Function: janet_asm_addenv
static int32_t janet_asm_addenv(JanetAssembler *a, Janet envname) {
    Janet check;
    JanetFuncDef *def = a->def;
    int32_t envindex;
    int32_t res;
    if (janet_equals(a->name, envname)) {
        return -1;
    }
    /* Check for memoized value */
    check = janet_table_get(&a->envs, envname);
    if (janet_checktype(check, JANET_NUMBER)) {
        return (int32_t) janet_unwrap_number(check);
    }
    if (NULL == a->parent) return -2;
    res = janet_asm_addenv(a->parent, envname);
    if (res < -1) {
        return res;
    }
    envindex = def->environments_length;
    janet_table_put(&a->envs, envname, janet_wrap_number(envindex));
    if (envindex >= a->environments_capacity) {
        int32_t newcap = 2 * envindex;
        def->environments = janet_realloc(def->environments, newcap * sizeof(int32_t));
        if (NULL == def->environments) {
            JANET_OUT_OF_MEMORY;
        }
        a->environments_capacity = newcap;
    }
    def->environments[envindex] = (int32_t) res;
    def->environments_length = envindex + 1;
    return envindex;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rsi, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0xf0(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x6e560
cmpl $0x0, %eax
je 0x18141
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x182d0
movq -0x18(%rbp), %rdi
addq $0x158, %rdi            # imm = 0x158
movq -0x10(%rbp), %rsi
callq 0x69420
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x20(%rbp)
movb $0x1, %al
testb $0x1, %al
jne 0x18169
jmp 0x1818f
movsd -0x20(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x1817b
jmp 0x181ac
movq -0x20(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
cmpq $0x0, %rax
je 0x181ac
jmp 0x181b9
movabsq $-0x800000000000, %rax  # imm = 0xFFFF800000000000
andq -0x20(%rbp), %rax
movabsq $-0x8000000000000, %rcx # imm = 0xFFF8000000000000
cmpq %rcx, %rax
jne 0x181b9
cvttsd2si -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x182d0
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpq (%rcx), %rax
jne 0x181d0
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x182d0
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x18100
movl %eax, -0x30(%rbp)
cmpl $-0x1, -0x30(%rbp)
jge 0x181f4
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x182d0
movq -0x28(%rbp), %rax
movl 0x74(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
addq $0x158, %rax            # imm = 0x158
movq %rax, -0x50(%rbp)
cvtsi2sdl -0x2c(%rbp), %xmm0
callq 0x7b820
movq -0x50(%rbp), %rdi
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x697e0
movl -0x2c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0xe4(%rcx), %eax
jl 0x182ab
movl -0x2c(%rbp), %eax
shll %eax
movl %eax, -0x44(%rbp)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
movslq -0x44(%rbp), %rsi
shlq $0x2, %rsi
callq 0x12840
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rcx
xorl %eax, %eax
cmpq 0x10(%rcx), %rax
jne 0x1829e
jmp 0x18270
movq 0x97d79(%rip), %rax     # 0xafff0
movq (%rax), %rdi
leaq 0x65d83(%rip), %rsi     # 0x7e004
leaq 0x67272(%rip), %rdx     # 0x7f4fa
movl $0xeb, %ecx
movb $0x0, %al
callq 0x125f0
movl $0x1, %edi
callq 0x12a70
movl -0x44(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0xe4(%rax)
movl -0x30(%rbp), %edx
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x2c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x2c(%rbp), %ecx
addl $0x1, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x74(%rax)
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)