// File: /workspace/github_c_makefile_star2_O0/mvermeulen[P]wspy/topdown.c
// Function: print_topdown_be
void print_topdown_be(struct counter_group *cgroup,enum output_format oformat,int mask){
  unsigned long cpu_cycles=0;
  unsigned long load_stall=0;
  unsigned long store_stall=0;  
  unsigned long l1_miss=0;
  unsigned long l2_miss=0;
  unsigned long l3_miss=0;
  
  struct counter_info *cinfo;

  if (oformat == PRINT_CSV_HEADER){
    fprintf(outfile,"l1_bound,l2_bound,l3_bound,dram_bound,store_bound");
  }

  switch(cpu_info->vendor){
  case VENDOR_INTEL:
    if (cinfo = find_ci_label(cgroup,"cpu-cycles")) cpu_cycles = cinfo->value;
    if (cinfo = find_ci_label(cgroup,"exe_activity.bound_on_loads")) load_stall = cinfo->value;
    if (cinfo = find_ci_label(cgroup,"exe_activity.bound_on_stores")) store_stall = cinfo->value;    
    if (cinfo = find_ci_label(cgroup,"memory_activity.stalls_l1d_miss")) l1_miss = cinfo->value;
    if (cinfo = find_ci_label(cgroup,"memory_activity.stalls_l2_miss")) l2_miss = cinfo->value;    
    if (cinfo = find_ci_label(cgroup,"memory_activity.stalls_l3_miss")) l3_miss = cinfo->value;
    break;
  case VENDOR_AMD:
    return;
  default:
    return;
  }

  if (cpu_cycles){
    switch(oformat){
    case PRINT_CSV:
      fprintf(outfile,"%4.1f,%4.1f,%4.1f,%4.1f,%4.1f,",
	      (double) (load_stall > l1_miss)?(load_stall - l1_miss)*100.0/cpu_cycles:0,
	      (double) (l1_miss - l2_miss)*100.0/cpu_cycles,
	      (double) (l2_miss - l3_miss)*100.0/cpu_cycles,
	      (double) l3_miss*100.0/cpu_cycles,
	      (double) store_stall*100.0/cpu_cycles);
      break;
    case PRINT_NORMAL:
      fprintf(outfile,"cpu-cycles           %-14lu # %4.1f%% memory latency\n",
	      cpu_cycles,(double) (load_stall+store_stall)*100.0/cpu_cycles);
      fprintf(outfile,"load stalls          %-14lu # %4.1f%% l1 bound\n",
	      load_stall,(load_stall>l1_miss)?(load_stall - l1_miss)*100.0/cpu_cycles:0);
      fprintf(outfile,"l1 miss              %-14lu # %4.1f%% l2 bound\n",
	      l1_miss,(double) (l1_miss - l2_miss)*100.0/cpu_cycles);
      fprintf(outfile,"l2 miss              %-14lu # %4.1f%% l3 bound\n",
	      l2_miss,(double) (l2_miss - l3_miss)*100.0/cpu_cycles);      
      fprintf(outfile,"l3 miss              %-14lu # %4.1f%% dram bound\n",
	      l3_miss,(double) l3_miss*100.0/cpu_cycles);
      fprintf(outfile,"store_stalls         %-14lu # %4.1f%% store bound\n",
	      store_stall,(double) store_stall*100.0/cpu_cycles);      
      break;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
cmpl $0x2, -0xc(%rbp)
jne 0x85b3
leaq 0xab66(%rip), %rax      # 0x13108
movq (%rax), %rdi
leaq 0x6b2b(%rip), %rsi      # 0xf0d7
movb $0x0, %al
callq 0x31d0
leaq 0xbbb6(%rip), %rax      # 0x14170
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
subl $0x1, %eax
je 0x86c1
jmp 0x85cd
movl -0x4c(%rbp), %eax
subl $0x2, %eax
jne 0x86c6
jmp 0x85db
movq -0x8(%rbp), %rdi
leaq 0x5375(%rip), %rsi      # 0xd95b
callq 0x6930
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x8601
movq -0x48(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x5612(%rip), %rsi      # 0xdc1e
callq 0x6930
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x8627
movq -0x48(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x5638(%rip), %rsi      # 0xdc6a
callq 0x6930
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x864d
movq -0x48(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x565f(%rip), %rsi      # 0xdcb7
callq 0x6930
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x8673
movq -0x48(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x5687(%rip), %rsi      # 0xdd05
callq 0x6930
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x8699
movq -0x48(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x56ae(%rip), %rsi      # 0xdd52
callq 0x6930
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x86bf
movq -0x48(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x86cb
jmp 0x8b6f
jmp 0x8b6f
cmpq $0x0, -0x18(%rbp)
je 0x8b6f
movl -0xc(%rbp), %eax
movl %eax, -0x50(%rbp)
testl %eax, %eax
je 0x8871
jmp 0x86e6
movl -0x50(%rbp), %eax
subl $0x1, %eax
jne 0x8b6d
jmp 0x86f4
leaq 0xaa0d(%rip), %rax      # 0x13108
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x30(%rbp), %rax
seta %al
andb $0x1, %al
movzbl %al, %eax
cvtsi2sd %eax, %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x8723
jp 0x8723
jmp 0x8784
movq -0x20(%rbp), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movq %rax, %xmm0
movaps 0x51f6(%rip), %xmm3     # 0xd930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x51fa(%rip), %xmm2     # 0xd940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x5153(%rip), %xmm1     # 0xd8b0
mulsd %xmm1, %xmm0
movq -0x18(%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 %xmm0, -0x60(%rbp)
jmp 0x878e
xorps %xmm0, %xmm0
movsd %xmm0, -0x60(%rbp)
jmp 0x878e
movq -0x58(%rbp), %rdi
movsd -0x60(%rbp), %xmm0
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rcx, %rax
movq %rax, %xmm1
movaps 0x5181(%rip), %xmm8     # 0xd930
punpckldq %xmm8, %xmm1    # xmm1 = xmm1[0],xmm8[0],xmm1[1],xmm8[1]
movapd 0x5184(%rip), %xmm7     # 0xd940
subpd %xmm7, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
movsd 0x50dd(%rip), %xmm6     # 0xd8b0
mulsd %xmm6, %xmm1
movq -0x18(%rbp), %xmm5
punpckldq %xmm8, %xmm5    # xmm5 = xmm5[0],xmm8[0],xmm5[1],xmm8[1]
subpd %xmm7, %xmm5
movaps %xmm5, %xmm2
unpckhpd %xmm5, %xmm5            # xmm5 = xmm5[1,1]
addsd %xmm2, %xmm5
divsd %xmm5, %xmm1
movq -0x40(%rbp), %rax
subq %rax, %rcx
movq %rcx, %xmm2
punpckldq %xmm8, %xmm2    # xmm2 = xmm2[0],xmm8[0],xmm2[1],xmm8[1]
subpd %xmm7, %xmm2
movaps %xmm2, %xmm3
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm3, %xmm2
mulsd %xmm6, %xmm2
divsd %xmm5, %xmm2
movq %rax, %xmm3
punpckldq %xmm8, %xmm3    # xmm3 = xmm3[0],xmm8[0],xmm3[1],xmm8[1]
subpd %xmm7, %xmm3
movaps %xmm3, %xmm4
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
addsd %xmm4, %xmm3
mulsd %xmm6, %xmm3
divsd %xmm5, %xmm3
movq -0x28(%rbp), %xmm4
punpckldq %xmm8, %xmm4    # xmm4 = xmm4[0],xmm8[0],xmm4[1],xmm8[1]
subpd %xmm7, %xmm4
movaps %xmm4, %xmm7
unpckhpd %xmm4, %xmm4            # xmm4 = xmm4[1,1]
addsd %xmm7, %xmm4
mulsd %xmm6, %xmm4
divsd %xmm5, %xmm4
leaq 0x68a4(%rip), %rsi      # 0xf109
movb $0x5, %al
callq 0x31d0
jmp 0x8b6d
leaq 0xa890(%rip), %rax      # 0x13108
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
addq %rcx, %rax
movq %rax, %xmm0
movaps 0x509a(%rip), %xmm3     # 0xd930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x509e(%rip), %xmm2     # 0xd940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x4ff7(%rip), %xmm1     # 0xd8b0
mulsd %xmm1, %xmm0
movq %rdx, %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
leaq 0x6848(%rip), %rsi      # 0xf128
movb $0x1, %al
callq 0x31d0
leaq 0xa81a(%rip), %rax      # 0x13108
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x30(%rbp), %rax
jbe 0x8968
movq -0x20(%rbp), %rax
movq -0x30(%rbp), %rcx
subq %rcx, %rax
movq %rax, %xmm0
movaps 0x5012(%rip), %xmm3     # 0xd930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x5016(%rip), %xmm2     # 0xd940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x4f6f(%rip), %xmm1     # 0xd8b0
mulsd %xmm1, %xmm0
movq -0x18(%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 %xmm0, -0x78(%rbp)
jmp 0x8972
xorps %xmm0, %xmm0
movsd %xmm0, -0x78(%rbp)
jmp 0x8972
movq -0x68(%rbp), %rdx
movq -0x70(%rbp), %rdi
movsd -0x78(%rbp), %xmm0
leaq 0x67d8(%rip), %rsi      # 0xf15e
movb $0x1, %al
movb %al, -0xa9(%rbp)
callq 0x31d0
movb -0xa9(%rbp), %al
leaq 0xa768(%rip), %rcx      # 0x13108
movq %rcx, -0x80(%rbp)
movq (%rcx), %rdi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rsi
movq %rdx, %rcx
subq %rsi, %rcx
movq %rcx, %xmm0
movaps 0x4f6f(%rip), %xmm3     # 0xd930
movaps %xmm3, -0xa0(%rbp)
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x4f6c(%rip), %xmm2     # 0xd940
movaps %xmm2, -0x90(%rbp)
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x4ebe(%rip), %xmm1     # 0xd8b0
movsd %xmm1, -0xa8(%rbp)
mulsd %xmm1, %xmm0
movq -0x18(%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
leaq 0x676d(%rip), %rsi      # 0xf18e
callq 0x31d0
movq -0x80(%rbp), %rcx
movsd -0xa8(%rbp), %xmm1
movaps -0xa0(%rbp), %xmm3
movaps -0x90(%rbp), %xmm2
movb -0xa9(%rbp), %al
movq (%rcx), %rdi
movq -0x38(%rbp), %rdx
movq -0x40(%rbp), %rsi
movq %rdx, %rcx
subq %rsi, %rcx
movq %rcx, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm2, %xmm0
movaps %xmm0, %xmm4
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm4, %xmm0
mulsd %xmm1, %xmm0
movq -0x18(%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
leaq 0x6728(%rip), %rsi      # 0xf1be
callq 0x31d0
movq -0x80(%rbp), %rcx
movsd -0xa8(%rbp), %xmm1
movaps -0xa0(%rbp), %xmm3
movaps -0x90(%rbp), %xmm2
movb -0xa9(%rbp), %al
movq (%rcx), %rdi
movq -0x40(%rbp), %rdx
movq %rdx, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm2, %xmm0
movaps %xmm0, %xmm4
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm4, %xmm0
mulsd %xmm1, %xmm0
movq -0x18(%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
leaq 0x66ed(%rip), %rsi      # 0xf1ee
callq 0x31d0
movsd -0xa8(%rbp), %xmm1
movaps -0xa0(%rbp), %xmm3
movaps -0x90(%rbp), %xmm2
movq -0x80(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rdx
movq %rdx, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm2, %xmm0
movaps %xmm0, %xmm4
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm4, %xmm0
mulsd %xmm1, %xmm0
movq -0x18(%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
leaq 0x66ba(%rip), %rsi      # 0xf220
movb $0x1, %al
callq 0x31d0
jmp 0x8b6f
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)