// File: /workspace/github_cpp_makefile_star2_O3/sopanpatra160[P]OOO_Superscalar_Processor_Simulator/cache.cc
// Function: cache::print_statistics()
void cache::print_statistics(){
	mr = (((float)num_miss_r+(float)num_miss_w)/((float)num_r+(float)num_w));
	unsigned int num_mem_traff = num_miss_r + num_miss_w + num_wb;
	//printf("\n%s","====== Simulation results (raw) ======\n");
	if(lev==1){
		printf("a. number of L%d reads: %d\n",lev,num_r);
		printf("b. number of L%d read misses: %d\n",lev,num_miss_r);
		printf("c. number of L%d writes: %d\n",lev,num_w);
		printf("d. number of L%d write misses: %d\n",lev,num_miss_w);
		printf("e. L%d miss rate: %.4f\n",lev,mr);
		printf("f. number of swaps:     %d\n",num_swap);
	}
	if(lev==0)
	{
			printf("g. number of victim cache writeback:     %d\n",num_wb_v);


	}

	if(lev==2){
		printf("h. number of L%d reads: %d\n",lev,num_r);
		printf("i. number of L%d read misses: %d\n",lev,num_miss_r);
		printf("j. number of L%d writes: %d\n",lev,num_w);
		printf("k. number of L%d write misses: %d\n",lev,num_miss_w);
		if(cs!=0)
			printf("l. L%d miss rate: %.4f\n",lev,mr);
		else
			printf("l. L%d miss rate: 0\n",lev);
		if(cs!=0)
			printf("m. number of L2 writeback: %d\n",num_wb);
		else
			printf("m. number of L2 writeback: 0\n");
			
		printf("%s %d\n","n. total memory traffic:",num_mem_traff);

	}

}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x84(%rdi), %ecx
cvtsi2ss %rcx, %xmm0
movl 0x8c(%rdi), %esi
cvtsi2ss %rsi, %xmm1
addss %xmm0, %xmm1
movl 0x80(%rdi), %edx
xorps %xmm0, %xmm0
cvtsi2ss %rdx, %xmm0
movl 0x88(%rdi), %eax
cvtsi2ss %rax, %xmm2
movl 0x24(%rdi), %eax
addss %xmm0, %xmm2
divss %xmm2, %xmm1
movss %xmm1, 0x90(%rdi)
leal (%rsi,%rcx), %ebp
addl 0x74(%rdi), %ebp
cmpl $0x1, %eax
jne 0x2c7d
leaq 0x2454(%rip), %rdi      # 0x5050
movl $0x1, %esi
xorl %eax, %eax
callq 0x1040
movl 0x24(%rbx), %esi
movl 0x84(%rbx), %edx
leaq 0x2454(%rip), %rdi      # 0x506c
xorl %eax, %eax
callq 0x1040
movl 0x24(%rbx), %esi
movl 0x88(%rbx), %edx
leaq 0x245f(%rip), %rdi      # 0x508e
xorl %eax, %eax
callq 0x1040
movl 0x24(%rbx), %esi
movl 0x8c(%rbx), %edx
leaq 0x2465(%rip), %rdi      # 0x50ab
xorl %eax, %eax
callq 0x1040
movl 0x24(%rbx), %esi
xorps %xmm0, %xmm0
cvtss2sd 0x90(%rbx), %xmm0
leaq 0x246c(%rip), %rdi      # 0x50ce
movb $0x1, %al
callq 0x1040
movl 0x7c(%rbx), %esi
leaq 0x2473(%rip), %rdi      # 0x50e6
xorl %eax, %eax
callq 0x1040
movl 0x24(%rbx), %eax
testl %eax, %eax
jne 0x2c95
movl 0x78(%rbx), %esi
leaq 0x2477(%rip), %rdi      # 0x5102
xorl %eax, %eax
callq 0x1040
movl 0x24(%rbx), %eax
cmpl $0x2, %eax
jne 0x2d20
movl 0x80(%rbx), %edx
leaq 0x2484(%rip), %rdi      # 0x512f
movl $0x2, %esi
xorl %eax, %eax
callq 0x1040
movl 0x24(%rbx), %esi
movl 0x84(%rbx), %edx
leaq 0x2484(%rip), %rdi      # 0x514b
xorl %eax, %eax
callq 0x1040
movl 0x24(%rbx), %esi
movl 0x88(%rbx), %edx
leaq 0x248f(%rip), %rdi      # 0x516d
xorl %eax, %eax
callq 0x1040
movl 0x24(%rbx), %esi
movl 0x8c(%rbx), %edx
leaq 0x2495(%rip), %rdi      # 0x518a
xorl %eax, %eax
callq 0x1040
cmpl $0x0, 0x14(%rbx)
movl 0x24(%rbx), %esi
je 0x2d27
xorps %xmm0, %xmm0
cvtss2sd 0x90(%rbx), %xmm0
leaq 0x2496(%rip), %rdi      # 0x51ad
movb $0x1, %al
callq 0x1040
jmp 0x2d35
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x2497(%rip), %rdi      # 0x51c5
xorl %eax, %eax
callq 0x1040
cmpl $0x0, 0x14(%rbx)
je 0x2d4e
movl 0x74(%rbx), %esi
leaq 0x2495(%rip), %rdi      # 0x51da
xorl %eax, %eax
callq 0x1040
jmp 0x2d5a
leaq 0x24d5(%rip), %rdi      # 0x522a
callq 0x1100
leaq 0x2498(%rip), %rdi      # 0x51f9
leaq 0x2498(%rip), %rsi      # 0x5200
movl %ebp, %edx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1040
nop