// File: chinmayachaudhry[P]Branch-Predictor/yehpatt.cpp
// Function: yehpatt::display_table()
void yehpatt :: display_table()
{
	if(branch_buffer != NULL)
		branch_buffer->display();
	
	cout << endl << "Final History Table Contents:" << endl;
	for(it = history_table.begin(); it != history_table.end(); it++)
	{
		int index = distance(history_table.begin(), it); 
		cout << "table[" << index << "]: "; 
		if(history_table.at(index) != 0)
			cout << showbase << internal << setfill(' ') << hex << setw(6) << history_table.at(index) << dec << endl;	
		else
			cout << "0x " << history_table.at(index) << dec << endl;
		
	}
	
	cout << endl << "Final Prediction Table Contents:" << endl;
	for(it = predictor_table.begin(); it != predictor_table.end(); it++)
	{
		int index = distance(predictor_table.begin(), it); 
		cout << "table[" << index << "]: " << predictor_table.at(index) << endl;	
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, 0x90(%rax)
je 0x79a1
movq -0x78(%rbp), %rax
movq 0x90(%rax), %rdi
callq 0x3fb0
movq 0x5630(%rip), %rdi      # 0xcfd8
movq 0x5619(%rip), %rsi      # 0xcfc8
callq 0x21e0
movq %rax, %rdi
leaq 0x194c(%rip), %rsi      # 0x930a
callq 0x21b0
movq %rax, %rdi
movq 0x55fb(%rip), %rsi      # 0xcfc8
callq 0x21e0
movq -0x78(%rbp), %rdi
addq $0x70, %rdi
callq 0x5330
movq %rax, %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0x10(%rbp)
movq -0x10(%rbp), %rcx
movq %rcx, 0x88(%rax)
movq -0x78(%rbp), %rdi
movq %rdi, %rax
addq $0x88, %rax
movq %rax, -0x80(%rbp)
addq $0x70, %rdi
callq 0x53a0
movq -0x80(%rbp), %rdi
movq %rax, -0x18(%rbp)
leaq -0x18(%rbp), %rsi
callq 0x5360
testb $0x1, %al
jne 0x7a29
jmp 0x7bd5
movq -0x78(%rbp), %rdi
addq $0x70, %rdi
callq 0x5330
movq %rax, %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0x28(%rbp)
movq 0x88(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x53d0
movl %eax, -0x1c(%rbp)
movq 0x5575(%rip), %rdi      # 0xcfd8
leaq 0x1899(%rip), %rsi      # 0x9303
callq 0x21b0
movq %rax, %rdi
movl -0x1c(%rbp), %esi
callq 0x2360
movq %rax, %rdi
leaq 0x16ca(%rip), %rsi      # 0x914e
callq 0x21b0
movq -0x78(%rbp), %rdi
addq $0x70, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x52f0
cmpl $0x0, (%rax)
je 0x7b61
movq 0x552e(%rip), %rdi      # 0xcfd8
leaq -0x3461(%rip), %rsi     # 0x4650
callq 0x20a0
movq %rax, %rdi
leaq -0x3440(%rip), %rsi     # 0x4680
callq 0x20a0
movq %rax, -0x98(%rbp)
movl $0x20, %edi
callq 0x4610
movq -0x98(%rbp), %rdi
movb %al, -0x31(%rbp)
movzbl -0x31(%rbp), %esi
callq 0x2310
movq %rax, %rdi
leaq -0x43a3(%rip), %rsi     # 0x3750
callq 0x20a0
movq %rax, -0x90(%rbp)
movl $0x6, %edi
callq 0x4630
movq -0x90(%rbp), %rdi
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %esi
callq 0x2240
movq -0x78(%rbp), %rdi
movq %rax, -0x88(%rbp)
addq $0x70, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x52f0
movq -0x88(%rbp), %rdi
movl (%rax), %esi
callq 0x2360
movq %rax, %rdi
leaq -0x347b(%rip), %rsi     # 0x46d0
callq 0x20a0
movq %rax, %rdi
movq 0x546e(%rip), %rsi      # 0xcfc8
callq 0x21e0
jmp 0x7bb8
movq 0x5470(%rip), %rdi      # 0xcfd8
leaq 0x17b9(%rip), %rsi      # 0x9328
callq 0x21b0
movq -0x78(%rbp), %rdi
movq %rax, -0xa0(%rbp)
addq $0x70, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x52f0
movq -0xa0(%rbp), %rdi
movl (%rax), %esi
callq 0x2360
movq %rax, %rdi
leaq -0x34d4(%rip), %rsi     # 0x46d0
callq 0x20a0
movq %rax, %rdi
movq 0x5415(%rip), %rsi      # 0xcfc8
callq 0x21e0
jmp 0x7bba
movq -0x78(%rbp), %rdi
addq $0x88, %rdi
xorl %esi, %esi
callq 0x5410
movq %rax, -0x40(%rbp)
jmp 0x79f5
movq 0x53fc(%rip), %rdi      # 0xcfd8
movq 0x53e5(%rip), %rsi      # 0xcfc8
callq 0x21e0
movq %rax, %rdi
leaq 0x173a(%rip), %rsi      # 0x932c
callq 0x21b0
movq %rax, %rdi
movq 0x53c7(%rip), %rsi      # 0xcfc8
callq 0x21e0
movq -0x78(%rbp), %rdi
addq $0x58, %rdi
callq 0x5330
movq %rax, %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0x48(%rbp)
movq -0x48(%rbp), %rcx
movq %rcx, 0x88(%rax)
movq -0x78(%rbp), %rdi
movq %rdi, %rax
addq $0x88, %rax
movq %rax, -0xa8(%rbp)
addq $0x58, %rdi
callq 0x53a0
movq -0xa8(%rbp), %rdi
movq %rax, -0x50(%rbp)
leaq -0x50(%rbp), %rsi
callq 0x5360
testb $0x1, %al
jne 0x7c63
jmp 0x7d13
movq -0x78(%rbp), %rdi
addq $0x58, %rdi
callq 0x5330
movq %rax, %rcx
movq -0x78(%rbp), %rax
movq %rcx, -0x60(%rbp)
movq 0x88(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x53d0
movl %eax, -0x54(%rbp)
movq 0x533b(%rip), %rdi      # 0xcfd8
leaq 0x165f(%rip), %rsi      # 0x9303
callq 0x21b0
movq %rax, %rdi
movl -0x54(%rbp), %esi
callq 0x2360
movq %rax, %rdi
leaq 0x1490(%rip), %rsi      # 0x914e
callq 0x21b0
movq -0x78(%rbp), %rdi
movq %rax, -0xb0(%rbp)
addq $0x58, %rdi
movslq -0x54(%rbp), %rsi
callq 0x52f0
movq -0xb0(%rbp), %rdi
movl (%rax), %esi
callq 0x2360
movq %rax, %rdi
movq 0x52d5(%rip), %rsi      # 0xcfc8
callq 0x21e0
movq -0x78(%rbp), %rdi
addq $0x88, %rdi
xorl %esi, %esi
callq 0x5410
movq %rax, -0x70(%rbp)
jmp 0x7c29
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)