// File: /workspace/github_c_makefile_star2_O3/mvermeulen[P]wspy/topdown.c
// Function: print_topdown
void print_topdown(struct counter_group *cgroup,enum output_format oformat,int mask){
  unsigned long slots=0;
  unsigned long slots_no_contention = 0;
  unsigned long retiring=0;
  unsigned long frontend=0;
  unsigned long frontend_latency=0;
  unsigned long frontend_bandwidth=0;
  unsigned long backend=0;
  unsigned long retire_not_complete=0;
  unsigned long retire_load_not_complete=0;
  unsigned long backend_cpu=0;
  unsigned long backend_memory=0;
  unsigned long speculation=0;
  unsigned long speculation_branches=0;
  unsigned long speculation_pipeline=0;
  unsigned long branches_mispredicted=0;
  unsigned long resyncs_or_nc_redirects=0;
  unsigned long contention=0;
  unsigned long retire_ucode=0;
  unsigned long retire_fastpath=0;
  int too_short = 0;
  struct counter_info *cinfo;

  if (oformat == PRINT_CSV_HEADER){
    fprintf(outfile,"retire,frontend,backend,speculate,");
  }

  switch(cpu_info->vendor){
  case VENDOR_INTEL:
    if (cinfo = find_ci_label(cgroup,"slots")) slots = cinfo->value;
    if (cinfo = find_ci_label(cgroup,"core.topdown-retiring")) retiring = cinfo->value;
    if (cinfo = find_ci_label(cgroup,"core.topdown-fe-bound")) frontend = cinfo->value;
    if (cinfo = find_ci_label(cgroup,"core.topdown-be-bound")) backend = cinfo->value;
    if (cinfo = find_ci_label(cgroup,"core.topdown-bad-spec")) speculation = cinfo->value;

    // backend level 2
    if (cinfo = find_ci_label(cgroup,"core.topdown-mem-bound")){
      backend_memory = cinfo->value;
      backend_cpu = backend - backend_memory;
    }

    // speculation level 2
    if (cinfo = find_ci_label(cgroup,"core.topdown-br-mispredict")){
      speculation_branches = cinfo->value;
      speculation_pipeline = speculation - speculation_branches;
    }

    // frontend level 2
    if (cinfo = find_ci_label(cgroup,"core.topdown-fetch-lat")){
      frontend_latency = cinfo->value;
      frontend_bandwidth = frontend - frontend_latency;
    }

    // retire level 2
    if (cinfo = find_ci_label(cgroup,"core.topdown-heavy-ops")){
      retire_ucode = cinfo->value;
      retire_fastpath = retiring - retire_ucode;
    }
    
    slots_no_contention = slots;
    break;
  case VENDOR_AMD:
    if (cinfo = find_ci_label(cgroup,"cpu-cycles")){
      if (cpu_info->coreinfo[0].vendor == CORE_AMD_ZEN){
	slots = cinfo->value * 6;
      } else if (cpu_info->coreinfo[0].vendor == CORE_AMD_ZEN5){
	slots = cinfo->value * 8;	
      }
    }
    if (cinfo = find_ci_label(cgroup,"ex_ret_ops")) retiring = cinfo->value;
    if (cinfo = find_ci_label(cgroup,"de_no_dispatch_per_slot.no_ops_from_frontend")) frontend = cinfo->value;
    if (cinfo = find_ci_label(cgroup,"de_no_dispatch_per_slot.backend_stalls")) backend = cinfo->value;
    if (cinfo = find_ci_label(cgroup,"de_no_dispatch_per_slot.smt_contention")) contention = cinfo->value;    
    if (cinfo = find_ci_label(cgroup,"de_src_op_disp.all")){
      if (cinfo->time_running == 0) too_short = 1;
      speculation = cinfo->value - retiring;
    }
    // backend level 2
    if (cinfo = find_ci_label(cgroup,"ex_no_retire.load_not_complete"))
      retire_load_not_complete = cinfo->value;
    if (cinfo = find_ci_label(cgroup,"ex_no_retire.not_complete"))
      retire_not_complete = cinfo->value;
    if (retire_load_not_complete && retire_not_complete){
      backend_memory = backend * (double) retire_load_not_complete / retire_not_complete;
      backend_cpu = backend - backend_memory;
    }

    // speculation level 2
    if (cinfo = find_ci_label(cgroup,"ex_ret_brn_misp"))
      branches_mispredicted = cinfo->value;
    if (cinfo = find_ci_label(cgroup,"resyncs_or_nc_redirects"))
      resyncs_or_nc_redirects = cinfo->value;
    if (branches_mispredicted && resyncs_or_nc_redirects){
      speculation_pipeline = speculation * (double) resyncs_or_nc_redirects / (resyncs_or_nc_redirects + branches_mispredicted);
      speculation_branches = speculation - speculation_pipeline;
    }

    // frontend level 2
    if (cinfo = find_ci_label(cgroup,"de_no_dispatch_per_slot.no_ops_from_frontend.cmask_0x6")){
      frontend_latency = cinfo->value*6;
      frontend_bandwidth = frontend - frontend_latency;
    }

    // retire level 2
    if (cinfo = find_ci_label(cgroup,"ex_ret_ucode_ops")){
      retire_ucode = retiring * (double) cinfo->value / retiring;
      retire_fastpath = retiring - retire_ucode;
    }
    
    slots_no_contention = slots - contention;
    break;
  default:
    return;
  }

  if (slots){
    switch(oformat){
    case PRINT_CSV:
      fprintf(outfile,"%4.1f,",(double) retiring/slots_no_contention*100);
      fprintf(outfile,"%4.1f,",(double) frontend/slots_no_contention*100);
      fprintf(outfile,"%4.1f,",(double) backend/slots_no_contention*100);
      fprintf(outfile,"%4.1f,",(double) speculation/slots_no_contention*100);
      
      break;
    case PRINT_NORMAL:
      if (too_short){
	warning("unable to read performance counter, is runtime too short?\n");
      } else {
	fprintf(outfile,"slots                %-14lu #\n",slots);
	fprintf(outfile,"retiring             %-14lu # %4.1f%% (%4.1lf%%)",
		retiring,(double) retiring/slots*100, (double) retiring/slots_no_contention*100);
	if (((double) retiring/slots_no_contention) > 0.54){
	  fprintf(outfile," high");
	} else if (((double) retiring/slots_no_contention) < 0.14){
	  fprintf(outfile," low");
	}
	fprintf(outfile,"\n");
	if (retire_ucode && frontend_bandwidth){
	  fprintf(outfile,"-- ucode             %-14lu #    %4.1f%%\n",
		  retire_ucode,(double) retire_ucode/slots*100);
	  fprintf(outfile,"-- fastpath          %-14lu #    %4.1f%%\n",
		  retire_fastpath,(double) retire_fastpath/slots*100);
	}		
	fprintf(outfile,"frontend             %-14lu # %4.1f%% (%4.1lf%%)",
		frontend,(double) frontend/slots*100, (double) frontend/slots_no_contention*100);
	if (((double) frontend/slots_no_contention) > 0.45){
	  fprintf(outfile," high");
	} else if (((double) frontend/slots_no_contention) < 0.05){
	  fprintf(outfile," low");
	}
	fprintf(outfile,"\n");
	if (frontend_latency && frontend_bandwidth){
	  fprintf(outfile,"-- latency           %-14lu #    %4.1f%%\n",
		  frontend_latency,(double) frontend_latency/slots*100);
	  fprintf(outfile,"-- bandwidth         %-14lu #    %4.1f%%\n",
		  frontend_bandwidth,(double) frontend_bandwidth/slots*100);
	}	
	fprintf(outfile,"backend              %-14lu # %4.1f%% (%4.1lf%%)",
		backend,(double) backend/slots*100, (double) backend/slots_no_contention*100);
	if (((double) backend/slots_no_contention) > 0.70){
	  fprintf(outfile," high");
	} else if (((double) backend/slots_no_contention) < 0.18){
	  fprintf(outfile," low");
	}
	fprintf(outfile,"\n");
	if (backend_memory && backend_cpu){
	  fprintf(outfile,"-- cpu               %-14lu #    %4.1f%%\n",
		  backend_cpu,(double) backend_cpu/slots*100);
	  fprintf(outfile,"-- memory            %-14lu #    %4.1f%%\n",
		  backend_memory,(double) backend_memory/slots*100);
	}
	fprintf(outfile,"speculation          %-14lu # %4.1f%% (%4.1lf%%)",
		speculation,(double) speculation/slots*100, (double) speculation/slots_no_contention*100);
	if (((double) speculation/slots_no_contention) > 0.10){
	  fprintf(outfile," high");
	} else if (((double) speculation/slots_no_contention) < 0.01){
	  fprintf(outfile," low");
	}
	fprintf(outfile,"\n");
	if (speculation_pipeline && speculation_branches){
	  fprintf(outfile,"-- branch mispredict %-14lu #    %4.1lf%%\n",
		  speculation_branches,(double) speculation_branches/slots*100);
	  fprintf(outfile,"-- pipeline restart  %-14lu #    %4.1f%%\n",
		  speculation_pipeline,(double) speculation_pipeline/slots*100);
	}
	fprintf(outfile,"smt-contention       %-14lu # %4.1f%% ( 0.0%%)\n",contention,(double) contention/slots*100);
      }
      break;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %esi, %r14d
movq %rdi, %r15
cmpl $0x2, %esi
jne 0x5cbe
leaq 0xc453(%rip), %rax      # 0x120f8
movq (%rax), %rcx
leaq 0x7174(%rip), %rdi      # 0xce23
movl $0x22, %esi
movl $0x1, %edx
callq 0x32c0
leaq 0xd49b(%rip), %rax      # 0x13160
movq (%rax), %rbx
movl (%rbx), %eax
cmpl $0x1, %eax
je 0x5cf2
cmpl $0x2, %eax
jne 0x636a
leaq 0x5ca2(%rip), %rsi      # 0xb981
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x5d31
movq 0x30(%rax), %rbp
jmp 0x5d33
leaq 0x5c72(%rip), %rsi      # 0xb96b
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x5d2a
movq 0x18(%rbx), %rcx
movl (%rcx), %ecx
cmpl $0x3, %ecx
je 0x5e9e
cmpl $0x2, %ecx
jne 0x5d2a
movq 0x30(%rax), %rax
addq %rax, %rax
leaq (%rax,%rax,2), %rbp
jmp 0x5ea6
xorl %ebp, %ebp
jmp 0x5ea6
xorl %ebp, %ebp
leaq 0x5c62(%rip), %rsi      # 0xb99c
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x5d51
movq 0x30(%rax), %rax
movq %rax, (%rsp)
jmp 0x5d59
movq $0x0, (%rsp)
leaq 0x5c94(%rip), %rsi      # 0xb9f4
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x5d73
movq 0x30(%rax), %r13
jmp 0x5d76
xorl %r13d, %r13d
leaq 0x5ca3(%rip), %rsi      # 0xba20
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x5d90
movq 0x30(%rax), %r12
jmp 0x5d93
xorl %r12d, %r12d
leaq 0x5c2e(%rip), %rsi      # 0xb9c8
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x5dad
movq 0x30(%rax), %rbx
jmp 0x5daf
xorl %ebx, %ebx
leaq 0x5d21(%rip), %rsi      # 0xbad7
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x5dd9
movq 0x30(%rax), %rcx
movq %r12, %rdx
movq %rcx, 0x50(%rsp)
subq %rcx, %rdx
movq %rdx, 0x30(%rsp)
jmp 0x5deb
movq $0x0, 0x30(%rsp)
movq $0x0, 0x50(%rsp)
leaq 0x5c87(%rip), %rsi      # 0xba79
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x5e15
movq 0x30(%rax), %rdx
movq %rbx, %rax
movq %rdx, 0x28(%rsp)
subq %rdx, %rax
movq %rax, 0x48(%rsp)
jmp 0x5e27
movq $0x0, 0x28(%rsp)
movq $0x0, 0x48(%rsp)
movq %r12, 0x68(%rsp)
leaq 0x5c77(%rip), %rsi      # 0xbaaa
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
movq %r13, 0x60(%rsp)
je 0x5e53
movq 0x30(%rax), %rcx
movq %rcx, 0x40(%rsp)
subq %rcx, %r13
jmp 0x5e5f
movq $0x0, 0x40(%rsp)
xorl %r13d, %r13d
movq %rbx, 0x58(%rsp)
leaq 0x5be1(%rip), %rsi      # 0xba4c
movq %r15, %rdi
callq 0x5860
movb $0x1, %cl
testq %rax, %rax
je 0x5e8f
movq 0x30(%rax), %rbx
movq (%rsp), %r15
subq %rbx, %r15
xorl %eax, %eax
movq %rbp, %r12
jmp 0x621f
xorl %eax, %eax
movq %rbp, %r12
xorl %ebx, %ebx
xorl %r15d, %r15d
jmp 0x621f
movq 0x30(%rax), %rbp
shlq $0x3, %rbp
leaq 0x5f0d(%rip), %rsi      # 0xbdba
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x5ec4
movq 0x30(%rax), %rax
movq %rax, (%rsp)
jmp 0x5ecc
movq $0x0, (%rsp)
leaq 0x5efd(%rip), %rsi      # 0xbdd0
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x5ee6
movq 0x30(%rax), %rax
jmp 0x5ee8
xorl %eax, %eax
movq %rax, 0x60(%rsp)
leaq 0x5f1f(%rip), %rsi      # 0xbe13
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x5f07
movq 0x30(%rax), %r13
jmp 0x5f0a
xorl %r13d, %r13d
leaq 0x5f68(%rip), %rsi      # 0xbe79
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x5f29
movq 0x30(%rax), %rax
movq %rax, 0x38(%rsp)
jmp 0x5f32
movq $0x0, 0x38(%rsp)
leaq 0x5f18(%rip), %rsi      # 0xbe51
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x5f5a
cmpq $0x0, 0x48(%rax)
setne 0x10(%rsp)
movq 0x30(%rax), %r12
subq (%rsp), %r12
jmp 0x5f62
movb $0x1, 0x10(%rsp)
xorl %r12d, %r12d
leaq 0x5f4e(%rip), %rsi      # 0xbeb7
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x5f7c
movq 0x30(%rax), %rbx
jmp 0x5f7e
xorl %ebx, %ebx
leaq 0x5f67(%rip), %rsi      # 0xbeec
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x6040
movq 0x30(%rax), %rax
testq %rbx, %rbx
setne %cl
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x6040
movq %r13, %xmm0
movq 0x5982(%rip), %xmm1     # 0xb940
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x5986(%rip), %xmm2     # 0xb950
subpd %xmm2, %xmm0
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm0, %xmm3
movq %rbx, %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
subpd %xmm2, %xmm0
movapd %xmm0, %xmm4
unpckhpd %xmm0, %xmm4            # xmm4 = xmm4[1],xmm0[1]
addsd %xmm0, %xmm4
mulsd %xmm3, %xmm4
movq %rax, %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
subpd %xmm2, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd %xmm1, %xmm4
cvttsd2si %xmm4, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x58a8(%rip), %xmm4     # 0xb8d0
cvttsd2si %xmm4, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq %r13, %rax
subq %rdx, %rax
movq %rax, 0x30(%rsp)
jmp 0x604b
movq $0x0, 0x30(%rsp)
xorl %edx, %edx
movq %rdx, 0x50(%rsp)
leaq 0x5ec4(%rip), %rsi      # 0xbf1b
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x606a
movq 0x30(%rax), %rbx
jmp 0x606c
xorl %ebx, %ebx
leaq 0x5ec3(%rip), %rsi      # 0xbf36
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x6131
movq 0x30(%rax), %rax
testq %rbx, %rbx
setne %cl
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x6131
movq %r12, %xmm0
movq 0x5894(%rip), %xmm1     # 0xb940
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x5898(%rip), %xmm2     # 0xb950
subpd %xmm2, %xmm0
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm0, %xmm3
movq %rax, %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
subpd %xmm2, %xmm0
movapd %xmm0, %xmm4
unpckhpd %xmm0, %xmm4            # xmm4 = xmm4[1],xmm0[1]
addsd %xmm0, %xmm4
mulsd %xmm3, %xmm4
addq %rax, %rbx
movq %rbx, %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
subpd %xmm2, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd %xmm1, %xmm4
cvttsd2si %xmm4, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x57b7(%rip), %xmm4     # 0xb8d0
cvttsd2si %xmm4, %rbx
andq %rcx, %rbx
orq %rax, %rbx
movq %r12, %rax
subq %rbx, %rax
movq %rax, 0x28(%rsp)
jmp 0x613c
movq $0x0, 0x28(%rsp)
xorl %ebx, %ebx
movq %r13, 0x68(%rsp)
leaq 0x5e11(%rip), %rsi      # 0xbf59
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
je 0x616f
movq 0x30(%rax), %rax
addq %rax, %rax
leaq (%rax,%rax,2), %rcx
movq 0x60(%rsp), %r13
movq %rcx, 0x40(%rsp)
subq %rcx, %r13
jmp 0x617b
movq $0x0, 0x40(%rsp)
xorl %r13d, %r13d
movq %rbx, 0x48(%rsp)
leaq 0x5e29(%rip), %rsi      # 0xbfb0
movq %r15, %rdi
callq 0x5860
testq %rax, %rax
movq %r12, 0x58(%rsp)
je 0x620b
movq (%rsp), %r15
movq %r15, %xmm0
movq 0x5796(%rip), %xmm1     # 0xb940
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x579a(%rip), %xmm2     # 0xb950
subpd %xmm2, %xmm0
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm0, %xmm3
movq 0x30(%rax), %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
subpd %xmm2, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd %xmm3, %xmm1
divsd %xmm3, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x56d5(%rip), %xmm1     # 0xb8d0
cvttsd2si %xmm1, %rbx
andq %rcx, %rbx
orq %rax, %rbx
subq %rbx, %r15
jmp 0x6210
xorl %ebx, %ebx
xorl %r15d, %r15d
movq 0x38(%rsp), %rax
movb 0x10(%rsp), %cl
movq %rbp, %r12
subq %rax, %r12
testq %rbp, %rbp
je 0x636a
testl %r14d, %r14d
je 0x637c
cmpl $0x1, %r14d
jne 0x636a
leaq 0xbeb6(%rip), %r14      # 0x120f8
movq (%r14), %rdi
movsd (%rsp), %xmm1
movsd 0x56ee(%rip), %xmm2     # 0xb940
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x56f3(%rip), %xmm3     # 0xb950
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %r12, %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
movapd %xmm2, (%rsp)
divsd %xmm2, %xmm0
mulsd 0x5631(%rip), %xmm0     # 0xb8c8
leaq 0x6e91(%rip), %rbx      # 0xd12f
movq %rbx, %rsi
movb $0x1, %al
callq 0x31c0
movq (%r14), %rdi
movsd 0x60(%rsp), %xmm1
unpcklps 0x5688(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x5690(%rip), %xmm1     # 0xb950
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd (%rsp), %xmm0
mulsd 0x55ef(%rip), %xmm0     # 0xb8c8
movq %rbx, %rsi
movb $0x1, %al
callq 0x31c0
movq (%r14), %rdi
movsd 0x68(%rsp), %xmm1
unpcklps 0x564d(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x5655(%rip), %xmm1     # 0xb950
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd (%rsp), %xmm0
mulsd 0x55b4(%rip), %xmm0     # 0xb8c8
movq %rbx, %rsi
movb $0x1, %al
callq 0x31c0
movq (%r14), %rdi
movsd 0x58(%rsp), %xmm1
unpcklps 0x5612(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x561a(%rip), %xmm1     # 0xb950
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd (%rsp), %xmm0
mulsd 0x5579(%rip), %xmm0     # 0xb8c8
movq %rbx, %rsi
movb $0x1, %al
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31c0
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb %cl, %cl
je 0x6480
movq %rax, 0x38(%rsp)
leaq 0xbd68(%rip), %r14      # 0x120f8
movq (%r14), %rdi
leaq 0x6ae7(%rip), %rsi      # 0xce81
movq %rbp, %rdx
xorl %eax, %eax
callq 0x31c0
movq (%r14), %rdi
movq (%rsp), %rdx
movq %rdx, %xmm0
movq 0x5588(%rip), %xmm2     # 0xb940
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x558c(%rip), %xmm3     # 0xb950
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, %xmm5
movq %rbp, %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 %xmm5, %xmm0
movapd %xmm1, 0x10(%rsp)
divsd %xmm1, %xmm0
movsd 0x54c1(%rip), %xmm4     # 0xb8c8
mulsd %xmm4, %xmm0
movq %r12, %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
movapd %xmm2, 0x70(%rsp)
divsd %xmm2, %xmm5
movapd %xmm5, 0x80(%rsp)
movapd %xmm5, %xmm1
mulsd %xmm4, %xmm1
leaq 0x6a5a(%rip), %rsi      # 0xcea0
movb $0x2, %al
callq 0x31c0
movapd 0x80(%rsp), %xmm1
ucomisd 0x5492(%rip), %xmm1     # 0xb8f0
jbe 0x649f
movq (%r14), %rcx
leaq 0x69a7(%rip), %rdi      # 0xce11
movl $0x5, %esi
movl $0x1, %edx
callq 0x32c0
movq 0x58(%rsp), %r12
jmp 0x64cb
leaq 0x69bf(%rip), %rdi      # 0xce46
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9337
movsd 0x5451(%rip), %xmm0     # 0xb8f8
ucomisd %xmm1, %xmm0
movq 0x58(%rsp), %r12
jbe 0x64cb
movq (%r14), %rcx
leaq 0x695b(%rip), %rdi      # 0xce17
movl $0x4, %esi
movl $0x1, %edx
callq 0x32c0
movq (%r14), %rsi
movl $0xa, %edi
callq 0x3150
testq %rbx, %rbx
je 0x657c
testq %r13, %r13
je 0x657c
movq (%r14), %rdi
movq %rbx, %xmm1
movq 0x5446(%rip), %xmm0     # 0xb940
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x544a(%rip), %xmm0     # 0xb950
subpd %xmm0, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0x10(%rsp), %xmm0
movsd 0x53a4(%rip), %xmm1     # 0xb8c8
mulsd %xmm1, %xmm0
leaq 0x69a2(%rip), %rsi      # 0xced1
movq %rbx, %rdx
movb $0x1, %al
callq 0x31c0
movq (%r14), %rdi
movq %r15, %xmm1
punpckldq 0x53f7(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x53ff(%rip), %xmm1     # 0xb950
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0x10(%rsp), %xmm0
mulsd 0x535d(%rip), %xmm0     # 0xb8c8
leaq 0x6989(%rip), %rsi      # 0xcefb
movq %r15, %rdx
movb $0x1, %al
callq 0x31c0
movq 0x60(%rsp), %rdx
movq %rdx, %xmm0
punpckldq 0x53b2(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
movq (%r14), %rdi
subpd 0x53b7(%rip), %xmm0     # 0xb950
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm0, %xmm3
movapd %xmm3, %xmm0
divsd 0x10(%rsp), %xmm0
movsd 0x5311(%rip), %xmm2     # 0xb8c8
mulsd %xmm2, %xmm0
divsd 0x70(%rsp), %xmm3
movapd %xmm3, (%rsp)
movapd %xmm3, %xmm1
mulsd %xmm2, %xmm1
leaq 0x6950(%rip), %rsi      # 0xcf25
movb $0x2, %al
callq 0x31c0
movapd (%rsp), %xmm1
ucomisd 0x5317(%rip), %xmm1     # 0xb900
jbe 0x660b
movq (%r14), %rcx
leaq 0x681c(%rip), %rdi      # 0xce11
movl $0x5, %esi
movl $0x1, %edx
callq 0x32c0
movq 0x50(%rsp), %rbx
jmp 0x6637
movsd 0x52f5(%rip), %xmm0     # 0xb908
ucomisd %xmm1, %xmm0
movq 0x50(%rsp), %rbx
jbe 0x6637
movq (%r14), %rcx
leaq 0x67ef(%rip), %rdi      # 0xce17
movl $0x4, %esi
movl $0x1, %edx
callq 0x32c0
movq (%r14), %rsi
movl $0xa, %edi
callq 0x3150
movq 0x40(%rsp), %rdx
testq %rdx, %rdx
je 0x66ea
testq %r13, %r13
je 0x66ea
movq (%r14), %rdi
movq %rdx, %xmm1
movq 0x52d5(%rip), %xmm0     # 0xb940
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x52d9(%rip), %xmm0     # 0xb950
subpd %xmm0, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0x10(%rsp), %xmm0
movsd 0x5233(%rip), %xmm1     # 0xb8c8
mulsd %xmm1, %xmm0
leaq 0x68b6(%rip), %rsi      # 0xcf56
movb $0x1, %al
callq 0x31c0
movq (%r14), %rdi
movq %r13, %xmm1
punpckldq 0x5289(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x5291(%rip), %xmm1     # 0xb950
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0x10(%rsp), %xmm0
mulsd 0x51ef(%rip), %xmm0     # 0xb8c8
leaq 0x68a0(%rip), %rsi      # 0xcf80
movq %r13, %rdx
movb $0x1, %al
callq 0x31c0
movq 0x68(%rsp), %rdx
movq %rdx, %xmm0
punpckldq 0x5244(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
movq (%r14), %rdi
subpd 0x5249(%rip), %xmm0     # 0xb950
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm0, %xmm3
movapd %xmm3, %xmm0
divsd 0x10(%rsp), %xmm0
movsd 0x51a3(%rip), %xmm2     # 0xb8c8
mulsd %xmm2, %xmm0
divsd 0x70(%rsp), %xmm3
movapd %xmm3, (%rsp)
movapd %xmm3, %xmm1
mulsd %xmm2, %xmm1
leaq 0x6867(%rip), %rsi      # 0xcfaa
movb $0x2, %al
callq 0x31c0
movapd (%rsp), %xmm1
ucomisd 0x5191(%rip), %xmm1     # 0xb8e8
jbe 0x676a
movq (%r14), %rcx
leaq 0x66ae(%rip), %rdi      # 0xce11
movl $0x5, %esi
jmp 0x6787
movsd 0x519e(%rip), %xmm0     # 0xb910
ucomisd %xmm1, %xmm0
jbe 0x6791
movq (%r14), %rcx
leaq 0x6695(%rip), %rdi      # 0xce17
movl $0x4, %esi
movl $0x1, %edx
callq 0x32c0
movq (%r14), %rsi
movl $0xa, %edi
callq 0x3150
testq %rbx, %rbx
movq 0x30(%rsp), %rdx
je 0x6844
testq %rdx, %rdx
je 0x6844
movq (%r14), %rdi
movq %rdx, %xmm1
movq 0x517b(%rip), %xmm0     # 0xb940
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x517f(%rip), %xmm0     # 0xb950
subpd %xmm0, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0x10(%rsp), %xmm0
movsd 0x50d9(%rip), %xmm1     # 0xb8c8
mulsd %xmm1, %xmm0
leaq 0x67e1(%rip), %rsi      # 0xcfdb
movb $0x1, %al
callq 0x31c0
movq (%r14), %rdi
movq %rbx, %xmm1
punpckldq 0x512f(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x5137(%rip), %xmm1     # 0xb950
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0x10(%rsp), %xmm0
mulsd 0x5095(%rip), %xmm0     # 0xb8c8
leaq 0x67cb(%rip), %rsi      # 0xd005
movq %rbx, %rdx
movb $0x1, %al
callq 0x31c0
movq %r12, %xmm0
punpckldq 0x50ef(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
movq (%r14), %rdi
subpd 0x50f4(%rip), %xmm0     # 0xb950
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm0, %xmm3
movapd %xmm3, %xmm0
divsd 0x10(%rsp), %xmm0
movsd 0x504e(%rip), %xmm2     # 0xb8c8
mulsd %xmm2, %xmm0
divsd 0x70(%rsp), %xmm3
movapd %xmm3, (%rsp)
movapd %xmm3, %xmm1
mulsd %xmm2, %xmm1
leaq 0x6797(%rip), %rsi      # 0xd02f
movq %r12, %rdx
movb $0x2, %al
callq 0x31c0
movapd (%rsp), %xmm1
ucomisd 0x5069(%rip), %xmm1     # 0xb918
jbe 0x68d1
movq (%r14), %rcx
leaq 0x6556(%rip), %rdi      # 0xce11
movl $0x5, %esi
movl $0x1, %edx
callq 0x32c0
movq 0x48(%rsp), %rbx
jmp 0x68fd
movsd 0x5047(%rip), %xmm0     # 0xb920
ucomisd %xmm1, %xmm0
movq 0x48(%rsp), %rbx
jbe 0x68fd
movq (%r14), %rcx
leaq 0x6529(%rip), %rdi      # 0xce17
movl $0x4, %esi
movl $0x1, %edx
callq 0x32c0
movq (%r14), %rsi
movl $0xa, %edi
callq 0x3150
testq %rbx, %rbx
movq 0x28(%rsp), %rdx
je 0x69b0
testq %rdx, %rdx
je 0x69b0
movq (%r14), %rdi
movq %rdx, %xmm1
movq 0x500f(%rip), %xmm0     # 0xb940
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x5013(%rip), %xmm0     # 0xb950
subpd %xmm0, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0x10(%rsp), %xmm0
movsd 0x4f6d(%rip), %xmm1     # 0xb8c8
mulsd %xmm1, %xmm0
leaq 0x66fa(%rip), %rsi      # 0xd060
movb $0x1, %al
callq 0x31c0
movq (%r14), %rdi
movq %rbx, %xmm1
punpckldq 0x4fc3(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x4fcb(%rip), %xmm1     # 0xb950
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0x10(%rsp), %xmm0
mulsd 0x4f29(%rip), %xmm0     # 0xb8c8
leaq 0x66e5(%rip), %rsi      # 0xd08b
movq %rbx, %rdx
movb $0x1, %al
callq 0x31c0
movq (%r14), %rdi
movq 0x38(%rsp), %rdx
movq %rdx, %xmm1
punpckldq 0x4f7b(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x4f83(%rip), %xmm1     # 0xb950
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0x10(%rsp), %xmm0
mulsd 0x4ee1(%rip), %xmm0     # 0xb8c8
leaq 0x66c7(%rip), %rsi      # 0xd0b5
movb $0x1, %al
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31c0