// File: /workspace/github_c_makefile_star2_O2/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 0xc1fe
movl %r12d, %r15d
subl %ebp, %r15d
movl 0x18(%r14), %r13d
subl %ebp, %r13d
cvtsi2sdl 0xf6c4(%rip), %xmm0 # 0x1b7f8
movl 0x513be(%rip), %eax     # 0x5d4f8
subl 0x513bc(%rip), %eax     # 0x5d4fc
cvtsi2sd %eax, %xmm1
callq 0x30f0
movsd 0x85c7(%rip), %xmm2     # 0x14718
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
cvtsi2sd %r15, %xmm1
callq 0x30f0
movsd 0x85a5(%rip), %xmm1     # 0x14718
subsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
cvtsi2sdl 0xf673(%rip), %xmm0 # 0x1b7f8
movl 0x5136d(%rip), %eax     # 0x5d4f8
subl 0x5136b(%rip), %eax     # 0x5d4fc
cvtsi2sd %eax, %xmm1
callq 0x30f0
movsd 0x8576(%rip), %xmm2     # 0x14718
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
cvtsi2sd %r13, %xmm1
callq 0x30f0
movsd 0x8554(%rip), %xmm1     # 0x14718
subsd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm3
movapd %xmm3, %xmm0
mulsd %xmm1, %xmm0
addl %r15d, %r13d
cvtsi2sd %r13, %xmm2
mulsd %xmm0, %xmm2
movapd %xmm3, %xmm0
mulsd 0x8532(%rip), %xmm3     # 0x14720
addsd %xmm1, %xmm0
mulsd %xmm1, %xmm3
addsd %xmm0, %xmm3
divsd %xmm3, %xmm2
movl (%r14), %eax
movl 0x18(%r14), %edx
testl %eax, %eax
je 0xc214
cmpl %r12d, %edx
cmovael %r12d, %edx
movl %edx, %ecx
jmp 0xc21b
movl %r12d, %ecx
subl %ebp, %ecx
addl %edx, %ecx
movl %ebp, %edx
cvtsi2sd %rdx, %xmm1
movl %ecx, %ecx
cvtsi2sd %rcx, %xmm0
movsd %xmm2, 0x18(%rsp)
subsd %xmm2, %xmm1
movsd %xmm0, 0x20(%rsp)
divsd %xmm0, %xmm1
movsd 0x84d3(%rip), %xmm0     # 0x14718
testl %eax, %eax
movsd %xmm1, 0x8(%rsp)
je 0xc255
divsd %xmm1, %xmm0
jmp 0xc265
addsd %xmm1, %xmm1
divsd %xmm1, %xmm0
addsd 0x84c3(%rip), %xmm0     # 0x14728
callq 0x3230
cvtsi2sdl 0x51286(%rip), %xmm1 # 0x5d4f8
divsd %xmm1, %xmm0
movsd 0x849a(%rip), %xmm1     # 0x14718
minsd %xmm0, %xmm1
xorl %eax, %eax
ucomisd 0x10(%r14), %xmm1
ja 0xc4d7
leaq 0x4(%rbx), %r15
movq 0x28(%r14), %rcx
cvttsd2si 0x18(%rsp), %r10
movl 0x18(%r14), %r11d
subq $0x8, %rsp
leaq 0x9271(%rip), %rdx      # 0x1551f
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 0xc4b3
movsd 0x8411(%rip), %xmm0     # 0x14718
movsd 0x8(%rsp), %xmm1
subsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
divsd 0x20(%rsp), %xmm0
movsd 0x8405(%rip), %xmm1     # 0x14728
callq 0x30f0
movapd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
movsd %xmm1, 0x10(%rsp)
divsd %xmm1, %xmm0
mulsd 0x83fc(%rip), %xmm0     # 0x14740
callq 0x3030
mulsd 0x83d7(%rip), %xmm0     # 0x14728
movslq (%rbx), %rax
leaq (%r15,%rax), %rdi
subq %rax, %r13
movsd 0x20(%r14), %xmm2
unpcklps 0x7cc8(%rip), %xmm2     # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x7cd0(%rip), %xmm2     # 0x14040
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
mulsd %xmm0, %xmm1
leaq 0x91b6(%rip), %rdx      # 0x1553d
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 0xc4b3
movsd 0x8374(%rip), %xmm3     # 0x14730
movsd 0x10(%rsp), %xmm1
mulsd %xmm1, %xmm3
mulsd 0x836a(%rip), %xmm1     # 0x14738
movsd 0x8(%rsp), %xmm2
addsd %xmm2, %xmm1
cmpl $0x0, (%r14)
movsd 0x8334(%rip), %xmm0     # 0x14718
movsd %xmm1, 0x10(%rsp)
je 0xc3f2
divsd %xmm1, %xmm0
jmp 0xc402
addsd %xmm1, %xmm1
divsd %xmm1, %xmm0
addsd 0x8326(%rip), %xmm0     # 0x14728
addsd %xmm2, %xmm3
movsd %xmm3, 0x8(%rsp)
callq 0x3230
cvtsi2sdl 0x510df(%rip), %xmm1 # 0x5d4f8
divsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
cmpl $0x0, (%r14)
je 0xc439
movsd 0x82e7(%rip), %xmm0     # 0x14718
divsd 0x8(%rsp), %xmm0
jmp 0xc457
movsd 0x8(%rsp), %xmm1
addsd %xmm1, %xmm1
movsd 0x82cd(%rip), %xmm0     # 0x14718
divsd %xmm1, %xmm0
addsd 0x82d1(%rip), %xmm0     # 0x14728
callq 0x3230
movapd %xmm0, %xmm3
cvtsi2sdl 0x51090(%rip), %xmm0 # 0x5d4f8
divsd %xmm0, %xmm3
movslq (%rbx), %rax
leaq (%r15,%rax), %rdi
movl $0x400, %esi            # imm = 0x400
subq %rax, %rsi
leaq 0x90c2(%rip), %rdx      # 0x15544
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 0xabc6(%rip), %rdx      # 0x1708f
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