// File: /workspace/github_c_makefile_star2_O3/yhg926[P]public_kssd/command_dist.c
// Function: output_ctrl
static inline void output_ctrl (unsigned int X_size, unsigned int XnY_size, print_ctrl_t* outfield, char *rname, prt_line_t* linebuf ){
 double rs = 0;
 if(outfield->correction){
  unsigned int X_XnY_size = X_size - XnY_size;
  unsigned int Y_XnY_size = outfield->Y_size - XnY_size;
  double P_K_in_X_XnY = 1 - pow( (1- 1/pow(alp_size,(kmerlen - dim_reduct_len) )), X_XnY_size );
  double P_K_in_Y_XnY = 1 - pow( (1- 1/pow(alp_size,(kmerlen - dim_reduct_len) )), Y_XnY_size );
  rs = P_K_in_X_XnY * P_K_in_Y_XnY * ( X_XnY_size + Y_XnY_size )
       /(P_K_in_X_XnY + P_K_in_Y_XnY - 2*P_K_in_X_XnY * P_K_in_Y_XnY);
 }
 unsigned int tmp = outfield->metric == Jcd ? X_size + outfield->Y_size - XnY_size
                   :(X_size < outfield->Y_size ? X_size : outfield->Y_size);
 double metric = ((double)XnY_size - rs) / tmp;
 double dist = log( GET_MATRIC(outfield->metric,metric) ) / kmerlen;
 if (dist > 1) dist = 1 ;
  if( dist > outfield->dthreshold ) { linebuf->len = 0 ; return; };
#define LST_PRT_LEN 27
 snprintf(linebuf->line,LINE_LEN,"%s\t%s\t%u-%u|%u|%u\t%.6lf\t%.6lf",outfield->qname,rname,XnY_size,(unsigned int)rs,X_size, outfield->Y_size, metric, dist);
 linebuf->len = LST_PRT_LEN + outfield->qry_len + strlen(linebuf->line + LST_PRT_LEN + outfield->qry_len);
 if(outfield->pfield > Dst) {
  double sd = pow(metric*(1 - metric) / tmp, 0.5) ;
  double pv = 0.5 * erfc( metric / sd * pow(0.5,0.5) ) ;
  snprintf(linebuf->line + linebuf->len, LINE_LEN - linebuf->len,"\t%E\t%E", pv, pv * outfield->cmprsn_num );
  linebuf->len += 4 + strlen(linebuf->line + linebuf->len + 4);
  if(outfield->pfield >Qv){
   double CI95_mtrc_1 = metric - 1.96*sd;
   double CI95_mtrc_2 = metric + 1.96*sd;
   double CI95_dist_1 = log( GET_MATRIC(outfield->metric,CI95_mtrc_2) ) / kmerlen;
   double CI95_dist_2 = log( GET_MATRIC(outfield->metric,CI95_mtrc_1) ) / kmerlen;
   snprintf(linebuf->line + linebuf->len, LINE_LEN - linebuf->len,"\t[%.6lf,%.6lf]\t[%.6lf,%.6lf]", CI95_mtrc_1, CI95_mtrc_2, CI95_dist_1, CI95_dist_2);
   linebuf->len += 20 + strlen(linebuf->line + linebuf->len + 20);
  }
 }
 snprintf(linebuf->line + linebuf->len, LINE_LEN - linebuf->len,"\n");
 linebuf->len += 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %rbx
movq %rcx, 0x10(%rsp)
movq %rdx, %r14
movl %esi, %ebp
movl %edi, %r12d
xorpd %xmm2, %xmm2
cmpb $0x1, 0x8(%rdx)
jne 0xcc1f
movl %r12d, %r15d
subl %ebp, %r15d
movl 0x18(%r14), %r13d
subl %ebp, %r13d
cvtsi2sdl 0xfcb2(%rip), %xmm0 # 0x1c7f8
movl 0x519ac(%rip), %eax     # 0x5e4f8
subl 0x519aa(%rip), %eax     # 0x5e4fc
cvtsi2sd %eax, %xmm1
callq 0x30f0
movsd 0x8c05(%rip), %xmm2     # 0x15768
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r15, %xmm1
callq 0x30f0
movsd 0x8be0(%rip), %xmm1     # 0x15768
subsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0xfc5b(%rip), %xmm0 # 0x1c7f8
movl 0x51955(%rip), %eax     # 0x5e4f8
subl 0x51953(%rip), %eax     # 0x5e4fc
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
callq 0x30f0
movsd 0x8bab(%rip), %xmm2     # 0x15768
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r13, %xmm1
callq 0x30f0
movsd 0x8b86(%rip), %xmm1     # 0x15768
subsd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm3
movapd %xmm3, %xmm0
mulsd %xmm1, %xmm0
addl %r15d, %r13d
xorps %xmm2, %xmm2
cvtsi2sd %r13, %xmm2
mulsd %xmm0, %xmm2
movapd %xmm3, %xmm0
mulsd 0x8b61(%rip), %xmm3     # 0x15770
addsd %xmm1, %xmm0
mulsd %xmm1, %xmm3
addsd %xmm0, %xmm3
divsd %xmm3, %xmm2
movl (%r14), %eax
movl 0x18(%r14), %edx
testl %eax, %eax
je 0xcc35
cmpl %r12d, %edx
cmovael %r12d, %edx
movl %edx, %ecx
jmp 0xcc3c
movl %r12d, %ecx
subl %ebp, %ecx
addl %edx, %ecx
movl %ebp, %edx
xorps %xmm1, %xmm1
cvtsi2sd %rdx, %xmm1
movl %ecx, %ecx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
movsd %xmm2, 0x18(%rsp)
subsd %xmm2, %xmm1
movsd %xmm0, 0x20(%rsp)
divsd %xmm0, %xmm1
movsd 0x8afc(%rip), %xmm0     # 0x15768
testl %eax, %eax
movsd %xmm1, 0x8(%rsp)
je 0xcc7c
divsd %xmm1, %xmm0
jmp 0xcc8c
addsd %xmm1, %xmm1
divsd %xmm1, %xmm0
addsd 0x8aec(%rip), %xmm0     # 0x15778
callq 0x3230
xorps %xmm1, %xmm1
cvtsi2sdl 0x5185c(%rip), %xmm1 # 0x5e4f8
divsd %xmm1, %xmm0
movsd 0x8ac0(%rip), %xmm1     # 0x15768
minsd %xmm0, %xmm1
xorl %eax, %eax
ucomisd 0x10(%r14), %xmm1
ja 0xcf07
leaq 0x4(%rbx), %r15
movq 0x28(%r14), %rcx
cvttsd2si 0x18(%rsp), %r10
movl 0x18(%r14), %r11d
subq $0x8, %rsp
leaq 0x9897(%rip), %rdx      # 0x1656f
movl $0x400, %r13d           # imm = 0x400
movl $0x400, %esi            # imm = 0x400
movq %r15, %rdi
movq 0x18(%rsp), %r8
movl %ebp, %r9d
movsd 0x10(%rsp), %xmm0
movb $0x2, %al
pushq %r11
pushq %r12
pushq %r10
callq 0x31b0
addq $0x20, %rsp
movslq 0x30(%r14), %r12
leaq (%rbx,%r12), %rdi
addq $0x1f, %rdi
callq 0x3130
addl %r12d, %eax
addl $0x1b, %eax
movl %eax, (%rbx)
cmpl $0x0, 0x4(%r14)
je 0xcee3
movsd 0x8a37(%rip), %xmm0     # 0x15768
movsd 0x8(%rsp), %xmm1
subsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
divsd 0x20(%rsp), %xmm0
movsd 0x8a2b(%rip), %xmm1     # 0x15778
callq 0x30f0
movapd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
movsd %xmm1, 0x10(%rsp)
divsd %xmm1, %xmm0
mulsd 0x8a22(%rip), %xmm0     # 0x15790
callq 0x3030
mulsd 0x89fd(%rip), %xmm0     # 0x15778
movslq (%rbx), %rax
leaq (%r15,%rax), %rdi
subq %rax, %r13
movsd 0x20(%r14), %xmm2
unpcklps 0x829e(%rip), %xmm2     # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x82a6(%rip), %xmm2     # 0x15040
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
mulsd %xmm0, %xmm1
leaq 0x97dc(%rip), %rdx      # 0x1658d
movq %r13, %rsi
movb $0x2, %al
callq 0x31b0
movslq (%rbx), %r12
leaq (%r15,%r12), %rdi
addq $0x4, %rdi
callq 0x3130
addl %r12d, %eax
addl $0x4, %eax
movl %eax, (%rbx)
cmpl $0x2, 0x4(%r14)
jb 0xcee3
movsd 0x899a(%rip), %xmm3     # 0x15780
movsd 0x10(%rsp), %xmm1
mulsd %xmm1, %xmm3
mulsd 0x8990(%rip), %xmm1     # 0x15788
movsd 0x8(%rsp), %xmm2
addsd %xmm2, %xmm1
cmpl $0x0, (%r14)
movsd 0x895a(%rip), %xmm0     # 0x15768
movsd %xmm1, 0x10(%rsp)
je 0xce1c
divsd %xmm1, %xmm0
jmp 0xce2c
addsd %xmm1, %xmm1
divsd %xmm1, %xmm0
addsd 0x894c(%rip), %xmm0     # 0x15778
addsd %xmm2, %xmm3
movsd %xmm3, 0x8(%rsp)
callq 0x3230
xorps %xmm1, %xmm1
cvtsi2sdl 0x516b2(%rip), %xmm1 # 0x5e4f8
divsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
cmpl $0x0, (%r14)
je 0xce66
movsd 0x890a(%rip), %xmm0     # 0x15768
divsd 0x8(%rsp), %xmm0
jmp 0xce84
movsd 0x8(%rsp), %xmm1
addsd %xmm1, %xmm1
movsd 0x88f0(%rip), %xmm0     # 0x15768
divsd %xmm1, %xmm0
addsd 0x88f4(%rip), %xmm0     # 0x15778
callq 0x3230
movapd %xmm0, %xmm3
xorps %xmm0, %xmm0
cvtsi2sdl 0x51660(%rip), %xmm0 # 0x5e4f8
divsd %xmm0, %xmm3
movslq (%rbx), %rax
leaq (%r15,%rax), %rdi
movl $0x400, %esi            # imm = 0x400
subq %rax, %rsi
leaq 0x96e2(%rip), %rdx      # 0x16594
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
movb $0x4, %al
callq 0x31b0
movslq (%rbx), %r14
leaq (%r15,%r14), %rdi
addq $0x14, %rdi
callq 0x3130
addl %r14d, %eax
addl $0x14, %eax
movl %eax, (%rbx)
cltq
addq %rax, %r15
movl $0x400, %ecx            # imm = 0x400
subl %eax, %ecx
movslq %ecx, %rsi
leaq 0xb1e6(%rip), %rdx      # 0x180df
movq %r15, %rdi
xorl %eax, %eax
callq 0x31b0
movl (%rbx), %eax
incl %eax
movl %eax, (%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq