// File: /workspace/github_cpp_makefile_star2_O2/pollow[P]MIPSClide/disassembler.cpp
// Function: Disassembler::reverse()
void Disassembler::reverse() {
    string str;
    for(size_t i = 0; i < codes.size(); i++) {
        Instruction tmp(codes[i]);
        str = tmp.reverse();
        if ( tmp.need_label ) {
            unsigned int t = pc+tmp.offset+1;
            if (labels.count(t) == 0) {
                labels[t] = "Label"+to_string(labels.size());
            }
            str += "Label"+to_string(labels.size());
        } else if ( tmp.need_target ) {
            unsigned int t = tmp.target;
            if (labels.count(t) == 0) {
                labels[t] = "Label"+to_string(labels.size());
            }
            str += "Label"+to_string(labels.size());
        }
        instructions.push_back("\t" + str);
        pc++;
    }
    for(auto i = labels.rbegin(); i != labels.rend(); i++) {
        instructions.insert(instructions.begin() + i->first, i->second + ":");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, %rbx
leaq -0x98(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x38(%rdi), %rax
movq %rax, -0x38(%rbp)
leaq 0x20(%rdi), %r14
leaq -0x88(%rbp), %r12
leaq -0x140(%rbp), %r13
xorl %edx, %edx
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rcx, %rdx
jae 0x9190
movq %rdx, -0x68(%rbp)
movl (%rax,%rdx,4), %eax
leaq -0x130(%rbp), %rcx
movq %rcx, -0x140(%rbp)
andq $0x0, -0x138(%rbp)
xorl %edx, %edx
movb %dl, -0x130(%rbp)
leaq -0x110(%rbp), %rcx
movq %rcx, -0x120(%rbp)
andq $0x0, -0x118(%rbp)
movb %dl, -0x110(%rbp)
leaq -0xf0(%rbp), %rcx
movq %rcx, -0x100(%rbp)
andq $0x0, -0xf8(%rbp)
movb %dl, -0xf0(%rbp)
leaq -0xd0(%rbp), %rcx
movq %rcx, -0xe0(%rbp)
andq $0x0, -0xd8(%rbp)
movb %dl, -0xd0(%rbp)
andl $0x0, -0xb4(%rbp)
andw $0x0, -0xaf(%rbp)
movb %dl, -0xad(%rbp)
movl %eax, -0xac(%rbp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x19f72
leaq -0xa8(%rbp), %rdi
movq %r12, %rsi
callq 0x53b0
movq %r12, %rdi
callq 0x5160
cmpb $0x1, -0xae(%rbp)
jne 0x908d
movl (%rbx), %eax
movswl -0xbc(%rbp), %ecx
leal (%rax,%rcx), %r13d
incl %r13d
movl %r13d, -0x88(%rbp)
movq -0x38(%rbp), %rdi
movq %r12, %rsi
callq 0x92de
testq %rax, %rax
jne 0x9050
movq 0x60(%rbx), %rsi
leaq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x9330
movq %r12, %rdi
leaq 0x13060(%rip), %rsi     # 0x1c07b
movq %r15, %rdx
callq 0x9302
movl %r13d, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x9372
movq %rax, %rdi
movq %r12, %rsi
callq 0x53b0
movq %r12, %rdi
callq 0x5160
leaq -0x58(%rbp), %rdi
callq 0x5160
movq 0x60(%rbx), %rsi
leaq -0x58(%rbp), %r13
movq %r13, %rdi
callq 0x9330
movq %r12, %rdi
leaq 0x13011(%rip), %rsi     # 0x1c07b
movq %r13, %rdx
callq 0x9302
leaq -0x140(%rbp), %r13
leaq -0xa8(%rbp), %rdi
movq %r12, %rsi
callq 0x5600
jmp 0x9140
cmpb $0x1, -0xad(%rbp)
jne 0x9151
movl -0xb4(%rbp), %r13d
movl %r13d, -0x88(%rbp)
movq -0x38(%rbp), %rdi
movq %r12, %rsi
callq 0x92de
testq %rax, %rax
jne 0x9108
movq 0x60(%rbx), %rsi
leaq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x9330
movq %r12, %rdi
leaq 0x12fa8(%rip), %rsi     # 0x1c07b
movq %r15, %rdx
callq 0x9302
movl %r13d, -0x2c(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x9372
movq %rax, %rdi
movq %r12, %rsi
callq 0x53b0
movq %r12, %rdi
callq 0x5160
leaq -0x58(%rbp), %rdi
callq 0x5160
movq 0x60(%rbx), %rsi
leaq -0x58(%rbp), %r15
movq %r15, %rdi
callq 0x9330
movq %r12, %rdi
leaq 0x12f59(%rip), %rsi     # 0x1c07b
movq %r15, %rdx
callq 0x9302
leaq -0x140(%rbp), %r13
leaq -0xa8(%rbp), %rdi
movq %r12, %rsi
callq 0x5600
movq %r12, %rdi
callq 0x5160
leaq -0x58(%rbp), %rdi
callq 0x5160
movq %r12, %rdi
leaq 0x13287(%rip), %rsi     # 0x1c3e2
leaq -0xa8(%rbp), %rdx
callq 0x93c3
movq %r14, %rdi
movq %r12, %rsi
callq 0x9864
movq %r12, %rdi
callq 0x5160
incl (%rbx)
movq %r13, %rdi
callq 0x943a
movq -0x68(%rbp), %rdx
incq %rdx
jmp 0x8efe
leaq 0x40(%rbx), %r13
leaq -0x140(%rbp), %r12
movq %rbx, -0x60(%rbp)
cmpq 0x50(%rbx), %r13
je 0x9203
movq (%r14), %r15
movq %r13, %rdi
callq 0x5350
movq %r14, %rbx
movslq 0x20(%rax), %r14
movq %r13, %rdi
callq 0x5350
leaq 0x28(%rax), %rsi
movq %r12, %rdi
leaq 0x13223(%rip), %rdx     # 0x1c3f0
callq 0x946c
shlq $0x5, %r14
addq %r14, %r15
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x9a42
movq %rbx, %r14
movq %r12, %rdi
callq 0x5160
movq %r13, %rdi
callq 0x5350
movq %rax, %r13
movq -0x60(%rbp), %rbx
jmp 0x919f
leaq -0xa8(%rbp), %rdi
callq 0x5160
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x927c
jmp 0x9237
jmp 0x923c
jmp 0x9237
jmp 0x927c
jmp 0x923c
jmp 0x927c
jmp 0x9237
jmp 0x923c
jmp 0x927c
jmp 0x927c
movq %rax, %rbx
jmp 0x924b
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x5160
leaq -0x58(%rbp), %rdi
jmp 0x9275
jmp 0x927c
movq %rax, %rbx
jmp 0x928b
movq %rax, %rbx
leaq -0x140(%rbp), %rdi
callq 0x5160
jmp 0x928b
jmp 0x927c
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x5160
jmp 0x927f
movq %rax, %rbx
leaq -0x140(%rbp), %rdi
callq 0x943a
leaq -0xa8(%rbp), %rdi
callq 0x5160
movq %rbx, %rdi
callq 0x5560
nop