// File: ys1998[P]spsim/src/main.cpp
// Function: print_regs(IntegerRegisterFile&, int*)
void print_regs(IntegerRegisterFile &rf, int *rmap){
	std::cout << "Integer Registers\n";
	for(int j=0; j<4; ++j){
		std::cout << "\033[0;36m  Register     Value\033[0m";
	}
	std::cout << "\n";
	for(int i=0; i < NUM_LOG_REGS/4; ++i){
		for(int j=0; j < 4; ++j){
			if(*(rmap + j*NUM_LOG_REGS/4 + i) != -1)
				std::cout << "\033[1;36m" <<
				std::setfill(' ') << std::setw(10) << j*NUM_LOG_REGS/4 + i << "\033[0m" <<
				std::setfill(' ') << std::setw(10) << rf.read(*(rmap + j*NUM_LOG_REGS/4 + i));
			else
				std::cout << "\033[1;36m" <<
				std::setfill(' ') << std::setw(10) << j*NUM_LOG_REGS/4 + i << "\033[0m" <<
				std::setfill(' ') << std::setw(10) << 0;
		}
		std::cout << std::endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x183c6(%rip), %rdi     # 0x2efd0
leaq 0xb704(%rip), %rsi      # 0x22315
callq 0x3290
movl $0x0, -0x14(%rbp)
cmpl $0x4, -0x14(%rbp)
jge 0x16c41
movq 0x183a6(%rip), %rdi     # 0x2efd0
leaq 0xb6f7(%rip), %rsi      # 0x22328
callq 0x3290
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x16c1d
movq 0x18388(%rip), %rdi     # 0x2efd0
leaq 0xb711(%rip), %rsi      # 0x22360
callq 0x3290
movl $0x0, -0x18(%rbp)
cmpl $0x8, -0x18(%rbp)
jge 0x16ea7
movl $0x0, -0x1c(%rbp)
cmpl $0x4, -0x1c(%rbp)
jge 0x16e86
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x1c(%rbp), %eax
shll $0x5, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x48(%rbp), %rax
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movslq -0x18(%rbp), %rcx
cmpl $-0x1, (%rax,%rcx,4)
je 0x16da7
movq 0x1831f(%rip), %rdi     # 0x2efd0
leaq 0xb690(%rip), %rsi      # 0x22348
callq 0x3290
movq %rax, -0x78(%rbp)
movl $0x20, %edi
callq 0x19700
movq -0x78(%rbp), %rdi
movb %al, -0x1d(%rbp)
movzbl -0x1d(%rbp), %esi
callq 0x3400
movq %rax, -0x70(%rbp)
movl $0xa, %edi
callq 0x19720
movq -0x70(%rbp), %rdi
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %esi
callq 0x3330
movq %rax, %rdi
movl -0x1c(%rbp), %eax
shll $0x5, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, %esi
addl -0x18(%rbp), %esi
callq 0x3460
movq %rax, %rdi
leaq 0xb6f5(%rip), %rsi      # 0x22412
callq 0x3290
movq %rax, -0x68(%rbp)
movl $0x20, %edi
callq 0x19700
movq -0x68(%rbp), %rdi
movb %al, -0x25(%rbp)
movzbl -0x25(%rbp), %esi
callq 0x3400
movq %rax, -0x60(%rbp)
movl $0xa, %edi
callq 0x19720
movq -0x60(%rbp), %rdi
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %esi
callq 0x3330
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movl -0x1c(%rbp), %eax
shll $0x5, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x58(%rbp), %rax
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movslq -0x18(%rbp), %rcx
movl (%rax,%rcx,4), %esi
callq 0x125f0
movq -0x50(%rbp), %rdi
movl %eax, %esi
callq 0x3460
jmp 0x16e76
movq 0x18222(%rip), %rdi     # 0x2efd0
leaq 0xb593(%rip), %rsi      # 0x22348
callq 0x3290
movq %rax, -0x98(%rbp)
movl $0x20, %edi
callq 0x19700
movq -0x98(%rbp), %rdi
movb %al, -0x2d(%rbp)
movzbl -0x2d(%rbp), %esi
callq 0x3400
movq %rax, -0x90(%rbp)
movl $0xa, %edi
callq 0x19720
movq -0x90(%rbp), %rdi
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %esi
callq 0x3330
movq %rax, %rdi
movl -0x1c(%rbp), %eax
shll $0x5, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, %esi
addl -0x18(%rbp), %esi
callq 0x3460
movq %rax, %rdi
leaq 0xb5ec(%rip), %rsi      # 0x22412
callq 0x3290
movq %rax, -0x88(%rbp)
movl $0x20, %edi
callq 0x19700
movq -0x88(%rbp), %rdi
movb %al, -0x35(%rbp)
movzbl -0x35(%rbp), %esi
callq 0x3400
movq %rax, -0x80(%rbp)
movl $0xa, %edi
callq 0x19720
movq -0x80(%rbp), %rdi
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %esi
callq 0x3330
movq %rax, %rdi
xorl %esi, %esi
callq 0x3460
jmp 0x16e78
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x16c6c
movq 0x18143(%rip), %rdi     # 0x2efd0
movq 0x1812c(%rip), %rsi     # 0x2efc0
callq 0x32e0
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x16c5b
addq $0xa0, %rsp
popq %rbp
retq