// File: /workspace/github_c_makefile_star2_O2/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 0x46fd(%rip), %rdx      # 0xc849
leaq 0x10(%rsp), %rdi
pushq $0x14
popq %rsi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30f0
cmpl $0x2, %ebp
jne 0x818c
leaq 0x8f9e(%rip), %rax      # 0x11108
movq (%rax), %rdi
leaq 0x46dd(%rip), %rsi      # 0xc851
movq %rbx, %rdx
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31c0
leaq 0x2e41(%rip), %rsi      # 0xafd4
movq %r13, %rdi
callq 0x576f
testq %rax, %rax
je 0x81a6
movq 0x30(%rax), %r12
jmp 0x81a9
xorl %r12d, %r12d
movq %r13, %rdi
movq %r14, %rsi
callq 0x576f
testq %rax, %rax
je 0x81bf
movq 0x30(%rax), %r14
jmp 0x81c2
xorl %r14d, %r14d
movq %r13, %rdi
movq %r15, %rsi
callq 0x576f
testq %rax, %rax
je 0x81d8
movq 0x30(%rax), %r15
jmp 0x81db
xorl %r15d, %r15d
leaq 0x8f06(%rip), %rax      # 0x110e8
cmpl $0x0, (%rax)
leaq 0x8f1c(%rip), %r13      # 0x11108
movq (%r13), %rdi
je 0x825c
movq %r15, %xmm1
movq 0x2741(%rip), %xmm2     # 0xa940
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x2745(%rip), %xmm3     # 0xa950
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 0x2688(%rip), %xmm0     # 0xa8c8
leaq 0x4291(%rip), %rsi      # 0xc4d8
movb $0x1, %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31c0
leaq 0x4025(%rip), %rsi      # 0xc288
movq %r12, %rdx
xorl %eax, %eax
callq 0x31c0
movq (%r13), %rdi
movq %r14, %xmm0
movq 0x26c2(%rip), %xmm2     # 0xa940
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x26c6(%rip), %xmm3     # 0xa950
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 0x265c(%rip), %xmm0     # 0xa928
leaq 0x4587(%rip), %rsi      # 0xc85a
movq %rbx, %rdx
movq %r14, %rcx
movq %rbx, %r8
movb $0x1, %al
callq 0x31c0
movq (%r13), %rdi
movq %r15, %xmm1
punpckldq 0x264c(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2654(%rip), %xmm1     # 0xa950
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd (%rsp), %xmm0
mulsd 0x25b3(%rip), %xmm0     # 0xa8c8
leaq 0x4565(%rip), %rsi      # 0xc881
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