// File: /workspace/github_cpp_makefile_star2_O3/NishadSaraf[P]Championship-Simulator/src/main.cc
// Function: print_deadlock(unsigned int)
void print_deadlock(uint32_t i)
{
    cout << "DEADLOCK! CPU " << i << " instr_id: " << ooo_cpu[i].ROB.entry[ooo_cpu[i].ROB.head].instr_id;
    cout << " translated: " << +ooo_cpu[i].ROB.entry[ooo_cpu[i].ROB.head].translated;
    cout << " fetched: " << +ooo_cpu[i].ROB.entry[ooo_cpu[i].ROB.head].fetched;
    cout << " scheduled: " << +ooo_cpu[i].ROB.entry[ooo_cpu[i].ROB.head].scheduled;
    cout << " executed: " << +ooo_cpu[i].ROB.entry[ooo_cpu[i].ROB.head].executed;
    cout << " is_memory: " << +ooo_cpu[i].ROB.entry[ooo_cpu[i].ROB.head].is_memory;
    cout << " event: " << ooo_cpu[i].ROB.entry[ooo_cpu[i].ROB.head].event_cycle;
    cout << " current: " << current_core_cycle[i] << endl;

    // print LQ entry
    cout << endl << "Load Queue Entry" << endl;
    for (uint32_t j=0; j<LQ_SIZE; j++) {
        cout << "[LQ] entry: " << j << " instr_id: " << ooo_cpu[i].LQ.entry[j].instr_id << " address: " << hex << ooo_cpu[i].LQ.entry[j].physical_address << dec << " translated: " << +ooo_cpu[i].LQ.entry[j].translated << " fetched: " << +ooo_cpu[i].LQ.entry[i].fetched << endl;
    }

    // print SQ entry
    cout << endl << "Store Queue Entry" << endl;
    for (uint32_t j=0; j<SQ_SIZE; j++) {
        cout << "[SQ] entry: " << j << " instr_id: " << ooo_cpu[i].SQ.entry[j].instr_id << " address: " << hex << ooo_cpu[i].SQ.entry[j].physical_address << dec << " translated: " << +ooo_cpu[i].SQ.entry[j].translated << " fetched: " << +ooo_cpu[i].SQ.entry[i].fetched << endl;
    }

    // print L1D MSHR entry
    PACKET_QUEUE *queue;
    queue = &ooo_cpu[i].L1D.MSHR;
    cout << endl << queue->NAME << " Entry" << endl;
    for (uint32_t j=0; j<queue->SIZE; j++) {
        cout << "[" << queue->NAME << "] entry: " << j << " instr_id: " << queue->entry[j].instr_id << " rob_index: " << queue->entry[j].rob_index;
        cout << " address: " << hex << queue->entry[j].address << " full_addr: " << queue->entry[j].full_addr << dec << " type: " << +queue->entry[j].type;
        cout << " fill_level: " << queue->entry[j].fill_level << " lq_index: " << queue->entry[j].lq_index << " sq_index: " << queue->entry[j].sq_index << endl; 
    }

    // print DRC
    cout << "Last DRC read mode: " << last_drc_read_mode << " write mode: " << last_drc_write_mode << endl;

    assert(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebp
movq 0x11690(%rip), %rbx     # 0x19fd0
leaq 0xbcbb(%rip), %rsi      # 0x14602
movl $0xe, %edx
movq %rbx, %rdi
callq 0x3280
movl %ebp, %esi
movq %rbx, %rdi
movq %rsi, %r12
callq 0x3170
movq %rax, %r14
leaq 0xc5e5(%rip), %rsi      # 0x14f50
movl $0xb, %edx
movq %rax, %rdi
callq 0x3280
imulq $0x64c80, %r12, %r15    # imm = 0x64C80
movq %r12, %rbp
leaq 0x138b7(%rip), %r13     # 0x1c240
leaq (%r15,%r13), %r12
movq 0x9b8(%r13,%r15), %rax
movl 0x958(%r13,%r15), %ecx
imulq $0x758, %rcx, %rcx      # imm = 0x758
movq (%rax,%rcx), %rsi
movq %r14, %rdi
callq 0x3170
leaq 0xbc5a(%rip), %rsi      # 0x14611
movl $0xd, %edx
movq %rbx, %rdi
callq 0x3280
movq 0x9b8(%r13,%r15), %rax
movl 0x958(%r13,%r15), %ecx
imulq $0x758, %rcx, %rcx      # imm = 0x758
movzbl 0x4c(%rax,%rcx), %esi
movq %rbx, %rdi
callq 0x33c0
leaq 0xbc30(%rip), %rsi      # 0x1461f
movl $0xa, %edx
movq %rbx, %rdi
callq 0x3280
movq 0x9b8(%r13,%r15), %rax
movl 0x958(%r13,%r15), %ecx
imulq $0x758, %rcx, %rcx      # imm = 0x758
movl 0x64(%rax,%rcx), %esi
movq %rbx, %rdi
callq 0x3170
leaq 0xbc04(%rip), %rsi      # 0x1462a
movl $0xc, %edx
movq %rbx, %rdi
callq 0x3280
movq 0x9b8(%r13,%r15), %rax
movl 0x958(%r13,%r15), %ecx
imulq $0x758, %rcx, %rcx      # imm = 0x758
movl 0x68(%rax,%rcx), %esi
movq %rbx, %rdi
callq 0x3170
leaq 0xbbda(%rip), %rsi      # 0x14637
movl $0xb, %edx
movq %rbx, %rdi
callq 0x3280
movq 0x9b8(%r13,%r15), %rax
movl 0x958(%r13,%r15), %ecx
imulq $0x758, %rcx, %rcx      # imm = 0x758
movl 0x78(%rax,%rcx), %esi
movq %rbx, %rdi
callq 0x33c0
leaq 0xbbaf(%rip), %rsi      # 0x14643
movl $0xc, %edx
movq %rbx, %rdi
callq 0x3280
movq 0x9b8(%r13,%r15), %rax
movl 0x958(%r13,%r15), %ecx
imulq $0x758, %rcx, %rcx      # imm = 0x758
movzbl 0x49(%rax,%rcx), %esi
movq %rbx, %rdi
callq 0x33c0
leaq 0xb6cf(%rip), %rsi      # 0x1419b
movl $0x8, %edx
movq %rbx, %rdi
callq 0x3280
movq 0x9b8(%r13,%r15), %rax
movl 0x958(%r13,%r15), %ecx
imulq $0x758, %rcx, %rcx      # imm = 0x758
movq 0x40(%rax,%rcx), %rsi
movq %rbx, %rdi
callq 0x3170
leaq 0xb7ce(%rip), %rsi      # 0x142d2
movl $0xa, %edx
movq %rbx, %rdi
callq 0x3280
leaq 0x783a8(%rip), %rax     # 0x80ec0
movq %rbp, %r15
movq (%rax,%rbp,8), %rsi
movq %rbx, %rdi
callq 0x3170
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq %rax, %r14
leaq 0xbace(%rip), %rsi      # 0x14650
movl $0x10, %edx
movq %rax, %rdi
callq 0x3280
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
xorl %ebp, %ebp
leaq (%r15,%r15,4), %r13
shlq $0x6, %r13
xorl %r14d, %r14d
movl $0xc, %edx
movq %rbx, %rdi
leaq 0xba8f(%rip), %rsi      # 0x14661
callq 0x3280
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3170
movq %rax, %r15
movl $0xb, %edx
movq %rax, %rdi
leaq 0xc35c(%rip), %rsi      # 0x14f50
callq 0x3280
movq 0x9f0(%r12), %rax
movq (%rax,%rbp), %rsi
movq %r15, %rdi
callq 0x3170
movq %rax, %r15
movl $0xa, %edx
movq %rax, %rdi
leaq 0xb564(%rip), %rsi      # 0x14183
callq 0x3280
movq (%r15), %rax
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r15,%rax)
movq 0x9f0(%r12), %rax
movq 0x18(%rax,%rbp), %rsi
movq %r15, %rdi
callq 0x3170
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%r15,%rax)
movl $0xd, %edx
movq %r15, %rdi
leaq 0xb998(%rip), %rsi      # 0x14611
callq 0x3280
movq 0x9f0(%r12), %rax
movzbl 0x3c(%rax,%rbp), %esi
movq %r15, %rdi
callq 0x33c0
movq %rax, %r15
movl $0xa, %edx
movq %rax, %rdi
leaq 0xb97a(%rip), %rsi      # 0x1461f
callq 0x3280
movq 0x9f0(%r12), %rax
movzbl 0x3d(%rax,%r13), %esi
movq %r15, %rdi
callq 0x33c0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
incq %r14
addq $0x140, %rbp            # imm = 0x140
cmpq $0x48, %r14
jne 0x8bc3
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq %rax, %r14
leaq 0xb93f(%rip), %rsi      # 0x1466e
movl $0x11, %edx
movq %rax, %rdi
callq 0x3280
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
xorl %ebp, %ebp
xorl %r14d, %r14d
movl $0xc, %edx
movq %rbx, %rdi
leaq 0xb909(%rip), %rsi      # 0x14680
callq 0x3280
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3170
movq %rax, %r15
movl $0xb, %edx
movq %rax, %rdi
leaq 0xc1b7(%rip), %rsi      # 0x14f50
callq 0x3280
movq 0xa28(%r12), %rax
movq (%rax,%rbp), %rsi
movq %r15, %rdi
callq 0x3170
movq %rax, %r15
movl $0xa, %edx
movq %rax, %rdi
leaq 0xb3bf(%rip), %rsi      # 0x14183
callq 0x3280
movq (%r15), %rax
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%r15,%rax)
movq 0xa28(%r12), %rax
movq 0x18(%rax,%rbp), %rsi
movq %r15, %rdi
callq 0x3170
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%r15,%rax)
movl $0xd, %edx
movq %r15, %rdi
leaq 0xb7f3(%rip), %rsi      # 0x14611
callq 0x3280
movq 0xa28(%r12), %rax
movzbl 0x3c(%rax,%rbp), %esi
movq %r15, %rdi
callq 0x33c0
movq %rax, %r15
movl $0xa, %edx
movq %rax, %rdi
leaq 0xb7d5(%rip), %rsi      # 0x1461f
callq 0x3280
movq 0xa28(%r12), %rax
movzbl 0x3d(%rax,%r13), %esi
movq %r15, %rdi
callq 0x33c0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
incq %r14
addq $0x140, %rbp            # imm = 0x140
cmpq $0x38, %r14
jne 0x8d68
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq 0x50eb8(%r12), %rsi
movq 0x50ec0(%r12), %rdx
movq %rax, %rdi
callq 0x3280
movq %rax, %r14
leaq 0xb76e(%rip), %rsi      # 0x1465a
movl $0x6, %edx
movq %rax, %rdi
callq 0x3280
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
cmpl $0x0, 0x50ed8(%r12)
je 0x9164
xorl %r13d, %r13d
leaq 0xb783(%rip), %rbp      # 0x146bc
xorl %r14d, %r14d
movl $0x1, %edx
movq %rbx, %rdi
leaq 0xb145(%rip), %rsi      # 0x14090
callq 0x3280
movq 0x50eb8(%r12), %rsi
movq 0x50ec0(%r12), %rdx
movq %rbx, %rdi
callq 0x3280
movq %rax, %r15
movl $0x9, %edx
movq %rax, %rdi
leaq 0xb6ea(%rip), %rsi      # 0x14664
callq 0x3280
movq %r15, %rdi
movq %r14, %rsi
callq 0x3170
movq %rax, %r15
movl $0xb, %edx
movq %rax, %rdi
leaq 0xbfb4(%rip), %rsi      # 0x14f50
callq 0x3280
movq 0x50f50(%r12), %rax
movq 0x368(%rax,%r13), %rsi
movq %r15, %rdi
callq 0x3170
movq %rax, %r15
movl $0xc, %edx
movq %rax, %rdi
leaq 0xb6c2(%rip), %rsi      # 0x1468d
callq 0x3280
movq 0x50f50(%r12), %rax
movl 0x10(%rax,%r13), %esi
movq %r15, %rdi
callq 0x33c0
movl $0xa, %edx
movq %rbx, %rdi
leaq 0xb18f(%rip), %rsi      # 0x14183
callq 0x3280
movq (%rbx), %rax
movq -0x18(%rax), %rax
movl 0x18(%rbx,%rax), %ecx
andl $-0x4b, %ecx
orl $0x8, %ecx
movl %ecx, 0x18(%rbx,%rax)
movq 0x50f50(%r12), %rax
movq 0x340(%rax,%r13), %rsi
movq %rbx, %rdi
callq 0x3170
movq %rax, %r15
movl $0xc, %edx
movq %rax, %rdi
leaq 0xb156(%rip), %rsi      # 0x1418e
callq 0x3280
movq 0x50f50(%r12), %rax
movq 0x348(%rax,%r13), %rsi
movq %r15, %rdi
callq 0x3170
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rax
movl 0x18(%r15,%rax), %ecx
andl $-0x4b, %ecx
orl $0x2, %ecx
movl %ecx, 0x18(%r15,%rax)
movl $0x7, %edx
movq %r15, %rdi
leaq 0xb61c(%rip), %rsi      # 0x1469a
callq 0x3280
movq 0x50f50(%r12), %rax
movzbl 0x32f(%rax,%r13), %esi
movq %r15, %rdi
callq 0x33c0
movl $0xd, %edx
movq %rbx, %rdi
leaq 0xb5f7(%rip), %rsi      # 0x146a2
callq 0x3280
movq 0x50f50(%r12), %rax
movl 0x8(%rax,%r13), %esi
movq %rbx, %rdi
callq 0x33c0
movq %rax, %r15
movl $0xb, %edx
movq %rax, %rdi
leaq 0xb5d9(%rip), %rsi      # 0x146b0
callq 0x3280
movq 0x50f50(%r12), %rax
movl 0x338(%rax,%r13), %esi
movq %r15, %rdi
callq 0x3170
movq %rax, %r15
movl $0xb, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x3280
movq 0x50f50(%r12), %rax
movl 0x33c(%rax,%r13), %esi
movq %r15, %rdi
callq 0x3170
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
incq %r14
movl 0x50ed8(%r12), %eax
addq $0x380, %r13            # imm = 0x380
cmpq %rax, %r14
jb 0x8f3c
movq 0x10e65(%rip), %rdi     # 0x19fd0
leaq 0xb556(%rip), %rsi      # 0x146c8
callq 0x3250
leaq 0x93caa(%rip), %rcx     # 0x9ce28
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x3090
leaq 0xb54d(%rip), %rsi      # 0x146dd
movq %rax, %rdi
callq 0x3250
leaq 0x93c91(%rip), %rcx     # 0x9ce30
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x3090
movq %rax, %rdi
callq 0x3110
leaq 0xaeae(%rip), %rdi      # 0x14067
leaq 0xb52b(%rip), %rsi      # 0x146eb
leaq 0xb530(%rip), %rcx      # 0x146f7
movl $0x127, %edx            # imm = 0x127
callq 0x3160