// File: /workspace/github_cpp_makefile_star2_O1/NishadSaraf[P]Championship-Simulator/src/main.cc
// Function: print_sim_stats(unsigned int, CACHE*)
void print_sim_stats(uint32_t cpu, CACHE *cache)
{
    uint64_t TOTAL_ACCESS = 0, TOTAL_HIT = 0, TOTAL_MISS = 0;

    for (uint32_t i=0; i<NUM_TYPES; i++) {
        TOTAL_ACCESS += cache->sim_access[cpu][i];
        TOTAL_HIT += cache->sim_hit[cpu][i];
        TOTAL_MISS += cache->sim_miss[cpu][i];
    }

    cout << cache->NAME;
    cout << " TOTAL     ACCESS: " << setw(10) << TOTAL_ACCESS << "  HIT: " << setw(10) << TOTAL_HIT << "  MISS: " << setw(10) << TOTAL_MISS << endl;

    cout << cache->NAME;
    cout << " LOAD      ACCESS: " << setw(10) << cache->sim_access[cpu][0] << "  HIT: " << setw(10) << cache->sim_hit[cpu][0] << "  MISS: " << setw(10) << cache->sim_miss[cpu][0] << endl;

    cout << cache->NAME;
    cout << " RFO       ACCESS: " << setw(10) << cache->sim_access[cpu][1] << "  HIT: " << setw(10) << cache->sim_hit[cpu][1] << "  MISS: " << setw(10) << cache->sim_miss[cpu][1] << endl;

    cout << cache->NAME;
    cout << " PREFETCH  ACCESS: " << setw(10) << cache->sim_access[cpu][2] << "  HIT: " << setw(10) << cache->sim_hit[cpu][2] << "  MISS: " << setw(10) << cache->sim_miss[cpu][2] << endl;

    cout << cache->NAME;
    cout << " WRITEBACK ACCESS: " << setw(10) << cache->sim_access[cpu][3] << "  HIT: " << setw(10) << cache->sim_hit[cpu][3] << "  MISS: " << setw(10) << cache->sim_miss[cpu][3] << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r12d
movq %r12, %rax
shlq $0x5, %rax
addq %rsi, %rax
addq $0x10328, %rax          # imm = 0x10328
pxor %xmm1, %xmm1
movq $-0x4, %rcx
pxor %xmm2, %xmm2
pxor %xmm0, %xmm0
movdqu -0x20(%rax,%rcx,8), %xmm3
paddq %xmm3, %xmm1
movdqu (%rax,%rcx,8), %xmm3
paddq %xmm3, %xmm2
movdqu 0x20(%rax,%rcx,8), %xmm3
paddq %xmm3, %xmm0
addq $0x2, %rcx
jne 0x7a5a
pshufd $0xee, %xmm1, %xmm3     # xmm3 = xmm1[2,3,2,3]
paddq %xmm1, %xmm3
movq %xmm3, %r15
pshufd $0xee, %xmm2, %xmm1     # xmm1 = xmm2[2,3,2,3]
paddq %xmm2, %xmm1
movq %xmm1, %r13
pshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
paddq %xmm0, %xmm1
movq %xmm1, (%rsp)
movq 0x7350(%rbx), %rsi
movq 0x7358(%rbx), %rdx
movq 0x12514(%rip), %r14     # 0x19fd0
movq %r14, %rdi
callq 0x3280
leaq 0xc910(%rip), %rsi      # 0x143db
movl $0x13, %edx
movq %r14, %rdi
callq 0x3280
movq (%r14), %rax
movq -0x18(%rax), %rax
movl $0xa, %ecx
movq %rcx, 0x10(%r14,%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0x3170
movq %rax, %rbp
leaq 0xc8f1(%rip), %rsi      # 0x143ef
movl $0x7, %edx
movq %rax, %rdi
callq 0x3280
movq (%rbp), %rax
movq -0x18(%rax), %rax
movl $0xa, %ecx
movq %rcx, 0x10(%rbp,%rax)
movl $0xa, %r15d
movq %rbp, %rdi
movq %r13, %rsi
callq 0x3170
movq %rax, %rbp
leaq 0xc8bf(%rip), %rsi      # 0x143f7
movl $0x8, %edx
movq %rax, %rdi
callq 0x3280
movq (%rbp), %rax
movq -0x18(%rax), %rax
movq %r15, 0x10(%rbp,%rax)
movq %rbp, %rdi
movq (%rsp), %rsi
callq 0x3170
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r13, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq 0x7350(%rbx), %rsi
movq 0x7358(%rbx), %rdx
movq %r14, %rdi
callq 0x3280
leaq 0xc87e(%rip), %rsi      # 0x14423
movl $0x13, %edx
movq %r14, %rdi
callq 0x3280
movq (%r14), %rax
movq -0x18(%rax), %rax
movl $0xa, %ebp
movq %rbp, 0x10(%r14,%rax)
shlq $0x5, %r12
movq 0x102e8(%rbx,%r12), %rsi
movq %r14, %rdi
callq 0x3170
movq %rax, %r13
movl $0x7, %edx
movq %rax, %rdi
leaq 0xc806(%rip), %rsi      # 0x143ef
callq 0x3280
movq (%r13), %rax
movq -0x18(%rax), %rax
movq %rbp, 0x10(%r13,%rax)
movl $0xa, %r15d
movq 0x10308(%rbx,%r12), %rsi
movq %r13, %rdi
callq 0x3170
movq %rax, %r13
movl $0x8, %edx
movq %rax, %rdi
leaq 0xc7d4(%rip), %rbp      # 0x143f7
movq %rbp, %rsi
callq 0x3280
movq (%r13), %rax
movq -0x18(%rax), %rax
movq %r15, 0x10(%r13,%rax)
movq 0x10328(%rbx,%r12), %rsi
movq %r13, %rdi
callq 0x3170
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r13, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq 0x7350(%rbx), %rsi
movq 0x7358(%rbx), %rdx
movq %r14, %rdi
callq 0x3280
leaq 0xc7a8(%rip), %rsi      # 0x14437
movl $0x13, %edx
movq %r14, %rdi
callq 0x3280
movq (%r14), %rax
movq -0x18(%rax), %rax
movq %r15, 0x10(%r14,%rax)
movq 0x102f0(%rbx,%r12), %rsi
movq %r14, %rdi
callq 0x3170
movq %rax, %r13
movl $0x7, %edx
movq %rax, %rdi
leaq 0xc725(%rip), %rsi      # 0x143ef
callq 0x3280
movq (%r13), %rax
movq -0x18(%rax), %rax
movq %r15, 0x10(%r13,%rax)
movq 0x10310(%rbx,%r12), %rsi
movq %r13, %rdi
callq 0x3170
movq %rax, %r13
movl $0x8, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x3280
movq (%r13), %rax
movq -0x18(%rax), %rax
movq %r15, 0x10(%r13,%rax)
movq 0x10330(%rbx,%r12), %rsi
movq %r13, %rdi
callq 0x3170
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r13, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq 0x7350(%rbx), %rsi
movq 0x7358(%rbx), %rdx
movq %r14, %rdi
callq 0x3280
leaq 0xc6e8(%rip), %rsi      # 0x1444b
movl $0x13, %edx
movq %r14, %rdi
callq 0x3280
movq (%r14), %rax
movq -0x18(%rax), %rax
movq %r15, 0x10(%r14,%rax)
movq 0x102f8(%rbx,%r12), %rsi
movq %r14, %rdi
callq 0x3170
movq %rax, %r13
movl $0x7, %edx
movq %rax, %rdi
leaq 0xc651(%rip), %rsi      # 0x143ef
callq 0x3280
movq (%r13), %rax
movq -0x18(%rax), %rax
movq %r15, 0x10(%r13,%rax)
movq 0x10318(%rbx,%r12), %rsi
movq %r13, %rdi
callq 0x3170
movq %rax, %r13
movl $0x8, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x3280
movq (%r13), %rax
movq -0x18(%rax), %rax
movq %r15, 0x10(%r13,%rax)
movq 0x10338(%rbx,%r12), %rsi
movq %r13, %rdi
callq 0x3170
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r13, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3180
movq 0x7350(%rbx), %rsi
movq 0x7358(%rbx), %rdx
movq %r14, %rdi
callq 0x3280
leaq 0xc628(%rip), %rsi      # 0x1445f
movl $0x13, %edx
movq %r14, %rdi
callq 0x3280
movq (%r14), %rax
movq -0x18(%rax), %rax
movl $0xa, %r13d
movq %r13, 0x10(%r14,%rax)
movq 0x10300(%rbx,%r12), %rsi
movq %r14, %rdi
callq 0x3170
movq %rax, %r14
movl $0x7, %edx
movq %rax, %rdi
leaq 0xc577(%rip), %rsi      # 0x143ef
callq 0x3280
movq (%r14), %rax
movq -0x18(%rax), %rax
movq %r13, 0x10(%r14,%rax)
movl $0xa, %r13d
movq 0x10320(%rbx,%r12), %rsi
movq %r14, %rdi
callq 0x3170
movq %rax, %r14
movl $0x8, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x3280
movq (%r14), %rax
movq -0x18(%rax), %rax
movq %r13, 0x10(%r14,%rax)
movq 0x10340(%rbx,%r12), %rsi
movq %r14, %rdi
callq 0x3170
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3180