// File: /workspace/github_c_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
movl %edi, %eax
andl $0x7f, %eax
xorl %ecx, %ecx
leaq 0x69a42(%rip), %rdx     # 0x7ff10
movq %r14, %rsi
leaq (%rdx,%rcx), %r14
cmpl %eax, 0x8(%rcx,%rdx)
cmovneq %rsi, %r14
je 0x164ef
addq $0x10, %rcx
cmpq $0x4d0, %rcx            # imm = 0x4D0
jne 0x164ce
xorl %r14d, %r14d
testq %r14, %r14
je 0x1654f
movq (%r14), %rdi
callq 0x47cd3
movabsq $-0x5800000000000, %rsi # imm = 0xFFFA800000000000
movq %rax, %rdi
callq 0x4f9ad
movq %rax, %r13
movl 0x8(%r14), %eax
leaq 0x70134(%rip), %rcx     # 0x86650
movl (%rcx,%rax,4), %eax
cmpq $0xd, %rax
ja 0x166cb
leaq 0x3c8f8(%rip), %rcx     # 0x52e28
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl %bh, %eax
cvtsi2sd %eax, %xmm0
callq 0x4fab8
movq %rax, %r14
movl %ebx, %eax
shrl $0x10, %eax
jmp 0x165b5
cvtsi2sd %ebx, %xmm0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4fab8
movl %ebx, %eax
shrl $0x8, %eax
movl $0xff, %r15d
andl %r15d, %eax
cvtsi2sd %eax, %xmm0
callq 0x4fab8
movq %rax, %r14
movl %ebx, %eax
shrl $0x10, %eax
andl %r15d, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
callq 0x4fab8
movq %rax, %r15
movl %ebx, %eax
shrl $0x18, %eax
jmp 0x16651
movzbl %bh, %eax
cvtsi2sd %eax, %xmm0
callq 0x4fab8
movq %rax, %r14
movl %ebx, %eax
sarl $0x10, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
callq 0x4fab8
movq %rax, %r15
movl $0x3, %edi
callq 0x48a50
movq %r13, (%rax)
movq %r14, 0x8(%rax)
movq %r15, 0x10(%rax)
jmp 0x16679
movl %ebx, %eax
sarl $0x8, %eax
jmp 0x165fc
movl $0x1, %edi
callq 0x48a50
movq %r13, (%rax)
jmp 0x16679
movl %ebx, %eax
shrl $0x8, %eax
cvtsi2sd %eax, %xmm0
callq 0x4fab8
movq %rax, %r14
movl $0x2, %edi
callq 0x48a50
movq %r13, (%rax)
movq %r14, 0x8(%rax)
jmp 0x16679
movl %ebx, %eax
shrl $0x8, %eax
movl $0xff, %r15d
andl %r15d, %eax
cvtsi2sd %eax, %xmm0
callq 0x4fab8
movq %rax, %r14
movl %ebx, %eax
shrl $0x10, %eax
andl %r15d, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
callq 0x4fab8
movq %rax, %r15
movl %ebx, %eax
sarl $0x18, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
callq 0x4fab8
movq %rax, %r12
movl $0x4, %edi
callq 0x48a50
movq %r13, (%rax)
movq %r14, 0x8(%rax)
movq %r15, 0x10(%rax)
movq %r12, 0x18(%rax)
movq %rax, %rdi
callq 0x48a81
testq %rax, %rax
je 0x166ae
testb %bl, %bl
jns 0x1668e
orb $0x1, -0x1e(%rax)
movabsq $-0x4000000000000, %rsi # imm = 0xFFFC000000000000
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4f9ad
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4f95a
xorl %eax, %eax
jmp 0x16681