// File: /workspace/github_c_makefile_star2_O3/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
andl $0x7f, %ebx
movl $0x8, %eax
leaq 0x68a6d(%rip), %rcx     # 0x7ef10
cmpl %ebx, (%rax,%rcx)
je 0x164cb
addq $0x10, %rax
cmpq $0x4d8, %rax            # imm = 0x4D8
jne 0x164a3
cvtsi2sd %edi, %xmm0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4ee44
movl %edi, -0x2c(%rbp)
movq -0x8(%rax,%rcx), %rdi
callq 0x47261
movabsq $-0x5800000000000, %rsi # imm = 0xFFFA800000000000
movq %rax, %rdi
callq 0x4ed39
movq %rax, %r13
movl %ebx, %eax
leaq 0x6f14a(%rip), %rcx     # 0x85640
movl (%rcx,%rax,4), %eax
cmpq $0xd, %rax
ja 0x16683
leaq 0x3b91e(%rip), %rcx     # 0x51e28
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x2c(%rbp), %ebx
movzbl %bh, %eax
cvtsi2sd %eax, %xmm0
callq 0x4ee44
movq %rax, %r14
movl %ebx, %eax
shrl $0x10, %eax
jmp 0x16582
movl -0x2c(%rbp), %r12d
movl %r12d, %eax
shrl $0x8, %eax
movl $0xff, %ebx
andl %ebx, %eax
cvtsi2sd %eax, %xmm0
callq 0x4ee44
movq %rax, %r14
movl %r12d, %eax
shrl $0x10, %eax
andl %ebx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
callq 0x4ee44
movq %rax, %r15
movl %r12d, %eax
shrl $0x18, %eax
jmp 0x16624
movl -0x2c(%rbp), %ebx
movzbl %bh, %eax
cvtsi2sd %eax, %xmm0
callq 0x4ee44
movq %rax, %r14
movl %ebx, %eax
sarl $0x10, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
callq 0x4ee44
movq %rax, %r15
movl $0x3, %edi
callq 0x47fa0
movq %r13, (%rax)
movq %r14, 0x8(%rax)
movq %r15, 0x10(%rax)
jmp 0x1664c
movl -0x2c(%rbp), %eax
sarl $0x8, %eax
jmp 0x165cb
movl $0x1, %edi
callq 0x47fa0
movq %r13, (%rax)
jmp 0x1664c
movl -0x2c(%rbp), %eax
shrl $0x8, %eax
cvtsi2sd %eax, %xmm0
callq 0x4ee44
movq %rax, %r14
movl $0x2, %edi
callq 0x47fa0
movq %r13, (%rax)
movq %r14, 0x8(%rax)
jmp 0x1664c
movl -0x2c(%rbp), %r12d
movl %r12d, %eax
shrl $0x8, %eax
movl $0xff, %ebx
andl %ebx, %eax
cvtsi2sd %eax, %xmm0
callq 0x4ee44
movq %rax, %r14
movl %r12d, %eax
shrl $0x10, %eax
andl %ebx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
callq 0x4ee44
movq %rax, %r15
movl %r12d, %eax
sarl $0x18, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
callq 0x4ee44
movq %rax, %r12
movl $0x4, %edi
callq 0x47fa0
movq %r13, (%rax)
movq %r14, 0x8(%rax)
movq %r15, 0x10(%rax)
movq %r12, 0x18(%rax)
movq %rax, %rdi
callq 0x47fd1
testq %rax, %rax
je 0x16683
cmpb $0x0, -0x2c(%rbp)
jns 0x16663
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 0x4ed39
movabsq $-0x77fffffffffff, %rdi # imm = 0xFFF8800000000001
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4ece6