// File: /workspace/github_cpp_makefile_star2_O1/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 0x116fd(%rip), %rbx     # 0x19fd0
leaq 0xbce8(%rip), %rsi      # 0x145c2
movl $0xe, %edx
movq %rbx, %rdi
callq 0x3280
movl %ebp, %esi
movq %rbx, %rdi
movq %rsi, %r12
callq 0x3170
movq %rax, %r14
leaq 0xc622(%rip), %rsi      # 0x14f20
movl $0xb, %edx
movq %rax, %rdi
callq 0x3280
imulq $0x64c80, %r12, %r15    # imm = 0x64C80
movq %r12, %rbp
leaq 0x13924(%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 0xbc87(%rip), %rsi      # 0x145d1
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 0xbc5d(%rip), %rsi      # 0x145df
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 0xbc31(%rip), %rsi      # 0x145ea
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 0xbc07(%rip), %rsi      # 0x145f7
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 0xbbdc(%rip), %rsi      # 0x14603
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 0xb73c(%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 0xb83b(%rip), %rsi      # 0x142d2
movl $0xa, %edx
movq %rbx, %rdi
callq 0x3280
leaq 0x78415(%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 0xbafb(%rip), %rsi      # 0x14610
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 0xbabc(%rip), %rsi      # 0x14621
callq 0x3280
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3170
movq %rax, %r15
movl $0xb, %edx
movq %rax, %rdi
leaq 0xc399(%rip), %rsi      # 0x14f20
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 0xb5d1(%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 0xb9c5(%rip), %rsi      # 0x145d1
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 0xb9a7(%rip), %rsi      # 0x145df
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 0x8b56
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 0xb96c(%rip), %rsi      # 0x1462e
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 0xb936(%rip), %rsi      # 0x14640
callq 0x3280
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3170
movq %rax, %r15
movl $0xb, %edx
movq %rax, %rdi
leaq 0xc1f4(%rip), %rsi      # 0x14f20
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 0xb42c(%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 0xb820(%rip), %rsi      # 0x145d1
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 0xb802(%rip), %rsi      # 0x145df
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 0x8cfb
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 0xb79b(%rip), %rsi      # 0x1461a
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 0x90f7
xorl %r13d, %r13d
leaq 0xb7b0(%rip), %rbp      # 0x1467c
xorl %r14d, %r14d
movl $0x1, %edx
movq %rbx, %rdi
leaq 0xb1b2(%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 0xb717(%rip), %rsi      # 0x14624
callq 0x3280
movq %r15, %rdi
movq %r14, %rsi
callq 0x3170
movq %rax, %r15
movl $0xb, %edx
movq %rax, %rdi
leaq 0xbff1(%rip), %rsi      # 0x14f20
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 0xb6ef(%rip), %rsi      # 0x1464d
callq 0x3280
movq 0x50f50(%r12), %rax
movl 0x10(%rax,%r13), %esi
movq %r15, %rdi
callq 0x33c0
movl $0xa, %edx
movq %rbx, %rdi
leaq 0xb1fc(%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 0xb1c3(%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 0xb649(%rip), %rsi      # 0x1465a
callq 0x3280
movq 0x50f50(%r12), %rax
movzbl 0x32f(%rax,%r13), %esi
movq %r15, %rdi
callq 0x33c0
movl $0xd, %edx
movq %rbx, %rdi
leaq 0xb624(%rip), %rsi      # 0x14662
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 0xb606(%rip), %rsi      # 0x14670
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 0x8ecf
movq 0x10ed2(%rip), %rdi     # 0x19fd0
leaq 0xb583(%rip), %rsi      # 0x14688
callq 0x3250
leaq 0x93d17(%rip), %rcx     # 0x9ce28
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x3090
leaq 0xb57a(%rip), %rsi      # 0x1469d
movq %rax, %rdi
callq 0x3250
leaq 0x93cfe(%rip), %rcx     # 0x9ce30
movq (%rcx), %rsi
movq %rax, %rdi
callq 0x3090
movq %rax, %rdi
callq 0x3110
leaq 0xaf1b(%rip), %rdi      # 0x14067
leaq 0xb558(%rip), %rsi      # 0x146ab
leaq 0xb55d(%rip), %rcx      # 0x146b7
movl $0x127, %edx            # imm = 0x127
callq 0x3160