// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
leaq -0x50(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl $0x14, %esi
leaq 0x52b1(%rip), %rdx      # 0xf83b
movb $0x0, %al
callq 0x3100
cmpl $0x2, -0xc(%rbp)
jne 0xa5b8
leaq 0x8b6a(%rip), %rax      # 0x13108
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
leaq 0x5297(%rip), %rsi      # 0xf843
movb $0x0, %al
callq 0x31d0
jmp 0xa7a2
movq -0x8(%rbp), %rdi
leaq 0x3a01(%rip), %rsi      # 0xdfc4
callq 0x6930
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0xa5de
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x6930
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0xa601
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x6930
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0xa624
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x68(%rbp)
leaq 0x8abd(%rip), %rax      # 0x130e8
cmpl $0x0, (%rax)
je 0xa69c
leaq 0x8ad1(%rip), %rax      # 0x13108
movq (%rax), %rdi
movq -0x68(%rbp), %xmm0
movaps 0x32ea(%rip), %xmm3     # 0xd930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x32ee(%rip), %xmm2     # 0xd940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq -0x60(%rbp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd 0x322b(%rip), %xmm1     # 0xd8b0
mulsd %xmm1, %xmm0
leaq 0x4e3a(%rip), %rsi      # 0xf4ca
movb $0x1, %al
callq 0x31d0
jmp 0xa7a2
leaq 0x8a65(%rip), %rax      # 0x13108
movq %rax, -0x70(%rbp)
movq (%rax), %rdi
movq -0x58(%rbp), %rdx
leaq 0x4bc5(%rip), %rsi      # 0xf27a
xorl %eax, %eax
callq 0x31d0
movq -0x70(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %r8
movq -0x60(%rbp), %rcx
movq %rcx, %xmm0
movaps 0x3259(%rip), %xmm3     # 0xd930
movaps %xmm3, -0x90(%rbp)
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x3256(%rip), %xmm2     # 0xd940
movaps %xmm2, -0x80(%rbp)
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq -0x58(%rbp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd 0x31ef(%rip), %xmm1     # 0xd910
mulsd %xmm1, %xmm0
leaq 0x5120(%rip), %rsi      # 0xf84c
movb $0x1, %al
movq %r8, %rdx
callq 0x31d0
movaps -0x90(%rbp), %xmm3
movaps -0x80(%rbp), %xmm2
movq -0x70(%rbp), %rax
movq (%rax), %rdi
leaq -0x50(%rbp), %rdx
movq -0x68(%rbp), %rcx
movq %rcx, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq -0x60(%rbp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd 0x3124(%rip), %xmm1     # 0xd8b0
mulsd %xmm1, %xmm0
leaq -0x50(%rbp), %r8
leaq 0x50d8(%rip), %rsi      # 0xf873
movb $0x1, %al
callq 0x31d0
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax,%rax)