// File: /workspace/github_cpp_makefile_star2_O1/saumya-prakash[P]AssemblerEmulator/Emulator.cpp
// Function: Emulator::memory_dump(std::ostream&) const
void Emulator::memory_dump(ostream& os) const
{
    int per_line = 4;

    os<<hex<<showbase;

    os<<"Text Segment :-\n\tsize = "<<text_size<<'\n';

    unsigned i = pc_lower;
    while(i<text_size)
    {
        os<<i<<": "<<mempory_space[i]<<'\n';
        i++;
    }

    os<<"\n\n";

    os<<"Data Segment :-\n\tsize = "<<data_size<<'\n';
    i = 0;
    while(i<data_size)
    {
        os<<i+data_lower<<": "<<mempory_space[i+data_lower];
        os<<"  (In decimal: "<<dec<<mempory_space[i+data_lower]<<hex<<")\n";
        i++;
    }


    os<<'\n'<<noshowbase;

    os<<dec;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rax
movq -0x18(%rax), %rcx
movl 0x18(%rsi,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rsi,%rcx)
movq -0x18(%rax), %rax
orl $0x200, 0x18(%rsi,%rax) # imm = 0x200
leaq 0x18eb(%rip), %rsi      # 0x7512
movl $0x18, %edx
movq %rbx, %rdi
callq 0x21b0
movl 0x48(%r14), %esi
movq %rbx, %rdi
callq 0x2110
leaq 0x5(%rsp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x21b0
cmpl $0x0, 0x48(%r14)
je 0x5cba
xorl %r15d, %r15d
leaq 0x18ee(%rip), %r12      # 0x7554
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2110
movq %rax, %rbp
movl $0x2, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x21b0
movq 0x30(%r14), %rax
movl (%rax,%r15,4), %esi
movq %rbp, %rdi
callq 0x2260
movb $0xa, 0x4(%rsp)
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x21b0
incq %r15
movl 0x48(%r14), %eax
cmpq %rax, %r15
jb 0x5c6b
leaq 0x186a(%rip), %rsi      # 0x752b
movl $0x2, %edx
movq %rbx, %rdi
callq 0x21b0
leaq 0x1859(%rip), %rsi      # 0x752e
movl $0x18, %edx
movq %rbx, %rdi
callq 0x21b0
movl 0x4c(%r14), %esi
movq %rbx, %rdi
callq 0x2110
leaq 0x6(%rsp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x21b0
cmpl $0x0, 0x4c(%r14)
je 0x5dc8
movl $0x400, %r12d           # imm = 0x400
leaq 0x183c(%rip), %r13      # 0x7557
movl %r12d, %ebp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x2110
movq %rax, %r15
movl $0x2, %edx
movq %rax, %rdi
leaq 0x1819(%rip), %rsi      # 0x7554
callq 0x21b0
movq 0x30(%r14), %rax
movl (%rax,%rbp,4), %esi
movq %r15, %rdi
callq 0x2260
movl $0xf, %edx
movq %rbx, %rdi
leaq 0x17e9(%rip), %rsi      # 0x7547
callq 0x21b0
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%rbx,%rax)
movq 0x30(%r14), %rax
movl (%rax,%rbp,4), %esi
movq %rbx, %rdi
callq 0x2260
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movl $0x2, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x21b0
movl 0x4c(%r14), %eax
leaq 0x1(%r12), %rcx
addq $-0x3ff, %r12           # imm = 0xFC01
cmpq %rax, %r12
movq %rcx, %r12
jb 0x5d1b
leaq 0x7(%rsp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rbx, %rdi
callq 0x21b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
andl $0xfffffdff, 0x18(%rax,%rcx) # imm = 0xFFFFFDFF
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%rbx,%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq