// File: /workspace/github_c_makefile_star2_O2/janet-lang[P]janet/src/core/asm.c
// Function: janet_asm_decode_instruction
Janet janet_asm_decode_instruction(uint32_t instr) {
    const JanetInstructionDef *def = janet_asm_reverse_lookup(instr);
    Janet name;
    if (NULL == def) {
        return janet_wrap_integer((int32_t)instr);
    }
    name = janet_csymbolv(def->name);
    const Janet *ret = NULL;
#define oparg(shift, mask) ((instr >> ((shift) << 3)) & (mask))
    switch (janet_instructions[def->opcode]) {
        case JINT_0:
            ret = tup1(name);
            break;
        case JINT_S:
            ret = tup2(name, janet_wrap_integer(oparg(1, 0xFFFFFF)));
            break;
        case JINT_L:
            ret = tup2(name, janet_wrap_integer((int32_t)instr >> 8));
            break;
        case JINT_SS:
        case JINT_ST:
        case JINT_SC:
        case JINT_SU:
        case JINT_SD:
            ret = tup3(name,
                       janet_wrap_integer(oparg(1, 0xFF)),
                       janet_wrap_integer(oparg(2, 0xFFFF)));
            break;
        case JINT_SI:
        case JINT_SL:
            ret =  tup3(name,
                        janet_wrap_integer(oparg(1, 0xFF)),
                        janet_wrap_integer((int32_t)instr >> 16));
            break;
        case JINT_SSS:
        case JINT_SES:
        case JINT_SSU:
            ret = tup4(name,
                       janet_wrap_integer(oparg(1, 0xFF)),
                       janet_wrap_integer(oparg(2, 0xFF)),
                       janet_wrap_integer(oparg(3, 0xFF)));
            break;
        case JINT_SSI:
            ret = tup4(name,
                       janet_wrap_integer(oparg(1, 0xFF)),
                       janet_wrap_integer(oparg(2, 0xFF)),
                       janet_wrap_integer((int32_t)instr >> 24));
            break;
    }
#undef oparg
    if (ret) {
        /* Check if break point set */
        if (instr & 0x80) {
            janet_tuple_flag(ret) |= JANET_TUPLE_FLAG_BRACKETCTOR;
        }
        return janet_wrap_tuple(ret);
    }
    return janet_wrap_nil();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edi, %ebx
movl %edi, %r15d
andl $0x7f, %ebx
pushq $-0x10
popq %rcx
leaq 0x65264(%rip), %rax     # 0x79f10
leaq 0x10(%rcx), %rdx
cmpq $0x4d0, %rdx            # imm = 0x4D0
je 0x14d20
cmpl %ebx, 0x18(%rcx,%rax)
movq %rdx, %rcx
jne 0x14cac
movq (%rdx,%rax), %rdi
callq 0x439c6
movabsq $-0x5800000000000, %rsi # imm = 0xFFFA800000000000
movq %rax, %rdi
callq 0x4b366
movq %rax, %r12
movl %ebx, %eax
leaq 0x6b957(%rip), %rcx     # 0x80640
movl (%rcx,%rax,4), %eax
cmpq $0xd, %rax
ja 0x14e4c
leaq 0x3912b(%rip), %rcx     # 0x4de28
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %r15d, %ebx
movzbl %bh, %eax
cvtsi2sd %eax, %xmm0
callq 0x4b471
movq %rax, %r14
movl %r15d, %eax
shrl $0x10, %eax
jmp 0x14d82
cvtsi2sd %r15d, %xmm0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x4b471
movl %r15d, %eax
shrl $0x8, %eax
movl $0xff, %ebx
andl %ebx, %eax
cvtsi2sd %eax, %xmm0
callq 0x4b471
movq %rax, %r14
movl %r15d, %eax
shrl $0x10, %eax
andl %ebx, %eax
cvtsi2sd %eax, %xmm0
callq 0x4b471
movq %rax, %rbx
movl %r15d, %eax
shrl $0x18, %eax
jmp 0x14e0a
movl %r15d, %ebx
movzbl %bh, %eax
cvtsi2sd %eax, %xmm0
callq 0x4b471
movq %rax, %r14
movl %r15d, %eax
sarl $0x10, %eax
cvtsi2sd %eax, %xmm0
callq 0x4b471
movq %r12, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x14e8b
jmp 0x14e24
movl %r15d, %eax
sarl $0x8, %eax
jmp 0x14dc1
pushq $0x1
popq %rdi
callq 0x44648
movq %r12, (%rax)
movq %rax, %rdi
callq 0x44674
jmp 0x14e24
movl %r15d, %eax
shrl $0x8, %eax
cvtsi2sd %eax, %xmm0
callq 0x4b471
movq %r12, %rdi
movq %rax, %rsi
callq 0x14e63
jmp 0x14e24
movl %r15d, %eax
shrl $0x8, %eax
movl $0xff, %ebx
andl %ebx, %eax
cvtsi2sd %eax, %xmm0
callq 0x4b471
movq %rax, %r14
movl %r15d, %eax
shrl $0x10, %eax
andl %ebx, %eax
cvtsi2sd %eax, %xmm0
callq 0x4b471
movq %rax, %rbx
movl %r15d, %eax
sarl $0x18, %eax
cvtsi2sd %eax, %xmm0
callq 0x4b471
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %rax, %rcx
callq 0x14ec3
testq %rax, %rax
je 0x14e4c
testb %r15b, %r15b
jns 0x14e32
orb $0x1, -0x1e(%rax)
movabsq $-0x4000000000000, %rsi # imm = 0xFFFC000000000000
movq %rax, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x4b366
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x4b313