LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: PageFault
void PageFault(State *state, uint8_t access_type) {
    state->excepted = true;
    switch (access_type) {
    case AccessInstruction:
        state->exception_code = InstructionPageFault;
        break;
    case AccessLoad:
        state->exception_code = LoadPageFault;
        break;
    case AccessStore:
        state->exception_code = StoreAMOPageFault;
        break;
    default:
        Error("Unknown access type: %d", access_type);
        break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb $0x1, 0x8138(%rdi)
cmpl $0x2, %esi
je 0x2a45
cmpl $0x1, %esi
je 0x2a38
testl %esi, %esi
jne 0x2a52
movq $0xc, 0x8140(%rdi)
jmp 0x2a50
movq $0xd, 0x8140(%rdi)
jmp 0x2a50
movq $0xf, 0x8140(%rdi)
popq %rbp
retq
movzbl %sil, %esi
leaq 0x5832(%rip), %rdi      # 0x828f
xorl %eax, %eax
popq %rbp
jmp 0x6b70
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: Require
bool Require(State *state, uint8_t mode) {
    if (state->mode == MACHINE) {
        if (mode == MACHINE || mode == SUPERVISOR || mode == USER) {
            return true;
        }
    } else if (state->mode == SUPERVISOR) {
        if (mode == SUPERVISOR || mode == USER) {
            return true;
        }
    } else if (state->mode == USER) {
        if (mode == USER) {
            return true;
        }
    }

    state->excepted = true;
    // printf("Require Illegal Instruction: pc: 0x%llx, state->mode: %d, mode: %d\n", state->pc, state->mode, mode);
    state->exception_code = IllegalInstruction;
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movzbl 0x8148(%rdi), %eax
cmpl $0x1, %eax
je 0x2e08
cmpl $0x3, %eax
jne 0x2e12
cmpb $0x3, %sil
ja 0x2e17
movzbl %sil, %ecx
movb $0x1, %al
cmpl $0x2, %ecx
jne 0x2e2f
jmp 0x2e17
movb $0x1, %al
cmpb $0x2, %sil
jae 0x2e17
jmp 0x2e2f
orb %sil, %al
je 0x2e2d
movb $0x1, 0x8138(%rdi)
movq $0x2, 0x8140(%rdi)
xorl %eax, %eax
jmp 0x2e2f
movb $0x1, %al
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecAddi
void ExecAddi(State *state, uint32_t instr) {
    uint8_t rd = instr >> 7 & SetNBits(5);
    uint8_t rs1 = instr >> 15 & SetNBits(5);
    int32_t immediate = Sext(instr >> 20 & SetNBits(12), 11);

    state->x[rd] = state->x[rs1] + immediate;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x14, %eax
movl %esi, %ecx
shrl $0xc, %ecx
movl $0xf8, %edx
andl %edx, %ecx
leaq -0x1000(%rax), %r8
testl %esi, %esi
cmovnsq %rax, %r8
addq 0x8008(%rdi,%rcx), %r8
shrl $0x4, %esi
andl %edx, %esi
movq %r8, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecSltiu
void ExecSltiu(State *state, uint32_t instr) {
    uint8_t rd = instr >> 7 & SetNBits(5);
    uint8_t rs1 = instr >> 15 & SetNBits(5);
    int32_t immediate = Sext(instr >> 20 & SetNBits(12), 11);

    state->x[rd] = ((uint64_t)state->x[rs1]) < ((uint64_t)immediate);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x14, %eax
movl %esi, %ecx
shrl $0xc, %ecx
movl $0xf8, %edx
andl %edx, %ecx
leaq -0x1000(%rax), %r8
testl %esi, %esi
cmovnsq %rax, %r8
xorl %eax, %eax
cmpq %r8, 0x8008(%rdi,%rcx)
setb %al
shrl $0x4, %esi
andl %edx, %esi
movq %rax, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecOri
void ExecOri(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint64_t immediate = Sext((instr >> 20) & SetNBits(12), 11);

    state->x[rd] = state->x[rs1] | immediate;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x14, %eax
leaq -0x1000(%rax), %rcx
testl %esi, %esi
cmovnsq %rax, %rcx
movl %esi, %eax
shrl $0xc, %eax
movl $0xf8, %edx
andl %edx, %eax
orq 0x8008(%rdi,%rax), %rcx
shrl $0x4, %esi
andl %edx, %esi
movq %rcx, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecAndi
void ExecAndi(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    int32_t immediate = Sext((instr >> 20) & SetNBits(12), 11);

    state->x[rd] = state->x[rs1] & immediate;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x14, %eax
movl %esi, %ecx
shrl $0xc, %ecx
movl $0xf8, %edx
andl %edx, %ecx
leaq -0x1000(%rax), %r8
testl %esi, %esi
cmovnsq %rax, %r8
andq 0x8008(%rdi,%rcx), %r8
shrl $0x4, %esi
andl %edx, %esi
movq %r8, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecOpImmInstr
void ExecOpImmInstr(State *state, uint32_t instr) {
    uint8_t funct3 = (instr >> 12) & SetNBits(3);
    uint8_t funct7 = (instr >> 25) & SetNBits(7);
    uint8_t funct6 = (instr >> 26) & SetNBits(6);

    switch (funct3) {
    case 0x0:
        ExecAddi(state, instr);
        break;
    case 0x1:
        ExecSlli(state, instr);
        break;
    case 0x2:
        ExecSlti(state, instr);
        break;
    case 0x3:
        ExecSltiu(state, instr);
        break;
    case 0x4:
        ExecXori(state, instr);
        break;
    case 0x5:
        if (funct6 == 0x00) {
            ExecSrli(state, instr);
        } else if (funct6 == 0x10) {
            ExecSrai(state, instr);
        }
        break;
    case 0x6:
        ExecOri(state, instr);
        break;
    case 0x7:
        ExecAndi(state, instr);
        break;
    default:
        Error("Unknown OP_IMM instruction: %2x", funct3);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0xc, %eax
movl %eax, %ecx
andl $0x7, %ecx
leaq 0x5028(%rip), %rdx      # 0x8090
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl %esi, %ecx
shrl $0x14, %ecx
movl $0xf8, %edx
andl %edx, %eax
leaq -0x1000(%rcx), %r8
testl %esi, %esi
cmovnsq %rcx, %r8
addq 0x8008(%rdi,%rax), %r8
jmp 0x313e
movl %esi, %ecx
shrl $0x14, %ecx
movl $0xf8, %edx
andl %edx, %eax
leaq -0x1000(%rcx), %r8
testl %esi, %esi
cmovnsq %rcx, %r8
xorq 0x8008(%rdi,%rax), %r8
jmp 0x313e
movl %esi, %ecx
shrl $0x14, %ecx
movl $0xf8, %edx
andl %edx, %eax
leaq -0x1000(%rcx), %r8
testl %esi, %esi
cmovnsq %rcx, %r8
xorl %ecx, %ecx
cmpq %r8, 0x8008(%rdi,%rax)
setl %cl
jmp 0x310b
movl %esi, %ecx
shrl $0x14, %ecx
movl $0xf8, %edx
andl %edx, %eax
leaq -0x1000(%rcx), %r8
testl %esi, %esi
cmovnsq %rcx, %r8
xorl %ecx, %ecx
cmpq %r8, 0x8008(%rdi,%rax)
setb %cl
shrl $0x4, %esi
andl %edx, %esi
movq %rcx, 0x8008(%rdi,%rsi)
jmp 0x31e4
movl %esi, %ecx
shrl $0x14, %ecx
movl $0xf8, %edx
andl %edx, %eax
leaq -0x1000(%rcx), %r8
testl %esi, %esi
cmovnsq %rcx, %r8
andq 0x8008(%rdi,%rax), %r8
shrl $0x4, %esi
andl %edx, %esi
movq %r8, 0x8008(%rdi,%rsi)
jmp 0x31e4
movl %esi, %ecx
shrl $0x14, %ecx
movl $0xf8, %edx
andl %edx, %eax
movq 0x8008(%rdi,%rax), %rax
shlq %cl, %rax
jmp 0x31d7
movl %esi, %ecx
shrl $0x1a, %ecx
cmpl $0x10, %ecx
je 0x31c0
testl %ecx, %ecx
jne 0x31e4
movl %esi, %ecx
shrl $0x14, %ecx
movl $0xf8, %edx
andl %edx, %eax
movq 0x8008(%rdi,%rax), %rax
shrq %cl, %rax
jmp 0x31d7
movl %esi, %ecx
shrl $0x14, %ecx
leaq -0x1000(%rcx), %rdx
testl %esi, %esi
cmovnsq %rcx, %rdx
movl $0xf8, %ecx
andl %ecx, %eax
orq 0x8008(%rdi,%rax), %rdx
shrl $0x4, %esi
andl %ecx, %esi
movq %rdx, 0x8008(%rdi,%rsi)
jmp 0x31e4
movl %esi, %ecx
shrl $0x14, %ecx
movl $0xf8, %edx
andl %edx, %eax
movq 0x8008(%rdi,%rax), %rax
sarq %cl, %rax
shrl $0x4, %esi
andl %edx, %esi
movq %rax, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecDiv
void ExecDiv(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint8_t rs2 = (instr >> 20) & SetNBits(5);

    if (state->x[rs2] == 0) {
        state->x[rd] = -1;
    } else if (state->x[rs1] == -((int64_t)1 << 63) && state->x[rs2] == -1) {
        state->x[rd] = -((int64_t)1 << 63);
    } else {
        state->x[rd] = state->x[rs1] / state->x[rs2];
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x11, %eax
andl $0xf8, %eax
movq 0x8008(%rdi,%rax), %r8
testq %r8, %r8
je 0x34e1
movl %esi, %eax
shrl $0xc, %eax
andl $0xf8, %eax
movq 0x8008(%rdi,%rax), %rcx
cmpq $-0x1, %r8
jne 0x34d7
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
cmpq %rax, %rcx
je 0x34e8
movq %rcx, %rax
cqto
idivq %r8
jmp 0x34e8
movq $-0x1, %rax
shrl $0x4, %esi
andl $0xf8, %esi
movq %rax, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecRemu
void ExecRemu(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint8_t rs2 = (instr >> 20) & SetNBits(5);

    if (state->x[rs2] == 0) {
        state->x[rd] = state->x[rs1];
    } else {
        state->x[rd] = (uint64_t)state->x[rs1] % (uint64_t)state->x[rs2];
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x11, %eax
movl $0xf8, %edx
andl %edx, %eax
movq 0x8008(%rdi,%rax), %rcx
movl %esi, %eax
shrl $0xc, %eax
andl %edx, %eax
movq 0x8008(%rdi,%rax), %rax
testq %rcx, %rcx
je 0x36b8
xorl %edx, %edx
divq %rcx
movq %rdx, %rax
shrl $0x4, %esi
andl $0xf8, %esi
movq %rax, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecJal
void ExecJal(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    int32_t offset = Sext((instr >> 31 & SetNBits(1)) << 20 |
                              (instr >> 12 & SetNBits(8)) << 12 |
                              (instr >> 20 & SetNBits(1)) << 11 |
                              (instr >> 21 & SetNBits(10)) << 1,
                          20);

    state->x[rd] = state->pc + sizeof(instr);
    state->pc += offset;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0xb, %eax
andl $0x100000, %eax         # imm = 0x100000
movl %esi, %ecx
andl $0xff000, %ecx          # imm = 0xFF000
movl %esi, %edx
shrl $0x9, %edx
andl $0x800, %edx            # imm = 0x800
movl %esi, %r8d
shrl $0x14, %r8d
andl $0x7fe, %r8d            # imm = 0x7FE
orl %ecx, %r8d
orl %edx, %r8d
orl %eax, %r8d
movq (%rdi), %rax
leaq 0x4(%rax), %rcx
movl %esi, %edx
shrl $0x4, %edx
andl $0xf8, %edx
leaq -0x200000(%r8), %r9
testl %esi, %esi
movq %rcx, 0x8008(%rdi,%rdx)
cmovnsq %r8, %r9
addq %rax, %r9
movq %r9, (%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecJalr
void ExecJalr(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    int32_t offset = Sext(instr >> 20 & SetNBits(12), 11);

    uint64_t t = state->pc + sizeof(instr);
    state->pc = (state->x[rs1] + offset) & ~1;
    state->x[rd] = t;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x14, %eax
movq (%rdi), %rcx
addq $0x4, %rcx
movl %esi, %edx
shrl $0xc, %edx
movl $0xf8, %r8d
andl %r8d, %edx
leaq -0x1000(%rax), %r9
testl %esi, %esi
cmovnsq %rax, %r9
addq 0x8008(%rdi,%rdx), %r9
andq $-0x2, %r9
movq %r9, (%rdi)
shrl $0x4, %esi
andl %r8d, %esi
movq %rcx, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecLb
void ExecLb(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    int32_t offset = Sext(instr >> 20 & SetNBits(12), 11);

    state->x[rd] = Sext(Read8(state, state->x[rs1] + offset), 7);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %eax
shrl $0x14, %eax
movl %esi, %ecx
shrl $0xc, %ecx
movl $0xf8, %r15d
andl %r15d, %ecx
leaq -0x1000(%rax), %rsi
testl %ebx, %ebx
cmovnsq %rax, %rsi
addq 0x8008(%rdi,%rcx), %rsi
callq 0x22fa
movzbl %al, %eax
leaq -0x100(%rax), %rcx
testb %al, %al
cmovnsq %rax, %rcx
shrl $0x4, %ebx
andl %r15d, %ebx
movq %rcx, 0x8008(%r14,%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecLh
void ExecLh(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    int32_t offset = Sext(instr >> 20 & SetNBits(12), 11);

    state->x[rd] = Sext(Read16(state, state->x[rs1] + offset), 15);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %eax
shrl $0x14, %eax
movl %esi, %ecx
shrl $0xc, %ecx
movl $0xf8, %r15d
andl %r15d, %ecx
leaq -0x1000(%rax), %rsi
testl %ebx, %ebx
cmovnsq %rax, %rsi
addq 0x8008(%rdi,%rcx), %rsi
callq 0x21e1
movzwl %ax, %eax
leaq -0x10000(%rax), %rcx
testw %ax, %ax
cmovnsq %rax, %rcx
shrl $0x4, %ebx
andl %r15d, %ebx
movq %rcx, 0x8008(%r14,%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecLw
void ExecLw(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    int32_t offset = Sext(instr >> 20 & SetNBits(12), 11);

    state->x[rd] = Sext(Read32(state, state->x[rs1] + offset), 31);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %eax
shrl $0x14, %eax
movl %esi, %ecx
shrl $0xc, %ecx
movl $0xf8, %r15d
andl %r15d, %ecx
leaq -0x1000(%rax), %rsi
testl %ebx, %ebx
cmovnsq %rax, %rsi
addq 0x8008(%rdi,%rcx), %rsi
callq 0x229e
movl %eax, %ecx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
orq %rcx, %rdx
testl %eax, %eax
cmovnsq %rcx, %rdx
shrl $0x4, %ebx
andl %r15d, %ebx
movq %rdx, 0x8008(%r14,%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecLd
void ExecLd(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    int32_t offset = Sext(instr >> 20 & SetNBits(12), 11);

    state->x[rd] = Read64(state, state->x[rs1] + offset);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %eax
shrl $0x14, %eax
movl %esi, %ecx
shrl $0xc, %ecx
movl $0xf8, %r15d
andl %r15d, %ecx
leaq -0x1000(%rax), %rsi
testl %ebx, %ebx
cmovnsq %rax, %rsi
addq 0x8008(%rdi,%rcx), %rsi
callq 0x223f
shrl $0x4, %ebx
andl %r15d, %ebx
movq %rax, 0x8008(%r14,%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecLoadInstr
void ExecLoadInstr(State *state, uint32_t instr) {
    uint8_t funct3 = (instr >> 12) & SetNBits(3);

    switch (funct3) {
    case 0x0:
        ExecLb(state, instr);
        break;
    case 0x1:
        ExecLh(state, instr);
        break;
    case 0x2:
        ExecLw(state, instr);
        break;
    case 0x3:
        ExecLd(state, instr);
        break;
    case 0x4:
        ExecLbu(state, instr);
        break;
    case 0x5:
        ExecLhu(state, instr);
        break;
    case 0x6:
        ExecLwu(state, instr);
        break;
    default:
        Error("Unimplemented Load Instruction: funct3=0x%x", funct3);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %eax
shrl $0xc, %eax
movl %eax, %esi
andl $0x7, %esi
leaq 0x42fe(%rip), %rcx      # 0x80d0
movslq (%rcx,%rsi,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
movq %r14, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3b21
movl %ebx, %ecx
shrl $0x14, %ecx
movl $0xf8, %r15d
andl %r15d, %eax
leaq -0x1000(%rcx), %rsi
testl %ebx, %ebx
cmovnsq %rcx, %rsi
addq 0x8008(%r14,%rax), %rsi
movq %r14, %rdi
callq 0x22fa
movzbl %al, %eax
jmp 0x3f2e
movl %ebx, %ecx
shrl $0x14, %ecx
movl $0xf8, %r15d
andl %r15d, %eax
leaq -0x1000(%rcx), %rsi
testl %ebx, %ebx
cmovnsq %rcx, %rsi
addq 0x8008(%r14,%rax), %rsi
movq %r14, %rdi
callq 0x229e
movl %eax, %ecx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
orq %rcx, %rdx
testl %eax, %eax
cmovnsq %rcx, %rdx
shrl $0x4, %ebx
andl %r15d, %ebx
movq %rdx, 0x8008(%r14,%rbx)
jmp 0x3f3c
movl %ebx, %ecx
shrl $0x14, %ecx
movl $0xf8, %r15d
andl %r15d, %eax
leaq -0x1000(%rcx), %rsi
testl %ebx, %ebx
cmovnsq %rcx, %rsi
addq 0x8008(%r14,%rax), %rsi
movq %r14, %rdi
callq 0x223f
jmp 0x3f2e
leaq 0x44b0(%rip), %rdi      # 0x835c
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x6b70
movq %r14, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3b86
movl %ebx, %ecx
shrl $0x14, %ecx
movl $0xf8, %r15d
andl %r15d, %eax
leaq -0x1000(%rcx), %rsi
testl %ebx, %ebx
cmovnsq %rcx, %rsi
addq 0x8008(%r14,%rax), %rsi
movq %r14, %rdi
callq 0x21e1
movzwl %ax, %eax
jmp 0x3f2e
movl %ebx, %ecx
shrl $0x14, %ecx
movl $0xf8, %r15d
andl %r15d, %eax
leaq -0x1000(%rcx), %rsi
testl %ebx, %ebx
cmovnsq %rcx, %rsi
addq 0x8008(%r14,%rax), %rsi
movq %r14, %rdi
callq 0x229e
movl %eax, %eax
shrl $0x4, %ebx
andl %r15d, %ebx
movq %rax, 0x8008(%r14,%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecSb
void ExecSb(State *state, uint32_t instr) {
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint8_t rs2 = (instr >> 20) & SetNBits(5);
    int32_t offset = Sext(
        ((instr >> 25 & SetNBits(7)) << 5) | ((instr >> 7 & SetNBits(5))), 11);

    // printf("sb: pc: %llx, addr: %llx, val: %d\n", state->pc, state->x[rs1] + offset, (uint8_t)state->x[rs2]);
    Write8(state, state->x[rs1] + offset,
           (uint8_t)state->x[rs2]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %ecx
shrl $0x14, %ecx
movl %ecx, %eax
andl $-0x20, %eax
movl %esi, %edx
shrl $0x7, %edx
andl $0x1f, %edx
orl %eax, %edx
movl %esi, %r8d
shrl $0xc, %r8d
andl $0xf8, %r8d
leaq -0x1000(%rdx), %rax
testl %esi, %esi
cmovnsq %rdx, %rax
addq 0x8008(%rdi,%r8), %rax
andl $0x1f, %ecx
movzbl 0x8008(%rdi,%rcx,8), %edx
movq %rax, %rsi
popq %rbp
jmp 0x2330
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecSh
void ExecSh(State *state, uint32_t instr) {
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint8_t rs2 = (instr >> 20) & SetNBits(5);
    int32_t offset = Sext(
        ((instr >> 25 & SetNBits(7)) << 5) | ((instr >> 7 & SetNBits(5))), 11);

    Write16(state, state->x[rs1] + offset,
            (uint16_t)state->x[rs2]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %ecx
shrl $0x14, %ecx
movl %ecx, %eax
andl $-0x20, %eax
movl %esi, %edx
shrl $0x7, %edx
andl $0x1f, %edx
orl %eax, %edx
movl %esi, %r8d
shrl $0xc, %r8d
andl $0xf8, %r8d
leaq -0x1000(%rdx), %rax
testl %esi, %esi
cmovnsq %rdx, %rax
addq 0x8008(%rdi,%r8), %rax
andl $0x1f, %ecx
movzwl 0x8008(%rdi,%rcx,8), %edx
movq %rax, %rsi
popq %rbp
jmp 0x2367
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecSd
void ExecSd(State *state, uint32_t instr) {
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint8_t rs2 = (instr >> 20) & SetNBits(5);
    int32_t offset = Sext(
        ((instr >> 25 & SetNBits(7)) << 5) | ((instr >> 7 & SetNBits(5))), 11);

    Write64(state, state->x[rs1] + offset, (uint64_t)state->x[rs2]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %ecx
shrl $0x14, %ecx
movl %ecx, %eax
andl $-0x20, %eax
movl %esi, %edx
shrl $0x7, %edx
andl $0x1f, %edx
orl %eax, %edx
movl %esi, %r8d
shrl $0xc, %r8d
andl $0xf8, %r8d
leaq -0x1000(%rdx), %rax
testl %esi, %esi
cmovnsq %rdx, %rax
addq 0x8008(%rdi,%r8), %rax
andl $0x1f, %ecx
movq 0x8008(%rdi,%rcx,8), %rdx
movq %rax, %rsi
popq %rbp
jmp 0x2d88
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecStoreInstr
void ExecStoreInstr(State *state, uint32_t instr) {
    uint8_t funct3 = (instr >> 12) & SetNBits(3);

    switch (funct3) {
    case 0x0:
        ExecSb(state, instr);
        break;
    case 0x1:
        ExecSh(state, instr);
        break;
    case 0x2:
        ExecSw(state, instr);
        break;
    case 0x3:
        ExecSd(state, instr);
        break;
    default:
        Error("Unimplemented Store Instruction: funct3=0x%x", funct3);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0xc, %eax
andl $0x7, %eax
cmpb $0x3, %al
ja 0x40ba
leaq 0x4057(%rip), %rcx      # 0x80f0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
popq %rbp
jmp 0x3f47
popq %rbp
jmp 0x3fe5
popq %rbp
jmp 0x4033
popq %rbp
jmp 0x3f96
leaq 0x42c7(%rip), %rdi      # 0x8388
movl %eax, %esi
xorl %eax, %eax
popq %rbp
jmp 0x6b70
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecBeq
void ExecBeq(State *state, uint32_t instr) {
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint8_t rs2 = (instr >> 20) & SetNBits(5);
    int32_t offset = Sext(((instr >> 31 & SetNBits(1)) << 12) |
                              ((instr >> 7 & SetNBits(1)) << 11) |
                              ((instr >> 25 & SetNBits(6)) << 5) |
                              ((instr >> 8 & SetNBits(4)) << 1),
                          12);

    if (state->x[rs1] == state->x[rs2])
        state->pc += offset;
    else
        state->pc += sizeof(instr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0xc, %eax
movl $0xf8, %ecx
andl %ecx, %eax
movq 0x8008(%rdi,%rax), %rdx
movl %esi, %r8d
shrl $0x11, %r8d
andl %ecx, %r8d
movl $0x4, %eax
cmpq 0x8008(%rdi,%r8), %rdx
jne 0x4136
movl %esi, %eax
shrl $0x14, %eax
andl $0x7e0, %eax            # imm = 0x7E0
movl %esi, %ecx
shrl $0x7, %ecx
andl $0x1e, %ecx
orl %eax, %ecx
movl %esi, %eax
shrl $0x13, %eax
andl $0x1000, %eax           # imm = 0x1000
movl %esi, %edx
shll $0x4, %edx
andl $0x800, %edx            # imm = 0x800
orl %ecx, %edx
orl %eax, %edx
leaq -0x2000(%rdx), %rax
testl %esi, %esi
cmovnsq %rdx, %rax
addq %rax, (%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecBranchInstr
void ExecBranchInstr(State *state, uint32_t instr) {
    uint8_t funct3 = (instr >> 12) & SetNBits(3);

    switch (funct3) {
    case 0x0:
        ExecBeq(state, instr);
        break;
    case 0x1:
        ExecBne(state, instr);
        break;
    case 0x4:
        ExecBlt(state, instr);
        break;
    case 0x5:
        ExecBge(state, instr);
        break;
    case 0x6:
        ExecBltu(state, instr);
        break;
    case 0x7:
        ExecBgeu(state, instr);
        break;
    default:
        Error("Unimplemented Branch Instruction: funct3=0x%x", funct3);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0xc, %eax
andl $0x7, %eax
cmpb $0x7, %al
ja 0x439d
leaq 0x3d7e(%rip), %rcx      # 0x8100
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
popq %rbp
jmp 0x40cb
popq %rbp
jmp 0x41ab
popq %rbp
jmp 0x42fb
leaq 0x4011(%rip), %rdi      # 0x83b5
movl %eax, %esi
xorl %eax, %eax
popq %rbp
jmp 0x6b70
popq %rbp
jmp 0x413b
popq %rbp
jmp 0x421b
popq %rbp
jmp 0x428b
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecAddiw
void ExecAddiw(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    int32_t immediate = Sext((instr >> 20) & SetNBits(12), 11);

    state->x[rd] = Sext((state->x[rs1] + immediate) & SetNBits(32), 31);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x14, %eax
movl %esi, %ecx
shrl $0xc, %ecx
movl $0xf8, %edx
andl %edx, %ecx
movl $0xfffff000, %r8d       # imm = 0xFFFFF000
orq %rax, %r8
testl %esi, %esi
cmovnsq %rax, %r8
addq 0x8008(%rdi,%rcx), %r8
movl %r8d, %eax
movslq %r8d, %rcx
movabsq $-0x100000000, %r8      # imm = 0xFFFFFFFF00000000
andq %rcx, %r8
orq %rax, %r8
shrl $0x4, %esi
andl %edx, %esi
movq %r8, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecSrliw
void ExecSrliw(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint8_t immediate = (instr >> 20) & SetNBits(5);

    state->x[rd] =
        Sext((uint64_t)(state->x[rs1] & SetNBits(32)) >> immediate, 31);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %ecx
shrl $0x14, %ecx
movl %esi, %eax
shrl $0xc, %eax
movl $0xf8, %edx
andl %edx, %eax
movl 0x8008(%rdi,%rax), %eax
andb $0x1f, %cl
shrq %cl, %rax
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
orq %rax, %rcx
testl $0x80000000, %eax       # imm = 0x80000000
cmoveq %rax, %rcx
shrl $0x4, %esi
andl %edx, %esi
movq %rcx, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecSraiw
void ExecSraiw(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint8_t immediate = (instr >> 20) & SetNBits(5);

    state->x[rd] = Sext((int32_t)(state->x[rs1] & SetNBits(32)) >> (uint32_t)immediate, 31);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %ecx
shrl $0x14, %ecx
movl %esi, %eax
shrl $0xc, %eax
movl $0xf8, %edx
andl %edx, %eax
movl 0x8008(%rdi,%rax), %eax
sarl %cl, %eax
cltq
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
orq %rax, %rcx
testl %eax, %eax
cmovnsq %rax, %rcx
shrl $0x4, %esi
andl %edx, %esi
movq %rcx, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecOpImm32Instr
void ExecOpImm32Instr(State *state, uint32_t instr) {
    uint8_t funct3 = (instr >> 12) & SetNBits(3);
    uint8_t funct7 = (instr >> 25) & SetNBits(7);

    switch (funct3) {
    case 0x0:
        ExecAddiw(state, instr);
        break;
    case 0x1:
        ExecSlliw(state, instr);
        break;
    case 0x5:
        if (funct7 == 0x00) {
            ExecSrliw(state, instr);
        } else if (funct7 == 0x20) {
            ExecSraiw(state, instr);
        }
        break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0xc, %eax
movl %eax, %ecx
andb $0x7, %cl
cmpb $0x5, %cl
je 0x4572
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x1, %ecx
je 0x4547
testl %ecx, %ecx
jne 0x45e8
movl %esi, %ecx
shrl $0x14, %ecx
movl $0xf8, %edx
andl %edx, %eax
testl %esi, %esi
movl $0x80000000, %r8d       # imm = 0x80000000
leaq 0x7ffff000(%rcx,%r8), %r8
cmovnsq %rcx, %r8
addq 0x8008(%rdi,%rax), %r8
movl %r8d, %eax
movslq %r8d, %rcx
movabsq $-0x100000000, %r8      # imm = 0xFFFFFFFF00000000
andq %rcx, %r8
orq %rax, %r8
shrl $0x4, %esi
andl %edx, %esi
movq %r8, 0x8008(%rdi,%rsi)
jmp 0x45e8
movl %esi, %ecx
shrl $0x14, %ecx
movl $0xf8, %edx
andl %edx, %eax
movq 0x8008(%rdi,%rax), %rax
andb $0x1f, %cl
shlq %cl, %rax
cltq
shrl $0x4, %esi
andl %edx, %esi
movq %rax, 0x8008(%rdi,%rsi)
jmp 0x45e8
movl %esi, %ecx
shrl $0x19, %ecx
cmpl $0x20, %ecx
je 0x45b1
testl %ecx, %ecx
jne 0x45e8
movl %esi, %ecx
shrl $0x14, %ecx
movl $0xf8, %edx
andl %edx, %eax
movl 0x8008(%rdi,%rax), %eax
andb $0x1f, %cl
shrq %cl, %rax
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
orq %rax, %rcx
testl $0x80000000, %eax       # imm = 0x80000000
cmoveq %rax, %rcx
jmp 0x45db
movl %esi, %ecx
shrl $0x14, %ecx
movl $0xf8, %edx
andl %edx, %eax
movl 0x8008(%rdi,%rax), %eax
sarl %cl, %eax
cltq
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
orq %rax, %rcx
testl %eax, %eax
cmovnsq %rax, %rcx
shrl $0x4, %esi
andl %edx, %esi
movq %rcx, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecAddw
void ExecAddw(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint8_t rs2 = (instr >> 20) & SetNBits(5);

    state->x[rd] = Sext((state->x[rs1] + state->x[rs2]) & SetNBits(32), 31);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0xc, %eax
movl $0xf8, %ecx
andl %ecx, %eax
movl %esi, %edx
shrl $0x11, %edx
andl %ecx, %edx
movq 0x8008(%rdi,%rdx), %rdx
addq 0x8008(%rdi,%rax), %rdx
movl %edx, %eax
movslq %edx, %rdx
movabsq $-0x100000000, %r8      # imm = 0xFFFFFFFF00000000
andq %rdx, %r8
orq %rax, %r8
shrl $0x4, %esi
andl %ecx, %esi
movq %r8, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecSllw
void ExecSllw(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint8_t rs2 = (instr >> 20) & SetNBits(5);

    state->x[rd] =
        Sext((state->x[rs1] << (state->x[rs2] & SetNBits(5))) & SetNBits(32), 31);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0xc, %eax
movl $0xf8, %edx
andl %edx, %eax
movq 0x8008(%rdi,%rax), %rax
movl %esi, %ecx
shrl $0x11, %ecx
andl %edx, %ecx
movb 0x8008(%rdi,%rcx), %cl
andb $0x1f, %cl
shlq %cl, %rax
movl %eax, %ecx
cltq
movabsq $-0x100000000, %r8      # imm = 0xFFFFFFFF00000000
andq %rax, %r8
orq %rcx, %r8
shrl $0x4, %esi
andl %edx, %esi
movq %r8, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecDivw
void ExecDivw(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint8_t rs2 = (instr >> 20) & SetNBits(5);

    if (state->x[rs2] == 0) {
        state->x[rd] = -1;
    } else if ((int32_t)(state->x[rs1] & SetNBits(32)) == -((int32_t)1 << 31) && (int32_t)(state->x[rs2] & SetNBits(32)) == -1) {
        state->x[rd] = -((int32_t)1 << 31);
    } else {
        state->x[rd] = Sext(((int32_t)(state->x[rs1] & SetNBits(32)) / (int32_t)(state->x[rs2] & SetNBits(32))), 31);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x11, %eax
andl $0xf8, %eax
movq 0x8008(%rdi,%rax), %rcx
testq %rcx, %rcx
je 0x4773
movl %esi, %eax
shrl $0xc, %eax
andl $0xf8, %eax
movl 0x8008(%rdi,%rax), %eax
cmpl $-0x1, %ecx
jne 0x4759
movq $-0x80000000, %rdx      # imm = 0x80000000
cmpl $0x80000000, %eax       # imm = 0x80000000
je 0x477a
cltd
idivl %ecx
cltq
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
orq %rax, %rdx
testl %eax, %eax
cmovnsq %rax, %rdx
jmp 0x477a
movq $-0x1, %rdx
shrl $0x4, %esi
andl $0xf8, %esi
movq %rdx, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecSrlw
void ExecSrlw(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint8_t rs2 = (instr >> 20) & SetNBits(5);

    state->x[rd] = Sext((uint32_t)state->x[rs1] >> state->x[rs2], 31);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0xc, %eax
movl $0xf8, %edx
andl %edx, %eax
movl 0x8008(%rdi,%rax), %eax
movl %esi, %ecx
shrl $0x11, %ecx
andl %edx, %ecx
movb 0x8008(%rdi,%rcx), %cl
shrl %cl, %eax
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
orq %rax, %rcx
testl %eax, %eax
cmovnsq %rax, %rcx
shrl $0x4, %esi
andl %edx, %esi
movq %rcx, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecDivuw
void ExecDivuw(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint8_t rs2 = (instr >> 20) & SetNBits(5);

    if (state->x[rs2] == 0) {
        state->x[rd] = ~((uint64_t)0);
    } else {
        state->x[rd] = Sext((state->x[rs1] & SetNBits(32)) /
                                (state->x[rs2] & SetNBits(32)),
                            31);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x11, %eax
andl $0xf8, %eax
movq 0x8008(%rdi,%rax), %rcx
testq %rcx, %rcx
je 0x4821
movl %esi, %eax
shrl $0xc, %eax
andl $0xf8, %eax
movl 0x8008(%rdi,%rax), %eax
movl %ecx, %ecx
xorl %edx, %edx
divq %rcx
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
orq %rax, %rcx
testl $0x80000000, %eax       # imm = 0x80000000
cmoveq %rax, %rcx
jmp 0x4828
movq $-0x1, %rcx
shrl $0x4, %esi
andl $0xf8, %esi
movq %rcx, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecSraw
void ExecSraw(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint8_t rs2 = (instr >> 20) & SetNBits(5);

    state->x[rd] =
        Sext((int32_t)(state->x[rs1] & SetNBits(32)) >> (uint32_t)(state->x[rs2] & SetNBits(5)), 31);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0xc, %eax
movl $0xf8, %edx
andl %edx, %eax
movl 0x8008(%rdi,%rax), %eax
movl %esi, %ecx
shrl $0x11, %ecx
andl %edx, %ecx
movb 0x8008(%rdi,%rcx), %cl
sarl %cl, %eax
cltq
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
orq %rax, %rcx
testl %eax, %eax
cmovnsq %rax, %rcx
shrl $0x4, %esi
andl %edx, %esi
movq %rcx, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecRemw
void ExecRemw(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint8_t rs2 = (instr >> 20) & SetNBits(5);

    if (state->x[rs2] == 0) {
        state->x[rd] = state->x[rs1];
    } else {
        state->x[rd] = Sext((state->x[rs1] % state->x[rs2]) & SetNBits(32), 31);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x11, %eax
movl $0xf8, %edx
andl %edx, %eax
movq 0x8008(%rdi,%rax), %rcx
movl %esi, %eax
shrl $0xc, %eax
andl %edx, %eax
movq 0x8008(%rdi,%rax), %rax
testq %rcx, %rcx
je 0x48cc
cqto
idivq %rcx
movl %edx, %ecx
movslq %edx, %rdx
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
andq %rdx, %rax
orq %rcx, %rax
shrl $0x4, %esi
andl $0xf8, %esi
movq %rax, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecRemuw
void ExecRemuw(State *state, uint32_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint8_t rs1 = (instr >> 15) & SetNBits(5);
    uint8_t rs2 = (instr >> 20) & SetNBits(5);

    if (state->x[rs2] == 0) {
        state->x[rd] = state->x[rs1];
    } else {
        state->x[rd] = Sext((state->x[rs1] & SetNBits(32)) %
                                (state->x[rs2] & SetNBits(32)),
                            31);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x11, %eax
movl $0xf8, %edx
andl %edx, %eax
movq 0x8008(%rdi,%rax), %rcx
movl %esi, %eax
shrl $0xc, %eax
andl %edx, %eax
movq 0x8008(%rdi,%rax), %rax
testq %rcx, %rcx
je 0x492b
movl %eax, %eax
movl %ecx, %ecx
xorl %edx, %edx
divq %rcx
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
orq %rdx, %rax
testl $0x80000000, %edx       # imm = 0x80000000
cmoveq %rdx, %rax
shrl $0x4, %esi
andl $0xf8, %esi
movq %rax, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCAddi4spn
void ExecCAddi4spn(State *state, uint16_t instr) {
    uint32_t uimm =
        ((instr >> 7 & SetNBits(4)) << 6) | ((instr >> 11 & SetNBits(2)) << 4) |
        ((instr >> 5 & SetNBits(1)) << 3) | ((instr >> 6 & SetNBits(1)) << 2);
    uint8_t rd = (instr >> 2) & SetNBits(3);

    state->x[8 + rd] = state->x[2] + uimm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl %eax
andl $0x3c0, %eax            # imm = 0x3C0
movl %esi, %ecx
shrl $0x7, %ecx
andl $0x30, %ecx
orl %eax, %ecx
movl %esi, %eax
shrl $0x2, %eax
andl $0x8, %eax
orl %ecx, %eax
movl %esi, %ecx
shrl $0x4, %ecx
andl $0x4, %ecx
orl %eax, %ecx
addq 0x8018(%rdi), %rcx
addl %esi, %esi
andl $0x38, %esi
movq %rcx, 0x8048(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCLw
void ExecCLw(State *state, uint16_t instr) {
    uint8_t uimm = ((instr >> 10 & SetNBits(3)) << 3) |
                   ((instr >> 5 & SetNBits(1)) << 6) |
                   ((instr >> 6 & SetNBits(1)) << 2);
    uint8_t rs1 = (instr >> 7) & SetNBits(3);
    uint8_t rd = (instr >> 2) & SetNBits(3);

    state->x[8 + rd] = Sext(Read32(state, state->x[8 + rs1] + uimm) & SetNBits(32), 31);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl %esi, %eax
shrl $0x7, %eax
andl $0x38, %eax
leal (%rsi,%rsi), %r14d
movl %r14d, %ecx
andl $0x40, %ecx
orl %eax, %ecx
shrl $0x4, %esi
movl %esi, %eax
andl $0x4, %eax
orl %ecx, %eax
andl $0x38, %esi
addq 0x8048(%rdi,%rsi), %rax
movq %rax, %rsi
callq 0x229e
movl %eax, %ecx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
orq %rcx, %rdx
testl %eax, %eax
cmovnsq %rcx, %rdx
andl $0x38, %r14d
movq %rdx, 0x8048(%rbx,%r14)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCSw
void ExecCSw(State *state, uint16_t instr) {
    uint8_t uimm = ((instr >> 10 & SetNBits(3)) << 3) |
                   ((instr >> 5 & SetNBits(1)) << 6) |
                   ((instr >> 6 & SetNBits(1)) << 2);
    uint8_t rs1 = (instr >> 7) & SetNBits(3);
    uint8_t rs2 = (instr >> 2) & SetNBits(3);

    Write32(state, state->x[8 + rs1] + uimm, state->x[8 + rs2]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x7, %eax
andl $0x38, %eax
leal (%rsi,%rsi), %ecx
movl %ecx, %edx
andl $0x40, %edx
orl %eax, %edx
shrl $0x4, %esi
movl %esi, %eax
andl $0x4, %eax
orl %edx, %eax
andl $0x38, %esi
addq 0x8048(%rdi,%rsi), %rax
andl $0x38, %ecx
movl 0x8048(%rdi,%rcx), %edx
movq %rax, %rsi
popq %rbp
jmp 0x2d33
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCSd
void ExecCSd(State *state, uint32_t instr) {
    uint8_t uimm = ((instr >> 10 & SetNBits(3)) << 3) |
                   ((instr >> 5 & SetNBits(2)) << 6);
    uint8_t rs1 = (instr >> 7) & SetNBits(3);
    uint8_t rs2 = (instr >> 2) & SetNBits(3);

    Write64(state, state->x[8 + rs1] + uimm, state->x[8 + rs2]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %ecx
shrl $0x7, %ecx
andl $0x38, %ecx
leal (%rsi,%rsi), %edx
movl %edx, %eax
andl $0xc0, %eax
orl %ecx, %eax
shrl $0x4, %esi
andl $0x38, %esi
addq 0x8048(%rdi,%rsi), %rax
andl $0x38, %edx
movq 0x8048(%rdi,%rdx), %rdx
movq %rax, %rsi
popq %rbp
jmp 0x2d88
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCAddi
void ExecCAddi(State *state, uint16_t instr) {
    int32_t imm = Sext(
        ((instr >> 12 & SetNBits(1)) << 5) | (instr >> 2 & SetNBits(5)), 5);

    if (imm == 0) {
        Error("Invalid c.addi immediate");
    }
    uint8_t rd = instr >> 7 & SetNBits(5);

    state->x[rd] = state->x[rd] + imm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %eax
shrl $0x7, %eax
andl $0x20, %eax
movl %esi, %ecx
shrl $0x2, %ecx
andl $0x1f, %ecx
orl %eax, %ecx
leaq -0x40(%rcx), %r15
testl %eax, %eax
cmoveq %rcx, %r15
testl %r15d, %r15d
jne 0x4ca0
leaq 0x374a(%rip), %rdi      # 0x83e3
xorl %eax, %eax
callq 0x6b70
shrl $0x4, %ebx
andl $0xf8, %ebx
addq %r15, 0x8008(%r14,%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCAddiw
void ExecCAddiw(State *state, uint16_t instr) {
    int32_t imm = Sext(
        ((instr >> 12 & SetNBits(1)) << 5) | ((instr >> 2) & SetNBits(5)), 5);
    uint8_t rd = (instr >> 7) & SetNBits(5);

    state->x[rd] = Sext((state->x[rd] + imm) & SetNBits(32), 31);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x7, %eax
movl %eax, %ecx
andl $0x20, %ecx
shrl $0x2, %esi
andl $0x1f, %esi
orl %ecx, %esi
andl $0x1f, %eax
movl $0xffffffc0, %edx       # imm = 0xFFFFFFC0
orq %rsi, %rdx
testl %ecx, %ecx
cmoveq %rsi, %rdx
addq 0x8008(%rdi,%rax,8), %rdx
movl %edx, %ecx
movslq %edx, %rdx
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
andq %rdx, %rsi
orq %rcx, %rsi
movq %rsi, 0x8008(%rdi,%rax,8)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCLi
void ExecCLi(State *state, uint16_t instr) {
    int32_t imm = Sext(
        ((instr >> 12 & SetNBits(1)) << 5) | (instr >> 2 & SetNBits(5)), 5);
    uint8_t rd = (instr >> 7) & SetNBits(5);

    state->x[rd] = imm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x7, %eax
movl %eax, %ecx
andl $0x20, %ecx
shrl $0x2, %esi
andl $0x1f, %esi
orl %ecx, %esi
leaq -0x40(%rsi), %rdx
testl %ecx, %ecx
cmoveq %rsi, %rdx
andl $0x1f, %eax
movq %rdx, 0x8008(%rdi,%rax,8)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCAddi16sp
void ExecCAddi16sp(State *state, uint16_t instr) {
    int32_t imm_t = (instr >> 2) & SetNBits(5);
    int32_t imm = Sext(
        ((instr >> 12 & SetNBits(1)) << 9) | ((imm_t >> 1 & SetNBits(2)) << 7) |
            ((imm_t >> 3 & SetNBits(1)) << 6) | ((imm_t & SetNBits(1)) << 5) |
            ((imm_t >> 4 & SetNBits(1)) << 4),
        9);

    state->x[2] = state->x[2] + imm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x3, %eax
andl $0x200, %eax            # imm = 0x200
movl %esi, %ecx
andl $0x18, %ecx
shll $0x4, %ecx
movl %esi, %edx
andl $0x20, %edx
movl %esi, %r8d
andl $0x4, %r8d
shrl $0x2, %esi
andl $0x10, %esi
leal (%rsi,%r8,8), %esi
leal (%rsi,%rdx,2), %edx
orl %ecx, %edx
orl %eax, %edx
leaq -0x400(%rdx), %rcx
testl %eax, %eax
cmoveq %rdx, %rcx
addq %rcx, 0x8018(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCLui
void ExecCLui(State *state, uint16_t instr) {
    int32_t imm = Sext(((instr >> 12 & SetNBits(1)) << 17) |
                           ((instr >> 2 & SetNBits(5)) << 12),
                       17);
    uint8_t rd = (instr >> 7) & SetNBits(5);

    if (imm == 0)
        Error("Invalid c.lui operand");

    state->x[rd] = imm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %eax
shll $0x5, %eax
andl $0x20000, %eax          # imm = 0x20000
movl %esi, %ecx
andl $0x7c, %ecx
shll $0xa, %ecx
orl %eax, %ecx
leaq -0x40000(%rcx), %r15
testl %eax, %eax
cmoveq %rcx, %r15
testl %r15d, %r15d
jne 0x4dc3
leaq 0x3640(%rip), %rdi      # 0x83fc
xorl %eax, %eax
callq 0x6b70
shrl $0x4, %ebx
andl $0xf8, %ebx
movq %r15, 0x8008(%r14,%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCAndi
void ExecCAndi(State *state, uint16_t instr) {
    int32_t imm = Sext(
        ((instr >> 12 & SetNBits(1)) << 5) | ((instr >> 2) & SetNBits(5)), 5);
    uint8_t rd = (instr >> 7) & SetNBits(3);

    state->x[8 + rd] = state->x[8 + rd] & imm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x7, %eax
andl $0x20, %eax
movl %esi, %ecx
shrl $0x2, %ecx
andl $0x1f, %ecx
orl %eax, %ecx
shrl $0x4, %esi
andl $0x38, %esi
leaq -0x40(%rcx), %rdx
testl %eax, %eax
cmoveq %rcx, %rdx
andq %rdx, 0x8048(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCJ
void ExecCJ(State *state, uint16_t instr) {
    uint32_t imm_t = (instr >> 2);
    // [11|4|9:8|10|6|7|3:1|5] = [10|9|8:7|6|5|4|3:1|0]
    int32_t imm = Sext(((imm_t >> 10 & SetNBits(1)) << 11) |
                           ((imm_t >> 6 & SetNBits(1)) << 10) |
                           ((imm_t >> 7 & SetNBits(2)) << 8) |
                           ((imm_t >> 4 & SetNBits(1)) << 7) |
                           ((imm_t >> 5 & SetNBits(1)) << 6) |
                           ((imm_t >> 0 & SetNBits(1)) << 5) |
                           ((imm_t >> 9 & SetNBits(1)) << 4) |
                           ((imm_t >> 1 & SetNBits(3)) << 1),
                       11);

    state->pc += imm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
movl %esi, %eax
shrl $0x2, %eax
leal (%rax,%rax), %r8d
movl %r8d, %ecx
andl $0x800, %ecx            # imm = 0x800
movl %eax, %edx
andl $0x40, %edx
shll $0x4, %edx
movl %r8d, %r9d
andl $0x300, %r9d            # imm = 0x300
movl %eax, %r10d
andl $0x10, %r10d
andl $0x40, %r8d
movl %esi, %r11d
andl $0x4, %r11d
shrl $0x7, %esi
andl $0x10, %esi
movl %eax, %ebx
andl $0xe, %ebx
orl %esi, %ebx
leal (%rbx,%r11,8), %esi
orl %r8d, %esi
leal (%rsi,%r10,8), %esi
orl %r9d, %esi
orl %edx, %esi
orl %ecx, %esi
movq %rsi, %rcx
orq $-0x1000, %rcx          # imm = 0xF000
btl $0xa, %eax
cmovaeq %rsi, %rcx
addq %rcx, (%rdi)
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCBeqz
void ExecCBeqz(State *state, uint16_t instr) {
    uint8_t rs1 = (instr >> 7) & SetNBits(3);
    int32_t imm = Sext(((instr >> 12 & SetNBits(1)) << 8) |
                           ((instr >> 5 & SetNBits(2)) << 6) |
                           ((instr >> 2 & SetNBits(1)) << 5) |
                           ((instr >> 10 & SetNBits(2)) << 3) |
                           ((instr >> 3 & SetNBits(2)) << 1),
                       8);

    if (state->x[8 + rs1] == 0)
        state->pc += imm;
    else
        state->pc += sizeof(instr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x4, %eax
movl %eax, %edx
andl $0x38, %edx
movl $0x2, %ecx
cmpq $0x0, 0x8048(%rdi,%rdx)
jne 0x4f2a
andl $0x100, %eax            # imm = 0x100
movl %esi, %ecx
shrl $0x7, %ecx
andl $0x18, %ecx
movl %esi, %edx
shrl $0x2, %edx
andl $0x6, %edx
orl %ecx, %edx
movl %esi, %ecx
andl $0x60, %ecx
andl $0x4, %esi
leal (%rdx,%rsi,8), %edx
leal (%rdx,%rcx,2), %edx
orl %eax, %edx
leaq -0x200(%rdx), %rcx
testl %eax, %eax
cmoveq %rdx, %rcx
addq %rcx, (%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCSubw
void ExecCSubw(State *state, uint16_t instr) {
    uint8_t rd = instr >> 7 & SetNBits(3);
    uint8_t rs2 = instr >> 2 & SetNBits(3);

    state->x[8 + rd] =
        Sext((state->x[8 + rd] - state->x[8 + rs2]) & SetNBits(32), 31);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x4, %eax
andl $0x38, %eax
movq 0x8048(%rdi,%rax), %rcx
addl %esi, %esi
andl $0x38, %esi
subq 0x8048(%rdi,%rsi), %rcx
movl %ecx, %edx
movslq %ecx, %rcx
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
andq %rcx, %rsi
orq %rdx, %rsi
movq %rsi, 0x8048(%rdi,%rax)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCSlli
void ExecCSlli(State *state, uint16_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint32_t uimm =
        ((instr >> 12 & SetNBits(1)) << 5) | ((instr >> 2 & SetNBits(5)));

    state->x[rd] = (uint64_t)state->x[rd] << uimm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x7, %eax
movl %eax, %ecx
andl $0x20, %ecx
shrl $0x2, %esi
andl $0x1f, %esi
orl %esi, %ecx
andl $0x1f, %eax
shlq %cl, 0x8008(%rdi,%rax,8)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCLwsp
void ExecCLwsp(State *state, uint16_t instr) {
    uint8_t rd = (instr >> 7) & SetNBits(5);
    uint32_t uimm = ((instr >> 2 & SetNBits(2)) << 6) |
                    ((instr >> 12 & SetNBits(1)) << 5) |
                    ((instr >> 4 & SetNBits(3)) << 2);

    state->x[rd] = Sext(Read32(state, state->x[2] + uimm) & SetNBits(32), 31);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl %esi, %r14d
shrl $0x7, %r14d
movl %esi, %eax
andl $0xc, %eax
shll $0x4, %eax
movl %r14d, %ecx
andl $0x20, %ecx
orl %eax, %ecx
shrl $0x2, %esi
andl $0x1c, %esi
orl %ecx, %esi
addq 0x8018(%rdi), %rsi
callq 0x229e
movl %eax, %ecx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
orq %rcx, %rdx
testl %eax, %eax
cmovnsq %rcx, %rdx
andl $0x1f, %r14d
movq %rdx, 0x8008(%rbx,%r14,8)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCLdsp
void ExecCLdsp(State *state, uint32_t instr) {
    uint8_t rd = instr >> 7 & SetNBits(5);
    uint32_t uimm = (instr >> 2 & SetNBits(3)) << 6 |
                    (instr >> 12 & SetNBits(1)) << 5 |
                    (instr >> 5 & SetNBits(2)) << 3;

    state->x[rd] = Read64(state, state->x[2] + uimm);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl %esi, %r14d
shrl $0x7, %r14d
movl %r14d, %eax
andl $0x20, %eax
movl %esi, %ecx
shrl $0x2, %ecx
andl $0x18, %ecx
andl $0x1c, %esi
shll $0x4, %esi
orl %eax, %esi
orl %ecx, %esi
addq 0x8018(%rdi), %rsi
callq 0x223f
andl $0x1f, %r14d
movq %rax, 0x8008(%rbx,%r14,8)
popq %rbx
popq %r14
popq %rbp
retq