// File: 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
subq $0x300, %rsp            # imm = 0x300
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x298(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x65f0
movq $0x0, -0x30(%rbp)
movq -0x298(%rbp), %rdi
movq -0x30(%rbp), %rax
movq %rax, -0x2a0(%rbp)
addq $0x8, %rdi
callq 0xbf70
movq %rax, %rcx
movq -0x2a0(%rbp), %rax
cmpq %rcx, %rax
jae 0xf00c
movq -0x298(%rbp), %rdi
addq $0x8, %rdi
movq -0x30(%rbp), %rsi
callq 0xf240
movl (%rax), %esi
leaq -0xc8(%rbp), %rdi
callq 0xf260
jmp 0xeb4d
leaq -0xf8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x432c0
jmp 0xeb62
leaq -0x28(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x6520
leaq -0xf8(%rbp), %rdi
callq 0x62a0
testb $0x1, -0x36(%rbp)
je 0xed8f
movq -0x298(%rbp), %rdi
movl (%rdi), %edx
movswl -0x44(%rbp), %eax
movl %eax, %ecx
movl %edx, %eax
leal 0x1(%rax,%rcx), %eax
movl %eax, -0xfc(%rbp)
addq $0x38, %rdi
movl -0xfc(%rbp), %eax
movl %eax, -0x100(%rbp)
leaq -0x100(%rbp), %rsi
callq 0xf2e0
movq %rax, -0x2a8(%rbp)
jmp 0xebc8
movq -0x2a8(%rbp), %rax
cmpq $0x0, %rax
jne 0xece0
movq -0x298(%rbp), %rdi
addq $0x38, %rdi
callq 0xf470
movq %rax, %rsi
leaq -0x140(%rbp), %rdi
callq 0xf390
jmp 0xebfa
leaq 0x3b47a(%rip), %rsi     # 0x4a07b
leaq -0x120(%rbp), %rdi
leaq -0x140(%rbp), %rdx
callq 0xf340
jmp 0xec16
movq -0x298(%rbp), %rdi
addq $0x38, %rdi
movl -0xfc(%rbp), %eax
movl %eax, -0x144(%rbp)
leaq -0x144(%rbp), %rsi
callq 0xf490
movq %rax, -0x2b0(%rbp)
jmp 0xec42
movq -0x2b0(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x6520
leaq -0x120(%rbp), %rdi
callq 0x62a0
leaq -0x140(%rbp), %rdi
callq 0x62a0
jmp 0xece0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xf18e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xeffb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xeccf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x62a0
leaq -0x140(%rbp), %rdi
callq 0x62a0
jmp 0xeffb
movq -0x298(%rbp), %rdi
addq $0x38, %rdi
callq 0xf470
movq %rax, %rsi
leaq -0x188(%rbp), %rdi
callq 0xf390
jmp 0xed01
leaq 0x3b373(%rip), %rsi     # 0x4a07b
leaq -0x168(%rbp), %rdi
leaq -0x188(%rbp), %rdx
callq 0xf340
jmp 0xed1d
leaq -0x28(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x6570
jmp 0xed2f
leaq -0x168(%rbp), %rdi
callq 0x62a0
leaq -0x188(%rbp), %rdi
callq 0x62a0
jmp 0xef66
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xed7e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x62a0
leaq -0x188(%rbp), %rdi
callq 0x62a0
jmp 0xeffb
testb $0x1, -0x35(%rbp)
je 0xef64
movq -0x298(%rbp), %rdi
movl -0x3c(%rbp), %eax
movl %eax, -0x18c(%rbp)
addq $0x38, %rdi
movl -0x18c(%rbp), %eax
movl %eax, -0x190(%rbp)
leaq -0x190(%rbp), %rsi
callq 0xf2e0
movq %rax, -0x2b8(%rbp)
jmp 0xedce
movq -0x2b8(%rbp), %rax
cmpq $0x0, %rax
jne 0xeeb8
movq -0x298(%rbp), %rdi
addq $0x38, %rdi
callq 0xf470
movq %rax, %rsi
leaq -0x1d0(%rbp), %rdi
callq 0xf390
jmp 0xee00
leaq 0x3b274(%rip), %rsi     # 0x4a07b
leaq -0x1b0(%rbp), %rdi
leaq -0x1d0(%rbp), %rdx
callq 0xf340
jmp 0xee1c
movq -0x298(%rbp), %rdi
addq $0x38, %rdi
movl -0x18c(%rbp), %eax
movl %eax, -0x1d4(%rbp)
leaq -0x1d4(%rbp), %rsi
callq 0xf490
movq %rax, -0x2c0(%rbp)
jmp 0xee48
movq -0x2c0(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x6520
leaq -0x1b0(%rbp), %rdi
callq 0x62a0
leaq -0x1d0(%rbp), %rdi
callq 0x62a0
jmp 0xeeb8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xeea7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x62a0
leaq -0x1d0(%rbp), %rdi
callq 0x62a0
jmp 0xeffb
movq -0x298(%rbp), %rdi
addq $0x38, %rdi
callq 0xf470
movq %rax, %rsi
leaq -0x218(%rbp), %rdi
callq 0xf390
jmp 0xeed9
leaq 0x3b19b(%rip), %rsi     # 0x4a07b
leaq -0x1f8(%rbp), %rdi
leaq -0x218(%rbp), %rdx
callq 0xf340
jmp 0xeef5
leaq -0x28(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x6570
jmp 0xef07
leaq -0x1f8(%rbp), %rdi
callq 0x62a0
leaq -0x218(%rbp), %rdi
callq 0x62a0
jmp 0xef64
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0xef53
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x62a0
leaq -0x218(%rbp), %rdi
callq 0x62a0
jmp 0xeffb
jmp 0xef66
movq -0x298(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x2c8(%rbp)
leaq 0x3b4f7(%rip), %rsi     # 0x4a476
leaq -0x238(%rbp), %rdi
leaq -0x28(%rbp), %rdx
callq 0xf5a0
jmp 0xef91
movq -0x2c8(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0xf570
jmp 0xefa6
leaq -0x238(%rbp), %rdi
callq 0x62a0
movq -0x298(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
leaq -0xc8(%rbp), %rdi
callq 0xf6b0
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xeafb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x62a0
leaq -0xc8(%rbp), %rdi
callq 0xf6b0
jmp 0xf18e
movq -0x298(%rbp), %rsi
addq $0x38, %rsi
leaq -0x240(%rbp), %rdi
callq 0xf700
movq -0x298(%rbp), %rsi
addq $0x38, %rsi
leaq -0x248(%rbp), %rdi
movq %rdi, -0x2d8(%rbp)
callq 0xf760
movq -0x2d8(%rbp), %rsi
leaq -0x240(%rbp), %rdi
callq 0xf730
movb %al, -0x2c9(%rbp)
jmp 0xf05c
movb -0x2c9(%rbp), %al
testb $0x1, %al
jne 0xf06b
jmp 0xf17c
movq -0x298(%rbp), %rdi
addq $0x20, %rdi
movq %rdi, -0x2e8(%rbp)
callq 0xf7d0
movq %rax, -0x260(%rbp)
leaq -0x240(%rbp), %rdi
callq 0xf840
movq %rax, -0x2e0(%rbp)
jmp 0xf09e
movq -0x2e0(%rbp), %rax
movslq (%rax), %rsi
leaq -0x260(%rbp), %rdi
callq 0xf800
movq %rax, -0x258(%rbp)
leaq -0x250(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0xf880
leaq -0x240(%rbp), %rdi
callq 0xf840
movq %rax, -0x2f0(%rbp)
jmp 0xf0e3
movq -0x2f0(%rbp), %rsi
addq $0x8, %rsi
leaq 0x3b38f(%rip), %rdx     # 0x4a484
leaq -0x280(%rbp), %rdi
callq 0xf8c0
jmp 0xf103
movq -0x2e8(%rbp), %rdi
movq -0x250(%rbp), %rsi
leaq -0x280(%rbp), %rdx
callq 0xf790
movq %rax, -0x2f8(%rbp)
jmp 0xf126
movq -0x2f8(%rbp), %rax
movq %rax, -0x288(%rbp)
leaq -0x280(%rbp), %rdi
callq 0x62a0
leaq -0x290(%rbp), %rdi
leaq -0x240(%rbp), %rsi
xorl %edx, %edx
callq 0xf940
jmp 0xf157
jmp 0xf023
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x280(%rbp), %rdi
callq 0x62a0
jmp 0xf18e
leaq -0x28(%rbp), %rdi
callq 0x62a0
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x62a0
movq -0xd0(%rbp), %rdi
callq 0x6790
nopw %cs:(%rax,%rax)