// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/asm.c
// Function: doarg_1
static int32_t doarg_1(
    JanetAssembler *a,
    enum JanetOpArgType argtype,
    Janet x) {
    int32_t ret = -1;
    JanetTable *c;
    switch (argtype) {
        default:
            c = NULL;
            break;
        case JANET_OAT_SLOT:
            c = &a->slots;
            break;
        case JANET_OAT_ENVIRONMENT:
            c = &a->envs;
            break;
        case JANET_OAT_LABEL:
            c = &a->labels;
            break;
        case JANET_OAT_FUNCDEF:
            c = &a->defs;
            break;
    }
    switch (janet_type(x)) {
        default:
            goto error;
            break;
        case JANET_NUMBER: {
            double y = janet_unwrap_number(x);
            if (janet_checkintrange(y)) {
                ret = (int32_t) y;
            } else {
                goto error;
            }
            break;
        }
        case JANET_TUPLE: {
            const Janet *t = janet_unwrap_tuple(x);
            if (argtype == JANET_OAT_TYPE) {
                int32_t i = 0;
                ret = 0;
                for (i = 0; i < janet_tuple_length(t); i++) {
                    ret |= doarg_1(a, JANET_OAT_SIMPLETYPE, t[i]);
                }
            } else {
                goto error;
            }
            break;
        }
        case JANET_KEYWORD: {
            if (NULL != c && argtype == JANET_OAT_LABEL) {
                Janet result = janet_table_get(c, x);
                if (janet_checktype(result, JANET_NUMBER)) {
                    ret = janet_unwrap_integer(result) - a->bytecode_count;
                } else {
                    goto error;
                }
            } else if (argtype == JANET_OAT_TYPE || argtype == JANET_OAT_SIMPLETYPE) {
                const TypeAlias *alias = janet_strbinsearch(
                                             &type_aliases,
                                             sizeof(type_aliases) / sizeof(TypeAlias),
                                             sizeof(TypeAlias),
                                             janet_unwrap_keyword(x));
                if (alias) {
                    ret = alias->mask;
                } else {
                    janet_asm_errorv(a, janet_formatc("unknown type %v", x));
                }
            } else {
                goto error;
            }
            break;
        }
        case JANET_SYMBOL: {
            if (NULL != c) {
                Janet result = janet_table_get(c, x);
                if (janet_checktype(result, JANET_NUMBER)) {
                    ret = (int32_t) janet_unwrap_number(result);
                } else {
                    janet_asm_errorv(a, janet_formatc("unknown name %v", x));
                }
            } else {
                goto error;
            }
            if (argtype == JANET_OAT_ENVIRONMENT && ret == -1) {
                /* Add a new env */
                ret = janet_asm_addenv(a, x);
                if (ret < -1) {
                    janet_asm_errorv(a, janet_formatc("unknown environment %v", x));
                }
            }
            break;
        }
    }
    if (argtype == JANET_OAT_SLOT && ret >= a->def->slotcount)
        a->def->slotcount = (int32_t) ret + 1;
    return ret;

error:
    janet_asm_errorv(a, janet_formatc("error parsing instruction argument %v", x));
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdx, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
movl -0x1c(%rbp), %eax
movq %rax, -0x60(%rbp)
subq $0x7, %rax
ja 0x17d3e
movq -0x60(%rbp), %rax
leaq 0x6712b(%rip), %rcx     # 0x7ee60
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq $0x0, -0x28(%rbp)
jmp 0x17d86
movq -0x18(%rbp), %rax
addq $0x128, %rax            # imm = 0x128
movq %rax, -0x28(%rbp)
jmp 0x17d86
movq -0x18(%rbp), %rax
addq $0x158, %rax            # imm = 0x158
movq %rax, -0x28(%rbp)
jmp 0x17d86
movq -0x18(%rbp), %rax
addq $0xf8, %rax
movq %rax, -0x28(%rbp)
jmp 0x17d86
movq -0x18(%rbp), %rax
addq $0x188, %rax            # imm = 0x188
movq %rax, -0x28(%rbp)
movsd -0x10(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x17d98
jmp 0x17da9
movq -0x10(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
movl %eax, -0x64(%rbp)
jmp 0x17db0
xorl %eax, %eax
movl %eax, -0x64(%rbp)
jmp 0x17db0
movl -0x64(%rbp), %eax
movl %eax, %ecx
movq %rcx, -0x70(%rbp)
subl $0x8, %eax
ja 0x17dd2
movq -0x70(%rbp), %rax
leaq 0x670b7(%rip), %rcx     # 0x7ee80
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x180b6
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x30(%rbp), %xmm0
movsd 0x6768a(%rip), %xmm1    # 0x7f478
ucomisd %xmm1, %xmm0
jb 0x17e23
movsd 0x67684(%rip), %xmm0    # 0x7f480
ucomisd -0x30(%rbp), %xmm0
jb 0x17e23
movsd -0x30(%rbp), %xmm0
cvttsd2si -0x30(%rbp), %eax
cvtsi2sd %eax, %xmm1
ucomisd %xmm1, %xmm0
jne 0x17e23
jp 0x17e23
cvttsd2si -0x30(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0x17e28
jmp 0x180b6
jmp 0x18087
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, -0x38(%rbp)
cmpl $0x4, -0x1c(%rbp)
jne 0x17e8e
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl -0x10(%rcx), %eax
jge 0x17e8c
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movl $0x5, %esi
callq 0x17d00
orl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x17e55
jmp 0x17e93
jmp 0x180b6
jmp 0x18087
xorl %eax, %eax
cmpq -0x28(%rbp), %rax
je 0x17f1d
cmpl $0x6, -0x1c(%rbp)
jne 0x17f1d
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x69420
movq %rax, -0x48(%rbp)
movb $0x1, %al
testb $0x1, %al
jne 0x17ebf
jmp 0x17ee5
movsd -0x48(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x17ed1
jmp 0x17f02
movq -0x48(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
cmpq $0x0, %rax
je 0x17f02
jmp 0x17f16
movabsq $-0x800000000000, %rax  # imm = 0xFFFF800000000000
andq -0x48(%rbp), %rax
movabsq $-0x8000000000000, %rcx # imm = 0xFFF8000000000000
cmpq %rcx, %rax
jne 0x17f16
cvttsd2si -0x48(%rbp), %eax
movq -0x18(%rbp), %rcx
subl 0xec(%rcx), %eax
movl %eax, -0x20(%rbp)
jmp 0x17f1b
jmp 0x180b6
jmp 0x17f91
cmpl $0x4, -0x1c(%rbp)
je 0x17f29
cmpl $0x5, -0x1c(%rbp)
jne 0x17f8a
movq -0x10(%rbp), %rdi
callq 0x7b260
movq %rax, %rcx
leaq 0x92cc4(%rip), %rdi     # 0xaac00
movl $0x13, %esi
movl $0x10, %edx
callq 0x6b360
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x17f62
movq -0x50(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x20(%rbp)
jmp 0x17f88
movq -0x18(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rsi
leaq 0x67b44(%rip), %rdi     # 0x7fab9
movb $0x0, %al
callq 0x5bdd0
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0x17630
jmp 0x17f8f
jmp 0x180b6
jmp 0x17f91
jmp 0x18087
xorl %eax, %eax
cmpq -0x28(%rbp), %rax
je 0x18030
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x69420
movq %rax, -0x58(%rbp)
movb $0x1, %al
testb $0x1, %al
jne 0x17fbb
jmp 0x17fe1
movsd -0x58(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x17fcd
jmp 0x17ffe
movq -0x58(%rbp), %rax
shrq $0x2f, %rax
andq $0xf, %rax
cmpq $0x0, %rax
je 0x17ffe
jmp 0x18008
movabsq $-0x800000000000, %rax  # imm = 0xFFFF800000000000
andq -0x58(%rbp), %rax
movabsq $-0x8000000000000, %rcx # imm = 0xFFF8000000000000
cmpq %rcx, %rax
jne 0x18008
cvttsd2si -0x58(%rbp), %eax
movl %eax, -0x20(%rbp)
jmp 0x1802e
movq -0x18(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rsi
leaq 0x67aae(%rip), %rdi     # 0x7fac9
movb $0x0, %al
callq 0x5bdd0
movq -0x80(%rbp), %rdi
movq %rax, %rsi
callq 0x17630
jmp 0x18035
jmp 0x180b6
cmpl $0x1, -0x1c(%rbp)
jne 0x18085
cmpl $-0x1, -0x20(%rbp)
jne 0x18085
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x18100
movl %eax, -0x20(%rbp)
cmpl $-0x1, -0x20(%rbp)
jge 0x18083
movq -0x18(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rsi
leaq 0x67a6c(%rip), %rdi     # 0x7fad9
movb $0x0, %al
callq 0x5bdd0
movq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x17630
jmp 0x18085
jmp 0x18087
cmpl $0x0, -0x1c(%rbp)
jne 0x180ae
movl -0x20(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
cmpl 0x5c(%rcx), %eax
jl 0x180ae
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl %ecx, 0x5c(%rax)
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x180e9
movq -0x18(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x10(%rbp), %rsi
leaq 0x67a24(%rip), %rdi     # 0x7faf0
movb $0x0, %al
callq 0x5bdd0
movq -0x90(%rbp), %rdi
movq %rax, %rsi
callq 0x17630
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)