// File: akgupta007[P]DBMS-query-processing-Algotihms/buffer_manager.cpp
// Function: BufferManager::PrintBuffer()
void BufferManager::PrintBuffer() {
	cout << "Buffer contains " << numPages << " pages of size "
      << pageSize <<".\n";
   cout << "Contents in order from most recently used to "
      << "least recently used.\n";

    for(auto slot:usedList) {
    	cout << slot << " :: \n";
      	cout << "  fd = " << buffers[slot].pageDescriptor.fd << "\n";
      	cout << "  pageNum = " << buffers[slot].pageDescriptor.pagenum << "\n";
      	cout << "  Dirty = " << buffers[slot].dirty << "\n";
      	cout << "  pinned = " << buffers[slot].pinned << "\n";
      
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq 0xcc9d(%rip), %rdi      # 0xffd8
leaq 0x6d4c(%rip), %rsi      # 0xa08e
callq 0x2190
movq %rax, %rdi
movq -0x30(%rbp), %rax
movl 0x38(%rax), %esi
callq 0x2260
movq %rax, %rdi
leaq 0x6d3f(%rip), %rsi      # 0xa09f
callq 0x2190
movq %rax, %rdi
movq -0x30(%rbp), %rax
movl 0x3c(%rax), %esi
callq 0x2260
movq %rax, %rdi
leaq 0x6d72(%rip), %rsi      # 0xa0f0
callq 0x2190
movq 0xcc4e(%rip), %rdi      # 0xffd8
leaq 0x6d1e(%rip), %rsi      # 0xa0af
callq 0x2190
movq %rax, %rdi
leaq 0x6d3d(%rip), %rsi      # 0xa0dd
callq 0x2190
movq -0x30(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3ac0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3af0
movq %rax, -0x20(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x3bb0
testb $0x1, %al
jne 0x33e1
jmp 0x3524
leaq -0x18(%rbp), %rdi
callq 0x3be0
movl (%rax), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %esi
movq 0xcbdf(%rip), %rdi      # 0xffd8
callq 0x2260
movq %rax, %rdi
leaq 0x6ceb(%rip), %rsi      # 0xa0f3
callq 0x2190
movq 0xcbc4(%rip), %rdi      # 0xffd8
leaq 0x6cde(%rip), %rsi      # 0xa0f9
callq 0x2190
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %esi
callq 0x2260
movq %rax, %rdi
leaq 0x6caf(%rip), %rsi      # 0xa0f7
callq 0x2190
movq 0xcb84(%rip), %rdi      # 0xffd8
leaq 0x6ca6(%rip), %rsi      # 0xa101
callq 0x2190
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
callq 0x2260
movq %rax, %rdi
leaq 0x6c6f(%rip), %rsi      # 0xa0f7
callq 0x2190
movq 0xcb44(%rip), %rdi      # 0xffd8
leaq 0x6c73(%rip), %rsi      # 0xa10e
callq 0x2190
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movb (%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x2280
movq %rax, %rdi
leaq 0x6c2b(%rip), %rsi      # 0xa0f7
callq 0x2190
movq 0xcb00(%rip), %rdi      # 0xffd8
leaq 0x6c3a(%rip), %rsi      # 0xa119
callq 0x2190
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movb 0x1(%rax), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x2280
movq %rax, %rdi
leaq 0x6be6(%rip), %rsi      # 0xa0f7
callq 0x2190
leaq -0x18(%rbp), %rdi
callq 0x3c00
jmp 0x33cb
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)