LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/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 0x2a3b
cmpl $0x3, %eax
jne 0x2a45
cmpb $0x3, %sil
ja 0x2a4a
movzbl %sil, %ecx
movb $0x1, %al
cmpl $0x2, %ecx
jne 0x2a62
jmp 0x2a4a
movb $0x1, %al
cmpb $0x2, %sil
jae 0x2a4a
jmp 0x2a62
orb %sil, %al
je 0x2a60
movb $0x1, 0x8138(%rdi)
movq $0x2, 0x8140(%rdi)
xorl %eax, %eax
jmp 0x2a62
movb $0x1, %al
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x2fe2
movl %esi, %eax
shrl $0xc, %eax
andl $0xf8, %eax
movq 0x8008(%rdi,%rax), %rcx
cmpq $-0x1, %r8
jne 0x2fd8
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
cmpq %rax, %rcx
je 0x2fec
movq %rcx, %rax
cqto
idivq %r8
jmp 0x2fec
movabsq $-0x1, %rax
shrl $0x4, %esi
andl $0xf8, %esi
movq %rax, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x31bf
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_O2/hobo0xcc[P]rve/src/cpu.c
// Function: ExecOpInstr
void ExecOpInstr(State *state, uint32_t instr) {
    uint8_t funct3 = (instr >> 12) & SetNBits(3);
    uint8_t funct7 = (instr >> 25) & SetNBits(7);

    switch (funct3) {
    case 0x0:
        if (funct7 == 0x00) {
            ExecAdd(state, instr);
        } else if (funct7 == 0x01) {
            ExecMul(state, instr);
        } else if (funct7 == 0x20) {
            ExecSub(state, instr);
        }
        break;
    case 0x1:
        if (funct7 == 0x00) {
            ExecSll(state, instr);
        } else if (funct7 == 0x01) {
            ExecMulh(state, instr);
        }
        break;
    case 0x2:
        if (funct7 == 0x00) {
            ExecSlt(state, instr);
        } else if (funct7 == 0x01) {
            ExecMulhsu(state, instr);
        }
        break;
    case 0x3:
        if (funct7 == 0x00) {
            ExecSltu(state, instr);
        } else if (funct7 == 0x01) {
            ExecMulhu(state, instr);
        }
        break;
    case 0x4:
        if (funct7 == 0x00) {
            ExecXor(state, instr);
        } else if (funct7 == 0x01) {
            ExecDiv(state, instr);
        }
        break;
    case 0x5:
        if (funct7 == 0x00) {
            ExecSrl(state, instr);
        } else if (funct7 == 0x01) {
            ExecDivu(state, instr);
        } else if (funct7 == 0x20) {
            ExecSra(state, instr);
        }
        break;
    case 0x6:
        if (funct7 == 0x00) {
            ExecOr(state, instr);
        } else if (funct7 == 0x01) {
            ExecRem(state, instr);
        }
        break;
    case 0x7:
        if (funct7 == 0x00) {
            ExecAnd(state, instr);
        } else if (funct7 == 0x01) {
            ExecRemu(state, instr);
        }
        break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %ecx
shrl $0xc, %ecx
movl %esi, %eax
shrl $0x19, %eax
andl $0x7, %ecx
leaq 0x3ec6(%rip), %rdx      # 0x70b0
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl $0x20, %eax
je 0x32a9
cmpl $0x1, %eax
je 0x32a3
testl %eax, %eax
jne 0x327d
popq %rbp
jmp 0x2d4c
cmpl $0x1, %eax
je 0x327f
testl %eax, %eax
jne 0x327d
popq %rbp
jmp 0x2f60
cmpl $0x1, %eax
je 0x3285
testl %eax, %eax
jne 0x327d
popq %rbp
jmp 0x2e61
cmpl $0x1, %eax
je 0x328b
testl %eax, %eax
jne 0x327d
popq %rbp
jmp 0x2ee9
cmpl $0x1, %eax
je 0x3291
testl %eax, %eax
jne 0x327d
popq %rbp
jmp 0x3155
cmpl $0x1, %eax
je 0x3297
testl %eax, %eax
jne 0x327d
popq %rbp
jmp 0x2def
cmpl $0x20, %eax
je 0x32b5
cmpl $0x1, %eax
je 0x32af
testl %eax, %eax
jne 0x327d
popq %rbp
jmp 0x2fff
cmpl $0x1, %eax
je 0x329d
testl %eax, %eax
jne 0x327d
popq %rbp
jmp 0x30c6
popq %rbp
retq
popq %rbp
jmp 0x2f96
popq %rbp
jmp 0x2e9e
popq %rbp
jmp 0x2f26
popq %rbp
jmp 0x318b
popq %rbp
jmp 0x2e27
popq %rbp
jmp 0x30fc
popq %rbp
jmp 0x2d82
popq %rbp
jmp 0x2db9
popq %rbp
jmp 0x303a
popq %rbp
jmp 0x308b
// File: /workspace/github_c_makefile_star2_O2/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
movl %esi, %eax
shrl $0xc, %eax
andl $0x7, %eax
leaq 0x3ac0(%rip), %rcx      # 0x70d0
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
popq %rbp
jmp 0x336c
popq %rbp
jmp 0x34f6
popq %rbp
jmp 0x3437
popq %rbp
jmp 0x34a1
leaq 0x3d24(%rip), %rdi      # 0x735c
movl %eax, %esi
xorl %eax, %eax
popq %rbp
jmp 0x5ca8
popq %rbp
jmp 0x33d1
popq %rbp
jmp 0x354e
popq %rbp
jmp 0x35a6
// File: /workspace/github_c_makefile_star2_O2/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 0x37c7
leaq 0x394a(%rip), %rcx      # 0x70f0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
popq %rbp
jmp 0x3654
popq %rbp
jmp 0x36f2
popq %rbp
jmp 0x3740
popq %rbp
jmp 0x36a3
leaq 0x3bba(%rip), %rdi      # 0x7388
movl %eax, %esi
xorl %eax, %eax
popq %rbp
jmp 0x5ca8
// File: /workspace/github_c_makefile_star2_O2/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 $0x14, %eax
movl %esi, %ecx
shrl $0xc, %ecx
andl $0xf8, %ecx
movq 0x8008(%rdi,%rcx), %rcx
movl %eax, %edx
andl $0x1f, %edx
cmpq 0x8008(%rdi,%rdx,8), %rcx
jne 0x383a
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
jmp 0x3844
movabsq $0x4, %rax
addq %rax, (%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x3ab0
leaq 0x366b(%rip), %rcx      # 0x7100
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
popq %rbp
jmp 0x37d8
popq %rbp
jmp 0x38ba
popq %rbp
jmp 0x3a0d
leaq 0x38fe(%rip), %rdi      # 0x73b5
movl %eax, %esi
xorl %eax, %eax
popq %rbp
jmp 0x5ca8
popq %rbp
jmp 0x3849
popq %rbp
jmp 0x392b
popq %rbp
jmp 0x399c
// File: /workspace/github_c_makefile_star2_O2/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 0x3c0c
andl $0x7, %eax
cmpl $0x1, %eax
je 0x3c06
testl %eax, %eax
jne 0x3c20
popq %rbp
jmp 0x3ad3
popq %rbp
jmp 0x3b24
movl %esi, %eax
shrl $0x19, %eax
cmpl $0x20, %eax
je 0x3c22
testl %eax, %eax
jne 0x3c20
popq %rbp
jmp 0x3b58
popq %rbp
retq
popq %rbp
jmp 0x3b9f
// File: /workspace/github_c_makefile_star2_O2/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 0x3db1
movl %esi, %eax
shrl $0xc, %eax
andl $0xf8, %eax
movl 0x8008(%rdi,%rax), %eax
cmpl $-0x1, %ecx
jne 0x3d97
movq $-0x80000000, %rdx      # imm = 0x80000000
cmpl $0x80000000, %eax       # imm = 0x80000000
je 0x3dbb
cltd
idivl %ecx
cltq
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
orq %rax, %rdx
testl %eax, %eax
cmovnsq %rax, %rdx
jmp 0x3dbb
movabsq $-0x1, %rdx
shrl $0x4, %esi
andl $0xf8, %esi
movq %rdx, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x3e5c
movl %esi, %eax
shrl $0xc, %eax
andl $0xf8, %eax
movl 0x8008(%rdi,%rax), %eax
xorl %edx, %edx
divl %ecx
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
orq %rax, %rcx
testl %eax, %eax
cmovnsq %rax, %rcx
jmp 0x3e66
movabsq $-0x1, %rcx
shrl $0x4, %esi
andl $0xf8, %esi
movq %rcx, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x3f60
xorl %edx, %edx
divl %ecx
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
orq %rdx, %rax
testl %edx, %edx
cmovnsq %rdx, %rax
shrl $0x4, %esi
andl $0xf8, %esi
movq %rax, 0x8008(%rdi,%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/cpu.c
// Function: ExecOp32Instr
void ExecOp32Instr(State *state, uint32_t instr) {
    uint8_t funct3 = (instr >> 12) & SetNBits(3);
    uint8_t funct7 = (instr >> 25) & SetNBits(7);

    switch (funct3) {
    case 0x0:
        if (funct7 == 0x00) {
            ExecAddw(state, instr);
        } else if (funct7 == 0x01) {
            ExecMulw(state, instr);
        } else {
            ExecSubw(state, instr);
        }
        break;
    case 0x1:
        ExecSllw(state, instr);
        break;
    case 0x4:
        if (funct7 == 0x01) {
            ExecDivw(state, instr);
        }
        break;
    case 0x5:
        if (funct7 == 0x00) {
            ExecSrlw(state, instr);
        } else if (funct7 == 0x01) {
            ExecDivuw(state, instr);
        } else if (funct7 == 0x20) {
            ExecSraw(state, instr);
        }
        break;
    case 0x6:
        if (funct7 == 0x01) {
            ExecRemw(state, instr);
        }
        break;
    case 0x7:
        if (funct7 == 0x01) {
            ExecRemuw(state, instr);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %ecx
shrl $0xc, %ecx
movl %ecx, %eax
andb $0x7, %al
cmpb $0x7, %al
ja 0x3fe6
movl %esi, %eax
shrl $0x19, %eax
andl $0x7, %ecx
leaq 0x318d(%rip), %rdx      # 0x7120
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl $0x1, %eax
je 0x3fe8
testl %eax, %eax
jne 0x3fee
popq %rbp
jmp 0x3c28
cmpl $0x1, %eax
jne 0x3fe6
popq %rbp
jmp 0x3d58
cmpl $0x1, %eax
jne 0x3fe6
popq %rbp
jmp 0x3f1d
popq %rbp
jmp 0x3d09
cmpl $0x20, %eax
je 0x3ffa
cmpl $0x1, %eax
je 0x3ff4
testl %eax, %eax
jne 0x3fe6
popq %rbp
jmp 0x3dce
cmpl $0x1, %eax
jne 0x3fe6
popq %rbp
jmp 0x3ec4
popq %rbp
retq
popq %rbp
jmp 0x3c73
popq %rbp
jmp 0x3cbf
popq %rbp
jmp 0x3e17
popq %rbp
jmp 0x3e79
// File: /workspace/github_c_makefile_star2_O2/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
movq %rdi, %rbx
movl %esi, %r14d
shrl $0x7, %r14d
movl %r14d, %eax
andl $0x20, %eax
shrl $0x2, %esi
andl $0x1f, %esi
orl %eax, %esi
leaq -0x40(%rsi), %r15
testl %eax, %eax
cmoveq %rsi, %r15
testl %r15d, %r15d
jne 0x41a1
leaq 0x3249(%rip), %rdi      # 0x73e3
xorl %eax, %eax
callq 0x5ca8
andl $0x1f, %r14d
addq %r15, 0x8008(%rbx,%r14,8)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x42bf
leaq 0x3144(%rip), %rdi      # 0x73fc
xorl %eax, %eax
callq 0x5ca8
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_O2/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, %ecx
andl $0x38, %ecx
cmpq $0x0, 0x8048(%rdi,%rcx)
je 0x43f9
movabsq $0x2, %rcx
jmp 0x442d
movl %esi, %ecx
shrl $0x7, %ecx
andl $0x100, %eax            # imm = 0x100
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_O2/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 0x2044
andl $0x1f, %r14d
movq %rax, 0x8008(%rbx,%r14,8)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/cpu.c
// Function: ExecEcall
void ExecEcall(State *state, uint32_t instr) {
    // printf("ecall: Exception: pc: 0x%llx\n", state->pc);
    // printf("ecall: a0: %llx, a1: %llx, a7: %llx\n", state->x[10], state->x[11], state->x[17]);
    state->excepted = true;
    int exception_code;
    if (state->mode == 0x3) {
        exception_code = EnvironmentCallFromMMode;
    } else if (state->mode == 0x1) {
        exception_code = EnvironmentCallFromSMode;
    } else if (state->mode == 0x0) {
        exception_code = EnvironmentCallFromUMode;
    } else {
        state->excepted = false;
        return;
    }

    state->exception_code = exception_code;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb $0x1, 0x8138(%rdi)
movzbl 0x8148(%rdi), %eax
testl %eax, %eax
je 0x4bcc
cmpl $0x3, %eax
je 0x4bc0
cmpl $0x1, %eax
jne 0x4bdf
movabsq $0x9, %rax
jmp 0x4bd6
movabsq $0xb, %rax
jmp 0x4bd6
movabsq $0x8, %rax
movq %rax, 0x8140(%rdi)
jmp 0x4be6
movb $0x0, 0x8138(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/cpu.c
// Function: ExecWfi
void ExecWfi(State *state, uint32_t instr) {
    printf("wfi\n");
    PrintRegisters(state, false);
    exit(state->x[10]);
    while (true);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x293b(%rip), %rdi      # 0x754a
callq 0x1060
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5fa1
movl 0x8058(%rbx), %edi
callq 0x11b0
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/cpu.c
// Function: ExecMret
void ExecMret(State *state, uint32_t instr) {
    Require(state, MACHINE);
    state->pc = state->csr[MEPC];
    state->mode = ReadCSR(state, MSTATUS, 11, 12);
    uint64_t mpie = ReadCSR(state, MSTATUS, 7, 7);
    WriteCSR(state, MSTATUS, 3, 3, mpie);
    WriteCSR(state, MSTATUS, 7, 7, 1);
    WriteCSR(state, MSTATUS, 11, 12, 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x3
popq %rsi
callq 0x2a13
movq 0x1a10(%rbx), %rax
movq %rax, (%rbx)
movq 0x1808(%rbx), %rax
movl %eax, %ecx
shrl $0xb, %ecx
andb $0x3, %cl
movb %cl, 0x8148(%rbx)
movq %rax, %rcx
andq $-0x1889, %rcx          # imm = 0xE777
shrl $0x4, %eax
andl $0x8, %eax
addq %rcx, %rax
addq $0x80, %rax
movq %rax, 0x1808(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/cpu.c
// Function: ExecSret
void ExecSret(State *state, uint32_t instr) {
    // printf("sret: mode: %d, pc: 0x%llx, sepc: 0x%llx, sstatus: %llx\n", state->mode, state->pc, state->csr[SEPC], state->csr[SSTATUS]);
    if (!Require(state, SUPERVISOR)) {
        return;
    }
    state->pc = state->csr[SEPC];
    state->mode = ReadCSR(state, SSTATUS, 8, 8);
    uint64_t spie = ReadCSR(state, SSTATUS, 5, 5);
    WriteCSR(state, SSTATUS, 1, 1, spie);
    WriteCSR(state, SSTATUS, 5, 5, 1);
    WriteCSR(state, SSTATUS, 8, 8, 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x1
popq %rsi
callq 0x2a13
testb %al, %al
je 0x4cd2
movq 0xa10(%rbx), %rax
movq %rax, (%rbx)
movq 0x808(%rbx), %rax
movl %eax, %ecx
shrl $0x8, %ecx
andb $0x1, %cl
movb %cl, 0x8148(%rbx)
movq %rax, %rcx
andq $-0x123, %rcx           # imm = 0xFEDD
shrl $0x4, %eax
andl $0x2, %eax
addq %rcx, %rax
addq $0x20, %rax
movq %rax, 0x808(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/cpu.c
// Function: ExecLrw
void ExecLrw(State *state, uint32_t instr) {
    uint8_t rd = instr >> 7 & SetNBits(5);
    uint8_t rs1 = instr >> 15 & SetNBits(5);
    uint8_t rl = instr >> 25 & SetNBits(1);
    uint8_t aq = instr >> 26 & SetNBits(1);

    state->x[rd] = Sext(Read32(state, state->x[rs1]), 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 $0xc, %eax
movl $0xf8, %r15d
andl %r15d, %eax
movq 0x8008(%rdi,%rax), %rsi
callq 0x2078
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_O2/hobo0xcc[P]rve/src/cpu.c
// Function: ExecAmoaddd
void ExecAmoaddd(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);
    uint8_t rl = instr >> 25 & SetNBits(1);
    uint8_t aq = instr >> 26 & SetNBits(1);

    int64_t t = Read64(state, state->x[rs1]);
    Write64(state, state->x[rs1], (uint64_t)(t + state->x[rs2]));
    state->x[rd] = t;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %r13d
shrl $0xc, %r13d
movl $0xf8, %r12d
andl %r12d, %r13d
movq 0x8008(%rdi,%r13), %rsi
callq 0x2044
movq %rax, %r15
movq 0x8008(%r14,%r13), %rsi
movl %ebx, %eax
shrl $0x11, %eax
andl %r12d, %eax
movq 0x8008(%r14,%rax), %rdx
addq %r15, %rdx
movq %r14, %rdi
callq 0x29dd
shrl $0x4, %ebx
andl %r12d, %ebx
movq %r15, 0x8008(%r14,%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/cpu.c
// Function: ExecScd
void ExecScd(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);
    uint8_t rl = instr >> 25 & SetNBits(1);
    uint8_t aq = instr >> 26 & SetNBits(1);

    int64_t t = Read64(state, state->x[rs1]);
    Write64(state, state->x[rs1], (uint64_t)(state->x[rs2]));
    state->x[rd] = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %r15d
shrl $0xc, %r15d
movl $0xf8, %r12d
andl %r12d, %r15d
movq 0x8008(%rdi,%r15), %rsi
callq 0x2044
movq 0x8008(%r14,%r15), %rsi
movl %ebx, %eax
shrl $0x11, %eax
andl %r12d, %eax
movq 0x8008(%r14,%rax), %rdx
movq %r14, %rdi
callq 0x29dd
shrl $0x4, %ebx
andl %r12d, %ebx
andq $0x0, 0x8008(%r14,%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/cutils.c
// Function: CreateVec
Vec *CreateVec() {
    Vec *v = malloc(sizeof(Vec));
    v->cap = sizeof(void *);
    v->len = 0;
    v->data = malloc(sizeof(void *));
    return v;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
pushq $0x10
popq %rdi
callq 0x1150
movq %rax, %rbx
movq $0x8, (%rax)
pushq $0x8
popq %rdi
callq 0x1150
movq %rax, 0x8(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/cutils.c
// Function: GrowVec
void GrowVec(Vec *v, int n) {
    int size = (v->len + n) * sizeof(void *);
    if (v->cap >= size)
        return;

    while (v->cap < size)
        v->cap *= 2;
    v->data = realloc(v->data, v->cap);
    if (v->data == NULL)
        Error("Failed to allocate memory");
}

// Assembly:
addl 0x4(%rdi), %esi
shll $0x3, %esi
movl (%rdi), %eax
cmpl %esi, %eax
jge 0x5b01
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl %esi, %eax
jge 0x5ae5
addl %eax, %eax
movl %eax, (%rbx)
jmp 0x5adb
movq 0x8(%rbx), %rdi
movslq %eax, %rsi
callq 0x1170
movq %rax, 0x8(%rbx)
testq %rax, %rax
leaq 0x8(%rsp), %rsp
popq %rbx
popq %rbp
je 0x5b02
retq
leaq 0x1a45(%rip), %rdi      # 0x754e
xorl %eax, %eax
jmp 0x5ca8
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/cutils.c
// Function: SetVec
void SetVec(Vec *v, int idx, void *item) {
    if (v->len <= idx || idx < 0) {
        Error("Index out of range in SetVec: %d", idx);
    }

    free(v->data[idx]);
    v->data[idx] = item;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %r15d
movq %rdi, %r14
testl %esi, %esi
js 0x5b90
cmpl %r15d, 0x4(%r14)
jg 0x5ba1
leaq 0x19ef(%rip), %rdi      # 0x7586
movl %r15d, %esi
xorl %eax, %eax
callq 0x5ca8
movq 0x8(%r14), %rax
movslq %r15d, %r15
movq (%rax,%r15,8), %rdi
callq 0x1040
movq 0x8(%r14), %rax
movq %rbx, (%rax,%r15,8)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/elf.c
// Function: LoadElf
uint64_t LoadElf(State *state, size_t size, uint8_t *bin) {
    Elf64_Ehdr *ehdr = (Elf64_Ehdr *)bin;

    if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG)) {
        Error("Not an ELF file");
    } else if (ehdr->e_type != ET_EXEC) {
        Error("Not an executable ELF file");
    }

    uint64_t sh_size = sizeof(Elf64_Shdr);
    Elf64_Shdr *shstrtab =
        (Elf64_Shdr *)(bin + ehdr->e_shoff + (sh_size * ehdr->e_shstrndx));

    char *strtab = (char *)(bin + shstrtab->sh_offset);

    uint64_t text_addr;
    bool tohost;
    for (uint64_t i = 0; i < sh_size * ehdr->e_shnum; i += sh_size) {
        Elf64_Shdr *shdr = (Elf64_Shdr *)(bin + ehdr->e_shoff + i);
        if (shdr->sh_type == SHT_PROGBITS) {
            uint64_t virtual_addr = shdr->sh_addr;
            if (virtual_addr == 0)
                continue;

            uint8_t *text = (uint8_t *)(bin + shdr->sh_offset);
            size_t text_size = shdr->sh_size;
            char *name = (strtab + shdr->sh_name);
            printf("%s: 0x%llx\n", name, virtual_addr);
            if (!strcmp(name, ".text")) {
                text_addr = virtual_addr;
            }

            LoadBinaryIntoMemory(state, text, text_size, virtual_addr - DRAM_BASE);
        }
    }

    return ehdr->e_entry;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rdi, -0x38(%rbp)
cmpl $0x464c457f, (%rdx)     # imm = 0x464C457F
je 0x5bed
leaq 0x19c1(%rip), %rdi      # 0x75ac
jmp 0x5bfb
cmpw $0x2, 0x10(%rbx)
je 0x5c02
leaq 0x19c1(%rip), %rdi      # 0x75bc
xorl %eax, %eax
callq 0x5ca8
movq 0x28(%rbx), %rax
addq %rbx, %rax
movzwl 0x3e(%rbx), %ecx
shll $0x6, %ecx
movq 0x18(%rcx,%rax), %rax
addq %rbx, %rax
movq %rax, -0x30(%rbp)
leaq 0x20(%rbx), %r15
xorl %r14d, %r14d
movzwl 0x3c(%rbx), %eax
shll $0x6, %eax
cmpq %rax, %r14
jae 0x5c92
movq 0x28(%rbx), %rax
addq %r15, %rax
cmpl $0x1, -0x1c(%r14,%rax)
jne 0x5c8c
movq -0x10(%r14,%rax), %r12
testq %r12, %r12
je 0x5c8c
movq -0x8(%r14,%rax), %r13
addq %rbx, %r13
movq (%r14,%rax), %rdx
movq %rdx, -0x40(%rbp)
movl -0x20(%rax,%r14), %esi
addq -0x30(%rbp), %rsi
leaq 0x196f(%rip), %rdi      # 0x75d7
movq %r12, %rdx
xorl %eax, %eax
callq 0x10b0
addq $-0x80000000, %r12      # imm = 0x80000000
movq -0x38(%rbp), %rdi
movq %r13, %rsi
movq -0x40(%rbp), %rdx
movq %r12, %rcx
callq 0x5ec4
addq $0x40, %r14
jmp 0x5c23
movq 0x18(%rbx), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/main.c
// Function: Error
void Error(const char *fmt, ...) {
    va_list ap;
    va_start(ap, fmt);
    fprintf(stderr, "Error: ");
    vfprintf(stderr, fmt, ap);
    fprintf(stderr, "\n");
    va_end(ap);
    exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
leaq -0xe0(%rbp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x5d03
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
leaq -0x30(%rbp), %r14
movq %rdi, 0x10(%r14)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%r14)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%r14)
movq 0x62d1(%rip), %r15      # 0xbff8
movq (%r15), %rcx
leaq 0x18b2(%rip), %rdi      # 0x75e3
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
callq 0x11c0
movq (%r15), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1190
movq (%r15), %rsi
pushq $0xa
popq %rdi
callq 0x10f0
pushq $0x1
popq %rdi
callq 0x11b0
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/main.c
// Function: NewUart
Uart *NewUart() {
    Uart *uart = calloc(1, sizeof(Uart));
    WINDOW *w = initscr();
    cbreak();
    nodelay(w, true);
    noecho();
    scrollok(w, true);
    uart->lsr |= 0x20;
    return uart;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
pushq $0x1
popq %rdi
movl $0x10b, %esi            # imm = 0x10B
callq 0x1100
movq %rax, %rbx
callq 0x10d0
movq %rax, %r14
callq 0x1140
pushq $0x1
popq %r15
movq %r14, %rdi
movl %r15d, %esi
callq 0x1030
callq 0x10a0
movq %r14, %rdi
movl %r15d, %esi
callq 0x1050
movb $0x20, 0x6(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/main.c
// Function: NewVirtio
Virtio *NewVirtio() {
    Virtio *virtio = calloc(1, sizeof(Virtio));
    virtio->queue_align = 0x1000;
    virtio->queue_notify = 0x1234;
    return virtio;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq $0x1
popq %rdi
pushq $0x48
popq %rsi
callq 0x1100
movl $0x1000, 0x14(%rax)     # imm = 0x1000
movl $0x1234, 0x1c(%rax)     # imm = 0x1234
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/main.c
// Function: ResetState
void ResetState(State *state) {
    memset(state->x, 0, sizeof(state->x));
    state->pc = 0;
    state->excepted = false;
    state->exception_code = 0;
    memset(state->csr, 0, sizeof(state->csr));
    state->mode = MACHINE;
    state->uart = NewUart();
    state->clint = NewClint();
    state->plic = NewPlic();
    state->virtio = NewVirtio();
    WriteCSR(state, SSTATUS, 32, 33, 2);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb $0x0, 0x8138(%rdi)
andq $0x0, 0x8140(%rdi)
movl $0x8108, %edx           # imm = 0x8108
xorl %esi, %esi
callq 0x10e0
movb $0x3, 0x8148(%rbx)
callq 0x5d5d
movq %rax, 0x8118(%rbx)
callq 0x5db5
movq %rax, 0x8120(%rbx)
callq 0x5dd3
movq %rax, 0x8128(%rbx)
callq 0x5dec
movq %rax, 0x8130(%rbx)
pushq $0x20
popq %rdx
pushq $0x21
popq %rcx
pushq $0x2
popq %r8
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x14c3
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/main.c
// Function: ReadBinaryFile
size_t ReadBinaryFile(const char *name, uint8_t **buf) {
    FILE *fp = fopen(name, "rb");
    if (fp == NULL) {
        Error("Can't open the file: %s.", name);
    }

    fseek(fp, 0, SEEK_END);
    size_t size = ftell(fp);
    fseek(fp, 0, SEEK_SET);

    uint8_t *result = malloc(size);
    fread(result, size, 1, fp);
    *buf = result;
    fclose(fp);
    return size;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x16fb(%rip), %rsi      # 0x75eb
callq 0x1180
testq %rax, %rax
je 0x5f54
movq %rax, %r14
pushq $0x2
popq %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x1160
movq %r14, %rdi
callq 0x1120
movq %rax, %r15
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1160
movq %r15, %rdi
callq 0x1150
movq %rax, %r12
pushq $0x1
popq %rdx
movq %rax, %rdi
movq %r15, %rsi
movq %r14, %rcx
callq 0x1070
movq %r12, (%rbx)
movq %r14, %rdi
callq 0x1090
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1693(%rip), %rdi      # 0x75ee
movq %r15, %rsi
xorl %eax, %eax
callq 0x5ca8
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/main.c
// Function: CPUMain
void CPUMain(State *state, uint64_t start_addr, size_t code_size,
             bool is_debug) {
    uint64_t count = 0;
    state->pc = start_addr;
    for (;;) {
        uint64_t bpc = state->pc;
        count++;
        if (is_debug && count >= 10000)
            return;
        
        // printf("pc: %llx\n", state->pc);
        Tick(state);
        if (state->pc == 0) {
            // printf("pc: %llx -> 0, sp: %llx\n", Translate(state, bpc, AccessInstruction), state->x[2]);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdi, %r14
movq %rsi, (%rdi)
pushq $0x1
popq %r15
cmpq $0x2710, %r15           # imm = 0x2710
setae %al
testb %al, %bl
jne 0x5f96
movq %r14, %rdi
callq 0x1998
incq %r15
jmp 0x5f7b
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/hobo0xcc[P]rve/src/main.c
// Function: main
int main(int argc, char **argv) {
    if (argc < 2) {
        Error("Missing argument, at least 1 argument required.");
    }

    int prog_name_idx = 1;
    bool is_debug = false;
    if (!strcmp(argv[1], "--debug")) {
        is_debug = true;
        prog_name_idx++;
    } else if (!strcmp(argv[1], "--test")) {
        RunTest();
        return 0;
    }

    uint8_t *bin;
    size_t size = ReadBinaryFile(argv[prog_name_idx++], &bin);
    State *state = NewState(0x9000000/*0x7A12000*/);
    ResetState(state);

    if (argc > prog_name_idx && !strcmp(argv[prog_name_idx], "--disk")) {
        char *name = argv[++prog_name_idx];
        uint8_t *data;
        ReadBinaryFile(name, &data);
        SetDisk(state, data);
        prog_name_idx += 2;
    }

    uint64_t addr = LoadElf(state, size, bin);

    state->x[1] = (uint64_t)(-2);

    CPUMain(state, addr, size, is_debug);

    PrintRegisters(state, is_debug);
    int32_t result;
    result = state->x[10];

    free(bin);
    free(state->mem);
    free(state);
    return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpl $0x1, %edi
jle 0x6148
movq %rsi, %rbx
movl %edi, %r12d
movq 0x8(%rsi), %r15
leaq 0x161e(%rip), %rsi      # 0x764d
movq %r15, %rdi
callq 0x1110
movl %eax, %r14d
testl %eax, %eax
je 0x6059
leaq 0x1610(%rip), %rsi      # 0x7655
movq %r15, %rdi
callq 0x1110
testl %eax, %eax
je 0x612e
pushq $0x1
jmp 0x605b
pushq $0x2
popq %r13
movl %r13d, %eax
incl %r13d
movq %rax, -0x30(%rbp)
movq (%rbx,%rax,8), %rdi
leaq -0x40(%rbp), %rsi
callq 0x5ed8
movq %rax, -0x38(%rbp)
movl $0x9000000, %edi        # imm = 0x9000000
callq 0x5e0b
movq %rax, %r15
movq %rax, %rdi
callq 0x5e4c
cmpl %r12d, %r13d
jae 0x60cc
movl %r13d, %eax
movq (%rbx,%rax,8), %rdi
leaq 0x15bc(%rip), %rsi      # 0x765c
callq 0x1110
testl %eax, %eax
jne 0x60cc
movq -0x30(%rbp), %rax
movq 0x10(%rbx,%rax,8), %rdi
leaq -0x48(%rbp), %rbx
movq %rbx, %rsi
callq 0x5ed8
movq (%rbx), %rax
movq 0x8130(%r15), %rcx
movq %rax, 0x40(%rcx)
xorl %ebx, %ebx
testl %r14d, %r14d
sete %bl
movq -0x40(%rbp), %r14
movq %r15, %rdi
movq -0x38(%rbp), %rsi
movq %r14, %rdx
callq 0x5bc4
movq $-0x2, 0x8010(%r15)
movq %r15, %rdi
movq %rax, %rsi
movl %ebx, %ecx
callq 0x5f65
movq %r15, %rdi
xorl %esi, %esi
callq 0x5fa1
movl 0x8058(%r15), %ebx
movq %r14, %rdi
callq 0x1040
movq 0x8108(%r15), %rdi
callq 0x1040
movq %r15, %rdi
callq 0x1040
jmp 0x6137
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x61c9
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x14ce(%rip), %rdi      # 0x761d
xorl %eax, %eax
callq 0x5ca8
nop
// File: /workspace/github_c_makefile_star2_O2/ukontainer[P]sqlite-bench/benchmark.c
// Function: benchmark_init
void benchmark_init() {
  db_ = NULL;
  db_num_ = 0;
  num_ = FLAGS_num;
  reads_ = FLAGS_reads < 0 ? FLAGS_num : FLAGS_reads;
  bytes_ = 0;
  rand_gen_init(&gen_, FLAGS_compression_ratio);
  rand_init(&rand_, 301);;

  struct dirent* ep;
  DIR* test_dir = opendir(FLAGS_db);
  if (!FLAGS_use_existing_db) {
    while ((ep = readdir(test_dir)) != NULL) {
      if (starts_with(ep->d_name, "dbbench_sqlite3")) {
        char file_name[1000];
        strcpy(file_name, FLAGS_db);
        strcat(file_name, ep->d_name);
        remove(file_name);
      }
    }
  }
  closedir(test_dir);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3f0, %rsp            # imm = 0x3F0
andq $0x0, 0x195ab0(%rip)    # 0x5977f0
andl $0x0, 0x195ab1(%rip)    # 0x5977f8
movq $0x597848, %rax         # imm = 0x597848
movl (%rax), %eax
movq $0x59784c, %rcx         # imm = 0x59784C
movl (%rcx), %ecx
testl %ecx, %ecx
cmovsl %eax, %ecx
andq $0x0, 0x195aa2(%rip)    # 0x597808
movl %eax, 0x195a90(%rip)    # 0x5977fc
movl %ecx, 0x195a8e(%rip)    # 0x597800
movq $0x597858, %rax         # imm = 0x597858
movsd (%rax), %xmm0
leaq 0x195a8c(%rip), %rdi    # 0x597810
callq 0x4039de
leaq 0x195a98(%rip), %rdi    # 0x597828
movl $0x12d, %esi            # imm = 0x12D
callq 0x403990
movq $0x597870, %r13         # imm = 0x597870
movq (%r13), %rdi
callq 0x4d2150
movq %rax, %rbx
movq $0x597868, %rax         # imm = 0x597868
cmpb $0x0, (%rax)
je 0x401dd2
movq %rbx, %rdi
callq 0x4d2380
addq $0x3f0, %rsp            # imm = 0x3F0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x1362aa(%rip), %r14    # 0x538083
movq %rsp, %r15
movq %rbx, %rdi
callq 0x4d23b0
testq %rax, %rax
je 0x401db9
movq %rax, %r12
addq $0x13, %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x46ad77
testb %al, %al
je 0x401ddc
movq (%r13), %rsi
movq %r15, %rdi
callq 0x401020
movq %r15, %rdi
movq %r12, %rsi
callq 0x401068
movq %r15, %rdi
callq 0x475010
jmp 0x401ddc
// File: /workspace/github_c_makefile_star2_O2/ukontainer[P]sqlite-bench/benchmark.c
// Function: start
static void start() {
  start_ =  now_micros() * 1e-6;
  bytes_ = 0;
  message_ = malloc(sizeof(char) * 10000);
  strcpy(message_, "");
  last_op_finish_ = start_;
  histogram_clear(&hist_);
  raw_clear(&raw_);
  done_ = 0;
  next_report_ = 100;
}

// Assembly:
subq $0x18, %rsp
callq 0x46ad54
movq %rax, %xmm0
punpckldq 0x1357f8(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x135800(%rip), %xmm0   # 0x538020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x1357fc(%rip), %xmm1   # 0x538030
movapd %xmm1, (%rsp)
movsd %xmm1, 0x194ff7(%rip)   # 0x597838
andq $0x0, 0x194fbf(%rip)    # 0x597808
movl $0x2710, %edi           # imm = 0x2710
callq 0x495830
movq %rax, 0x194fd6(%rip)    # 0x597830
movb $0x0, (%rax)
movaps (%rsp), %xmm0
movsd %xmm0, 0x194a67(%rip)   # 0x5972d0
leaq 0x194a68(%rip), %rdi    # 0x5972d8
callq 0x402e54
leaq 0x194f54(%rip), %rdi    # 0x5977d0
callq 0x403b84
andl $0x0, 0x194f60(%rip)    # 0x5977e8
movl $0x64, 0x194f5a(%rip)   # 0x5977ec
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/ukontainer[P]sqlite-bench/benchmark.c
// Function: exec_error_check
inline
static void exec_error_check(int status, char *err_msg) {
  if (status != SQLITE_OK) {
    fprintf(stderr, "SQL error: %s\n", err_msg);
    sqlite3_free(err_msg);
    exit(1);
  }
}

// Assembly:
testl %edi, %edi
jne 0x402df9
retq
pushq %rbx
movq %rsi, %rbx
movq $0x5956a8, %rax         # imm = 0x5956A8
movq (%rax), %rdi
leaq 0x1356a4(%rip), %rsi    # 0x5384b2
movq %rbx, %rdx
xorl %eax, %eax
callq 0x474dd0
movq %rbx, %rdi
callq 0x404c6c
pushq $0x1
popq %rdi
callq 0x4742a0
// File: /workspace/github_c_makefile_star2_O2/ukontainer[P]sqlite-bench/histogram.c
// Function: histogram_clear
void histogram_clear(Histogram* hist_) {
  hist_->min_ = bucket_limit[kNumBuckets - 1];
  hist_->max_ = 0;
  hist_->num_ = 0;
  hist_->sum_ = 0;
  hist_->sum_squares_ = 0;
  for (int i = 0; i < kNumBuckets; i++) {
    hist_->buckets_[i] = 0;
  }
}

// Assembly:
movabsq $0x6974e718d7d7625a, %rax # imm = 0x6974E718D7D7625A
movq %rax, (%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movups %xmm0, 0x18(%rdi)
pushq $0x5
popq %rax
cmpq $0x9f, %rax
je 0x402e81
andq $0x0, (%rdi,%rax,8)
incq %rax
jmp 0x402e6f
retq
// File: /workspace/github_c_makefile_star2_O2/ukontainer[P]sqlite-bench/histogram.c
// Function: histogram_add
void histogram_add(Histogram* hist_, double value) {
  int b = 0;
  while (b < kNumBuckets - 1 && bucket_limit[b] <= value) {
    b++;
  }
  hist_->buckets_[b] += 1.0;
  if (hist_->min_ > value) hist_->min_ = value;
  if (hist_->max_ < value) hist_->max_ = value;
  hist_->num_++;
  hist_->sum_ += value;
  hist_->sum_squares_ += (value * value);
}

// Assembly:
xorl %eax, %eax
leaq 0x135685(%rip), %rcx    # 0x538510
cmpq $0x4c8, %rax            # imm = 0x4C8
je 0x402ea0
ucomisd (%rax,%rcx), %xmm0
jb 0x402ea0
addq $0x8, %rax
jmp 0x402e8b
movsd 0x28(%rdi,%rax), %xmm1
addsd 0x135632(%rip), %xmm1   # 0x5384e0
movsd %xmm1, 0x28(%rdi,%rax)
movsd (%rdi), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x402ec2
movsd %xmm0, (%rdi)
ucomisd 0x8(%rdi), %xmm0
jbe 0x402ece
movsd %xmm0, 0x8(%rdi)
movupd 0x10(%rdi), %xmm1
movapd 0x135625(%rip), %xmm2   # 0x538500
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
addpd %xmm1, %xmm2
movupd %xmm2, 0x10(%rdi)
mulsd %xmm0, %xmm0
addsd 0x20(%rdi), %xmm0
movsd %xmm0, 0x20(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/ukontainer[P]sqlite-bench/histogram.c
// Function: histogram_merge
void histogram_merge(Histogram* hist_, const Histogram* other_) {
  if (other_->min_ < hist_->min_) hist_->min_ = other_->min_;
  if (other_->max_ > hist_->max_) hist_->max_ = other_->max_;
  hist_->num_ += other_->num_;
  hist_->sum_ += other_->sum_;
  hist_->sum_squares_ += other_->sum_squares_;
  for (int b = 0; b < kNumBuckets; b++) {
    hist_->buckets_[b] += other_->buckets_[b];
  }
}

// Assembly:
movsd (%rsi), %xmm0
movsd (%rdi), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x402f09
movsd %xmm0, (%rdi)
movsd 0x8(%rsi), %xmm0
ucomisd 0x8(%rdi), %xmm0
jbe 0x402f1a
movsd %xmm0, 0x8(%rdi)
movupd 0x10(%rsi), %xmm0
movupd 0x10(%rdi), %xmm1
addpd %xmm0, %xmm1
movupd %xmm1, 0x10(%rdi)
movsd 0x20(%rsi), %xmm0
addsd 0x20(%rdi), %xmm0
movsd %xmm0, 0x20(%rdi)
pushq $0x5
popq %rax
cmpq $0x9f, %rax
je 0x402f5b
movsd (%rsi,%rax,8), %xmm0
addsd (%rdi,%rax,8), %xmm0
movsd %xmm0, (%rdi,%rax,8)
incq %rax
jmp 0x402f3f
retq
// File: /workspace/github_c_makefile_star2_O2/ukontainer[P]sqlite-bench/random.c
// Function: rand_init
void rand_init(Random* rand_, uint32_t s) {
  rand_->seed_ = s & 0x7fffffffu;
  /* Avoid bad seeds. */
  if (rand_->seed_ == 0 || rand_->seed_ == 2147483647L) {
    rand_->seed_ = 1;
  }
}

// Assembly:
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl %eax, %esi
movl %esi, (%rdi)
cmpl %eax, %esi
je 0x4039a1
testl %esi, %esi
jne 0x4039a7
movl $0x1, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/ukontainer[P]sqlite-bench/random.c
// Function: rand_gen_init
void rand_gen_init(RandomGenerator* gen_, double compression_ratio) {
  Random rnd;
  char* piece;
  
  gen_->data_ = malloc(sizeof(char) * 1048576);
  gen_->data_size_ = 0;
  gen_->pos_ = 0;
  (gen_->data_)[0] = '\0';

  rand_init(&rnd, 301);
  while (gen_->data_size_ < 1048576) {
    piece = compressible_string(&rnd, compression_ratio, 100);
    strcat(gen_->data_, piece);
    gen_->data_size_ += strlen(piece);
  }

  free(piece);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movsd %xmm0, 0x8(%rsp)
movq %rdi, %rbx
movl $0x100000, %edi         # imm = 0x100000
callq 0x495830
movq %rax, (%rbx)
andq $0x0, 0x8(%rbx)
movq %rbx, 0x10(%rsp)
andl $0x0, 0x10(%rbx)
movb $0x0, (%rax)
movsd 0x8(%rsp), %xmm0
mulsd 0x134acf(%rip), %xmm0   # 0x5384f0
cvttsd2si %xmm0, %eax
cmpl $0x2, %eax
pushq $0x1
popq %r14
cmovgel %eax, %r14d
leal 0x1(%r14), %eax
movq %rax, 0x8(%rsp)
movl $0x12d, %ebp            # imm = 0x12D
pushq $0x5f
popq %rbx
xorl %eax, %eax
cmpq $0xfffff, %rax          # imm = 0xFFFFF
ja 0x403af9
movq 0x8(%rsp), %rdi
callq 0x495830
movq %rax, %r12
xorl %ecx, %ecx
cmpq %rcx, %r14
je 0x403a98
movl %ebp, %eax
imulq $0x41a7, %rax, %rax     # imm = 0x41A7
movq %rax, %rdx
shrq $0x1f, %rdx
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
leal (%rdx,%rax), %ebp
addl $0x80000001, %ebp       # imm = 0x80000001
addl %eax, %edx
cmovnsl %edx, %ebp
movl %ebp, %eax
xorl %edx, %edx
divl %ebx
addb $0x20, %dl
movb %dl, (%r12,%rcx)
incq %rcx
jmp 0x403a5e
xorl %ebx, %ebx
movb %bl, (%r12,%r14)
movq %r12, %rdi
callq 0x401100
movq %rax, %r15
pushq $0x65
popq %rdi
callq 0x495830
movq %rax, %r13
movb %bl, (%rax)
xorl %ebx, %ebx
movslq %ebx, %rbx
cmpq $0x63, %rbx
ja 0x403ad1
movq %r13, %rdi
movq %r12, %rsi
callq 0x401068
addq %r15, %rbx
jmp 0x403ab8
movq 0x10(%rsp), %rbx
movq (%rbx), %rdi
movq %r13, %rsi
callq 0x401068
movq %r13, %rdi
callq 0x401100
addq 0x8(%rbx), %rax
movq %rax, 0x8(%rbx)
pushq $0x5f
popq %rbx
jmp 0x403a43
movq %r13, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x495b70