// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x90(%rdi), %rdi
testq %rdi, %rdi
je 0x4993
callq 0x322a
movq 0x363e(%rip), %r14      # 0x7fd8
movq %r14, %rdi
callq 0x20d0
leaq 0x94d(%rip), %rsi       # 0x52f6
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x20d0
leaq 0x70(%rbx), %r15
movq 0x70(%rbx), %rbp
leaq 0x772(%rip), %r13       # 0x513a
movq %rbp, 0x88(%rbx)
cmpq 0x78(%rbx), %rbp
je 0x4ac7
subq (%r15), %rbp
shrq $0x2, %rbp
movq %r14, %rdi
leaq 0x905(%rip), %rsi       # 0x52ef
callq 0x2180
movq %rax, %rdi
movl %ebp, %esi
callq 0x2260
movq %rax, %rdi
movq %r13, %rsi
callq 0x2180
movslq %ebp, %rbp
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3982
cmpl $0x0, (%rax)
je 0x4a73
movq (%r14), %rax
movq -0x18(%rax), %rcx
orl $0x200, 0x18(%r14,%rcx) # imm = 0x200
movq -0x18(%rax), %rax
movl 0x18(%r14,%rax), %ecx
movl $0xffffff4f, %edx       # imm = 0xFFFFFF4F
andl %edx, %ecx
orl $0x10, %ecx
movl %ecx, 0x18(%r14,%rax)
movq %r14, %rdi
pushq $0x20
popq %rsi
callq 0x2240
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rcx
movl 0x18(%r12,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%r12,%rcx)
movq -0x18(%rax), %rax
movq $0x6, 0x10(%r12,%rax)
jmp 0x4a85
movq %r14, %rdi
leaq 0x897(%rip), %rsi       # 0x5314
callq 0x2180
movq %rax, %r12
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3982
movl (%rax), %esi
movq %r12, %rdi
callq 0x2260
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
callq 0x20d0
movq 0x88(%rbx), %rbp
addq $0x4, %rbp
jmp 0x49c8
movq 0x350a(%rip), %rdi      # 0x7fd8
callq 0x20d0
leaq 0x83e(%rip), %rsi       # 0x5318
movq %rax, %rdi
callq 0x2180
movq %rax, %rdi
callq 0x20d0
leaq 0x58(%rbx), %r15
movq 0x58(%rbx), %rbp
leaq 0x7f6(%rip), %r12       # 0x52ef
leaq 0x63a(%rip), %r13       # 0x513a
movq %rbp, 0x88(%rbx)
cmpq 0x60(%rbx), %rbp
je 0x4b66
subq 0x58(%rbx), %rbp
shrq $0x2, %rbp
movq 0x34bc(%rip), %rdi      # 0x7fd8
movq %r12, %rsi
callq 0x2180
movq %rax, %rdi
movl %ebp, %esi
callq 0x2260
movq %rax, %rdi
movq %r13, %rsi
callq 0x2180
movq %rax, %r14
movslq %ebp, %rsi
movq %r15, %rdi
callq 0x3982
movl (%rax), %esi
movq %r14, %rdi
callq 0x2260
movq %rax, %rdi
callq 0x20d0
movq 0x88(%rbx), %rbp
addq $0x4, %rbp
jmp 0x4b00
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop