// File: NishadSaraf[P]Championship-Simulator/src/main.cc
// Function: print_dram_stats()
void print_dram_stats()
{
    cout << endl;
    cout << "DRAM Statistics" << endl;
    cout << " RQ ROW_BUFFER_HIT: " << setw(10) << uncore.DRAM.RQ.ROW_BUFFER_HIT << "  ROW_BUFFER_MISS: " << setw(10) << uncore.DRAM.RQ.ROW_BUFFER_MISS << endl;
    cout << " DBUS_CONGESTED: " << setw(10) << uncore.DRAM.dbus_congested[NUM_TYPES][NUM_TYPES] << endl; 
    cout << " WQ ROW_BUFFER_HIT: " << setw(10) << uncore.DRAM.WQ.ROW_BUFFER_HIT << "  ROW_BUFFER_MISS: " << setw(10) << uncore.DRAM.WQ.ROW_BUFFER_MISS;
    cout << "  FULL: " << setw(10) << uncore.DRAM.WQ.FULL << endl; 

    for (uint32_t i=0; i<NUM_TYPES+1; i++) {
        for (uint32_t j=0; j<NUM_TYPES+1; j++)
            cout << " DBUS_OCCUPIED_BY_" << i << " BLOCKING_" << j << " numbers: " << uncore.DRAM.dbus_congested[i][j] << endl;
        cout << endl;
    }

    uint64_t total_congested_cycle = 0;
    for (uint32_t i=0; i<DRAM_CHANNELS; i++)
        total_congested_cycle += uncore.DRAM.dbus_cycle_congested[i];
    cout << " AVG_CONGESTED_CYCLE: " << (total_congested_cycle / uncore.DRAM.dbus_congested[NUM_TYPES][NUM_TYPES]) << endl;
}

// Assembly:
subq $0x68, %rsp
movq 0x1d275(%rip), %rdi     # 0x28fd0
movq 0x1d256(%rip), %rsi     # 0x28fb8
callq 0x3250
movq 0x1d262(%rip), %rdi     # 0x28fd0
leaq 0x17707(%rip), %rsi     # 0x2347c
callq 0x3220
movq %rax, %rdi
movq 0x1d234(%rip), %rsi     # 0x28fb8
callq 0x3250
movq 0x1d240(%rip), %rdi     # 0x28fd0
leaq 0x176f5(%rip), %rsi     # 0x2348c
callq 0x3220
movq %rax, 0x8(%rsp)
movl $0xa, %edi
callq 0xfda0
movq 0x8(%rsp), %rdi
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %esi
callq 0x3270
movq %rax, %rdi
leaq 0x84119(%rip), %rax     # 0x8fee0
movq 0x1a320(%rax), %rsi
callq 0x3080
movq %rax, %rdi
leaq 0x176c4(%rip), %rsi     # 0x234a1
callq 0x3220
movq %rax, 0x10(%rsp)
movl $0xa, %edi
callq 0xfda0
movq 0x10(%rsp), %rdi
movl %eax, 0x60(%rsp)
movl 0x60(%rsp), %esi
callq 0x3270
movq %rax, %rdi
leaq 0x840d3(%rip), %rax     # 0x8fee0
movq 0x1a328(%rax), %rsi
callq 0x3080
movq %rax, %rdi
movq 0x1d195(%rip), %rsi     # 0x28fb8
callq 0x3250
movq 0x1d1a1(%rip), %rdi     # 0x28fd0
leaq 0x1767f(%rip), %rsi     # 0x234b5
callq 0x3220
movq %rax, 0x18(%rsp)
movl $0xa, %edi
callq 0xfda0
movq 0x18(%rsp), %rdi
movl %eax, 0x5c(%rsp)
movl 0x5c(%rsp), %esi
callq 0x3270
movq %rax, %rdi
leaq 0x8407a(%rip), %rax     # 0x8fee0
movq 0x179e0(%rax), %rsi
callq 0x3080
movq %rax, %rdi
movq 0x1d13c(%rip), %rsi     # 0x28fb8
callq 0x3250
movq 0x1d148(%rip), %rdi     # 0x28fd0
leaq 0x17638(%rip), %rsi     # 0x234c7
callq 0x3220
movq %rax, 0x20(%rsp)
movl $0xa, %edi
callq 0xfda0
movq 0x20(%rsp), %rdi
movl %eax, 0x58(%rsp)
movl 0x58(%rsp), %esi
callq 0x3270
movq %rax, %rdi
leaq 0x84021(%rip), %rax     # 0x8fee0
movq 0x18680(%rax), %rsi
callq 0x3080
movq %rax, %rdi
leaq 0x175cc(%rip), %rsi     # 0x234a1
callq 0x3220
movq %rax, 0x28(%rsp)
movl $0xa, %edi
callq 0xfda0
movq 0x28(%rsp), %rdi
movl %eax, 0x54(%rsp)
movl 0x54(%rsp), %esi
callq 0x3270
movq %rax, %rdi
leaq 0x83fdb(%rip), %rax     # 0x8fee0
movq 0x18688(%rax), %rsi
callq 0x3080
movq 0x1d0b8(%rip), %rdi     # 0x28fd0
leaq 0x175bd(%rip), %rsi     # 0x234dc
callq 0x3220
movq %rax, 0x30(%rsp)
movl $0xa, %edi
callq 0xfda0
movq 0x30(%rsp), %rdi
movl %eax, 0x50(%rsp)
movl 0x50(%rsp), %esi
callq 0x3270
movq %rax, %rdi
leaq 0x83f91(%rip), %rax     # 0x8fee0
movq 0x18690(%rax), %rsi
callq 0x3080
movq %rax, %rdi
movq 0x1d053(%rip), %rsi     # 0x28fb8
callq 0x3250
movl $0x0, 0x4c(%rsp)
cmpl $0x5, 0x4c(%rsp)
jae 0xc04b
movl $0x0, 0x48(%rsp)
cmpl $0x5, 0x48(%rsp)
jae 0xc028
movq 0x1d039(%rip), %rdi     # 0x28fd0
leaq 0x17547(%rip), %rsi     # 0x234e5
callq 0x3220
movq %rax, %rdi
movl 0x4c(%rsp), %esi
callq 0x32c0
movq %rax, %rdi
leaq 0x1753f(%rip), %rsi     # 0x234f8
callq 0x3220
movq %rax, %rdi
movl 0x48(%rsp), %esi
callq 0x32c0
movq %rax, %rdi
leaq 0x1752f(%rip), %rsi     # 0x23503
callq 0x3220
movq %rax, %rdi
movl 0x4c(%rsp), %eax
movl %eax, %ecx
leaq 0x83ef7(%rip), %rax     # 0x8fee0
addq $0x103a8, %rax          # imm = 0x103A8
addq $0x7578, %rax           # imm = 0x7578
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x48(%rsp), %ecx
movq (%rax,%rcx,8), %rsi
callq 0x3080
movq %rax, %rdi
movq 0x1cfa5(%rip), %rsi     # 0x28fb8
callq 0x3250
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0xbf85
movq 0x1cfa1(%rip), %rdi     # 0x28fd0
movq 0x1cf82(%rip), %rsi     # 0x28fb8
callq 0x3250
movl 0x4c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4c(%rsp)
jmp 0xbf72
movq $0x0, 0x40(%rsp)
movl $0x0, 0x3c(%rsp)
cmpl $0x1, 0x3c(%rsp)
jae 0xc08f
movl 0x3c(%rsp), %eax
movl %eax, %ecx
leaq 0x83e70(%rip), %rax     # 0x8fee0
movq 0x17918(%rax,%rcx,8), %rax
addq 0x40(%rsp), %rax
movq %rax, 0x40(%rsp)
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0xc05c
movq 0x1cf3a(%rip), %rdi     # 0x28fd0
leaq 0x17471(%rip), %rsi     # 0x2350e
callq 0x3220
movq %rax, %rdi
movq 0x40(%rsp), %rax
leaq 0x83e2f(%rip), %rcx     # 0x8fee0
xorl %edx, %edx
divq 0x179e0(%rcx)
movq %rax, %rsi
callq 0x3080
movq %rax, %rdi
movq 0x1ceec(%rip), %rsi     # 0x28fb8
callq 0x3250
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)