// File: /workspace/github_cpp_makefile_star2_O1/gulshan216[P]Perceptron_Based_Reuse_Prediction/efectiu.cc
// Function: print_stats()
void print_stats (void) {
	int i;

	LLC.repl->PrintStats (cout);
	// estimate number of instructions executed so far using IPC from original simulations

	double sum = 0.0;
	for (i=0; i<ncores; i++)
		sum += last_insts[i];

	// compute estimated MPKIs

	char hostname[100];
	gethostname (hostname, 100);
	printf ("hostname %s\n", hostname);
	fflush (stdout);

	// printf ("L3 counts: %lld %lld %lld %lld ", LLC.counts[0], LLC.counts[1], LLC.counts[2], LLC.counts[6]);
	printf ("L3 instructions: ");
	for (i=0; i<ncores; i++) printf ("core %d: %lld ", i, last_insts[i]-insts_at_warming[i]);
	printf ("\nL3 misses: ");
	for (i=0; i<ncores; i++) printf ("core %d: %lld ", i, (l3_misses[i]-l3_misses_at_warming[i]));
	printf ("\nL3 mpki: ");
	for (i=0; i<ncores; i++) printf ("core %d: %0.4f ", i, 1000.0 * (l3_misses[i]-l3_misses_at_warming[i]) / (double) (last_insts[i]-insts_at_warming[i]));
	printf ("\n");
	if (!warming) for (i=0; i<ncores; i++) {
#if 0
#define L3_MISS_PENALTY	270
		double cpi = 
			  ( L3_MISS_PENALTY * ((l3_misses[i]-l3_misses_at_warming[i]) / 
(double) (last_insts[i]-insts_at_warming[i])) )
			+ 0.33333;
#else
#endif
		const char *name = readers[i]->getname ();
		model *m = NULL;
		double cpi;
		for (int j=0; models[j].name; j++) {
			if (strstr (name, models[j].name)) {
				m = &models[j];
				break;
			}
		}
		if (!m) {
			fprintf (stderr, "no model! defaulting to stupid model.\n");
#define L3_MISS_PENALTY	270
			cpi = ( L3_MISS_PENALTY * ((l3_misses[i]-l3_misses_at_warming[i]) / (double) (last_insts[i]-insts_at_warming[i])) ) + 0.33333;
		} else {
			double mpki = 1000.0 * ((l3_misses[i]-l3_misses_at_warming[i]) / (double) (last_insts[i]-insts_at_warming[i]));
			cpi = mpki * m->m + m->b;
		}
		printf ("core %d: %0.4f IPC\n", i, 1 / cpi);
	}
	fflush (stdout);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq 0x1f780e(%rip), %rdi    # 0x5fcfa8
movq $0x602200, %rsi         # imm = 0x602200
callq 0x405e7a
leaq 0x10(%rsp), %rbx
movl $0x64, %esi
movq %rbx, %rdi
callq 0x54cb50
leaq 0x184091(%rip), %rdi    # 0x589850
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4de520
movq $0x5fb510, %rax         # imm = 0x5FB510
movq (%rax), %rdi
callq 0x4ed080
leaq 0x18407e(%rip), %rdi    # 0x58985d
xorl %eax, %eax
callq 0x4de520
cmpl $0x0, 0x1f88db(%rip)    # 0x5fe0c8
leaq 0x1f891c(%rip), %r12    # 0x5fe110
leaq 0x1fa115(%rip), %r13    # 0x5ff910
jle 0x405832
leaq 0x18406b(%rip), %rbx    # 0x58986f
xorl %r15d, %r15d
xorl %r14d, %r14d
movq (%r15,%r12), %rdx
subq (%r15,%r13), %rdx
movq %rbx, %rdi
movl %r14d, %esi
xorl %eax, %eax
callq 0x4de520
incq %r14
movslq 0x1f889f(%rip), %rax    # 0x5fe0c8
addq $0x8, %r15
cmpq %rax, %r14
jl 0x40580a
leaq 0x184045(%rip), %rdi    # 0x58987e
xorl %eax, %eax
callq 0x4de520
cmpl $0x0, 0x1f8881(%rip)    # 0x5fe0c8
leaq 0x1f8772(%rip), %rbp    # 0x5fdfc0
leaq 0x1f87eb(%rip), %r15    # 0x5fe040
jle 0x40588c
leaq 0x184011(%rip), %rbx    # 0x58986f
xorl %r12d, %r12d
xorl %r14d, %r14d
movq (%r12,%rbp), %rdx
subq (%r12,%r15), %rdx
movq %rbx, %rdi
movl %r14d, %esi
xorl %eax, %eax
callq 0x4de520
incq %r14
movslq 0x1f8845(%rip), %rax    # 0x5fe0c8
addq $0x8, %r12
cmpq %rax, %r14
jl 0x405864
leaq 0x183ff8(%rip), %rdi    # 0x58988b
xorl %eax, %eax
callq 0x4de520
cmpl $0x0, 0x1f8827(%rip)    # 0x5fe0c8
leaq 0x1f8868(%rip), %rcx    # 0x5fe110
jle 0x405953
movq %rbp, %rbx
xorl %r12d, %r12d
leaq 0x183fdb(%rip), %r13    # 0x589896
xorl %r14d, %r14d
movq (%r12,%rbx), %rax
subq (%r12,%r15), %rax
movq %rax, %xmm1
movq 0x18381d(%rip), %xmm2   # 0x5890f0
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x183821(%rip), %xmm3   # 0x589100
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq (%r12,%rcx), %rax
leaq 0x1fa016(%rip), %rdx    # 0x5ff910
subq (%r12,%rdx), %rax
mulsd 0x18380a(%rip), %xmm0   # 0x589110
movq %rax, %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
movq %r13, %rdi
movl %r14d, %esi
movb $0x1, %al
movq %r15, %rbp
movq %rcx, %r15
callq 0x4de520
movq %r15, %rcx
movq %rbp, %r15
incq %r14
movslq 0x1f8782(%rip), %rax    # 0x5fe0c8
addq $0x8, %r12
cmpq %rax, %r14
jl 0x4058be
movq %r15, %rbp
movl $0xa, %edi
callq 0x4ee110
cmpb $0x0, 0x1f50c1(%rip)    # 0x5faa28
leaq 0x1f9fa2(%rip), %r13    # 0x5ff910
jne 0x405aa1
cmpl $0x0, 0x1f874d(%rip)    # 0x5fe0c8
jle 0x405aa1
xorl %ebx, %ebx
leaq 0x1f7636(%rip), %r15    # 0x5fcfc0
movq 0x1f47af(%rip), %rsi    # 0x5fa140
testq %rsi, %rsi
je 0x4059d5
movq (%r15,%rbx,8), %r12
addq $0x60, %r12
movq %r12, %rdi
callq 0x401098
leaq 0x1f4793(%rip), %r14    # 0x5fa140
testq %rax, %rax
jne 0x4059d8
leaq 0x1f4787(%rip), %r14    # 0x5fa140
movq 0x18(%r14), %rsi
testq %rsi, %rsi
je 0x4059d5
movq %r12, %rdi
callq 0x401098
addq $0x18, %r14
testq %rax, %rax
je 0x4059b9
jmp 0x4059d8
xorl %r14d, %r14d
testq %r14, %r14
je 0x405a8c
leaq 0x1f85d8(%rip), %rax    # 0x5fdfc0
movq (%rax,%rbx,8), %rax
subq (%rbp,%rbx,8), %rax
movq %rax, %xmm0
movq 0x1836f2(%rip), %xmm2   # 0x5890f0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x1836f6(%rip), %xmm3   # 0x589100
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
leaq 0x1f86ef(%rip), %rax    # 0x5fe110
movq (%rax,%rbx,8), %rax
subq (%r13,%rbx,8), %rax
movq %rax, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm3, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
divsd %xmm2, %xmm1
mulsd 0x1836c1(%rip), %xmm1   # 0x589110
mulsd 0x8(%r14), %xmm1
addsd 0x10(%r14), %xmm1
movsd 0x1836b5(%rip), %xmm0   # 0x589118
divsd %xmm1, %xmm0
leaq 0x183e5f(%rip), %rdi    # 0x5898cd
movl %ebx, %esi
movb $0x1, %al
callq 0x4de520
incq %rbx
movslq 0x1f8647(%rip), %rax    # 0x5fe0c8
cmpq %rax, %rbx
jl 0x40598a
jmp 0x405aa1
movq %rbx, %rdi
leaq 0x8(%rsp), %rsi
callq 0x40139a
movsd 0x8(%rsp), %xmm1
jmp 0x405a5b
movq $0x5fb510, %rax         # imm = 0x5FB510
movq (%rax), %rdi
callq 0x4ed080
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop