// File: saumya-prakash[P]AssemblerEmulator/Emulator.cpp
// Function: Emulator::disassemble(std::ostream&) const
void Emulator::disassemble(ostream& os) const
{
    for(int i=0; i<text_size; ++i)
    {
        string tmp = reverse_decode(mempory_space[i]);

        os<<"PC = ";
        os<<setw(10)<<setfill('0')<<i<<setfill(' ')<<"   ";

        os<<"Memory Content = ";
        os<<"0x"<<setw(8)<<setfill('0')<<hex<<mempory_space[i]<<dec<<setfill(' ')<<"   ";

        cout<<" "<<tmp<<endl;
    }
}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movq %rdi, 0x100(%rsp)
movq %rsi, 0xf8(%rsp)
movq 0x100(%rsp), %rax
movq %rax, 0xa8(%rsp)
movl $0x0, 0xf4(%rsp)
movq 0xa8(%rsp), %rcx
movl 0xf4(%rsp), %eax
cmpl 0x48(%rcx), %eax
jae 0x6968
movq 0xa8(%rsp), %rsi
movq 0x30(%rsi), %rax
movslq 0xf4(%rsp), %rcx
movl (%rax,%rcx,4), %edx
leaq 0xd0(%rsp), %rdi
callq 0x64c0
movq 0xf8(%rsp), %rdi
leaq 0x3e88(%rip), %rsi      # 0xa535
callq 0x21f0
jmp 0x66b4
movq 0xf8(%rsp), %rax
movq %rax, 0x98(%rsp)
movl $0xa, %edi
callq 0x75a0
movl %eax, 0xa4(%rsp)
jmp 0x66d7
movq 0x98(%rsp), %rdi
movl 0xa4(%rsp), %eax
movl %eax, 0xc0(%rsp)
movl 0xc0(%rsp), %esi
callq 0x2290
movq %rax, 0x90(%rsp)
jmp 0x6703
movl $0x30, %edi
callq 0x75c0
movb %al, 0x8f(%rsp)
jmp 0x6716
movq 0x90(%rsp), %rdi
movb 0x8f(%rsp), %al
movb %al, 0xbf(%rsp)
movzbl 0xbf(%rsp), %esi
callq 0x2350
movq %rax, 0x80(%rsp)
jmp 0x6743
movq 0x80(%rsp), %rdi
movl 0xf4(%rsp), %esi
callq 0x2380
movq %rax, 0x78(%rsp)
jmp 0x675e
movl $0x20, %edi
callq 0x75c0
movb %al, 0x77(%rsp)
jmp 0x676e
movq 0x78(%rsp), %rdi
movb 0x77(%rsp), %al
movb %al, 0xbe(%rsp)
movzbl 0xbe(%rsp), %esi
callq 0x2350
movq %rax, 0x68(%rsp)
jmp 0x6792
movq 0x68(%rsp), %rdi
leaq 0x3d9d(%rip), %rsi      # 0xa53b
callq 0x21f0
jmp 0x67a5
movq 0xf8(%rsp), %rdi
leaq 0x3d8b(%rip), %rsi      # 0xa53f
callq 0x21f0
jmp 0x67bb
movq 0xf8(%rsp), %rdi
leaq 0x3d87(%rip), %rsi      # 0xa551
callq 0x21f0
movq %rax, 0x60(%rsp)
jmp 0x67d6
movl $0x8, %edi
callq 0x75a0
movl %eax, 0x5c(%rsp)
jmp 0x67e6
movq 0x60(%rsp), %rdi
movl 0x5c(%rsp), %eax
movl %eax, 0xb8(%rsp)
movl 0xb8(%rsp), %esi
callq 0x2290
movq %rax, 0x50(%rsp)
jmp 0x6809
movl $0x30, %edi
callq 0x75c0
movb %al, 0x4f(%rsp)
jmp 0x6819
movq 0x50(%rsp), %rdi
movb 0x4f(%rsp), %al
movb %al, 0xb7(%rsp)
movzbl 0xb7(%rsp), %esi
callq 0x2350
movq %rax, 0x40(%rsp)
jmp 0x683d
movq 0x40(%rsp), %rdi
leaq 0xd97(%rip), %rsi       # 0x75e0
callq 0x20b0
movq %rax, 0x38(%rsp)
jmp 0x6855
movq 0x38(%rsp), %rdi
movq 0xa8(%rsp), %rax
movq 0x30(%rax), %rax
movslq 0xf4(%rsp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x2380
movq %rax, 0x30(%rsp)
jmp 0x687d
movq 0x30(%rsp), %rdi
leaq 0xd77(%rip), %rsi       # 0x7600
callq 0x20b0
movq %rax, 0x28(%rsp)
jmp 0x6895
movl $0x20, %edi
callq 0x75c0
movb %al, 0x27(%rsp)
jmp 0x68a5
movq 0x28(%rsp), %rdi
movb 0x27(%rsp), %al
movb %al, 0xb6(%rsp)
movzbl 0xb6(%rsp), %esi
callq 0x2350
movq %rax, 0x18(%rsp)
jmp 0x68c9
movq 0x18(%rsp), %rdi
leaq 0x3c66(%rip), %rsi      # 0xa53b
callq 0x21f0
jmp 0x68dc
movq 0x76ed(%rip), %rdi      # 0xdfd0
leaq 0x3c53(%rip), %rsi      # 0xa53d
callq 0x21f0
movq %rax, 0x10(%rsp)
jmp 0x68f6
movq 0x10(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x21d0
movq %rax, 0x8(%rsp)
jmp 0x690f
movq 0x8(%rsp), %rdi
movq 0x76a5(%rip), %rsi      # 0xdfc0
callq 0x2240
jmp 0x6922
leaq 0xd0(%rsp), %rdi
callq 0x2140
movl 0xf4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xf4(%rsp)
jmp 0x6662
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc8(%rsp)
movl %eax, 0xc4(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x2140
jmp 0x6970
addq $0x108, %rsp            # imm = 0x108
retq
movq 0xc8(%rsp), %rdi
callq 0x2390
nopl (%rax)