// File: /workspace/github_c_makefile_star2_O1/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 0x55a4(%rip), %rdx      # 0xd849
leaq 0x10(%rsp), %rdi
movl $0x14, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x30f0
cmpl $0x2, %ebp
jne 0x82e7
leaq 0x9e33(%rip), %rax      # 0x120f8
movq (%rax), %rdi
leaq 0x5582(%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 0x3ce6(%rip), %rsi      # 0xbfd4
movq %r13, %rdi
callq 0x587d
testq %rax, %rax
je 0x8301
movq 0x30(%rax), %r12
jmp 0x8304
xorl %r12d, %r12d
movq %r13, %rdi
movq %r14, %rsi
callq 0x587d
testq %rax, %rax
je 0x831a
movq 0x30(%rax), %r14
jmp 0x831d
xorl %r14d, %r14d
movq %r13, %rdi
movq %r15, %rsi
callq 0x587d
testq %rax, %rax
je 0x8333
movq 0x30(%rax), %r15
jmp 0x8336
xorl %r15d, %r15d
leaq 0x9d9b(%rip), %rax      # 0x120d8
cmpl $0x0, (%rax)
leaq 0x9db1(%rip), %r13      # 0x120f8
movq (%r13), %rdi
je 0x83b7
movq %r15, %xmm1
movq 0x35e6(%rip), %xmm2     # 0xb940
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x35ea(%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 0x352d(%rip), %xmm0     # 0xb8c8
leaq 0x5136(%rip), %rsi      # 0xd4d8
movb $0x1, %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31c0
leaq 0x4eca(%rip), %rsi      # 0xd288
movq %r12, %rdx
xorl %eax, %eax
callq 0x31c0
movq (%r13), %rdi
movq %r14, %xmm0
movq 0x3567(%rip), %xmm2     # 0xb940
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x356b(%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 0x3501(%rip), %xmm0     # 0xb928
leaq 0x542c(%rip), %rsi      # 0xd85a
movq %rbx, %rdx
movq %r14, %rcx
movq %rbx, %r8
movb $0x1, %al
callq 0x31c0
movq (%r13), %rdi
movq %r15, %xmm1
punpckldq 0x34f1(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x34f9(%rip), %xmm1     # 0xb950
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd (%rsp), %xmm0
mulsd 0x3458(%rip), %xmm0     # 0xb8c8
leaq 0x540a(%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