LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCJalr
void ExecCJalr(State *state, uint16_t instr) {
    uint8_t rs1 = (instr >> 7) & SetNBits(5);

    int64_t t = state->pc + 2;
    state->pc = state->x[rs1];
    state->x[1] = t;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
shrl $0x7, %esi
andl $0x1f, %esi
movq (%rdi), %rax
addq $0x2, %rax
movq 0x8008(%rdi,%rsi,8), %rcx
movq %rcx, (%rdi)
movq %rax, 0x8010(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x57ea
cmpl $0x3, %eax
je 0x57e3
cmpl $0x1, %eax
jne 0x57f8
movl $0x9, %eax
jmp 0x57ef
movl $0xb, %eax
jmp 0x57ef
movl $0x8, %eax
movq %rax, 0x8140(%rdi)
jmp 0x57ff
movb $0x0, 0x8138(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x2d22(%rip), %rdi      # 0x854a
callq 0x1060
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6e91
movl 0x8058(%rbx), %edi
callq 0x11b0
// File: /workspace/github_c_makefile_star2_O1/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
cmpb $0x3, 0x8148(%rdi)
je 0x5861
movb $0x1, 0x8138(%rdi)
movq $0x2, 0x8140(%rdi)
movq 0x1a10(%rdi), %rax
movq %rax, (%rdi)
movq 0x1808(%rdi), %rax
movl %eax, %ecx
shrl $0xb, %ecx
andb $0x3, %cl
movb %cl, 0x8148(%rdi)
movq %rax, %rcx
andq $-0x1889, %rcx          # imm = 0xE777
shrl $0x4, %eax
andl $0x8, %eax
addq %rcx, %rax
addq $0x80, %rax
movq %rax, 0x1808(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
movzbl 0x8148(%rdi), %eax
orl $0x2, %eax
cmpl $0x3, %eax
jne 0x58f4
movq 0xa10(%rdi), %rax
movq %rax, (%rdi)
movq 0x808(%rdi), %rax
movl %eax, %ecx
shrl $0x8, %ecx
andb $0x1, %cl
movb %cl, 0x8148(%rdi)
movq %rax, %rcx
andq $-0x123, %rcx           # imm = 0xFEDD
shrl $0x4, %eax
andl $0x2, %eax
addq %rcx, %rax
addq $0x20, %rax
movq %rax, 0x808(%rdi)
jmp 0x5906
movb $0x1, 0x8138(%rdi)
movq $0x2, 0x8140(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCsrrw
void ExecCsrrw(State *state, uint32_t instr) {
    uint8_t rd = instr >> 7 & SetNBits(5);
    uint8_t rs1 = instr >> 15 & SetNBits(5);
    uint32_t csr = instr >> 20 & SetNBits(12);

    int64_t t = state->csr[csr];
    state->csr[csr] = state->x[rs1];
    state->x[rd] = t;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0x14, %eax
movq 0x8(%rdi,%rax,8), %rcx
movl %esi, %edx
shrl $0xc, %edx
movl $0xf8, %r8d
andl %r8d, %edx
movq 0x8008(%rdi,%rdx), %rdx
movq %rdx, 0x8(%rdi,%rax,8)
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: ExecCsrrwi
void ExecCsrrwi(State *state, uint32_t instr) {
    uint8_t rd = instr >> 7 & SetNBits(5);
    uint8_t zimm = instr >> 15 & SetNBits(5);
    uint32_t csr = instr >> 20 & SetNBits(12);

    state->x[rd] = state->csr[csr];
    state->csr[csr] = zimm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0xf, %eax
andl $0x1f, %eax
movl %esi, %ecx
shrl $0x14, %ecx
movq 0x8(%rdi,%rcx,8), %rdx
shrl $0x4, %esi
andl $0xf8, %esi
movq %rdx, 0x8008(%rdi,%rsi)
movq %rax, 0x8(%rdi,%rcx,8)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecCsrrsi
void ExecCsrrsi(State *state, uint32_t instr) {
    uint8_t rd = instr >> 7 & SetNBits(5);
    uint8_t zimm = instr >> 15 & SetNBits(5);
    uint32_t csr = instr >> 20 & SetNBits(12);

    int64_t t = state->csr[csr];
    state->csr[csr] = t | zimm;
    state->x[rd] = t;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
shrl $0xf, %eax
andl $0x1f, %eax
movl %esi, %ecx
shrl $0x14, %ecx
movq 0x8(%rdi,%rcx,8), %rdx
orq %rdx, %rax
movq %rax, 0x8(%rdi,%rcx,8)
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: ExecAmoaddw
void ExecAmoaddw(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 = Sext(Read32(state, state->x[rs1]), 31);
    Write32(state, state->x[rs1], (uint32_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, %r12d
shrl $0xc, %r12d
movl $0xf8, %r15d
andl %r15d, %r12d
movq 0x8008(%rdi,%r12), %rsi
callq 0x229e
movl %eax, %ecx
movabsq $-0x100000000, %r13     # imm = 0xFFFFFFFF00000000
orq %rcx, %r13
testl %eax, %eax
cmovnsq %rcx, %r13
movq 0x8008(%r14,%r12), %rsi
movl %ebx, %eax
shrl $0x11, %eax
andl %r15d, %eax
movl 0x8008(%r14,%rax), %edx
addl %r13d, %edx
movq %r14, %rdi
callq 0x2d33
shrl $0x4, %ebx
andl %r15d, %ebx
movq %r13, 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_O1/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 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: ExecAmominw
void ExecAmominw(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 = Sext(Read32(state, state->x[rs1]), 31);
    if (t < state->x[rs2]) {
        Write32(state, state->x[rs1], (uint32_t)t);
    } else {
        Write32(state, state->x[rs1], (uint32_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, %r12d
shrl $0xc, %r12d
movl $0xf8, %r15d
andl %r15d, %r12d
movq 0x8008(%rdi,%r12), %rsi
callq 0x229e
movl %eax, %ecx
movabsq $-0x100000000, %r13     # imm = 0xFFFFFFFF00000000
orq %rcx, %r13
testl %eax, %eax
cmovnsq %rcx, %r13
movl %ebx, %eax
shrl $0x11, %eax
andl %r15d, %eax
movq 0x8008(%r14,%rax), %rdx
movq 0x8008(%r14,%r12), %rsi
cmpq %rdx, %r13
cmovlq %r13, %rdx
movq %r14, %rdi
callq 0x2d33
shrl $0x4, %ebx
andl %r15d, %ebx
movq %r13, 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_O1/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 0x223f
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 0x2d88
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_O1/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 0x223f
movq 0x8008(%r14,%r15), %rsi
movl %ebx, %eax
shrl $0x11, %eax
andl %r12d, %eax
movq 0x8008(%r14,%rax), %rdx
movq %r14, %rdi
callq 0x2d88
shrl $0x4, %ebx
andl %r12d, %ebx
movq $0x0, 0x8008(%r14,%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/cpu.c
// Function: ExecAmomind
void ExecAmomind(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]);
    if (t < state->x[rs2]) {
        Write64(state, state->x[rs1], (uint64_t)t);
    } else {
        Write64(state, state->x[rs1], (uint64_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 0x223f
movq %rax, %r15
movl %ebx, %eax
shrl $0x11, %eax
andl %r12d, %eax
movq 0x8008(%r14,%rax), %rdx
movq 0x8008(%r14,%r13), %rsi
cmpq %rdx, %r15
cmovlq %r15, %rdx
movq %r14, %rdi
callq 0x2d88
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_O1/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
movl $0x10, %edi
callq 0x1150
movq %rax, %rbx
movq $0x8, (%rax)
movl $0x8, %edi
callq 0x1150
movq %rax, 0x8(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
cmpl %esi, (%rdi)
jge 0x69bf
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl (%rdi), %eax
cmpl %esi, %eax
jge 0x69a3
addl %eax, %eax
cmpl %esi, %eax
jl 0x699b
movl %eax, (%rbx)
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 0x69c0
retq
leaq 0x1b87(%rip), %rdi      # 0x854e
xorl %eax, %eax
jmp 0x6b70
// File: /workspace/github_c_makefile_star2_O1/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 0x6a50
cmpl %r15d, 0x4(%r14)
jg 0x6a61
leaq 0x1b2f(%rip), %rdi      # 0x8586
movl %r15d, %esi
xorl %eax, %eax
callq 0x6b70
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_O1/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 0x6aad
leaq 0x1b01(%rip), %rdi      # 0x85ac
jmp 0x6abb
cmpw $0x2, 0x10(%rbx)
je 0x6ac2
leaq 0x1b01(%rip), %rdi      # 0x85bc
xorl %eax, %eax
callq 0x6b70
cmpw $0x0, 0x3c(%rbx)
je 0x6b5b
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
movq 0x28(%rbx), %rax
addq %r15, %rax
cmpl $0x1, -0x1c(%r14,%rax)
jne 0x6b4b
movq -0x10(%r14,%rax), %r12
testq %r12, %r12
je 0x6b4b
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 0x1ab0(%rip), %rdi      # 0x85d7
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 0x6dae
addq $0x40, %r14
movzwl 0x3c(%rbx), %eax
shll $0x6, %eax
cmpq %rax, %r14
jb 0x6aee
movq 0x18(%rbx), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/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 0x6bcb
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 0x6409(%rip), %r15      # 0xcff8
movq (%r15), %rcx
leaq 0x19ea(%rip), %rdi      # 0x85e3
movl $0x7, %esi
movl $0x1, %edx
callq 0x11c0
movq (%r15), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1190
movq (%r15), %rsi
movl $0xa, %edi
callq 0x10f0
movl $0x1, %edi
callq 0x11b0
// File: /workspace/github_c_makefile_star2_O1/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 %r14
pushq %rbx
movl $0x1, %edi
movl $0x10b, %esi            # imm = 0x10B
callq 0x1100
movq %rax, %rbx
callq 0x10d0
movq %rax, %r14
callq 0x1140
movq %r14, %rdi
movl $0x1, %esi
callq 0x1030
callq 0x10a0
movq %r14, %rdi
movl $0x1, %esi
callq 0x1050
orb $0x20, 0x6(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
movl $0x1, %edi
movl $0x48, %esi
callq 0x1100
movl $0x1000, 0x14(%rax)     # imm = 0x1000
movl $0x1234, 0x1c(%rax)     # imm = 0x1234
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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)
movq $0x0, 0x8140(%rdi)
movl $0x8108, %edx           # imm = 0x8108
xorl %esi, %esi
callq 0x10e0
movb $0x3, 0x8148(%rbx)
callq 0x6c2d
movq %rax, 0x8118(%rbx)
movl $0x1, %edi
movl $0x18, %esi
callq 0x1100
movq %rax, 0x8120(%rbx)
movl $0x1, %edi
movl $0x1018, %esi           # imm = 0x1018
callq 0x1100
movq %rax, 0x8128(%rbx)
movl $0x1, %edi
movl $0x48, %esi
callq 0x1100
movl $0x1000, 0x14(%rax)     # imm = 0x1000
movl $0x1234, 0x1c(%rax)     # imm = 0x1234
movq %rax, 0x8130(%rbx)
movl $0x2, %r8d
movq %rbx, %rdi
movl $0x100, %esi            # imm = 0x100
movl $0x20, %edx
movl $0x21, %ecx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x14db
// File: /workspace/github_c_makefile_star2_O1/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 0x1811(%rip), %rsi      # 0x85eb
callq 0x1180
testq %rax, %rax
je 0x6e42
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
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
movl $0x1, %edx
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 0x17a5(%rip), %rdi      # 0x85ee
movq %r15, %rsi
xorl %eax, %eax
callq 0x6b70
// File: /workspace/github_c_makefile_star2_O1/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)
movl $0x2, %r15d
movq %r14, %rdi
callq 0x19e4
cmpq $0x2710, %r15           # imm = 0x2710
setae %al
andb %bl, %al
incq %r15
cmpb $0x1, %al
jne 0x6e6b
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x7069
movq %rsi, %r15
movl %edi, %r12d
movq 0x8(%rsi), %r14
leaq 0x1730(%rip), %rsi      # 0x864d
movq %r14, %rdi
callq 0x1110
movl %eax, %ebx
testl %eax, %eax
je 0x6f52
leaq 0x1723(%rip), %rsi      # 0x8655
movq %r14, %rdi
callq 0x1110
movl $0x1, %r13d
testl %eax, %eax
jne 0x6f58
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x711a
jmp 0x7058
movl $0x2, %r13d
movl %r13d, %eax
incl %r13d
movq %rax, -0x30(%rbp)
movq (%r15,%rax,8), %rdi
leaq -0x40(%rbp), %rsi
callq 0x6dc2
movq %rax, -0x38(%rbp)
movl $0x1, %edi
movl $0x8150, %esi           # imm = 0x8150
callq 0x1100
movq %rax, %r14
movl $0x1, %edi
movl $0x9000000, %esi        # imm = 0x9000000
callq 0x1100
movq %rax, 0x8108(%r14)
movq %r14, %rdi
callq 0x6d01
cmpl %r12d, %r13d
jge 0x6fe2
movl %r13d, %eax
movq (%r15,%rax,8), %rdi
leaq 0x16a6(%rip), %rsi      # 0x865c
callq 0x1110
testl %eax, %eax
jne 0x6fe2
movq -0x30(%rbp), %rax
movq 0x10(%r15,%rax,8), %rdi
leaq -0x48(%rbp), %r15
movq %r15, %rsi
callq 0x6dc2
movq (%r15), %rax
movq 0x8130(%r14), %rcx
movq %rax, 0x40(%rcx)
movq -0x40(%rbp), %r15
movq %r14, %rdi
movq -0x38(%rbp), %rsi
movq %r15, %rdx
callq 0x6a84
movq $-0x2, 0x8010(%r14)
movq %rax, (%r14)
movl $0x2, %r12d
testl %ebx, %ebx
sete %r13b
movq %r14, %rdi
callq 0x19e4
cmpq $0x2710, %r12           # imm = 0x2710
setae %al
andb %r13b, %al
incq %r12
cmpb $0x1, %al
jne 0x7009
movq %r14, %rdi
xorl %esi, %esi
callq 0x6e91
movl 0x8058(%r14), %ebx
movq %r15, %rdi
callq 0x1040
movq 0x8108(%r14), %rdi
callq 0x1040
movq %r14, %rdi
callq 0x1040
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x15ad(%rip), %rdi      # 0x861d
xorl %eax, %eax
callq 0x6b70
nop
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/test.c
// Function: mulhu
uint64_t mulhu(uint64_t a, uint64_t b)
{
  uint64_t t;
  uint32_t y1, y2, y3;
  uint64_t a0 = (uint32_t)a, a1 = a >> 32;
  uint64_t b0 = (uint32_t)b, b1 = b >> 32;

  t = a1*b0 + ((a0*b0) >> 32);
  y1 = t;
  y2 = t >> 32;

  t = a0*b1 + y1;
  y1 = t;

  t = a1*b1 + y2 + (t >> 32);
  y2 = t;
  y3 = t >> 32;

  return ((uint64_t)y3 << 32) | y2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, %ecx
shrq $0x20, %rdi
movl %esi, %edx
shrq $0x20, %rsi
movq %rdx, %rax
imulq %rdi, %rax
imulq %rcx, %rdx
shrq $0x20, %rdx
addq %rax, %rdx
movl %edx, %eax
shrq $0x20, %rdx
imulq %rsi, %rcx
addq %rcx, %rax
imulq %rdi, %rsi
addq %rsi, %rdx
shrq $0x20, %rax
addq %rdx, %rax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/hobo0xcc[P]rve/src/test.c
// Function: RunTest
void RunTest() {
    State *state = NewState(1000);
    ResetState(state);

    state->csr[MSTATUS] = 0;
    WriteCSR(state, MSTATUS, 0, 1, 3);
    assert(state->csr[MSTATUS] == 3);

    state->csr[MSTATUS] = 0;
    WriteCSR(state, MSTATUS, 2, 2, 1);
    assert(state->csr[MSTATUS] == 4);

    state->csr[MSTATUS] = 0;
    WriteCSR(state, MSTATUS, 0, 63, 20);
    assert(ReadCSR(state, MSTATUS, 0, 4) == 20);

    Write8(state, CLINT_BASE, 0x0e);
    assert(Read8(state, CLINT_BASE) == 0x0e);

    assert(GetRange(10, 2, 3) == 2);

    state->x[1] = 0xffffffff80000000;
    state->x[2] = 0xffffffffffff8000;
    printf("a: %lld\n", mulhsu(state->x[1], state->x[2]));
    uint32_t instr = 0x0220a733;
    ExecMulhsu(state, instr);
    printf("%lld, %lld, %lld\n", state->x[1], state->x[2], state->x[14]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x6cc9
movq %rax, %rbx
movq %rax, %rdi
callq 0x6d01
movq $0x0, 0x1808(%rbx)
movl $0x3, %r8d
movq %rbx, %rdi
movl $0x300, %esi            # imm = 0x300
xorl %edx, %edx
movl $0x1, %ecx
callq 0x14db
cmpq $0x3, 0x1808(%rbx)
jne 0x7287
movq $0x0, 0x1808(%rbx)
movl $0x1, %r8d
movq %rbx, %rdi
movl $0x300, %esi            # imm = 0x300
movl $0x2, %edx
movl $0x2, %ecx
callq 0x14db
cmpq $0x4, 0x1808(%rbx)
jne 0x72a6
movq $0x0, 0x1808(%rbx)
movl $0x14, %r8d
movq %rbx, %rdi
movl $0x300, %esi            # imm = 0x300
xorl %edx, %edx
movl $0x3f, %ecx
callq 0x14db
movq %rbx, %rdi
movl $0x300, %esi            # imm = 0x300
xorl %edx, %edx
movl $0x4, %ecx
callq 0x147c
cmpq $0x14, %rax
jne 0x72c5
movl $0x2000000, %esi        # imm = 0x2000000
movq %rbx, %rdi
movl $0xe, %edx
callq 0x2330
movl $0x2000000, %esi        # imm = 0x2000000
movq %rbx, %rdi
callq 0x22fa
cmpb $0xe, %al
jne 0x72e4
movl $0xa, %edi
movl $0x2, %esi
movl $0x3, %edx
callq 0x12ff
cmpq $0x2, %rax
jne 0x7303
movq $-0x80000000, 0x8010(%rbx) # imm = 0x80000000
movq $-0x8000, 0x8018(%rbx) # imm = 0x8000
leaq 0x14c9(%rip), %rdi      # 0x870c
movq $-0x80000000, %rsi      # imm = 0x80000000
xorl %eax, %eax
callq 0x10b0
movq %rbx, %rdi
movl $0x220a733, %esi        # imm = 0x220A733
callq 0x339d
movq 0x8010(%rbx), %rsi
movq 0x8018(%rbx), %rdx
movq 0x8078(%rbx), %rcx
leaq 0x149b(%rip), %rdi      # 0x8715
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x10b0
leaq 0x13d5(%rip), %rdi      # 0x8663
leaq 0x13e7(%rip), %rsi      # 0x867c
leaq 0x13eb(%rip), %rcx      # 0x8687
movl $0x27, %edx
callq 0x10c0
leaq 0x13e9(%rip), %rdi      # 0x8696
leaq 0x13c8(%rip), %rsi      # 0x867c
leaq 0x13cc(%rip), %rcx      # 0x8687
movl $0x2b, %edx
callq 0x10c0
leaq 0x13e3(%rip), %rdi      # 0x86af
leaq 0x13a9(%rip), %rsi      # 0x867c
leaq 0x13ad(%rip), %rcx      # 0x8687
movl $0x2f, %edx
callq 0x10c0
leaq 0x13e8(%rip), %rdi      # 0x86d3
leaq 0x138a(%rip), %rsi      # 0x867c
leaq 0x138e(%rip), %rcx      # 0x8687
movl $0x32, %edx
callq 0x10c0
leaq 0x13ea(%rip), %rdi      # 0x86f4
leaq 0x136b(%rip), %rsi      # 0x867c
leaq 0x136f(%rip), %rcx      # 0x8687
movl $0x34, %edx
callq 0x10c0
// File: /workspace/github_c_makefile_star2_O1/ukontainer[P]sqlite-bench/benchmark.c
// Function: finished_single_op
void finished_single_op() {
  if (FLAGS_histogram || FLAGS_raw) {
    double now = now_micros() * 1e-6;
    double micros = (now - last_op_finish_) * 1e6;
    if (FLAGS_histogram) {
      histogram_add(&hist_, micros);
      if (micros > 20000) {
        fprintf(stderr, "long op: %.1f micros%30s\r", micros, "");
        fflush(stderr);
      }
    }
    if (FLAGS_raw) {
      raw_add(&raw_, micros);
    }
    last_op_finish_ = now;
  }

  done_++;
  if (done_ >= next_report_) {
    if      (next_report_ < 1000)   next_report_ += 100;
    else if (next_report_ < 5000)   next_report_ += 500;
    else if (next_report_ < 10000)  next_report_ += 1000;
    else if (next_report_ < 50000)  next_report_ += 5000;
    else if (next_report_ < 100000) next_report_ += 10000;
    else if (next_report_ < 500000) next_report_ += 50000;
    else                            next_report_ += 100000;
    fprintf(stderr, "... finished %d ops%30s\r", done_, "");
    fflush(stderr);
  }
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq $0x5a4854, %rbx         # imm = 0x5A4854
cmpb $0x0, (%rbx)
jne 0x402c99
movq $0x5a4855, %rax         # imm = 0x5A4855
cmpb $0x1, (%rax)
jne 0x402d2f
callq 0x47d21c
movq %rax, %xmm0
punpckldq 0x147365(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x14736d(%rip), %xmm0   # 0x54a020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x147369(%rip), %xmm1   # 0x54a030
movapd %xmm1, 0x10(%rsp)
movapd %xmm1, %xmm0
subsd 0x1a15f7(%rip), %xmm0   # 0x5a42d0
mulsd 0x147357(%rip), %xmm0   # 0x54a038
cmpb $0x1, (%rbx)
jne 0x402d0a
leaq 0x1a15eb(%rip), %rdi    # 0x5a42d8
movapd %xmm0, (%rsp)
movaps (%rsp), %xmm0
callq 0x403779
movapd (%rsp), %xmm0
ucomisd 0x147338(%rip), %xmm0   # 0x54a040
ja 0x402d54
movq $0x5a4855, %rax         # imm = 0x5A4855
cmpb $0x1, (%rax)
jne 0x402d22
leaq 0x1a1ab3(%rip), %rdi    # 0x5a47d0
callq 0x4042cc
movaps 0x10(%rsp), %xmm0
movsd %xmm0, 0x1a15a1(%rip)   # 0x5a42d0
movl 0x1a1ab3(%rip), %esi    # 0x5a47e8
incl %esi
movl %esi, 0x1a1aab(%rip)    # 0x5a47e8
movl 0x1a1aa9(%rip), %edi    # 0x5a47ec
cmpl %edi, %esi
jge 0x402d4d
addq $0x20, %rsp
popq %rbx
retq
callq 0x40190c
jmp 0x402d47
movaps (%rsp), %xmm0
callq 0x4018e3
movapd (%rsp), %xmm0
jmp 0x402d0a
// File: /workspace/github_c_makefile_star2_O1/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
xorl %eax, %eax
movq %rax, 0x1a1a73(%rip)    # 0x5a47f0
movl $0x0, 0x1a1a71(%rip)    # 0x5a47f8
movq $0x5a4848, %rcx         # imm = 0x5A4848
movl (%rcx), %ecx
movl %ecx, 0x1a1a66(%rip)    # 0x5a47fc
movq $0x5a484c, %rdx         # imm = 0x5A484C
movl (%rdx), %edx
testl %edx, %edx
cmovsl %ecx, %edx
movl %edx, 0x1a1a56(%rip)    # 0x5a4800
movq %rax, 0x1a1a57(%rip)    # 0x5a4808
movq $0x5a4858, %rax         # imm = 0x5A4858
movsd (%rax), %xmm0
leaq 0x1a1a4d(%rip), %rdi    # 0x5a4810
callq 0x4040de
leaq 0x1a1a59(%rip), %rdi    # 0x5a4828
movl $0x12d, %esi            # imm = 0x12D
callq 0x404074
movq $0x5a4870, %r13         # imm = 0x5A4870
movq (%r13), %rdi
callq 0x4e4650
movq %rax, %rbx
movq $0x5a4868, %rax         # imm = 0x5A4868
cmpb $0x0, (%rax)
jne 0x402e54
movq %rbx, %rdi
callq 0x4e48b0
testq %rax, %rax
je 0x402e54
movq %rax, %r12
leaq 0x147274(%rip), %r14    # 0x54a083
movq %rsp, %r15
addq $0x13, %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x47d23f
testb %al, %al
je 0x402e44
movq (%r13), %rsi
movq %r15, %rdi
callq 0x401020
movq %r15, %rdi
movq %r12, %rsi
callq 0x401068
movq %r15, %rdi
callq 0x4874f0
movq %rbx, %rdi
callq 0x4e48b0
movq %rax, %r12
testq %rax, %rax
jne 0x402e12
movq %rbx, %rdi
callq 0x4e4880
addq $0x3f0, %rsp            # imm = 0x3F0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x47d21c
movq %rax, %xmm0
punpckldq 0x146f6c(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x146f74(%rip), %xmm0   # 0x54a020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x146f70(%rip), %xmm1   # 0x54a030
movapd %xmm1, (%rsp)
movsd %xmm1, 0x1a176b(%rip)   # 0x5a4838
movq $0x0, 0x1a1730(%rip) # 0x5a4808
movl $0x2710, %edi           # imm = 0x2710
callq 0x4a7d10
movq %rax, 0x1a1747(%rip)    # 0x5a4830
movb $0x0, (%rax)
movaps (%rsp), %xmm0
movsd %xmm0, 0x1a11d8(%rip)   # 0x5a42d0
leaq 0x1a11d9(%rip), %rdi    # 0x5a42d8
callq 0x40375c
leaq 0x1a16c5(%rip), %rdi    # 0x5a47d0
callq 0x404298
movl $0x0, 0x1a16ce(%rip)    # 0x5a47e8
movl $0x64, 0x1a16c8(%rip)   # 0x5a47ec
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/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:
leaq 0x146d80(%rip), %rcx    # 0x54a500
xorl %eax, %eax
ucomisd (%rcx), %xmm0
jb 0x40379c
incq %rax
addq $0x8, %rcx
cmpq $0x99, %rax
jne 0x403782
movl $0x99, %eax
movl %eax, %eax
movsd 0x28(%rdi,%rax,8), %xmm1
addsd 0x146d34(%rip), %xmm1   # 0x54a4e0
movsd %xmm1, 0x28(%rdi,%rax,8)
movsd (%rdi), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x4037c0
movsd %xmm0, (%rdi)
ucomisd 0x8(%rdi), %xmm0
jbe 0x4037cc
movsd %xmm0, 0x8(%rdi)
movsd 0x10(%rdi), %xmm1
addsd 0x146d07(%rip), %xmm1   # 0x54a4e0
movsd %xmm1, 0x10(%rdi)
movsd 0x18(%rdi), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rdi)
mulsd %xmm0, %xmm0
addsd 0x20(%rdi), %xmm0
movsd %xmm0, 0x20(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x40380d
movsd %xmm0, (%rdi)
movsd 0x8(%rsi), %xmm0
ucomisd 0x8(%rdi), %xmm0
jbe 0x40381e
movsd %xmm0, 0x8(%rdi)
movsd 0x10(%rsi), %xmm0
addsd 0x10(%rdi), %xmm0
movsd %xmm0, 0x10(%rdi)
movsd 0x18(%rsi), %xmm0
addsd 0x18(%rdi), %xmm0
movsd %xmm0, 0x18(%rdi)
movsd 0x20(%rsi), %xmm0
addsd 0x20(%rdi), %xmm0
movsd %xmm0, 0x20(%rdi)
movl $0x5, %eax
movsd (%rsi,%rax,8), %xmm0
addsd (%rdi,%rax,8), %xmm0
movsd %xmm0, (%rdi,%rax,8)
incq %rax
cmpq $0x9f, %rax
jne 0x403850
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x404085
testl %esi, %esi
jne 0x40408b
movl $0x1, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/ukontainer[P]sqlite-bench/random.c
// Function: rand_uniform
uint32_t rand_next(Random* rand_) {
  static const uint32_t M = 2147483647L;
  static const uint64_t A = 16807;

  uint64_t product = rand_->seed_ * A;

  rand_->seed_ = (uint32_t)((product >> 31) + (product & M));

  if (rand_->seed_ > M) {
    rand_->seed_ -= M;
  }

  return rand_->seed_;
}

// Assembly:
movl (%rdi), %eax
imulq $0x41a7, %rax, %rcx     # imm = 0x41A7
movq %rcx, %rdx
shrq $0x1f, %rdx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
leal (%rdx,%rcx), %eax
addl $0x80000001, %eax       # imm = 0x80000001
addl %ecx, %edx
cmovnsl %edx, %eax
movl %eax, (%rdi)
xorl %edx, %edx
divl %esi
movl %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x4a7d10
movq %rax, (%rbx)
movq $0x0, 0x8(%rbx)
movq %rbx, 0x10(%rsp)
movl $0x0, 0x10(%rbx)
movsd 0x8(%rsp), %xmm0
mulsd 0x1463cc(%rip), %xmm0   # 0x54a4f0
cvttsd2si %xmm0, %ecx
cmpl $0x2, %ecx
movl $0x1, %ebp
cmovgel %ecx, %ebp
movb $0x0, (%rax)
leal 0x1(%rbp), %eax
movq %rax, 0x8(%rsp)
movl $0x12d, %r14d           # imm = 0x12D
movq 0x8(%rsp), %rdi
callq 0x4a7d10
movq %rax, %r15
xorl %eax, %eax
movl %r14d, %ecx
imulq $0x41a7, %rcx, %rcx     # imm = 0x41A7
movq %rcx, %rdx
shrq $0x1f, %rdx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
leal (%rdx,%rcx), %r14d
addl $0x80000001, %r14d      # imm = 0x80000001
addl %ecx, %edx
cmovnsl %edx, %r14d
imulq $0x58ed2309, %r14, %rcx # imm = 0x58ED2309
shrq $0x20, %rcx
movl %r14d, %edx
subl %ecx, %edx
shrl %edx
addl %ecx, %edx
shrl $0x6, %edx
imull $0x5f, %edx, %ecx
movl %r14d, %edx
subl %ecx, %edx
addb $0x20, %dl
movb %dl, (%r15,%rax)
incq %rax
cmpq %rax, %rbp
jne 0x404153
xorl %ebx, %ebx
movb %bl, (%r15,%rbp)
movq %r15, %rdi
callq 0x401100
movq %rax, %r13
movl $0x65, %edi
callq 0x4a7d10
movq %rax, %r12
movb %bl, (%rax)
xorl %ebx, %ebx
movq %r12, %rdi
movq %r15, %rsi
callq 0x401068
addl %r13d, %ebx
movslq %ebx, %rbx
cmpq $0x64, %rbx
jb 0x4041cb
movq 0x10(%rsp), %rbx
movq (%rbx), %rdi
movq %r12, %rsi
callq 0x401068
movq %r12, %rdi
callq 0x401100
addq 0x8(%rbx), %rax
movq %rax, 0x8(%rbx)
cmpq $0x100000, %rax         # imm = 0x100000
jb 0x404144
movq %r12, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4a8050
// File: /workspace/github_c_makefile_star2_O1/ukontainer[P]sqlite-bench/random.c
// Function: rand_gen_generate
char* rand_gen_generate(RandomGenerator* gen_, int len) {
  if (gen_->pos_ + len > gen_->data_size_) {
    gen_->pos_ = 0;
    assert(len < gen_->data_size_);
  }
  gen_->pos_ += len;
  char* substr = malloc(sizeof(char) * (len + 1));
  strncpy(substr, (gen_->data_) + gen_->pos_ - len, len);

  return substr;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
movslq 0x10(%rdi), %rcx
movslq %esi, %rbx
addq %rbx, %rcx
movq 0x8(%rdi), %rax
cmpq %rcx, %rax
jae 0x40424c
movl $0x0, 0x10(%r14)
cmpq %rbx, %rax
jbe 0x404279
movslq 0x10(%r14), %r15
leal (%r15,%rbx), %eax
movl %eax, 0x10(%r14)
leal 0x1(%rbx), %eax
movslq %eax, %rdi
callq 0x4a7d10
addq (%r14), %r15
movq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x401098
leaq 0x146eeb(%rip), %rdi    # 0x54b16b
leaq 0x146efb(%rip), %rsi    # 0x54b182
leaq 0x146efd(%rip), %rcx    # 0x54b18b
movl $0x5b, %edx
callq 0x480020
// File: /workspace/github_c_makefile_star2_O1/ukontainer[P]sqlite-bench/raw.c
// Function: raw_add
void raw_add(Raw *raw_, double value) {
  if (!raw_->data_)
    raw_calloc(raw_);
  if (raw_->data_size_ < raw_->pos_ + 1)
    raw_realloc(raw_);
  raw_->data_[raw_->pos_] = value;
  raw_->pos_++;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpq $0x0, (%rdi)
jne 0x404307
movq $0xf4240, 0x8(%rbx)     # imm = 0xF4240
movl $0x8, %edi
movl $0xf4240, %esi          # imm = 0xF4240
movsd %xmm0, 0x8(%rsp)
callq 0x4a9160
movsd 0x8(%rsp), %xmm0
movq %rax, (%rbx)
movl $0x0, 0x10(%rbx)
movq 0x8(%rbx), %rsi
movslq 0x10(%rbx), %rax
incq %rax
cmpq %rax, %rsi
jae 0x40433f
leaq (%rsi,%rsi), %rax
movq %rax, 0x8(%rbx)
movq (%rbx), %rdi
shlq $0x4, %rsi
movsd %xmm0, 0x8(%rsp)
callq 0x4a83a0
movsd 0x8(%rsp), %xmm0
movq %rax, (%rbx)
testq %rax, %rax
je 0x404357
movq (%rbx), %rax
movslq 0x10(%rbx), %rcx
movsd %xmm0, (%rax,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, 0x10(%rbx)
addq $0x10, %rsp
popq %rbx
retq
callq 0x4021fa
// File: /workspace/github_c_makefile_star2_O1/ukontainer[P]sqlite-bench/raw.c
// Function: raw_to_string
char* raw_to_string(Raw *raw_) {
  if (!raw_->data_)
    raw_calloc(raw_);
  size_t r_size = 1024;
  char *r = malloc(sizeof(char) * r_size);
  strcpy(r, "");
  char buf[200];
  for (int i = 0; i < raw_->pos_; i++) {
    snprintf(buf, sizeof(buf), "%.4f\n", raw_->data_[i]);
    if (r_size < strlen(r) + strlen(buf)) {
      r = realloc(r, r_size * 2);
      r_size *= 2;
    }
    strcat(r, buf);
  }
  return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
cmpq $0x0, (%rdi)
jne 0x404397
movq $0xf4240, 0x8(%rbx)     # imm = 0xF4240
movl $0x8, %edi
movl $0xf4240, %esi          # imm = 0xF4240
callq 0x4a9160
movq %rax, (%rbx)
movl $0x0, 0x10(%rbx)
movl $0x400, %r14d           # imm = 0x400
movl $0x400, %edi            # imm = 0x400
callq 0x4a7d10
movq %rax, %r15
movb $0x0, (%rax)
cmpl $0x0, 0x10(%rbx)
jle 0x40441b
xorl %r12d, %r12d
movq %rsp, %r13
movq (%rbx), %rax
movsd (%rax,%r12,8), %xmm0
movl $0xc8, %esi
movq %r13, %rdi
leaq 0x146647(%rip), %rdx    # 0x54aa18
movb $0x1, %al
callq 0x487370
movq %r15, %rdi
callq 0x401100
movq %rax, %rbp
movq %r13, %rdi
callq 0x401100
addq %rbp, %rax
cmpq %rax, %r14
jae 0x404404
addq %r14, %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0x4a83a0
movq %rax, %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x401068
incq %r12
movslq 0x10(%rbx), %rax
cmpq %rax, %r12
jl 0x4043b9
movq %r15, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ukontainer[P]sqlite-bench/raw.c
// Function: raw_print
void raw_print(FILE *stream, Raw *raw_) {
  if (!raw_->data_)
    raw_calloc(raw_);
  fprintf(stream, "num,time\n");
  for (int i = 0; i < raw_->pos_; i++)
    fprintf(stream, "%d,%.4f\n", i, raw_->data_[i]);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpq $0x0, (%rsi)
jne 0x404465
movq $0xf4240, 0x8(%rbx)     # imm = 0xF4240
movl $0x8, %edi
movl $0xf4240, %esi          # imm = 0xF4240
callq 0x4a9160
movq %rax, (%rbx)
movl $0x0, 0x10(%rbx)
leaq 0x146d4f(%rip), %rdi    # 0x54b1bb
movl $0x9, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x495ea0
cmpl $0x0, 0x10(%rbx)
jle 0x4044b3
xorl %r15d, %r15d
leaq 0x146d37(%rip), %r12    # 0x54b1c5
movq (%rbx), %rax
movsd (%rax,%r15,8), %xmm0
movq %r14, %rdi
movq %r12, %rsi
movl %r15d, %edx
movb $0x1, %al
callq 0x4872b0
incq %r15
movslq 0x10(%rbx), %rax
cmpq %rax, %r15
jl 0x40448e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O1/ukontainer[P]sqlite-bench/sqlite3.c
// Function: sqlite3LookasideUsed
SQLITE_PRIVATE int sqlite3LookasideUsed(sqlite3 *db, int *pHighwater){
  u32 nInit = countLookasideSlots(db->lookaside.pInit);
  u32 nFree = countLookasideSlots(db->lookaside.pFree);
  if( pHighwater ) *pHighwater = db->lookaside.nSlot - nInit;
  return db->lookaside.nSlot - (nInit+nFree);
}

// Assembly:
movq 0x178(%rdi), %rdx
xorl %eax, %eax
movl $0x0, %ecx
testq %rdx, %rdx
je 0x4049f5
xorl %ecx, %ecx
movq (%rdx), %rdx
incl %ecx
testq %rdx, %rdx
jne 0x4049eb
movq 0x180(%rdi), %rdx
testq %rdx, %rdx
je 0x404a0d
xorl %eax, %eax
movq (%rdx), %rdx
decl %eax
testq %rdx, %rdx
jne 0x404a03
testq %rsi, %rsi
je 0x404a1c
movl 0x168(%rdi), %edx
subl %ecx, %edx
movl %edx, (%rsi)
subl %ecx, %eax
addl 0x168(%rdi), %eax
retq
// File: /workspace/github_c_makefile_star2_O1/ukontainer[P]sqlite-bench/sqlite3.c
// Function: sqlite3VdbeClearObject
SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
  SubProgram *pSub, *pNext;
  assert( p->db==0 || p->db==db );
  releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
  for(pSub=p->pProgram; pSub; pSub=pNext){
    pNext = pSub->pNext;
    vdbeFreeOpArray(db, pSub->aOp, pSub->nOp);
    sqlite3DbFree(db, pSub);
  }
  if( p->magic!=VDBE_MAGIC_INIT ){
    releaseMemArray(p->aVar, p->nVar);
    sqlite3DbFree(db, p->pVList);
    sqlite3DbFree(db, p->pFree);
  }
  vdbeFreeOpArray(db, p->aOp, p->nOp);
  sqlite3DbFree(db, p->aColName);
  sqlite3DbFree(db, p->zSql);
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
  {
    int i;
    for(i=0; i<p->nScan; i++){
      sqlite3DbFree(db, p->aScan[i].zName);
    }
    sqlite3DbFree(db, p->aScan);
  }
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x80(%rsi), %rdi
movzwl 0xbc(%rsi), %esi
addl %esi, %esi
callq 0x4233b9
movq 0x110(%r14), %r15
testq %r15, %r15
je 0x404b1b
movq 0x28(%r15), %r12
movq (%r15), %rsi
movl 0x8(%r15), %edx
movq %rbx, %rdi
callq 0x423448
movq %rbx, %rdi
movq %r15, %rsi
callq 0x415dca
movq %r12, %r15
testq %r12, %r12
jne 0x404af5
cmpl $0x16bceaa5, 0x24(%r14) # imm = 0x16BCEAA5
je 0x404b5e
movq 0xa0(%r14), %rdi
movswl 0x20(%r14), %esi
callq 0x4233b9
movq 0xa8(%r14), %rsi
testq %rsi, %rsi
je 0x404b4a
movq %rbx, %rdi
callq 0x415dca
movq 0xf0(%r14), %rsi
testq %rsi, %rsi
je 0x404b5e
movq %rbx, %rdi
callq 0x415dca
movq 0x68(%r14), %rsi
movl 0xb8(%r14), %edx
movq %rbx, %rdi
callq 0x423448
movq 0x80(%r14), %rsi
testq %rsi, %rsi
je 0x404b85
movq %rbx, %rdi
callq 0x415dca
movq 0xe8(%r14), %rsi
testq %rsi, %rsi
je 0x404ba4
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x415dca
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq