// File: /workspace/github_c_makefile_star2_O0/mvermeulen[P]wspy/topdown.c
// Function: print_topdown_op
void print_topdown_op(struct counter_group *cgroup,enum output_format oformat,int mask){
  unsigned long instructions=0;
  unsigned long opcache_miss=0;
  unsigned long opcache_access=0;
  unsigned long dtlb1=0;
  unsigned long dtlb2=0;
  
  struct counter_info *cinfo;

  if (oformat == PRINT_CSV_HEADER){
    fprintf(outfile,"opcache,dtlb1,dtlb2,");
  }

  switch(cpu_info->vendor){
  case VENDOR_INTEL:
    return;
    break;
  case VENDOR_AMD:
    if (cinfo = find_ci_label(cgroup,"instructions")) instructions = cinfo->value;
    if (cinfo = find_ci_label(cgroup,"op_cache_hit_miss.all_op_cache_accesses")) opcache_access = cinfo->value;
    if (cinfo = find_ci_label(cgroup,"op_cache_hit_miss.op_cache_miss")) opcache_miss = cinfo->value;
    if (cinfo = find_ci_label(cgroup,"ls_l1_d_tlb_miss.all")) dtlb1 = cinfo->value;
    if (cinfo = find_ci_label(cgroup,"ls_l1_d_tlb_miss.all_l2_miss")) dtlb2 = cinfo->value;
    break;
  default:
    return;
  }

  if (instructions){
    switch(oformat){
    case PRINT_CSV:
      if (opcache_access)
	fprintf(outfile,"%4.1f,",(double) opcache_miss / opcache_access*100);
      else
	fprintf(outfile,"0.0");
      fprintf(outfile,"%4.3f",(double) dtlb1*1000.0 / instructions);
      fprintf(outfile,"%4.3f",(double) dtlb2*1000.0 / instructions);
      break;
    case PRINT_NORMAL:
      fprintf(outfile,"instructions         %-14lu #\n",instructions);
      fprintf(outfile,"opcache              %-14lu # %4.3f opcache per 1000 inst\n",
	      opcache_access,(double) opcache_access * 1000 / instructions);
      fprintf(outfile,"opcache miss         %-14lu # %4.1f%% opcache miss rate\n",
	      opcache_miss,(double) opcache_miss / opcache_access*100.0);
      fprintf(outfile,"l1 dTLB miss         %-14lu # %4.3f L1 dTLB per 1000 inst\n",
	      dtlb1,(double) dtlb1*1000/instructions);
      fprintf(outfile,"l2 dTLB miss         %-14lu # %4.3f L2 dTLB per 1000 inst\n",
	      dtlb2,(double) dtlb2*1000/instructions);
      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)
cmpl $0x2, -0xc(%rbp)
jne 0x91cb
leaq 0x9f4e(%rip), %rax      # 0x13108
movq (%rax), %rdi
leaq 0x61fa(%rip), %rsi      # 0xf3be
movb $0x0, %al
callq 0x31d0
leaq 0xaf9e(%rip), %rax      # 0x14170
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0x44(%rbp)
subl $0x1, %eax
je 0x91f4
jmp 0x91e1
movl -0x44(%rbp), %eax
subl $0x2, %eax
jne 0x92b4
jmp 0x91ef
jmp 0x9624
movq -0x8(%rbp), %rdi
leaq 0x4dc5(%rip), %rsi      # 0xdfc4
callq 0x6930
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x921a
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x4e02(%rip), %rsi      # 0xe027
callq 0x6930
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x9240
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x4e1a(%rip), %rsi      # 0xe065
callq 0x6930
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x9266
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x5259(%rip), %rsi      # 0xe4ca
callq 0x6930
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x928c
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x525e(%rip), %rsi      # 0xe4f5
callq 0x6930
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x92b2
movq -0x40(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x92b9
jmp 0x9624
cmpq $0x0, -0x18(%rbp)
je 0x9624
movl -0xc(%rbp), %eax
movl %eax, -0x48(%rbp)
testl %eax, %eax
je 0x9441
jmp 0x92d4
movl -0x48(%rbp), %eax
subl $0x1, %eax
jne 0x9622
jmp 0x92e2
cmpq $0x0, -0x28(%rbp)
je 0x9352
leaq 0x9e18(%rip), %rax      # 0x13108
movq (%rax), %rdi
movq -0x20(%rbp), %xmm0
movaps 0x4631(%rip), %xmm3     # 0xd930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x4635(%rip), %xmm2     # 0xd940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq -0x28(%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 0x4572(%rip), %xmm1     # 0xd8b0
mulsd %xmm1, %xmm0
leaq 0x5dd8(%rip), %rsi      # 0xf121
movb $0x1, %al
callq 0x31d0
jmp 0x936a
leaq 0x9daf(%rip), %rax      # 0x13108
movq (%rax), %rdi
leaq 0x5f0d(%rip), %rsi      # 0xf270
movb $0x0, %al
callq 0x31d0
leaq 0x9d97(%rip), %rax      # 0x13108
movq %rax, -0x50(%rbp)
movq (%rax), %rdi
movq -0x30(%rbp), %xmm0
movaps 0x45ac(%rip), %xmm3     # 0xd930
movaps %xmm3, -0x70(%rbp)
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x45ac(%rip), %xmm2     # 0xd940
movaps %xmm2, -0x60(%rbp)
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x4561(%rip), %xmm1     # 0xd910
movsd %xmm1, -0x78(%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 0x5e99(%rip), %rsi      # 0xf274
movb $0x1, %al
callq 0x31d0
movsd -0x78(%rbp), %xmm1
movaps -0x70(%rbp), %xmm3
movaps -0x60(%rbp), %xmm2
movq -0x50(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %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 0x5e3f(%rip), %rsi      # 0xf274
movb $0x1, %al
callq 0x31d0
jmp 0x9622
leaq 0x9cc0(%rip), %rax      # 0x13108
movq %rax, -0x80(%rbp)
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
leaq 0x5e20(%rip), %rsi      # 0xf27a
xorl %eax, %eax
callq 0x31d0
movq -0x80(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rdx
movq %rdx, %xmm0
movaps 0x44b8(%rip), %xmm3     # 0xd930
movaps %xmm3, -0xa0(%rbp)
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x44b5(%rip), %xmm2     # 0xd940
movaps %xmm2, -0x90(%rbp)
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd 0x4467(%rip), %xmm1     # 0xd910
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 0x5efb(%rip), %rsi      # 0xf3d3
movb $0x1, %al
movb %al, -0xa9(%rbp)
callq 0x31d0
movq -0x80(%rbp), %rcx
movaps -0xa0(%rbp), %xmm3
movaps -0x90(%rbp), %xmm2
movb -0xa9(%rbp), %al
movq (%rcx), %rdi
movq -0x20(%rbp), %rdx
movq %rdx, %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 -0x28(%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 0x4370(%rip), %xmm1     # 0xd8b0
mulsd %xmm1, %xmm0
leaq 0x5ec3(%rip), %rsi      # 0xf40e
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 -0x30(%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 0x5e91(%rip), %rsi      # 0xf447
callq 0x31d0
movsd -0xa8(%rbp), %xmm1
movaps -0xa0(%rbp), %xmm3
movaps -0x90(%rbp), %xmm2
movq -0x80(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%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 0x5e67(%rip), %rsi      # 0xf482
movb $0x1, %al
callq 0x31d0
jmp 0x9624
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)