LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/7shi[P]8086run/v1/main.cpp
// Function: inittty()
void inittty() {
    termios t;
    tcgetattr(STDIN_FILENO, &t);
    oldt = t;

    struct sigaction sa;
    memset(&sa, 0, sizeof (sa));
    sa.sa_handler = siginthandler;
    sigaction(SIGINT, &sa, NULL);
    atexit(resettty);

    t.c_lflag &= ~(ICANON | ECHO);
    tcsetattr(STDIN_FILENO, TCSANOW, &t);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xd8, %rsp
leaq 0x4(%rsp), %rbx
xorl %edi, %edi
movq %rbx, %rsi
callq 0x10c0
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups 0x2c(%rbx), %xmm3
movups %xmm0, 0x6de8(%rip)     # 0x8170
movups %xmm1, 0x6df1(%rip)     # 0x8180
movups %xmm2, 0x6dfa(%rip)     # 0x8190
movups %xmm3, 0x6dff(%rip)     # 0x819c
leaq 0x48(%rsp), %r14
movl $0x90, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x1040
leaq -0x78(%rip), %rax       # 0x1340
movq %rax, -0x8(%r14)
pushq $0x2
popq %rdi
leaq 0x40(%rsp), %rsi
xorl %edx, %edx
callq 0x1100
leaq -0x89(%rip), %rdi       # 0x1349
callq 0x4ba0
andb $-0xb, 0xc(%rbx)
xorl %edi, %edi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x1110
addq $0xd8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/7shi[P]8086run/v1/main.cpp
// Function: debug(_IO_FILE*, bool)
void
debug(FILE *f, bool h) {
    if (h) fprintf(f, " AX   BX   CX   DX   SP   BP   SI   DI    FLAGS    ES   SS   DS   CS   IP  dump\n");
    fprintf(f,
            "%04x %04x %04x %04x-%04x %04x %04x %04x %c%c%c%c%c%c%c%c%c %04x %04x %04x %04x:%04x %02x%02x\n",
            AX, BX, CX, DX, SP, BP, SI, DI,
            "-O"[OF], "-D"[DF], "-I"[IF], "-T"[TF], "-S"[SF], "-Z"[ZF], "-A"[AF], "-P"[PF], "-C"[CF],
            *ES, *SS, *DS, *CS, IP, CS[IP], CS[IP + 1]);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
testl %esi, %esi
je 0x141f
movq %rdi, %rbx
leaq 0x4192(%rip), %rdi      # 0x55a0
pushq $0x50
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1170
movq %rbx, %rdi
movzwl 0x126d9a(%rip), %edx    # 0x1281c0
movzwl 0x126d99(%rip), %ecx    # 0x1281c6
movzwl 0x126d8d(%rip), %r8d    # 0x1281c2
movzbl 0x126dd4(%rip), %eax    # 0x128210
leaq 0x420c(%rip), %rsi      # 0x564f
movsbl (%rax,%rsi), %eax
movq %rax, 0x60(%rsp)
movzbl 0x126dbe(%rip), %eax    # 0x128211
leaq 0x41f8(%rip), %rsi      # 0x5652
movsbl (%rax,%rsi), %eax
movq %rax, 0x58(%rsp)
movzbl 0x126da8(%rip), %eax    # 0x128212
leaq 0x41e4(%rip), %rsi      # 0x5655
movsbl (%rax,%rsi), %eax
movq %rax, 0x50(%rsp)
movzbl 0x126d92(%rip), %eax    # 0x128213
leaq 0x41d0(%rip), %rsi      # 0x5658
movsbl (%rax,%rsi), %eax
movq %rax, 0x48(%rsp)
movzbl 0x126d7c(%rip), %eax    # 0x128214
leaq 0x41bc(%rip), %rsi      # 0x565b
movsbl (%rax,%rsi), %eax
movq %rax, 0x40(%rsp)
movzbl 0x126d66(%rip), %eax    # 0x128215
leaq 0x41a8(%rip), %rsi      # 0x565e
movsbl (%rax,%rsi), %eax
movq %rax, 0x30(%rsp)
movzbl 0x126d50(%rip), %eax    # 0x128216
leaq 0x4194(%rip), %rsi      # 0x5661
movsbl (%rax,%rsi), %eax
movq %rax, 0x18(%rsp)
movzbl 0x126d3a(%rip), %eax    # 0x128217
leaq 0x4180(%rip), %rsi      # 0x5664
movsbl (%rax,%rsi), %eax
movq %rax, 0x8(%rsp)
movzbl 0x126d24(%rip), %eax    # 0x128218
leaq 0x416c(%rip), %rsi      # 0x5667
movsbl (%rax,%rsi), %r13d
movzwl 0x126ca8(%rip), %r10d   # 0x1281b0
movq 0x126e21(%rip), %rax    # 0x128330
movzbl (%rax,%r10), %r11d
movzbl 0x1(%rax,%r10), %r14d
movzwl 0x126ca2(%rip), %r9d    # 0x1281c4
movzwl 0x126c9f(%rip), %eax    # 0x1281c8
movq %rax, 0x38(%rsp)
movzwl 0x126c95(%rip), %eax    # 0x1281ca
movq %rax, 0x28(%rsp)
movzwl 0x126c8b(%rip), %eax    # 0x1281cc
movq %rax, 0x20(%rsp)
movzwl 0x126c81(%rip), %eax    # 0x1281ce
movq %rax, 0x10(%rsp)
movzwl 0x126dcf(%rip), %ebp    # 0x128328
movzwl 0x126de7(%rip), %r15d   # 0x128348
movzwl 0x126df0(%rip), %ebx    # 0x128358
movzwl 0x126dc8(%rip), %r12d   # 0x128338
leaq 0x407a(%rip), %rsi      # 0x55f1
xorl %eax, %eax
pushq %r14
pushq %r11
pushq %r10
pushq %r12
pushq %rbx
pushq %r15
pushq %rbp
pushq %r13
pushq 0x48(%rsp)
pushq 0x60(%rsp)
pushq 0x80(%rsp)
pushq 0x98(%rsp)
pushq 0xa8(%rsp)
pushq 0xb8(%rsp)
pushq 0xc8(%rsp)
pushq 0xd8(%rsp)
pushq 0x90(%rsp)
pushq 0xa8(%rsp)
pushq 0xb8(%rsp)
pushq 0xd0(%rsp)
callq 0x1130
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/7shi[P]8086run/v1/main.cpp
// Function: dump(_IO_FILE*, SReg*, unsigned short, int)
void dump(FILE *f, SReg *seg, uint16_t addr, int len) {
    fprintf(f, "org 0x%04x:0x%04x\n", seg->v, addr);
    for (int i = 0; i < len; ++i) {
        if (i & 7) {
            fprintf(f, ", ");
        } else {
            if (i > 0) fprintf(f, "\n");
            fprintf(f, "db ");
        }
        fprintf(f, "0x%02x", (*seg)[addr + i]);
    }
    fprintf(f, "\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r14d
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
movzwl 0x8(%rsi), %edx
leaq 0x405d(%rip), %rsi      # 0x566a
xorl %r12d, %r12d
movl %ebp, %ecx
xorl %eax, %eax
callq 0x1130
movl %ebp, %r13d
testl %r14d, %r14d
cmovlel %r12d, %r14d
leaq 0x405a(%rip), %r12      # 0x5684
xorl %ebp, %ebp
cmpq %rbp, %r14
je 0x1684
testb $0x7, %bpl
je 0x1642
leaq 0x403f(%rip), %rdi      # 0x567d
pushq $0x2
jmp 0x165b
testq %rbp, %rbp
je 0x1652
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x10f0
leaq 0x4027(%rip), %rdi      # 0x5680
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x1170
movq (%r15), %rax
addq %r13, %rax
movzbl (%rbp,%rax), %edx
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x1130
incq %rbp
jmp 0x162c
pushq $0xa
popq %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10f0
// File: /workspace/github_cpp_makefile_star2_O2/7shi[P]8086run/v1/main.cpp
// Function: error(char const*, ...)
void error(const char *fmt, ...) {
    IP = oldip;
    dump(stderr, &CS, IP - 0x18, 0x30);
    debug(stderr, true);
    va_list ap;
    va_start(ap, fmt);
    vfprintf(stderr, fmt, ap);
    va_end(ap);
    fputc('\n', stderr);
    exit(1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
testb %al, %al
je 0x16e8
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
leaq 0x20(%rsp), %r15
movq %rsi, 0x8(%r15)
movq %rdx, 0x10(%r15)
movq %rcx, 0x18(%r15)
movq %r8, 0x20(%r15)
movq %r9, 0x28(%r15)
movzwl 0x126aaa(%rip), %eax    # 0x1281b2
movw %ax, 0x126aa1(%rip)     # 0x1281b0
movq 0x68ca(%rip), %r14      # 0x7fe0
movq (%r14), %rdi
addl $-0x18, %eax
movzwl %ax, %edx
leaq 0x126c0a(%rip), %rsi    # 0x128330
pushq $0x30
popq %rcx
callq 0x15ec
movq (%r14), %rdi
pushq $0x1
popq %rbp
movl %ebp, %esi
callq 0x13f2
movq %rsp, %rdx
movq %r15, 0x10(%rdx)
leaq 0x100(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rdx)
movq (%r14), %rdi
movq %rbx, %rsi
callq 0x1120
movq (%r14), %rsi
pushq $0xa
popq %rdi
callq 0x10f0
movl %ebp, %edi
callq 0x10e0
// File: /workspace/github_cpp_makefile_star2_O2/7shi[P]8086run/v1/main.cpp
// Function: out(unsigned short, unsigned char)
void out(uint16_t n, uint8_t v) {
    switch (n) {
        case 0x0020: // PIC 8259 (master)
            // TODO
            break;
        case 0x0021: // PIC 8259 (master) - OCW1
            // TODO
            break;
        case 0x0042: // PIT 8254 - counter 2
            // TODO
            break;
        case 0x0043: // PIT 8254 - interval, beep
            // TODO
            break;
        case 0x0061: // PPI 8255 - port B
            break;
        default:
            error("not implemented: out %04x,%02x", n, v);
    }
    io[n] = v;
}

// Assembly:
leal -0x42(%rdi), %eax
cmpl $0x1f, %eax
ja 0x178a
movl $0x80000003, %ecx       # imm = 0x80000003
btl %eax, %ecx
jb 0x1794
movl %edi, %eax
addl $-0x20, %eax
cmpl $0x2, %eax
jae 0x17a3
movzwl %di, %eax
leaq 0x116a12(%rip), %rcx    # 0x1181b0
movb %sil, (%rax,%rcx)
retq
pushq %rax
movzwl %di, %eax
movzbl %sil, %edx
leaq 0x3ed9(%rip), %rdi      # 0x568b
movl %eax, %esi
xorl %eax, %eax
callq 0x169d
// File: /workspace/github_cpp_makefile_star2_O2/7shi[P]8086run/v1/main.cpp
// Function: in(unsigned short)
uint8_t in(uint16_t n) {
    switch (n) {
        case 0x0020: // PIC 8259 (master)
            // TODO
            break;
        case 0x0021: // PIC 8259 (master) - IMR
            break;
        case 0x0040: // PIT 8254 - counter 0
            // TODO
            break;
        case 0x0061: // PPI 8255 - port B (beep)
            break;
        case 0x00a1: // PIC 8259 (slave) - IMR
            break;
        case 0x03da: // CRTC 6845 - status register
            return io[n] = !io[n];
        default:
            error("not implemented: in %04x", n);
    }
    return io[n];
}

// Assembly:
leal -0x20(%rdi), %eax
cmpl $0x2, %eax
jb 0x17ef
cmpl $0x40, %edi
je 0x17ef
cmpl $0x61, %edi
je 0x17ef
cmpl $0xa1, %edi
je 0x17ef
cmpl $0x3da, %edi            # imm = 0x3DA
jne 0x17fd
cmpb $0x0, 0x116da6(%rip)    # 0x11858a
sete %al
sete 0x116d9c(%rip)          # 0x11858a
retq
movzwl %di, %eax
leaq 0x1169b7(%rip), %rcx    # 0x1181b0
movb (%rax,%rcx), %al
retq
pushq %rax
movzwl %di, %esi
leaq 0x3ea2(%rip), %rdi      # 0x56aa
xorl %eax, %eax
callq 0x169d
// File: /workspace/github_cpp_makefile_star2_O2/7shi[P]8086run/v1/main.cpp
// Function: intr(int)
void intr(int n) {
    uint8_t *v = &mem[n << 2];
    uint16_t cs = read16(v + 2), ip = read16(v);
    if (!cs && ip < 0x20) return bios(ip);
    push(getf());
    IF = TF = 0;
    push(*CS);
    push(IP);
    CS = cs;
    IP = ip;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
shll $0x2, %edi
movslq %edi, %rax
leaq 0x637b(%rip), %r15      # 0x81b0
movzwl 0x2(%rax,%r15), %r14d
testq %r14, %r14
setne %cl
movzwl (%rax,%r15), %ebx
cmpl $0x20, %ebx
setae %al
orb %cl, %al
jne 0x1e5c
movl %ebx, %edi
popq %rbx
popq %r14
popq %r15
jmp 0x180f
callq 0x4396
movzwl %ax, %edi
callq 0x4377
xorl %eax, %eax
movb %al, 0x1263a2(%rip)     # 0x128213
movb %al, 0x12639b(%rip)     # 0x128212
movzwl 0x1264ba(%rip), %edi    # 0x128338
callq 0x4377
movzwl 0x126326(%rip), %edi    # 0x1281b0
callq 0x4377
movl %r14d, %eax
shll $0x4, %eax
addq %rax, %r15
movq %r15, 0x126491(%rip)    # 0x128330
movw %r14w, 0x126491(%rip)   # 0x128338
movw %bx, 0x126302(%rip)     # 0x1281b0
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/7shi[P]8086run/v1/main.cpp
// Function: Operand::operator=(int)
inline void operator=(int value) {
        if (type == Reg) {
            if (w) {
                r[v] = value;
            } else {
                *r8[v] = value;
            }
            return;
        }
        uint8_t *p = ptr();
        if (p) {
            if (w) {
                write16(p, value);
            } else {
                *p = value;
            }
        }
    }

// Assembly:
movl %esi, %eax
cmpl $0x0, (%rdi)
je 0x44c0
movq 0x10(%rdi), %rcx
testq %rcx, %rcx
je 0x44bf
movq (%rcx), %rcx
testq %rcx, %rcx
je 0x44bf
movslq 0x8(%rdi), %rdx
movb 0x4(%rdi), %sil
movb %al, (%rcx,%rdx)
cmpb $0x1, %sil
jne 0x44bf
movb %ah, 0x1(%rcx,%rdx)
retq
movslq 0x8(%rdi), %rcx
cmpb $0x1, 0x4(%rdi)
jne 0x44d6
leaq 0x123cef(%rip), %rdx    # 0x1281c0
movw %ax, (%rdx,%rcx,2)
retq
leaq 0x123cf3(%rip), %rdx    # 0x1281d0
movq (%rdx,%rcx,8), %rcx
movb %al, (%rcx)
retq
// File: /workspace/github_cpp_makefile_star2_O2/7shi[P]8086run/v1/main.cpp
// Function: setf8(int)
inline int setf8(int value) {
    int8_t v = value;
    OF = value != v;
    SF = v < 0;
    ZF = v == 0;
    PF = ptable[uint8_t(value)];
    return value;
}

// Assembly:
movl %edi, %eax
movsbl %al, %ecx
cmpl %edi, %ecx
setne 0x123cef(%rip)          # 0x128210
movzbl %cl, %edx
shrl $0x1f, %ecx
movb %cl, 0x123ce7(%rip)     # 0x128214
testl %edx, %edx
sete 0x123cdf(%rip)          # 0x128215
leaq 0x123ce3(%rip), %rcx    # 0x128220
movb (%rdx,%rcx), %cl
movb %cl, 0x123cd1(%rip)     # 0x128217
retq
// File: /workspace/github_cpp_makefile_star2_O2/7shi[P]8086run/v1/main.cpp
// Function: setf16(int)
inline int setf16(int value) {
    int16_t v = value;
    OF = value != v;
    SF = v < 0;
    ZF = v == 0;
    PF = ptable[uint8_t(value)];
    return value;
}

// Assembly:
movl %edi, %eax
movswl %ax, %ecx
cmpl %edi, %ecx
setne 0x123cbb(%rip)          # 0x128210
movl %ecx, %edx
shrl $0x1f, %edx
movb %dl, 0x123cb4(%rip)     # 0x128214
testw $0xffff, %cx            # imm = 0xFFFF
sete 0x123ca9(%rip)          # 0x128215
movzbl %al, %ecx
leaq 0x123caa(%rip), %rdx    # 0x128220
movb (%rcx,%rdx), %cl
movb %cl, 0x123c98(%rip)     # 0x128217
retq
// File: /workspace/github_cpp_makefile_star2_O2/7shi[P]8086run/v1/main.cpp
// Function: Operand::modrm(unsigned char*, bool, SReg*)
inline size_t modrm(uint8_t *p, bool w, SReg *seg) {
        uint8_t b = p[1], mod = b >> 6, rm = b & 7;
        switch (mod) {
            case 0:
                if (rm == 6) {
                    set(Ptr, w, read16(p + 2), seg);
                    return 4;
                }
                set(ModRM + rm, w, 0, seg);
                return 2;
            case 1:
                set(ModRM + rm, w, (int8_t) p[2], seg);
                return 3;
            case 2:
                set(ModRM + rm, w, (int16_t) read16(p + 2), seg);
                return 4;
        }
        set(Reg, w, rm, NULL);
        return 2;
    }

// Assembly:
pushq %rax
movq %rcx, %r8
movzbl 0x1(%rsi), %eax
movl %eax, %ecx
shrl $0x6, %ecx
andl $0x7, %eax
leaq 0xf7d(%rip), %r9        # 0x5514
movslq (%r9,%rcx,4), %rcx
addq %r9, %rcx
jmpq *%rcx
cmpb $0x6, %al
jne 0x460b
testq %r8, %r8
leaq 0x123da2(%rip), %rax    # 0x128350
cmovneq %r8, %rax
movzwl 0x2(%rsi), %ecx
movl $0x2, (%rdi)
movb %dl, 0x4(%rdi)
movq %rax, 0x10(%rdi)
movl %ecx, 0x8(%rdi)
jmp 0x45dc
addl $0x3, %eax
movzbl %al, %eax
movswl 0x2(%rsi), %ecx
movzbl %dl, %edx
movl %eax, %esi
callq 0x4620
pushq $0x4
jmp 0x461c
andl $0x0, (%rdi)
movb %dl, 0x4(%rdi)
andq $0x0, 0x10(%rdi)
movzbl %al, %eax
movl %eax, 0x8(%rdi)
jmp 0x461a
addl $0x3, %eax
movzbl %al, %eax
movsbl 0x2(%rsi), %ecx
movzbl %dl, %edx
movl %eax, %esi
callq 0x4620
pushq $0x3
jmp 0x461c
addl $0x3, %eax
movzbl %dl, %edx
movl %eax, %esi
xorl %ecx, %ecx
callq 0x4620
pushq $0x2
popq %rax
popq %rcx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/7shi[P]8086run/v1/main.cpp
// Function: Operand::set(int, bool, int, SReg*)
inline void set(int type, bool w, int v, SReg *seg) {
        this->type = type;
        this->w = w;
        switch (type) {
            case Ptr:
                this->seg = seg ? seg : &DS;
                this->v = uint16_t(v);
                break;
            case ModRM + 0:
                this->seg = seg ? seg : &DS;
                this->v = uint16_t(BX + SI + v);
                break;
            case ModRM + 1:
                this->seg = seg ? seg : &DS;
                this->v = uint16_t(BX + DI + v);
                break;
            case ModRM + 2:
                this->seg = seg ? seg : &SS;
                this->v = uint16_t(BP + SI + v);
                break;
            case ModRM + 3:
                this->seg = seg ? seg : &SS;
                this->v = uint16_t(BP + DI + v);
                break;
            case ModRM + 4:
                this->seg = seg ? seg : &DS;
                this->v = uint16_t(SI + v);
                break;
            case ModRM + 5:
                this->seg = seg ? seg : &DS;
                this->v = uint16_t(DI + v);
                break;
            case ModRM + 6:
                this->seg = seg ? seg : &SS;
                this->v = uint16_t(BP + v);
                break;
            case ModRM + 7:
                this->seg = seg ? seg : &DS;
                this->v = uint16_t(BX + v);
                break;
            default:
                this->seg = NULL;
                this->v = v;
                break;
        }
    }

// Assembly:
movl %esi, (%rdi)
movb %dl, 0x4(%rdi)
addl $-0x2, %esi
cmpl $0x8, %esi
ja 0x4738
leaq 0xeec(%rip), %rax       # 0x5524
movslq (%rax,%rsi,4), %rdx
addq %rax, %rdx
jmpq *%rdx
testq %r8, %r8
leaq 0x123d05(%rip), %rax    # 0x128350
cmovneq %r8, %rax
movq %rax, 0x10(%rdi)
jmp 0x4731
testq %r8, %r8
leaq 0x123cde(%rip), %rax    # 0x128340
cmovneq %r8, %rax
movq %rax, 0x10(%rdi)
addw 0x123b59(%rip), %cx     # 0x1281ca
jmp 0x470f
testq %r8, %r8
leaq 0x123cd0(%rip), %rax    # 0x128350
cmovneq %r8, %rax
movq %rax, 0x10(%rdi)
addw 0x123b37(%rip), %cx     # 0x1281c6
jmp 0x470f
testq %r8, %r8
leaq 0x123ca5(%rip), %rax    # 0x128340
cmovneq %r8, %rax
movq %rax, 0x10(%rdi)
addw 0x123b20(%rip), %cx     # 0x1281ca
jmp 0x46f4
testq %r8, %r8
leaq 0x123c8a(%rip), %rax    # 0x128340
cmovneq %r8, %rax
movq %rax, 0x10(%rdi)
addw 0x123b05(%rip), %cx     # 0x1281ca
jmp 0x4731
testq %r8, %r8
leaq 0x123c7f(%rip), %rax    # 0x128350
cmovneq %r8, %rax
movq %rax, 0x10(%rdi)
addw 0x123ae6(%rip), %cx     # 0x1281c6
jmp 0x46f4
testq %r8, %r8
leaq 0x123c64(%rip), %rax    # 0x128350
cmovneq %r8, %rax
movq %rax, 0x10(%rdi)
addw 0x123ad1(%rip), %cx     # 0x1281cc
jmp 0x4731
testq %r8, %r8
leaq 0x123c49(%rip), %rax    # 0x128350
cmovneq %r8, %rax
movq %rax, 0x10(%rdi)
addw 0x123ab8(%rip), %cx     # 0x1281ce
jmp 0x4731
testq %r8, %r8
leaq 0x123c2e(%rip), %rax    # 0x128350
cmovneq %r8, %rax
movq %rax, 0x10(%rdi)
addw 0x123a95(%rip), %cx     # 0x1281c6
movzwl %cx, %ecx
movl %ecx, 0x8(%rdi)
retq
andq $0x0, 0x10(%rdi)
jmp 0x4734
nop
// File: /workspace/github_cpp_makefile_star2_O2/7shi[P]8086run/v1/main.cpp
// Function: Operand::regrm(Operand*, unsigned char*, bool, bool, SReg*)
inline size_t regrm(Operand *opr, uint8_t *p, bool dir, bool w, SReg *seg) {
        if (dir) {
            set(Reg, w, (p[1] >> 3) & 7, NULL);
            return opr->modrm(p, w, seg);
        }
        opr->set(Reg, w, (p[1] >> 3) & 7, NULL);
        return modrm(p, w, seg);
    }

// Assembly:
movzbl 0x1(%rdx), %eax
shrl $0x3, %eax
andl $0x7, %eax
testl %ecx, %ecx
movq %rsi, %rcx
cmovneq %rdi, %rcx
cmovneq %rsi, %rdi
andl $0x0, (%rcx)
movb %r8b, 0x4(%rcx)
andq $0x0, 0x10(%rcx)
movl %eax, 0x8(%rcx)
movq %rdx, %rsi
movl %r8d, %edx
movq %r9, %rcx
jmp 0x4580
// File: /workspace/github_cpp_makefile_star2_O2/7shi[P]8086run/v1/main.cpp
// Function: setf(unsigned short)
inline void setf(uint16_t flags) {
    CF = flags & 0x001;
    PF = flags & 0x004;
    AF = flags & 0x010;
    ZF = flags & 0x040;
    SF = flags & 0x080;
    TF = flags & 0x100;
    IF = flags & 0x200;
    DF = flags & 0x400;
    OF = flags & 0x800;
}

// Assembly:
movl %edi, %eax
andb $0x1, %al
movb %al, 0x123a9a(%rip)     # 0x128218
movl %edi, %eax
shrb $0x2, %al
andb $0x1, %al
movb %al, 0x123a8c(%rip)     # 0x128217
movl %edi, %eax
shrb $0x4, %al
andb $0x1, %al
movb %al, 0x123a7e(%rip)     # 0x128216
movl %edi, %eax
shrb $0x6, %al
andb $0x1, %al
movb %al, 0x123a70(%rip)     # 0x128215
movl %edi, %eax
shrb $0x7, %al
movb %al, 0x123a64(%rip)     # 0x128214
movl %edi, %eax
shrl $0x8, %eax
andb $0x1, %al
movb %al, 0x123a56(%rip)     # 0x128213
movl %edi, %eax
shrl $0x9, %eax
andb $0x1, %al
movb %al, 0x123a48(%rip)     # 0x128212
movl %edi, %eax
shrl $0xa, %eax
andb $0x1, %al
movb %al, 0x123a3a(%rip)     # 0x128211
shrl $0xb, %edi
andb $0x1, %dil
movb %dil, 0x123a2b(%rip)    # 0x128210
retq
// File: /workspace/github_cpp_makefile_star2_O2/7shi[P]8086run/v1/main.cpp
// Function: Operand::u() const
inline int u() const {
        if (type == Reg) return w ? r[v] : *r8[v];
        uint8_t *p = ptr();
        if (!p) return v;
        return w ? read16(p) : *p;
    }

// Assembly:
cmpl $0x0, (%rdi)
movl 0x8(%rdi), %eax
movslq %eax, %rcx
je 0x4ac9
movq 0x10(%rdi), %rdx
testq %rdx, %rdx
je 0x4aee
movq (%rdx), %rdx
testq %rdx, %rdx
je 0x4aee
cmpb $0x1, 0x4(%rdi)
jne 0x4aea
movzwl (%rdx,%rcx), %eax
retq
cmpb $0x1, 0x4(%rdi)
jne 0x4adb
leaq 0x1236ea(%rip), %rax    # 0x1281c0
movzwl (%rax,%rcx,2), %eax
retq
leaq 0x1236ee(%rip), %rax    # 0x1281d0
movq (%rax,%rcx,8), %rax
movzbl (%rax), %eax
retq
movzbl (%rdx,%rcx), %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/7shi[P]8086run/v1/main.cpp
// Function: Disk::open(char const*)
bool open(const char *img) {
        if (!(f = fopen(img, "r+b"))) return false;
        struct stat st;
        fstat(fileno(f), &st);
        switch (st.st_size / 1024) {
            case 360: // 2D
                type = 1, c = 40, h = 2, s = 9;
                break;
            case 720: // 2DD
                type = 3, c = 80, h = 2, s = 9;
                break;
            default: // 2HD
                type = 4, c = 80, h = 2, s = 18;
                break;
        }
        return true;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x90, %rsp
movq %rsi, %rax
movq %rdi, %rbx
leaq 0xc40(%rip), %rsi       # 0x5749
movq %rax, %rdi
callq 0x10d0
movq %rax, %r14
movq %rax, (%rbx)
testq %rax, %rax
je 0x4b7f
movq %r14, %rdi
callq 0x10a0
movq %rsp, %r15
movl %eax, %edi
movq %r15, %rsi
callq 0x1160
movq 0x30(%r15), %rax
movl $0x400, %ecx            # imm = 0x400
cqto
idivq %rcx
pushq $0x9
popq %rcx
cmpq $0x168, %rax            # imm = 0x168
je 0x4b5c
cmpq $0x2d0, %rax            # imm = 0x2D0
jne 0x4b66
movsd 0xa26(%rip), %xmm0      # 0x5580
jmp 0x4b71
movsd 0xa0c(%rip), %xmm0      # 0x5570
jmp 0x4b71
movsd 0xa22(%rip), %xmm0      # 0x5590
pushq $0x12
popq %rcx
movlps %xmm0, 0x8(%rbx)
movl $0x2, 0x10(%rbx)
movl %ecx, 0x14(%rbx)
testq %r14, %r14
setne %al
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/liujan[P]randomforest/Node.cpp
// Function: Node::Node()
Node::Node(){
    left = NULL;
    right = NULL;
    sum = 0;
    memset(num, 0, sizeof(num));
    attribute = 0;
    value = 0;
    depth = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andl $0x0, (%rdi)
addq $0x8, %rdi
movl $0xa0, %edx
xorl %esi, %esi
popq %rbp
jmp 0x2110
// File: /workspace/github_cpp_makefile_star2_O2/liujan[P]randomforest/Node.cpp
// Function: Node::Node(Node const&)
Node::Node(const Node &other){
    this->attribute = other.attribute;
    this->value = other.value;
    this->left = other.left;
    this->right = other.right;
    this->sum = other.sum;
    this->samples = other.samples;
    this->depth = other.depth;
    for (int i = 0; i < numOfTypes; i++)
        this->num[i] = other.num[i];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x90, %esi
leaq (%rdi,%rsi), %r15
xorps %xmm0, %xmm0
andq $0x0, 0xa0(%rdi)
movups %xmm0, 0x90(%rdi)
movl (%rbx), %eax
movl %eax, (%rdi)
movsd 0x8(%rbx), %xmm0
movsd %xmm0, 0x8(%rdi)
movq 0x10(%rbx), %rax
movq %rax, 0x10(%rdi)
movq 0x18(%rbx), %rax
movq %rax, 0x18(%rdi)
movl 0x20(%rbx), %eax
movl %eax, 0x20(%rdi)
addq %rbx, %rsi
movq %r15, %rdi
callq 0x2510
movl 0x8c(%rbx), %eax
movl %eax, 0x8c(%r14)
xorl %eax, %eax
cmpq $0x1a, %rax
je 0x24f1
movl 0x24(%rbx,%rax,4), %ecx
movl %ecx, 0x24(%r14,%rax,4)
incq %rax
jmp 0x24dd
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r15, %rdi
callq 0x25e4
movq %rbx, %rdi
callq 0x2290
nop
// File: /workspace/github_cpp_makefile_star2_O2/liujan[P]randomforest/Tree.cpp
// Function: Tree::readSample(std::vector<std::pair<int, std::vector<double, std::allocator<double>>>, std::allocator<std::pair<int, std::vector<double, std::allocator<double>>>>>)
bool Tree::readSample(vector<pair<int, vector<double> > > all_samples){
    if (all_samples.empty()){
        cout << "[Error] all sample is empty!" << endl;
        return false;
    }
    
    if (root == NULL)
        root = new Node();
    
    double p = 0.0;
    for (int i = 0; i < all_samples.size(); i++){
        p = rand() * 1.0 / RAND_MAX;
        if (p <= 0.6) {  //每棵树用总样本的60%来训练
            root->samples.push_back(all_samples[i]);
            int type = all_samples[i].first;
            root->num[type - 1]++;
        }
    }
    root->sum = root->samples.size();

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq (%rsi), %r12
movq 0x8(%rsi), %r13
cmpq %r13, %r12
je 0x2c32
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, (%rdi)
jne 0x2ba5
movl $0xa8, %edi
callq 0x21b0
movq %rax, %r15
movq %rax, %rdi
callq 0x245c
movq %r15, (%rbx)
movq %r13, -0x30(%rbp)
movq %r12, -0x38(%rbp)
xorl %r15d, %r15d
movl $0x90, %r12d
xorl %r13d, %r13d
movq 0x8(%r14), %rax
subq (%r14), %rax
sarq $0x5, %rax
cmpq %r13, %rax
jbe 0x2c10
callq 0x2080
cvtsi2sd %eax, %xmm0
divsd 0x342e(%rip), %xmm0     # 0x6008
movsd 0x342e(%rip), %xmm1     # 0x6010
ucomisd %xmm0, %xmm1
jb 0x2c07
movq (%rbx), %rdi
addq %r12, %rdi
movq (%r14), %rsi
addq %r15, %rsi
callq 0x35ee
movq (%r14), %rax
movslq (%rax,%r15), %rax
movq (%rbx), %rcx
incl 0x20(%rcx,%rax,4)
incq %r13
addq $0x20, %r15
jmp 0x2bb9
movq (%rbx), %rax
movq 0x98(%rax), %rcx
subq 0x90(%rax), %rcx
shrq $0x5, %rcx
movl %ecx, 0x20(%rax)
movq -0x38(%rbp), %r12
movq -0x30(%rbp), %r13
jmp 0x2c4d
movq 0x739f(%rip), %rdi      # 0x9fd8
leaq 0x3420(%rip), %rsi      # 0x6060
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
cmpq %r13, %r12
setne %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0xa8, %esi
movq %r15, %rdi
callq 0x21c0
movq %rbx, %rdi
callq 0x2290
// File: /workspace/github_cpp_makefile_star2_O2/liujan[P]randomforest/Tree.cpp
// Function: Tree::buildTree()
bool Tree::buildTree(){
    
    if (root == NULL)
        return false;
    
    cout << "building tree ..." << endl;
    
    double p = 0.7;  //当一个节点里有p的样本为同一类型，则该节点不再进行分裂
    queue<Node *> q; //用于辅助非递归建树
    q.push(root);
    int sum = 0; //记录一共分裂了多少次
    while (!q.empty()) {
        Node * current = q.front();
        q.pop();
        if (current == NULL)
            continue;
        
        for (int i = 0; i < numOfTypes; i++){ //当一个节点里有p的样本为同一类型，则该节点不再进行分裂
            if ((current->num[i] * 1.0 / current->sum) > p)
                continue;
        }
        if (current->depth >= 8) //当当前节点的高度大于5时，当前节点不再进行分裂
            continue;
        
        if (current->sum < 50) //当一个节点里样本数小于50时，该节点不再进行分裂
            continue;
        
        //cout <<"depth = " <<  current->depth << " bin = " << sum << endl;
        pair<Node *, Node *> child = this->selectBestPart(current);
        Node *left = child.first;
        Node *right = child.second;
        
        current->left = left;
        current->right = right;
        
        q.push(left);
        q.push(right);
        sum++;
    }
    
    cout << "building tree completed" << endl;
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq (%rdi), %rax
testq %rax, %rax
je 0x2d64
movq %rdi, %rbx
movq %rax, -0x30(%rbp)
movq 0x7333(%rip), %rdi      # 0x9fd8
leaq 0x33d1(%rip), %rsi      # 0x607d
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
leaq -0x90(%rbp), %r14
movq %r14, %rdi
callq 0x362a
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3dac
leaq -0x40(%rbp), %r15
leaq -0x38(%rbp), %r12
movq -0x80(%rbp), %rax
cmpq %rax, -0x60(%rbp)
je 0x2d39
movq (%rax), %r13
movq %r14, %rdi
callq 0x4004
testq %r13, %r13
je 0x2cdb
cmpl $0x7, 0x8c(%r13)
jg 0x2cdb
cmpl $0x32, 0x20(%r13)
jl 0x2cdb
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2d96
movq %rax, -0x40(%rbp)
movq %rdx, -0x38(%rbp)
movq %rax, 0x10(%r13)
movq %rdx, 0x18(%r13)
movq %r14, %rdi
movq %r15, %rsi
callq 0x3dac
movq %r14, %rdi
movq %r12, %rsi
callq 0x3dac
jmp 0x2cdb
movq 0x7298(%rip), %rdi      # 0x9fd8
leaq 0x3348(%rip), %rsi      # 0x608f
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
leaq -0x90(%rbp), %rdi
callq 0x37d2
movq -0x30(%rbp), %rax
testq %rax, %rax
setne %al
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2d7f
jmp 0x2d7f
jmp 0x2d7f
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x37d2
movq %rbx, %rdi
callq 0x2290
// File: /workspace/github_cpp_makefile_star2_O2/liujan[P]randomforest/Tree.cpp
// Function: getType(Node*)
int getType(Node *node){
    if (node == NULL)
        return 0;
    int max_value = -1000, index = 0;
    for (int i = 0; i < numOfTypes; i++){
        if (max_value <= node->num[i]){
            max_value = node->num[i];
            index = i + 1;
        }
    }
    return index;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rdi, %rdi
je 0x3444
xorl %ecx, %ecx
movl $0xfffffc18, %edx       # imm = 0xFFFFFC18
xorl %eax, %eax
cmpq $0x1a, %rcx
je 0x3446
movl 0x24(%rdi,%rcx,4), %esi
incq %rcx
cmpl %esi, %edx
cmovlel %esi, %edx
cmovlel %ecx, %eax
jmp 0x342d
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/liujan[P]randomforest/Tree.cpp
// Function: Tree::predict(std::vector<double, std::allocator<double>>)
int Tree::predict(vector<double> features){
    if (root == NULL){
        cout << "[Error] empty tree" << endl;
        return 0;
    }
    Node *head = root;
    while (true) {
        if (head->left == NULL && head->right == NULL){
            return getType(head);
        }
        int attr = head->attribute;
        double value = head->value;
        if (features[attr] < value){
            if (head->left == NULL)
                return getType(head);
            else
                head = head->left;
        }
        else {
            if (head->right == NULL)
                return getType(head);
            else
                head = head->right;
        }
    }
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rax
testq %rax, %rax
je 0x3488
movq %rax, %rdi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x3467
cmpq $0x0, 0x18(%rdi)
je 0x3482
movslq (%rdi), %rcx
movsd 0x8(%rdi), %xmm0
movq (%rsi), %rdx
ucomisd (%rdx,%rcx,8), %xmm0
ja 0x347d
movq 0x18(%rdi), %rax
testq %rax, %rax
jne 0x3454
popq %rbp
jmp 0x341b
movq 0x6b49(%rip), %rdi      # 0x9fd8
leaq 0x2c11(%rip), %rsi      # 0x60a7
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
xorl %eax, %eax
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/liujan[P]randomforest/Tree.cpp
// Function: Tree::randomSelect()
vector<int> Tree::randomSelect(){
    vector<int> v;
    for (int i = 0; i < numOfFeatures; i++){
        double p = rand() * 1.0 / RAND_MAX;
        if (p <= 0.6)
            v.push_back(i);
    }
    return v;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movupd %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
xorl %eax, %eax
leaq -0x14(%rbp), %r14
movl %eax, -0x14(%rbp)
cmpl $0x269, %eax            # imm = 0x269
jge 0x3504
callq 0x2080
cvtsi2sd %eax, %xmm0
divsd 0x2b24(%rip), %xmm0     # 0x6008
movsd 0x2b24(%rip), %xmm1     # 0x6010
ucomisd %xmm0, %xmm1
jb 0x34fd
movq %rbx, %rdi
movq %r14, %rsi
callq 0x37ac
movl -0x14(%rbp), %eax
incl %eax
jmp 0x34c9
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x406c
movq %r14, %rdi
callq 0x2290
nop
// File: /workspace/github_cpp_makefile_star2_O2/liujan[P]randomforest/Tree.cpp
// Function: Tree::~Tree()
Tree::~Tree(){
    Node *head = root;
    queue<Node*>q;
    q.push(head);
    while(!q.empty()){
        head = q.front();
        q.pop();
        if (head == NULL)
            continue;
        Node *left = head->left;
        Node *right = head->right;
        delete head;
        q.push(left);
        q.push(right);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq (%rdi), %rax
movq %rax, -0x28(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x362a
leaq -0x88(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x3dac
leaq -0x88(%rbp), %rbx
leaq -0x38(%rbp), %r14
leaq -0x30(%rbp), %r15
movq -0x78(%rbp), %rax
cmpq %rax, -0x58(%rbp)
je 0x35cb
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq %rbx, %rdi
callq 0x4004
movq -0x28(%rbp), %r12
testq %r12, %r12
je 0x3565
movq 0x10(%r12), %rax
movq %rax, -0x38(%rbp)
movq 0x18(%r12), %rax
movq %rax, -0x30(%rbp)
leaq 0x90(%r12), %rdi
callq 0x25e4
movl $0xa8, %esi
movq %r12, %rdi
callq 0x21c0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3dac
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3dac
jmp 0x3565
leaq -0x88(%rbp), %rdi
callq 0x37d2
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x35e6
movq %rax, %rdi
callq 0x260f
// File: /workspace/github_cpp_makefile_star2_O2/liujan[P]randomforest/RandomForest.cpp
// Function: RandomForest::build()
void RandomForest::build(){
    if (test_samples.empty()){
        cout << "[Error] test sample is empty" << endl;
        return;
    }
    Tree *tree = new Tree();
    if (tree->readSample(this->all_samples)){
        tree->buildTree();
        for (int j = 0; j < test_samples.size(); j++){
            int id = test_samples[j].first;
            int type = tree->predict(test_samples[j].second);
            result[id][type]++;
        }
    }
    delete tree;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq 0x18(%rdi), %rax
movq %rdi, -0x30(%rbp)
cmpq 0x20(%rdi), %rax
je 0x4e82
pushq $0x8
popq %rbx
movq %rbx, %rdi
callq 0x21b0
movq %rax, %r13
movq %rax, %rdi
callq 0x2b20
leaq -0x58(%rbp), %r12
movq %r12, %rdi
movq -0x30(%rbp), %rsi
callq 0x364a
movq %r13, %rdi
movq %r12, %rsi
callq 0x2b60
movl %eax, %r12d
leaq -0x58(%rbp), %rdi
callq 0x25e4
testb %r12b, %r12b
je 0x4e60
movq %r13, %rdi
callq 0x2c7a
movq -0x30(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x38(%rbp)
xorl %ecx, %ecx
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rsi
movq 0x20(%rax), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %rcx, %rax
jbe 0x4e60
movq %rcx, -0x40(%rbp)
movslq -0x8(%rsi,%rbx), %r14
addq %rbx, %rsi
leaq -0x70(%rbp), %r15
movq %r15, %rdi
callq 0x2804
movq %r13, %r12
movq %r13, %rdi
movq %r15, %rsi
callq 0x3448
movl %eax, %r13d
movq %r15, %rdi
callq 0x2666
movslq %r13d, %rax
imulq $0x6c, %r14, %rcx
addq -0x38(%rbp), %rcx
incl (%rcx,%rax,4)
movq -0x40(%rbp), %rcx
incq %rcx
addq $0x20, %rbx
movq %r12, %r13
jmp 0x4df9
movq %r13, %rdi
callq 0x3524
pushq $0x8
popq %rsi
movq %r13, %rdi
callq 0x21c0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x514f(%rip), %rdi      # 0x9fd8
leaq 0x1290(%rip), %rsi      # 0x6120
callq 0x21a0
movq %rax, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x20f0
movq %rax, %r14
leaq -0x58(%rbp), %rdi
callq 0x25e4
jmp 0x4ed5
movq %rax, %r14
pushq $0x8
popq %rsi
movq %r13, %rdi
callq 0x21c0
jmp 0x4ed5
movq %rax, %r14
leaq -0x70(%rbp), %rdi
callq 0x2666
movq %r14, %rdi
callq 0x2290
nop
// File: /workspace/github_cpp_makefile_star2_O2/liujan[P]randomforest/RandomForest.cpp
// Function: RandomForest::buildTree(int)
bool RandomForest::buildTree(int num){
    if (all_samples.empty()){
        cout << "[Error] all sample is empty" << endl;
        return false;
    }
    
    for (int i = 0; i < num; i++){
        cout << i+1 << " ";
        this->build();
    }
    
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
movq %rax, -0x38(%rbp)
movq %rcx, -0x30(%rbp)
cmpq %rcx, %rax
je 0x4f50
movq %rdi, %rbx
xorl %r13d, %r13d
testl %esi, %esi
cmovgl %esi, %r13d
negl %r13d
pushq $0x1
popq %r14
movq 0x50bb(%rip), %r15      # 0x9fd8
leaq 0x12b2(%rip), %r12      # 0x61d6
leal (%r14,%r13), %eax
cmpl $0x1, %eax
je 0x4f6b
movq %r15, %rdi
movl %r14d, %esi
callq 0x2280
movq %rax, %rdi
movq %r12, %rsi
callq 0x21a0
movq %rbx, %rdi
callq 0x4d7e
incl %r14d
jmp 0x4f24
movq 0x5081(%rip), %rdi      # 0x9fd8
leaq 0x11df(%rip), %rsi      # 0x613d
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
movq -0x30(%rbp), %rax
cmpq %rax, -0x38(%rbp)
setne %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/liujan[P]randomforest/RandomForest.cpp
// Function: RandomForest::predict()
void RandomForest::predict(){
    if (this->test_samples.empty()){
        cout << "[Error] test sample is empty" << endl;
        return;
    }
    ofstream out("result.csv");
    if (!out.is_open()){
        cout << "[Error] failed to open file result.csv" << endl;
        return;
    }
    cout << "predicting ..." << endl;
    out << "Id,label" << "\n";
    
    for (int i = 0; i < numOfTest; i++){
        int max_value = -1000, index = 0;
        for (int j = 0; j < numOfTypes+1; j++){
            if (result[i][j] > max_value){
                max_value = result[i][j];
                index = j;
            }
        }
        out << i << "," << index << "\n";
    }
    
    out.close();
    cout << "predicting completed" << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq 0x18(%rdi), %rax
cmpq 0x20(%rdi), %rax
je 0x508e
movq %rdi, %rbx
leaq 0x11c3(%rip), %rsi      # 0x6175
leaq -0x228(%rbp), %rdi
pushq $0x10
popq %rdx
callq 0x21e0
leaq -0x1b8(%rbp), %rdi
callq 0x2060
testb %al, %al
je 0x50ba
movq 0x4ffc(%rip), %rdi      # 0x9fd8
leaq 0x119d(%rip), %rsi      # 0x6180
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
leaq 0x1198(%rip), %rsi      # 0x618f
leaq -0x228(%rbp), %rdi
callq 0x21a0
leaq 0x125e(%rip), %rsi      # 0x6268
movq %rax, %rdi
callq 0x21a0
addq $0x48, %rbx
xorl %r14d, %r14d
leaq 0x1178(%rip), %r12      # 0x6198
leaq 0x1241(%rip), %r13      # 0x6268
cmpq $0x617, %r14            # imm = 0x617
je 0x50c3
xorl %eax, %eax
movl $0xfffffc18, %ecx       # imm = 0xFFFFFC18
xorl %r15d, %r15d
cmpq $0x1b, %rax
je 0x5055
movl (%rbx,%rax,4), %edx
cmpl %ecx, %edx
cmovgl %edx, %ecx
cmovgl %eax, %r15d
incq %rax
jmp 0x503e
leaq -0x228(%rbp), %rdi
movl %r14d, %esi
callq 0x2280
movq %rax, %rdi
movq %r12, %rsi
callq 0x21a0
movq %rax, %rdi
movl %r15d, %esi
callq 0x2280
movq %rax, %rdi
movq %r13, %rsi
callq 0x21a0
incq %r14
addq $0x6c, %rbx
jmp 0x5027
movq 0x4f43(%rip), %rdi      # 0x9fd8
leaq 0x1084(%rip), %rsi      # 0x6120
callq 0x21a0
movq %rax, %rdi
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x20f0
leaq 0x1098(%rip), %rsi      # 0x6159
jmp 0x50d6
leaq -0x228(%rbp), %rdi
callq 0x2220
leaq 0x10c4(%rip), %rsi      # 0x619a
movq 0x4efb(%rip), %rdi      # 0x9fd8
callq 0x21a0
movq %rax, %rdi
callq 0x20f0
leaq -0x228(%rbp), %rdi
callq 0x2240
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x510a
movq %rax, %rbx
leaq -0x228(%rbp), %rdi
callq 0x2240
movq %rbx, %rdi
callq 0x2290
nop
// File: /workspace/github_cpp_makefile_star2_O2/liujan[P]randomforest/main.cpp
// Function: fun()
void fun(){
    ifstream in("train.csv");
    ofstream out("train1.csv");
    
    string s;
    getline(in, s);
    out << s << endl;
    while (1){
        if (in.eof())
            break;
        getline(in, s);
        double p = rand() * 1.0 / RAND_MAX;
        if (p <= 0.1)
            out << s << endl;
        if (in.peek() == '\n')
            in.get();
    }
    in.close();
    out.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x428, %rsp            # imm = 0x428
leaq 0x8e8(%rip), %rsi       # 0x61af
leaq -0x240(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x22b0
leaq 0x973(%rip), %rsi       # 0x6250
leaq -0x440(%rbp), %rdi
pushq $0x10
popq %rdx
callq 0x21e0
leaq -0x28(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x240(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x2040
leaq -0x440(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x2190
movq %rax, %rdi
callq 0x20f0
leaq -0x240(%rbp), %rbx
leaq -0x38(%rbp), %r14
leaq -0x440(%rbp), %r15
movq -0x240(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x2, -0x220(%rbp,%rax)
jne 0x599f
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2040
callq 0x2080
cvtsi2sd %eax, %xmm0
divsd 0x6a1(%rip), %xmm0      # 0x6008
movsd 0x8d9(%rip), %xmm1      # 0x6248
ucomisd %xmm0, %xmm1
jb 0x5988
movq %r15, %rdi
movq %r14, %rsi
callq 0x2190
movq %rax, %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x20b0
cmpl $0xa, %eax
jne 0x5936
movq %rbx, %rdi
callq 0x2200
jmp 0x5936
leaq -0x240(%rbp), %rdi
callq 0x2050
leaq -0x440(%rbp), %rdi
callq 0x2220
leaq -0x38(%rbp), %rdi
callq 0x20e0
leaq -0x440(%rbp), %rdi
callq 0x2240
leaq -0x240(%rbp), %rdi
callq 0x2070
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x5a07
jmp 0x59ef
jmp 0x59ef
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x20e0
leaq -0x440(%rbp), %rdi
callq 0x2240
leaq -0x240(%rbp), %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x2290
// File: /workspace/github_cpp_makefile_star2_O2/liujan[P]randomforest/main.cpp
// Function: main
int main(int argc, const char * argv[]) {
    // insert code here...
    std::cout << "Hello, World!\n";
    
    RandomForest forest;
    forest.readTrainSample("train.csv");
    forest.readTestSample("test.csv");
    forest.buildTree(7000);
    forest.predict();
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x29248, %rsp          # imm = 0x29248
movq 0x45aa(%rip), %rdi      # 0x9fd8
leaq 0x826(%rip), %rsi       # 0x625b
callq 0x21a0
leaq -0x29250(%rbp), %rdi
callq 0x4d6c
leaq 0x762(%rip), %rsi       # 0x61af
leaq -0x50(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x5b08
leaq -0x29250(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x5122
leaq -0x50(%rbp), %rdi
callq 0x20e0
leaq 0x78b(%rip), %rsi       # 0x6205
leaq -0x30(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x5b08
leaq -0x29250(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x5352
leaq -0x30(%rbp), %rdi
callq 0x20e0
leaq -0x29250(%rbp), %rdi
movl $0x1b58, %esi           # imm = 0x1B58
callq 0x4ede
leaq -0x29250(%rbp), %rdi
callq 0x4f86
leaq -0x29250(%rbp), %rdi
callq 0x5578
xorl %eax, %eax
addq $0x29248, %rsp          # imm = 0x29248
popq %rbx
popq %rbp
retq
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
jmp 0x5ae7
jmp 0x5af0
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x20e0
jmp 0x5af3
jmp 0x5af0
movq %rax, %rbx
leaq -0x29250(%rbp), %rdi
callq 0x5578
movq %rbx, %rdi
callq 0x2290
nop
// File: /workspace/github_cpp_makefile_star2_O2/mhe[P]raytracerframework_cpp/main.cpp
// Function: main
int main(int argc, char *argv[])
{
	cout << "Introduction to Computer Graphics - Raytracer" << endl << endl;
	if (argc != 3) {
		cerr << "Usage: " << argv[0] << " in-file out-file.png" << endl;
		return 1;
	}

	Raytracer raytracer;

	if (!raytracer.readScene(argv[1])) {
		cerr << "Error: reading scene from " << argv[1] << " failed - no output generated."<< endl;
		return 1;
	}
	raytracer.renderToFile(argv[2]);
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movl %edi, %r14d
movq 0x1f25c(%rip), %rdi     # 0x2dfd0
leaq 0x1367a(%rip), %rsi     # 0x223f5
callq 0x4280
movq %rax, %rdi
callq 0x4120
movq %rax, %rdi
callq 0x4120
cmpl $0x3, %r14d
jne 0xedb8
movq 0x8(%rbx), %rsi
leaq -0x18(%rbp), %rdi
callq 0xf244
testb %al, %al
je 0xeddf
movq 0x10(%rbx), %rsi
leaq -0x18(%rbp), %rdi
callq 0xf6c6
xorl %eax, %eax
jmp 0xee18
movq 0x1f231(%rip), %rdi     # 0x2dff0
leaq 0x1365d(%rip), %rsi     # 0x22423
callq 0x4280
movq (%rbx), %rsi
movq %rax, %rdi
callq 0x4280
leaq 0x1364e(%rip), %rsi     # 0x2242b
jmp 0xee05
movq 0x1f20a(%rip), %rdi     # 0x2dff0
leaq 0x13654(%rip), %rsi     # 0x22441
callq 0x4280
movq 0x8(%rbx), %rsi
movq %rax, %rdi
callq 0x4280
leaq 0x13657(%rip), %rsi     # 0x2245c
movq %rax, %rdi
callq 0x4280
movq %rax, %rdi
callq 0x4120
pushq $0x1
popq %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mhe[P]raytracerframework_cpp/raytracer.cpp
// Function: operator>>(YAML::Node const&, Triple&)
void operator >> (const YAML::Node& node, Triple& t)
{
	assert(node.size()==3);
    node[0] >> t.x;
    node[1] >> t.y;
    node[2] >> t.z;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x1a706
cmpl $0x3, %eax
jne 0xef5d
movq %r14, %rdi
xorl %esi, %esi
callq 0x1a794
movq %rax, %rdi
movq %rbx, %rsi
callq 0xf793
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x1a794
leaq 0x8(%rbx), %rsi
movq %rax, %rdi
callq 0xf793
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0x1a794
addq $0x10, %rbx
movq %rax, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0xf793
leaq 0x1355c(%rip), %rdi     # 0x224c0
leaq 0x13564(%rip), %rsi     # 0x224cf
leaq 0x1356b(%rip), %rcx     # 0x224dd
pushq $0x20
popq %rdx
callq 0x41a0
// File: /workspace/github_cpp_makefile_star2_O2/mhe[P]raytracerframework_cpp/raytracer.cpp
// Function: parseTriple(YAML::Node const&)
Triple parseTriple(const YAML::Node& node)
{
	Triple t;
    node[0] >> t.x;
    node[1] >> t.y;
    node[2] >> t.z;	
	return t;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x8(%rdi), %r12
leaq 0x10(%rdi), %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movq %rsi, %rdi
xorl %esi, %esi
callq 0x1a794
movq %rax, %rdi
movq %rbx, %rsi
callq 0xf793
pushq $0x1
popq %rsi
movq %r15, %rdi
callq 0x1a794
movq %rax, %rdi
movq %r12, %rsi
callq 0xf793
pushq $0x2
popq %rsi
movq %r15, %rdi
callq 0x1a794
movq %rax, %rdi
movq %r14, %rsi
callq 0xf793
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mhe[P]raytracerframework_cpp/raytracer.cpp
// Function: Raytracer::parseMaterial(YAML::Node const&)
Material* Raytracer::parseMaterial(const YAML::Node& node)
{
	Material *m = new Material();
	node["color"] >> m->color;	
	node["ka"] >> m->ka;
	node["kd"] >> m->kd;
	node["ks"] >> m->ks;
	node["n"] >> m->n;
	return m;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
pushq $0x38
popq %rdi
callq 0x42a0
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
leaq 0x134f8(%rip), %rsi     # 0x2250b
movq %r14, %rdi
callq 0xf7ee
movq %rax, %rdi
movq %rbx, %rsi
callq 0xeefc
leaq 0x134e4(%rip), %rsi     # 0x22511
movq %r14, %rdi
callq 0xf7ee
leaq 0x18(%rbx), %rsi
movq %rax, %rdi
callq 0xf793
leaq 0x134cc(%rip), %rsi     # 0x22514
movq %r14, %rdi
callq 0xf7ee
leaq 0x20(%rbx), %rsi
movq %rax, %rdi
callq 0xf793
leaq 0x134b4(%rip), %rsi     # 0x22517
movq %r14, %rdi
callq 0xf7ee
leaq 0x28(%rbx), %rsi
movq %rax, %rdi
callq 0xf793
leaq 0x13e8a(%rip), %rsi     # 0x22f08
movq %r14, %rdi
callq 0xf7ee
leaq 0x30(%rbx), %rsi
movq %rax, %rdi
callq 0xf793
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mhe[P]raytracerframework_cpp/raytracer.cpp
// Function: Raytracer::parseObject(YAML::Node const&)
Object* Raytracer::parseObject(const YAML::Node& node)
{
	Object *returnObject = NULL;
	std::string objectType;
	node["type"] >> objectType;
	if (objectType.compare("sphere") == 0) {
		
		Point pos;
		node["position"] >> pos;
		double r;
		node["radius"] >> r;
		Sphere *sphere = new Sphere(pos,r);		
		returnObject = sphere;
	}
	if (returnObject) {
		// read the material and attach to object
		returnObject->material = parseMaterial(node["material"]);
	}
	return returnObject;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rsi, %rbx
leaq -0x40(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x1345b(%rip), %rsi     # 0x2251a
movq %rbx, %rdi
callq 0xf7ee
leaq -0x50(%rbp), %rsi
movq %rax, %rdi
callq 0xf843
leaq 0x13445(%rip), %rsi     # 0x2251f
leaq -0x50(%rbp), %rdi
callq 0x40c0
testl %eax, %eax
je 0xf0ef
xorl %r14d, %r14d
jmp 0xf181
xorps %xmm0, %xmm0
movaps %xmm0, -0x30(%rbp)
andq $0x0, -0x20(%rbp)
leaq 0x13424(%rip), %rsi     # 0x22526
movq %rbx, %rdi
callq 0xf7ee
leaq -0x30(%rbp), %rsi
movq %rax, %rdi
callq 0xeefc
leaq 0x13412(%rip), %rsi     # 0x2252f
movq %rbx, %rdi
callq 0xf7ee
leaq -0x18(%rbp), %rsi
movq %rax, %rdi
callq 0xf793
pushq $0x30
popq %rdi
callq 0x42a0
movq %rax, %r14
movq -0x20(%rbp), %rax
movq %rax, 0x20(%r14)
movaps -0x30(%rbp), %xmm0
movups %xmm0, 0x10(%r14)
movsd -0x18(%rbp), %xmm0
leaq 0x1e627(%rip), %rax     # 0x2d780
addq $0x10, %rax
movq %rax, (%r14)
movsd %xmm0, 0x28(%r14)
leaq 0x133c9(%rip), %rsi     # 0x22536
movq %rbx, %rdi
callq 0xf7ee
movq %rax, %rsi
callq 0xefec
movq %rax, 0x8(%r14)
leaq -0x50(%rbp), %rdi
callq 0x45d8
movq %r14, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0xf19c
jmp 0xf19c
jmp 0xf19c
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x45d8
movq %rbx, %rdi
callq 0x4530