// File: /workspace/github_c_makefile_star2_O3/mvermeulen[P]wspy/topdown.c
// Function: print_cache
void print_cache(struct counter_group *cgroup,
		 enum output_format oformat,
		 char *name,char *access_counter,char *miss_counter){
  struct counter_info *cinfo;
  char miss_name[20];
  unsigned long instructions = 0;
  unsigned long access = 0;
  unsigned long miss = 0;
  snprintf(miss_name,sizeof(miss_name),"%s miss",name);

  if (oformat == PRINT_CSV_HEADER){
    fprintf(outfile,"%s miss,",name);
    return;
  }  

  if (cinfo = find_ci_label(cgroup,"instructions"))
    instructions = cinfo->value;
  if (cinfo = find_ci_label(cgroup,access_counter))
    access = cinfo->value;
  if (cinfo = find_ci_label(cgroup,miss_counter))
    miss = cinfo->value;  

  if (csvflag){
    fprintf(outfile,"%4.2f%%,",(double) miss / access * 100.0);
  } else {
    fprintf(outfile,"instructions         %-14lu #\n",instructions);
    fprintf(outfile,"%-20s %-14lu # %4.3f %s per 1000 inst\n",
	    name,access,(double) access / instructions * 1000.0,name);
    fprintf(outfile,"%-20s %-14lu # %4.2f%% %s\n",
	    miss_name, miss, (double) miss / access * 100.0, miss_name);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r15
movq %rcx, %r14
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r13
leaq 0x55cc(%rip), %rdx      # 0xd849
leaq 0x10(%rsp), %rdi
movl $0x14, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30f0
cmpl $0x2, %ebp
jne 0x82bf
leaq 0x9e5b(%rip), %rax      # 0x120f8
movq (%rax), %rdi
leaq 0x55aa(%rip), %rsi      # 0xd851
movq %rbx, %rdx
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31c0
leaq 0x3d0e(%rip), %rsi      # 0xbfd4
movq %r13, %rdi
callq 0x5860
testq %rax, %rax
je 0x82d9
movq 0x30(%rax), %r12
jmp 0x82dc
xorl %r12d, %r12d
movq %r13, %rdi
movq %r14, %rsi
callq 0x5860
testq %rax, %rax
je 0x82f2
movq 0x30(%rax), %r14
jmp 0x82f5
xorl %r14d, %r14d
movq %r13, %rdi
movq %r15, %rsi
callq 0x5860
testq %rax, %rax
je 0x830b
movq 0x30(%rax), %r15
jmp 0x830e
xorl %r15d, %r15d
leaq 0x9dc3(%rip), %rax      # 0x120d8
cmpl $0x0, (%rax)
leaq 0x9dd9(%rip), %r13      # 0x120f8
movq (%r13), %rdi
je 0x838f
movq %r15, %xmm1
movq 0x360e(%rip), %xmm2     # 0xb940
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x3612(%rip), %xmm3     # 0xb950
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %r14, %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
mulsd 0x3555(%rip), %xmm0     # 0xb8c8
leaq 0x515e(%rip), %rsi      # 0xd4d8
movb $0x1, %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31c0
leaq 0x4ef2(%rip), %rsi      # 0xd288
movq %r12, %rdx
xorl %eax, %eax
callq 0x31c0
movq (%r13), %rdi
movq %r14, %xmm0
movq 0x358f(%rip), %xmm2     # 0xb940
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x3593(%rip), %xmm3     # 0xb950
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, %xmm4
movapd %xmm1, (%rsp)
movq %r12, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm4, %xmm0
divsd %xmm1, %xmm0
mulsd 0x3529(%rip), %xmm0     # 0xb928
leaq 0x5454(%rip), %rsi      # 0xd85a
movq %rbx, %rdx
movq %r14, %rcx
movq %rbx, %r8
movb $0x1, %al
callq 0x31c0
movq (%r13), %rdi
movq %r15, %xmm1
punpckldq 0x3519(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x3521(%rip), %xmm1     # 0xb950
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd (%rsp), %xmm0
mulsd 0x3480(%rip), %xmm0     # 0xb8c8
leaq 0x5432(%rip), %rsi      # 0xd881
leaq 0x10(%rsp), %rdx
movq %r15, %rcx
movq %rdx, %r8
movb $0x1, %al
callq 0x31c0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq