// File: chinmayachaudhry[P]Branch-Predictor/btb.cpp
// Function: btb::display()
void btb :: display()
{
	cout << endl << "Final BTB Tag  Array Contents {valid, pc}:" << endl;
	for(int i = 0; i<sets; i++)
	{
		cout << "Set" << setfill(' ') << setw(6) << i << ":   ";
		for(int j = 0; j<(int)btb_assoc; j++)
		{
			if(cacheline[i][j].getValidity() == "Valid")
				cout << "{1, " << showbase << internal << setfill(' ') << hex << setw(10) << cacheline[i][j].getAddress() << "} " << dec;
			else
				cout << "{0, " << showbase << internal << setfill(' ') << hex << setw(10) << cacheline[i][j].getAddress() << "} " << dec;
		}
		cout << endl;	
	}
	cout << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq 0x900a(%rip), %rdi      # 0xcfd8
movq 0x8ff3(%rip), %rsi      # 0xcfc8
callq 0x21e0
movq %rax, %rdi
leaq 0x50da(%rip), %rsi      # 0x90be
callq 0x21b0
movq %rax, %rdi
movq 0x8fd5(%rip), %rsi      # 0xcfc8
callq 0x21e0
movl $0x0, -0xc(%rbp)
movq -0x60(%rbp), %rcx
movslq -0xc(%rbp), %rax
cmpq 0x18(%rcx), %rax
jge 0x42eb
movq 0x8fc0(%rip), %rdi      # 0xcfd8
leaq 0x50ca(%rip), %rsi      # 0x90e9
callq 0x21b0
movq %rax, -0x70(%rbp)
movl $0x20, %edi
callq 0x4610
movq -0x70(%rbp), %rdi
movb %al, -0xd(%rbp)
movzbl -0xd(%rbp), %esi
callq 0x2310
movq %rax, -0x68(%rbp)
movl $0x6, %edi
callq 0x4630
movq -0x68(%rbp), %rdi
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %esi
callq 0x2240
movq %rax, %rdi
movl -0xc(%rbp), %esi
callq 0x2360
movq %rax, %rdi
leaq 0x5079(%rip), %rsi      # 0x90ed
callq 0x21b0
movl $0x0, -0x18(%rbp)
movq -0x60(%rbp), %rcx
movl -0x18(%rbp), %eax
cmpl 0x24(%rcx), %eax
jge 0x42ca
movq -0x60(%rbp), %rax
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movslq -0x18(%rbp), %rax
imulq $0x38, %rax, %rax
addq %rax, %rsi
leaq -0x38(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x44a0
movq -0x80(%rbp), %rdi
leaq 0x4fee(%rip), %rsi      # 0x90b0
callq 0x4470
movb %al, -0x71(%rbp)
jmp 0x40cc
leaq -0x38(%rbp), %rdi
callq 0x2110
movb -0x71(%rbp), %al
testb $0x1, %al
jne 0x40e1
jmp 0x41dd
movq 0x8ef0(%rip), %rdi      # 0xcfd8
leaq 0x5003(%rip), %rsi      # 0x90f2
callq 0x21b0
movq %rax, %rdi
leaq 0x552(%rip), %rsi       # 0x4650
callq 0x20a0
movq %rax, %rdi
leaq 0x573(%rip), %rsi       # 0x4680
callq 0x20a0
movq %rax, -0x98(%rbp)
movl $0x20, %edi
callq 0x4610
movq -0x98(%rbp), %rdi
movb %al, -0x45(%rbp)
movzbl -0x45(%rbp), %esi
callq 0x2310
movq %rax, %rdi
leaq -0x9f0(%rip), %rsi      # 0x3750
callq 0x20a0
movq %rax, -0x90(%rbp)
movl $0xa, %edi
callq 0x4630
movq -0x90(%rbp), %rdi
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %esi
callq 0x2240
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, -0x88(%rbp)
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x18(%rbp), %rax
imulq $0x38, %rax, %rax
addq %rax, %rdi
callq 0x46b0
movq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x2100
movq %rax, %rdi
leaq 0x4f4d(%rip), %rsi      # 0x90f7
callq 0x21b0
movq %rax, %rdi
leaq 0x517(%rip), %rsi       # 0x46d0
callq 0x20a0
jmp 0x42ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x2110
jmp 0x4307
movq 0x8df4(%rip), %rdi      # 0xcfd8
leaq 0x4f0f(%rip), %rsi      # 0x90fa
callq 0x21b0
movq %rax, %rdi
leaq 0x456(%rip), %rsi       # 0x4650
callq 0x20a0
movq %rax, %rdi
leaq 0x477(%rip), %rsi       # 0x4680
callq 0x20a0
movq %rax, -0xb0(%rbp)
movl $0x20, %edi
callq 0x4610
movq -0xb0(%rbp), %rdi
movb %al, -0x4d(%rbp)
movzbl -0x4d(%rbp), %esi
callq 0x2310
movq %rax, %rdi
leaq -0xaec(%rip), %rsi      # 0x3750
callq 0x20a0
movq %rax, -0xa8(%rbp)
movl $0xa, %edi
callq 0x4630
movq -0xa8(%rbp), %rdi
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %esi
callq 0x2240
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, -0xa0(%rbp)
movq (%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x18(%rbp), %rax
imulq $0x38, %rax, %rax
addq %rax, %rdi
callq 0x46b0
movq -0xa0(%rbp), %rdi
movq %rax, %rsi
callq 0x2100
movq %rax, %rdi
leaq 0x4e51(%rip), %rsi      # 0x90f7
callq 0x21b0
movq %rax, %rdi
leaq 0x41b(%rip), %rsi       # 0x46d0
callq 0x20a0
jmp 0x42bc
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x4080
movq 0x8d07(%rip), %rdi      # 0xcfd8
movq 0x8cf0(%rip), %rsi      # 0xcfc8
callq 0x21e0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3fff
movq 0x8ce6(%rip), %rdi      # 0xcfd8
movq 0x8ccf(%rip), %rsi      # 0xcfc8
callq 0x21e0
addq $0xb0, %rsp
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x2380