// File: /workspace/github_cpp_makefile_star2_O2/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, %ebx
movq 0xf474(%rip), %r12      # 0x15fd0
leaq 0x9a6f(%rip), %rsi      # 0x105d2
movq %r12, %rdi
callq 0x2230
movl %ebx, %esi
movq %rax, %rdi
movq %rsi, %r14
callq 0x2170
leaq 0xa2d9(%rip), %rsi      # 0x10e58
movq %rax, %rdi
callq 0x2230
imulq $0x64c80, %r14, %rbx    # imm = 0x64C80
movq %r14, %r13
leaq 0x11698(%rip), %r14     # 0x18230
leaq (%r14,%rbx), %r15
movq 0x9b8(%r14,%rbx), %rcx
movl 0x958(%r14,%rbx), %edx
imulq $0x758, %rdx, %rdx      # imm = 0x758
movq (%rcx,%rdx), %rsi
movq %rax, %rdi
callq 0x2170
leaq 0x9a1b(%rip), %rsi      # 0x105e1
movq %r12, %rdi
callq 0x2230
movq 0x9b8(%r14,%rbx), %rcx
movl 0x958(%r14,%rbx), %edx
imulq $0x758, %rdx, %rdx      # imm = 0x758
movzbl 0x4c(%rcx,%rdx), %esi
movq %rax, %rdi
callq 0x2390
leaq 0x99f6(%rip), %rsi      # 0x105ef
movq %r12, %rdi
callq 0x2230
movq 0x9b8(%r14,%rbx), %rcx
movl 0x958(%r14,%rbx), %edx
imulq $0x758, %rdx, %rdx      # imm = 0x758
movl 0x64(%rcx,%rdx), %esi
movq %rax, %rdi
callq 0x2170
leaq 0x99cf(%rip), %rsi      # 0x105fa
movq %r12, %rdi
callq 0x2230
movq 0x9b8(%r14,%rbx), %rcx
movl 0x958(%r14,%rbx), %edx
imulq $0x758, %rdx, %rdx      # imm = 0x758
movl 0x68(%rcx,%rdx), %esi
movq %rax, %rdi
callq 0x2170
leaq 0x99aa(%rip), %rsi      # 0x10607
movq %r12, %rdi
callq 0x2230
movq 0x9b8(%r14,%rbx), %rcx
movl 0x958(%r14,%rbx), %edx
imulq $0x758, %rdx, %rdx      # imm = 0x758
movl 0x78(%rcx,%rdx), %esi
movq %rax, %rdi
callq 0x2390
leaq 0x9984(%rip), %rsi      # 0x10613
movq %r12, %rdi
callq 0x2230
movq 0x9b8(%r14,%rbx), %rcx
movl 0x958(%r14,%rbx), %edx
imulq $0x758, %rdx, %rdx      # imm = 0x758
movzbl 0x49(%rcx,%rdx), %esi
movq %rax, %rdi
callq 0x2390
leaq 0x94d9(%rip), %rsi      # 0x1019b
movq %r12, %rdi
callq 0x2230
movq 0x9b8(%r14,%rbx), %rcx
movl 0x958(%r14,%rbx), %edx
imulq $0x758, %rdx, %rdx      # imm = 0x758
movq 0x40(%rcx,%rdx), %rsi
movq %rax, %rdi
callq 0x2170
leaq 0x95dd(%rip), %rsi      # 0x102d2
movq %r12, %rdi
callq 0x2230
leaq 0x761ac(%rip), %rcx     # 0x7ceb0
movq %r13, %rbx
movq (%rcx,%r13,8), %rsi
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x2110
movq %r12, %rdi
callq 0x2110
leaq 0x98f6(%rip), %rsi      # 0x10620
movq %rax, %rdi
callq 0x2230
movq %rax, %rdi
callq 0x2110
xorl %r12d, %r12d
leaq 0x98ed(%rip), %rbp      # 0x10631
leaq 0x9438(%rip), %r13      # 0x10183
imulq $0x140, %rbx, %r14      # imm = 0x140
xorl %ebx, %ebx
movq 0xf275(%rip), %rdi      # 0x15fd0
cmpq $0x48, %rbx
je 0x6e42
movq %rbp, %rsi
callq 0x2230
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2170
movq %rax, %rdi
leaq 0xa0d6(%rip), %rsi      # 0x10e58
callq 0x2230
movq 0x9f0(%r15), %rcx
movq (%rcx,%r12), %rsi
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
movq %r13, %rsi
callq 0x2230
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq 0x9f0(%r15), %rcx
movq 0x18(%rcx,%r12), %rsi
movq %rax, %rdi
callq 0x2170
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
leaq 0x97f4(%rip), %rsi      # 0x105e1
callq 0x2230
movq 0x9f0(%r15), %rcx
movzbl 0x3c(%rcx,%r12), %esi
movq %rax, %rdi
callq 0x2390
movq %rax, %rdi
leaq 0x97de(%rip), %rsi      # 0x105ef
callq 0x2230
movq 0x9f0(%r15), %rcx
movzbl 0x3d(%rcx,%r14), %esi
movq %rax, %rdi
callq 0x2390
movq %rax, %rdi
callq 0x2110
incq %rbx
addq $0x140, %r12            # imm = 0x140
jmp 0x6d54
callq 0x2110
leaq 0x97f0(%rip), %rsi      # 0x1063e
movq %rax, %rdi
callq 0x2230
movq %rax, %rdi
callq 0x2110
xorl %r12d, %r12d
leaq 0x9779(%rip), %r13      # 0x105e1
leaq 0x9780(%rip), %rbp      # 0x105ef
xorl %ebx, %ebx
cmpq $0x38, %rbx
je 0x6f5f
movq 0xf14e(%rip), %rdi      # 0x15fd0
leaq 0x97c7(%rip), %rsi      # 0x10650
callq 0x2230
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2170
movq %rax, %rdi
leaq 0x9fb5(%rip), %rsi      # 0x10e58
callq 0x2230
movq 0xa28(%r15), %rcx
movq (%rcx,%r12), %rsi
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
leaq 0x92be(%rip), %rsi      # 0x10183
callq 0x2230
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq 0xa28(%r15), %rcx
movq 0x18(%rcx,%r12), %rsi
movq %rax, %rdi
callq 0x2170
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
movq %r13, %rsi
callq 0x2230
movq 0xa28(%r15), %rcx
movzbl 0x3c(%rcx,%r12), %esi
movq %rax, %rdi
callq 0x2390
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2230
movq 0xa28(%r15), %rcx
movzbl 0x3d(%rcx,%r14), %esi
movq %rax, %rdi
callq 0x2390
movq %rax, %rdi
callq 0x2110
incq %rbx
addq $0x140, %r12            # imm = 0x140
jmp 0x6e71
leaq 0x50eb8(%r15), %rbx
movq 0xf063(%rip), %r14      # 0x15fd0
movq %r14, %rdi
callq 0x2110
movq %rax, %rdi
movq %rbx, %rsi
callq 0x21d0
leaq 0x96a3(%rip), %rsi      # 0x1062a
movq %rax, %rdi
callq 0x2230
movq %rax, %rdi
callq 0x2110
xorl %ebp, %ebp
leaq 0x96ec(%rip), %r12      # 0x1068c
xorl %r13d, %r13d
movl 0x50ed8(%r15), %eax
cmpq %rax, %r13
jae 0x714a
movq %r14, %rdi
leaq 0x90d3(%rip), %rsi      # 0x10090
callq 0x2230
movq %rax, %rdi
movq %rbx, %rsi
callq 0x21d0
movq %rax, %rdi
leaq 0x965d(%rip), %rsi      # 0x10634
callq 0x2230
movq %rax, %rdi
movq %r13, %rsi
callq 0x2170
movq %rax, %rdi
leaq 0x9e67(%rip), %rsi      # 0x10e58
callq 0x2230
movq 0x50f50(%r15), %rcx
movq 0x368(%rcx,%rbp), %rsi
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
leaq 0x9646(%rip), %rsi      # 0x1065d
callq 0x2230
movq 0x50f50(%r15), %rcx
movl 0x10(%rcx,%rbp), %esi
movq %rax, %rdi
callq 0x2390
movq %r14, %rdi
leaq 0x914a(%rip), %rsi      # 0x10183
callq 0x2230
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq 0x50f50(%r15), %rcx
movq 0x340(%rcx,%rbp), %rsi
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
leaq 0x911a(%rip), %rsi      # 0x1018e
callq 0x2230
movq 0x50f50(%r15), %rcx
movq 0x348(%rcx,%rbp), %rsi
movq %rax, %rdi
callq 0x2170
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
leaq 0x95bb(%rip), %rsi      # 0x1066a
callq 0x2230
movq 0x50f50(%r15), %rcx
movzbl 0x32f(%rcx,%rbp), %esi
movq %rax, %rdi
callq 0x2390
movq %r14, %rdi
leaq 0x959d(%rip), %rsi      # 0x10672
callq 0x2230
movq 0x50f50(%r15), %rcx
movl 0x8(%rcx,%rbp), %esi
movq %rax, %rdi
callq 0x2390
movq %rax, %rdi
leaq 0x9589(%rip), %rsi      # 0x10680
callq 0x2230
movq 0x50f50(%r15), %rcx
movl 0x338(%rcx,%rbp), %esi
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
movq %r12, %rsi
callq 0x2230
movq 0x50f50(%r15), %rcx
movl 0x33c(%rcx,%rbp), %esi
movq %rax, %rdi
callq 0x2170
movq %rax, %rdi
callq 0x2110
incq %r13
addq $0x380, %rbp            # imm = 0x380
jmp 0x6fa3
movq 0xee7f(%rip), %rdi      # 0x15fd0
leaq 0x9540(%rip), %rsi      # 0x10698
callq 0x2230
leaq 0x91cb4(%rip), %rcx     # 0x98e18
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x2080
leaq 0x9537(%rip), %rsi      # 0x106ad
movq %rax, %rdi
callq 0x2230
leaq 0x91c9b(%rip), %rcx     # 0x98e20
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x2080
movq %rax, %rdi
callq 0x2110
leaq 0x8ec8(%rip), %rdi      # 0x10067
leaq 0x9515(%rip), %rsi      # 0x106bb
leaq 0x951a(%rip), %rcx      # 0x106c7
movl $0x127, %edx            # imm = 0x127
callq 0x2160