// File: /workspace/github_c_makefile_star2_O0/mvermeulen[P]wspy/topdown.c
// Function: print_ipc
void print_ipc(struct counter_group *cgroup,enum output_format oformat){
  int i;
  unsigned long cpu_cycles=0,scaled_cpu_cycles=0;
  unsigned long instructions=0;
  unsigned long branches=0;
  unsigned long branch_misses=0;
  double elapsed;
  double scale;
  if (oformat == PRINT_CSV_HEADER){
    fprintf(outfile,"ipc,");
    return;
  }
  elapsed = finish_time.tv_sec + finish_time.tv_nsec / 1000000000.0 -
    start_time.tv_sec - start_time.tv_nsec / 1000000000.0;  

  for (i=0;i<cgroup->ncounters;i++){
    if (!strcmp(cgroup->cinfo[i].label,"cpu-cycles")){
      cpu_cycles = (double) cgroup->cinfo[i].value * cgroup->cinfo[i].time_enabled / cgroup->cinfo[i].time_running;
      scaled_cpu_cycles = (double) cpu_cycles * (double) cgroup->cinfo[i].time_enabled / (double) cgroup->cinfo[i].time_running;
    } else if (!strcmp(cgroup->cinfo[i].label,"instructions")){
      instructions = (double) cgroup->cinfo[i].value * cgroup->cinfo[i].time_enabled / cgroup->cinfo[i].time_running;
    } else if (!strcmp(cgroup->cinfo[i].label,"branches")){
      branches = (double) cgroup->cinfo[i].value * cgroup->cinfo[i].time_enabled / cgroup->cinfo[i].time_running;
    } else if (!strcmp(cgroup->cinfo[i].label,"branch-misses")){
      branch_misses = (double) cgroup->cinfo[i].value * cgroup->cinfo[i].time_enabled / cgroup->cinfo[i].time_running;
    }
  }

  switch(oformat){
  case PRINT_NORMAL:
    if (cpu_cycles){
      fprintf(outfile,"cpu-cycles           %-14lu # %4.2f GHz\n",cpu_cycles,(double) cpu_cycles / elapsed / 1000000000.0 / cpu_info->num_cores_available / (aflag?cpu_info->num_cores_available:1));
      fprintf(outfile,"instructions         %-14lu # %4.2f IPC",instructions,(double) instructions / cpu_cycles);
      if (((double) instructions / cpu_cycles) > 3.0){
	fprintf(outfile," high");
      }
      else if (((double) instructions / cpu_cycles) < 0.7){
	fprintf(outfile," low");
      }
      fprintf(outfile,"\n");
      break;
    case PRINT_CSV:
      fprintf(outfile,"%4.2f,",(double) instructions / cpu_cycles);
      break;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%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 0x6a0d
leaq 0xc711(%rip), %rax      # 0x13108
movq (%rax), %rdi
leaq 0x83ac(%rip), %rsi      # 0xedad
movb $0x0, %al
callq 0x31d0
jmp 0x70db
cvtsi2sdq 0xd73a(%rip), %xmm0 # 0x14150
cvtsi2sdq 0xd739(%rip), %xmm1 # 0x14158
movsd 0x67b1(%rip), %xmm2     # 0xd1d8
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
cvtsi2sdq 0xd728(%rip), %xmm1 # 0x14160
subsd %xmm1, %xmm0
cvtsi2sdq 0xd723(%rip), %xmm1 # 0x14168
movsd 0x678b(%rip), %xmm2     # 0xd1d8
divsd %xmm2, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x6e36
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x10(%rbp), %rcx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x6ecd(%rip), %rsi      # 0xd95b
callq 0x31b0
cmpl $0x0, %eax
jne 0x6bc1
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x10(%rbp), %rcx
imulq $0x58, %rcx, %rcx
movq 0x30(%rax,%rcx), %xmm0
movaps 0x6e77(%rip), %xmm4     # 0xd930
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
movapd 0x6e7b(%rip), %xmm3     # 0xd940
subpd %xmm3, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq 0x50(%rax,%rcx), %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
subpd %xmm3, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movq 0x48(%rax,%rcx), %xmm1
punpckldq %xmm4, %xmm1    # xmm1 = xmm1[0],xmm4[0],xmm1[1],xmm4[1]
subpd %xmm3, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x6dab(%rip), %xmm1     # 0xd8d0
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd %xmm3, %xmm0
movaps %xmm0, %xmm2
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm2, %xmm0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x10(%rbp), %rcx
imulq $0x58, %rcx, %rcx
movq 0x50(%rax,%rcx), %xmm2
punpckldq %xmm4, %xmm2    # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
subpd %xmm3, %xmm2
movaps %xmm2, %xmm5
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm5, %xmm2
mulsd %xmm2, %xmm0
movq 0x48(%rax,%rcx), %xmm2
punpckldq %xmm4, %xmm2    # xmm2 = xmm2[0],xmm4[0],xmm2[1],xmm4[1]
subpd %xmm3, %xmm2
movaps %xmm2, %xmm3
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
addsd %xmm3, %xmm2
divsd %xmm2, %xmm0
movaps %xmm0, %xmm2
cvttsd2si %xmm2, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x20(%rbp)
jmp 0x6e26
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x10(%rbp), %rcx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x73e6(%rip), %rsi      # 0xdfc4
callq 0x31b0
cmpl $0x0, %eax
jne 0x6c8d
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x10(%rbp), %rcx
imulq $0x58, %rcx, %rcx
movq 0x30(%rax,%rcx), %xmm0
movaps 0x6d27(%rip), %xmm3     # 0xd930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x6d2b(%rip), %xmm2     # 0xd940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq 0x50(%rax,%rcx), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm4
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm4, %xmm1
mulsd %xmm1, %xmm0
movq 0x48(%rax,%rcx), %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
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x6c5b(%rip), %xmm1     # 0xd8d0
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x28(%rbp)
jmp 0x6e24
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x10(%rbp), %rcx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x734c(%rip), %rsi      # 0xdff6
callq 0x31b0
cmpl $0x0, %eax
jne 0x6d59
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x10(%rbp), %rcx
imulq $0x58, %rcx, %rcx
movq 0x30(%rax,%rcx), %xmm0
movaps 0x6c5b(%rip), %xmm3     # 0xd930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x6c5f(%rip), %xmm2     # 0xd940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq 0x50(%rax,%rcx), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm4
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm4, %xmm1
mulsd %xmm1, %xmm0
movq 0x48(%rax,%rcx), %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
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x6b8f(%rip), %xmm1     # 0xd8d0
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x30(%rbp)
jmp 0x6e22
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x10(%rbp), %rcx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x7266(%rip), %rsi      # 0xdfdc
callq 0x31b0
cmpl $0x0, %eax
jne 0x6e20
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x10(%rbp), %rcx
imulq $0x58, %rcx, %rcx
movq 0x30(%rax,%rcx), %xmm0
movaps 0x6b8f(%rip), %xmm3     # 0xd930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x6b93(%rip), %xmm2     # 0xd940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq 0x50(%rax,%rcx), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm4
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm4, %xmm1
mulsd %xmm1, %xmm0
movq 0x48(%rax,%rcx), %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
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
movsd 0x6ac3(%rip), %xmm1     # 0xd8d0
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
andq %rdx, %rcx
orq %rcx, %rax
movq %rax, -0x38(%rbp)
jmp 0x6e22
jmp 0x6e24
jmp 0x6e26
jmp 0x6e28
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x6a61
movl -0xc(%rbp), %eax
movl %eax, -0x4c(%rbp)
testl %eax, %eax
je 0x6e53
jmp 0x6e42
movl -0x4c(%rbp), %eax
subl $0x1, %eax
je 0x707c
jmp 0x70db
cmpq $0x0, -0x18(%rbp)
je 0x70d9
leaq 0xc2a3(%rip), %rax      # 0x13108
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x60(%rbp)
movq %rax, %xmm0
movaps 0x6ab0(%rip), %xmm1     # 0xd930
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x6ab4(%rip), %xmm1     # 0xd940
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd -0x40(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd 0x632c(%rip), %xmm1     # 0xd1d8
divsd %xmm1, %xmm0
leaq 0xd2b9(%rip), %rax      # 0x14170
movq (%rax), %rax
movl 0x10(%rax), %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
leaq 0xc206(%rip), %rax      # 0x130d8
cmpl $0x0, (%rax)
je 0x6ee9
leaq 0xd292(%rip), %rax      # 0x14170
movq (%rax), %rax
movl 0x10(%rax), %eax
movl %eax, -0x6c(%rbp)
jmp 0x6ef3
movl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x6ef3
movq -0x60(%rbp), %rdx
movq -0x68(%rbp), %rdi
movsd -0x58(%rbp), %xmm0
movl -0x6c(%rbp), %eax
movl %eax, %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
leaq 0x7e9d(%rip), %rsi      # 0xedb2
movb $0x1, %al
movb %al, -0x91(%rbp)
callq 0x31d0
movb -0x91(%rbp), %al
leaq 0xc1d9(%rip), %rcx      # 0x13108
movq (%rcx), %rdi
movq -0x28(%rbp), %rdx
movq %rdx, %xmm0
movaps 0x69ee(%rip), %xmm3     # 0xd930
movaps %xmm3, -0x90(%rbp)
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x69eb(%rip), %xmm2     # 0xd940
movaps %xmm2, -0x80(%rbp)
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %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 0x7e50(%rip), %rsi      # 0xeddb
callq 0x31d0
movaps -0x90(%rbp), %xmm3
movaps -0x80(%rbp), %xmm2
movq -0x28(%rbp), %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 -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 0x68e9(%rip), %xmm1     # 0xd8c0
ucomisd %xmm1, %xmm0
jbe 0x6ff7
leaq 0xc124(%rip), %rax      # 0x13108
movq (%rax), %rdi
leaq 0x7e15(%rip), %rsi      # 0xee03
movb $0x0, %al
callq 0x31d0
jmp 0x7062
movq -0x28(%rbp), %xmm1
movaps 0x692d(%rip), %xmm3     # 0xd930
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
movapd 0x6931(%rip), %xmm2     # 0xd940
subpd %xmm2, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movq -0x18(%rbp), %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm2, %xmm0
movaps %xmm0, %xmm2
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm2, %xmm0
divsd %xmm0, %xmm1
movsd 0x6886(%rip), %xmm0     # 0xd8c8
ucomisd %xmm1, %xmm0
jbe 0x7060
leaq 0xc0b9(%rip), %rax      # 0x13108
movq (%rax), %rdi
leaq 0x7db0(%rip), %rsi      # 0xee09
movb $0x0, %al
callq 0x31d0
jmp 0x7062
leaq 0xc09f(%rip), %rax      # 0x13108
movq (%rax), %rdi
leaq 0x7e1d(%rip), %rsi      # 0xee90
movb $0x0, %al
callq 0x31d0
jmp 0x70db
leaq 0xc085(%rip), %rax      # 0x13108
movq (%rax), %rdi
movq -0x28(%rbp), %xmm0
movaps 0x689e(%rip), %xmm3     # 0xd930
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x68a2(%rip), %xmm2     # 0xd940
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %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 0x7d3e(%rip), %rsi      # 0xee0e
movb $0x1, %al
callq 0x31d0
jmp 0x70db
jmp 0x70db
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)