// File: daniel5151[P]mips241/src/debug.cc
// Function: MIPS::Debugger::debugPrint()
void Debugger::debugPrint() {
  // "clear" screen
  cerr << string(100, '\n');

  print_stackRAM();
  print_progRAM();
  print_CPU();

  if (!watch.empty()) {
    cerr
      << endl
      << "     ADDR    |   HEXVAL   " << endl
      << "  -----------|------------" << endl;
    for (auto addr : watch) {
      cerr
        << "  "
        << toHex(addr)
        << " | "
        << toHex(ram.load(addr))
        << endl
        << endl;

    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x34d0
movq -0xb0(%rbp), %rcx
leaq -0x28(%rbp), %rdi
movl $0x64, %esi
movl $0xa, %edx
callq 0x3ce0
jmp 0x7356
movq 0xfc93(%rip), %rdi      # 0x16ff0
leaq -0x28(%rbp), %rsi
callq 0x3220
jmp 0x7368
leaq -0x28(%rbp), %rdi
callq 0x3528
leaq -0x29(%rbp), %rdi
callq 0x32d0
movq -0xb8(%rbp), %rdi
callq 0x70c0
movq -0xb8(%rbp), %rdi
callq 0x71c0
movq -0xb8(%rbp), %rdi
callq 0x72d0
movq -0xb8(%rbp), %rdi
addq $0x80, %rdi
callq 0x84e0
testb $0x1, %al
jne 0x75ca
movq 0xfc30(%rip), %rdi      # 0x16ff0
movq 0xfbe1(%rip), %rsi      # 0x16fa8
callq 0x32a0
movq %rax, %rdi
leaq 0x8e23(%rip), %rsi      # 0x101f9
callq 0x3250
movq %rax, %rdi
movq 0xfbc3(%rip), %rsi      # 0x16fa8
callq 0x32a0
movq %rax, %rdi
leaq 0x8e20(%rip), %rsi      # 0x10214
callq 0x3250
movq %rax, %rdi
movq 0xfba5(%rip), %rsi      # 0x16fa8
callq 0x32a0
movq -0xb8(%rbp), %rax
addq $0x80, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x8500
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdi
callq 0x8530
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x8560
testb $0x1, %al
jne 0x7449
jmp 0x75c8
leaq -0x50(%rbp), %rdi
callq 0x8590
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
movq 0xfb92(%rip), %rdi      # 0x16ff0
leaq 0x8c68(%rip), %rsi      # 0x100cd
callq 0x3250
movq %rax, -0xd0(%rbp)
leaq -0x80(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
leaq -0x5c(%rbp), %rsi
callq 0x82b0
movq -0xd0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
callq 0x3220
movq %rax, -0xc0(%rbp)
jmp 0x74a1
movq -0xc0(%rbp), %rdi
leaq 0x8c4e(%rip), %rsi      # 0x100fd
callq 0x3250
movq %rax, -0xd8(%rbp)
jmp 0x74bd
movq -0xb8(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x5c(%rbp), %esi
callq 0xd9e0
movl %eax, -0xdc(%rbp)
jmp 0x74d8
movl -0xdc(%rbp), %eax
movl %eax, -0xa4(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa4(%rbp), %rsi
callq 0x82b0
jmp 0x74f9
movq -0xd8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x3220
movq %rax, -0xe8(%rbp)
jmp 0x7515
movq -0xe8(%rbp), %rdi
movq 0xfa85(%rip), %rsi      # 0x16fa8
callq 0x32a0
movq %rax, -0xf0(%rbp)
jmp 0x7531
movq -0xf0(%rbp), %rdi
movq 0xfa69(%rip), %rsi      # 0x16fa8
callq 0x32a0
jmp 0x7546
leaq -0xa0(%rbp), %rdi
callq 0x3528
leaq -0x80(%rbp), %rdi
callq 0x3528
leaq -0x50(%rbp), %rdi
callq 0x85b0
jmp 0x7433
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x758c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x3528
leaq -0x29(%rbp), %rdi
callq 0x32d0
jmp 0x75d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x75bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x3528
leaq -0x80(%rbp), %rdi
callq 0x3528
jmp 0x75d3
jmp 0x75ca
addq $0xf0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x34c0
nopl (%rax)