// File: /workspace/github_c_makefile_star2_O1/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, %r13d
xorpd %xmm2, %xmm2
cmpb $0x1, 0x8(%rdx)
jne 0xc96a
movl %r13d, %r15d
subl %ebp, %r15d
movl 0x18(%r14), %r12d
subl %ebp, %r12d
cvtsi2sdl 0xff67(%rip), %xmm0 # 0x1c7f8
movl 0x51c61(%rip), %eax     # 0x5e4f8
subl 0x51c5f(%rip), %eax     # 0x5e4fc
cvtsi2sd %eax, %xmm1
callq 0x30f0
movsd 0x8e6a(%rip), %xmm2     # 0x15718
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r15, %xmm1
callq 0x30f0
movsd 0x8e45(%rip), %xmm1     # 0x15718
subsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0xff10(%rip), %xmm0 # 0x1c7f8
movl 0x51c0a(%rip), %eax     # 0x5e4f8
subl 0x51c08(%rip), %eax     # 0x5e4fc
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
callq 0x30f0
movsd 0x8e10(%rip), %xmm2     # 0x15718
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r12, %xmm1
callq 0x30f0
movsd 0x8deb(%rip), %xmm1     # 0x15718
subsd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm3
movapd %xmm3, %xmm0
mulsd %xmm1, %xmm0
addl %r15d, %r12d
xorps %xmm2, %xmm2
cvtsi2sd %r12, %xmm2
mulsd %xmm0, %xmm2
movapd %xmm3, %xmm0
mulsd 0x8dc6(%rip), %xmm3     # 0x15720
addsd %xmm1, %xmm0
mulsd %xmm1, %xmm3
addsd %xmm0, %xmm3
divsd %xmm3, %xmm2
movl (%r14), %eax
movl 0x18(%r14), %edx
testl %eax, %eax
je 0xc980
cmpl %r13d, %edx
cmovael %r13d, %edx
movl %edx, %ecx
jmp 0xc987
movl %r13d, %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 0x8d61(%rip), %xmm0     # 0x15718
testl %eax, %eax
movsd %xmm1, 0x8(%rsp)
je 0xc9c7
divsd %xmm1, %xmm0
jmp 0xc9d7
addsd %xmm1, %xmm1
divsd %xmm1, %xmm0
addsd 0x8d51(%rip), %xmm0     # 0x15728
callq 0x3230
xorps %xmm1, %xmm1
cvtsi2sdl 0x51b11(%rip), %xmm1 # 0x5e4f8
divsd %xmm1, %xmm0
movsd 0x8d25(%rip), %xmm1     # 0x15718
minsd %xmm0, %xmm1
xorl %eax, %eax
ucomisd 0x10(%r14), %xmm1
ja 0xcc51
leaq 0x4(%rbx), %r15
movq 0x28(%r14), %rcx
cvttsd2si 0x18(%rsp), %r10
movl 0x18(%r14), %r11d
subq $0x8, %rsp
leaq 0x9afc(%rip), %rdx      # 0x1651f
movl $0x400, %r12d           # 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 %r13
pushq %r10
callq 0x31b0
addq $0x20, %rsp
movslq 0x30(%r14), %r13
leaq (%rbx,%r13), %rdi
addq $0x1f, %rdi
callq 0x3130
addl %r13d, %eax
addl $0x1b, %eax
movl %eax, (%rbx)
cmpl $0x0, 0x4(%r14)
je 0xcc30
movsd 0x8c9c(%rip), %xmm0     # 0x15718
movsd 0x8(%rsp), %xmm1
subsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
divsd 0x20(%rsp), %xmm0
movsd 0x8c90(%rip), %xmm1     # 0x15728
callq 0x30f0
movapd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
movsd %xmm1, 0x10(%rsp)
divsd %xmm1, %xmm0
mulsd 0x8c87(%rip), %xmm0     # 0x15740
callq 0x3030
mulsd 0x8c62(%rip), %xmm0     # 0x15728
movslq (%rbx), %rax
leaq (%r15,%rax), %rdi
movl $0x400, %esi            # imm = 0x400
subq %rax, %rsi
movsd 0x20(%r14), %xmm2
unpcklps 0x854e(%rip), %xmm2     # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x8556(%rip), %xmm2     # 0x15040
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
mulsd %xmm0, %xmm1
leaq 0x9a3c(%rip), %rdx      # 0x1653d
movb $0x2, %al
callq 0x31b0
movslq (%rbx), %r13
leaq (%r15,%r13), %rdi
addq $0x4, %rdi
callq 0x3130
addl %r13d, %eax
addl $0x4, %eax
movl %eax, (%rbx)
cmpl $0x2, 0x4(%r14)
jb 0xcc30
movsd 0x8bfd(%rip), %xmm3     # 0x15730
movsd 0x10(%rsp), %xmm1
mulsd %xmm1, %xmm3
mulsd 0x8bf3(%rip), %xmm1     # 0x15738
movsd 0x8(%rsp), %xmm2
addsd %xmm2, %xmm1
cmpl $0x0, (%r14)
movsd 0x8bbd(%rip), %xmm0     # 0x15718
movsd %xmm1, 0x10(%rsp)
je 0xcb69
divsd %xmm1, %xmm0
jmp 0xcb79
addsd %xmm1, %xmm1
divsd %xmm1, %xmm0
addsd 0x8baf(%rip), %xmm0     # 0x15728
addsd %xmm2, %xmm3
movsd %xmm3, 0x8(%rsp)
callq 0x3230
xorps %xmm1, %xmm1
cvtsi2sdl 0x51965(%rip), %xmm1 # 0x5e4f8
divsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
cmpl $0x0, (%r14)
je 0xcbb3
movsd 0x8b6d(%rip), %xmm0     # 0x15718
divsd 0x8(%rsp), %xmm0
jmp 0xcbd1
movsd 0x8(%rsp), %xmm1
addsd %xmm1, %xmm1
movsd 0x8b53(%rip), %xmm0     # 0x15718
divsd %xmm1, %xmm0
addsd 0x8b57(%rip), %xmm0     # 0x15728
callq 0x3230
movapd %xmm0, %xmm3
xorps %xmm0, %xmm0
cvtsi2sdl 0x51913(%rip), %xmm0 # 0x5e4f8
divsd %xmm0, %xmm3
movslq (%rbx), %rax
leaq (%r15,%rax), %rdi
movl $0x400, %esi            # imm = 0x400
subq %rax, %rsi
leaq 0x9945(%rip), %rdx      # 0x16544
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)
movslq (%rbx), %rax
addq %rax, %r15
subq %rax, %r12
leaq 0xb46f(%rip), %rdx      # 0x180af
movq %r15, %rdi
movq %r12, %rsi
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
nop