// File: /workspace/github_c_makefile_star2_O1/yhg926[P]public_kssd/command_dist.c
// Function: fname_dist_print
void fname_dist_print(int ref_bin_code, int qry_fcode, const char *distout_dir, unsigned int*ref_ctx_ct_list,
   unsigned int*qry_ctx_ct_list, char (*refname)[PATHLEN], char (*qryfname)[PATHLEN], FILE *dout_fp)
{
 sprintf(full_distfcode,"%s/%d.%d.dist",distout_dir,ref_bin_code,qry_fcode);
  ctx_obj_ct_t *ctx_obj_ct;
 int fd;
 struct stat s;
 fd = open (full_distfcode, O_RDONLY);
 check (fd < 0, "open %s failed: %s", full_distfcode, strerror (errno));
 fstat (fd, & s);
 ctx_obj_ct = mmap(0, s.st_size , PROT_READ, MAP_PRIVATE, fd, 0);
 check ( ctx_obj_ct == MAP_FAILED, "mmap %s failed: %s", full_distfcode, strerror (errno));
 double jac_ind,contain_ind,Dm,Da,P_K_in_X_XnY, P_K_in_Y_XnY,
 j_prim, c_prim,
 sd_j_prim, sd_c_prim,
 CI95_j_prim1, CI95_j_prim2, CI95_c_prim1, CI95_c_prim2,
 CI95_Dm_prim1,CI95_Dm_prim2,CI95_Da_prim1,CI95_Da_prim2;
 int Min_XY_size, X_size, Y_size, XnY_size, XuY_size, X_XnY_size, Y_XnY_size ;
 for(llong i = 0;i < s.st_size/sizeof(ctx_obj_ct_t); i++) {
  X_size = ref_ctx_ct_list[ref_bin_code*BIN_SZ + i];
  Y_size = qry_ctx_ct_list[qry_fcode];
  Min_XY_size = X_size < Y_size ? X_size : Y_size ;
  XnY_size = ctx_obj_ct[i];
  XuY_size = X_size + Y_size - XnY_size ;
  X_XnY_size = X_size - XnY_size;
  Y_XnY_size = Y_size- XnY_size;
  jac_ind = (double)XnY_size / XuY_size;
  contain_ind = (double)XnY_size / Min_XY_size ;
  Dm = jac_ind ==1? 0: -log(2*jac_ind/(1+jac_ind)) / kmerlen ;
  Da = contain_ind==1? 0: -log(contain_ind) / kmerlen ;
  P_K_in_X_XnY = 1 - pow( (1- 1/pow(alp_size,(kmerlen - dim_reduct_len) )), X_XnY_size );
  P_K_in_Y_XnY = 1 - pow( (1- 1/pow(alp_size,(kmerlen - dim_reduct_len) )), Y_XnY_size );
  double 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);
  j_prim = ((double)XnY_size - rs) / XuY_size ;
  c_prim = ((double)XnY_size - rs) / Min_XY_size ;
  sd_j_prim = pow(j_prim*(1 - j_prim) / XuY_size, 0.5) ;
  sd_c_prim = pow(c_prim*(1 - c_prim) / Min_XY_size,0.5) ;
  CI95_j_prim1 = j_prim - 1.96*sd_j_prim;
  CI95_j_prim2 = j_prim + 1.96*sd_j_prim;
  CI95_c_prim1 = c_prim - 1.96*sd_c_prim;
  CI95_c_prim2 = c_prim + 1.96*sd_c_prim;
  CI95_Dm_prim1 = CI95_j_prim2 == 1? 0:-log(2*CI95_j_prim2/(1+CI95_j_prim2)) / kmerlen ;
  CI95_Dm_prim2 = CI95_j_prim1 == 1? 0:-log(2*CI95_j_prim1/(1+CI95_j_prim1)) / kmerlen ;
  CI95_Da_prim1 = CI95_c_prim2 == 1? 0:-log(CI95_c_prim2) / kmerlen ;
  CI95_Da_prim2 = CI95_c_prim1 == 1? 0:-log(CI95_c_prim1) / kmerlen ;
  double pv_j_prim = 0.5 * erfc( j_prim / sd_j_prim * pow(0.5,0.5) );
  double pv_c_prim = 0.5 * erfc( c_prim/sd_c_prim * pow(0.5,0.5) );
  double qv_j_prim = pv_j_prim * ref_seq_num*qry_seq_num ;
  double qv_c_prim = pv_c_prim * ref_seq_num*qry_seq_num ;
  fprintf(dout_fp,"%s\t%s\t%u-%u|%u|%u\t%lf\t%lf\t%lf\t%lf\t[%lf,%lf]\t[%lf,%lf]\t[%lf,%lf]\t[%lf,%lf]\t%E\t%E\t%E\t%E\n", qryfname[qry_fcode],refname[ref_bin_code*BIN_SZ + i],XnY_size,(unsigned int)rs,X_size,Y_size,jac_ind,Dm,
        contain_ind,Da,CI95_j_prim1,CI95_j_prim2,CI95_Dm_prim1,CI95_Dm_prim2,CI95_c_prim1,
    CI95_c_prim2,CI95_Da_prim1,CI95_Da_prim2,pv_j_prim,pv_c_prim,qv_j_prim,qv_c_prim);
 }
 close(fd);
  munmap(ctx_obj_ct, s.st_size);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %r9, %rbx
movq %r8, 0xe8(%rsp)
movq %rcx, 0x68(%rsp)
movl %esi, %r8d
movl %edi, %ecx
movq 0x238(%rsp), %rax
movq %rax, 0xe0(%rsp)
movq 0x230(%rsp), %rax
movq %rax, 0x88(%rsp)
leaq 0x54db8(%rip), %r12     # 0x5e500
leaq 0xc7a6(%rip), %rsi      # 0x15ef5
movq %r12, %rdi
movl %ecx, 0x60(%rsp)
movl %r8d, 0x58(%rsp)
xorl %eax, %eax
callq 0x3430
movq %r12, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x3380
movl %eax, %r14d
movl %eax, %r13d
shrl $0x1f, %r13d
callq 0x3060
movq %rax, %rbp
movl (%rax), %edi
callq 0x3470
leaq 0xba21(%rip), %rsi      # 0x151af
movl %r13d, %edi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xbca1
leaq 0x168(%rsp), %r13
movl %r14d, %edi
movq %r13, %rsi
callq 0x34a0
movq 0x30(%r13), %r15
xorl %edi, %edi
movq %r15, %rsi
movl $0x1, %edx
movl $0x2, %ecx
movl %r14d, 0x7c(%rsp)
movl %r14d, %r8d
xorl %r9d, %r9d
callq 0x3150
xorl %r14d, %r14d
movq %rax, 0x90(%rsp)
cmpq $-0x1, %rax
sete %r14b
movl (%rbp), %edi
callq 0x3470
leaq 0xb9cc(%rip), %rsi      # 0x151c2
movl %r14d, %edi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xbca1
movq %r15, 0x80(%rsp)
cmpq $0x4, %r15
jb 0x9e82
movq 0x80(%rsp), %rax
shrq $0x2, %rax
movq %rax, 0xd8(%rsp)
movl 0x60(%rsp), %r12d
shll $0x10, %r12d
movslq %r12d, %rax
movslq 0x58(%rsp), %rcx
movq %rcx, 0xd0(%rsp)
shlq $0x8, %rcx
addq %rcx, 0x88(%rsp)
movq 0x68(%rsp), %rcx
leaq (%rcx,%rax,4), %rcx
movq %rcx, 0xc8(%rsp)
shlq $0x8, %rax
addq %rax, %rbx
xorl %r12d, %r12d
movsd 0xbea4(%rip), %xmm2     # 0x15718
movq %rbx, 0xf8(%rsp)
movq 0xc8(%rsp), %rax
movl (%rax,%r12,4), %r15d
movq 0xe8(%rsp), %rax
movq 0xd0(%rsp), %rcx
movl (%rax,%rcx,4), %r14d
cmpl %r14d, %r15d
movl %r14d, %ebx
cmovll %r15d, %ebx
movq 0x90(%rsp), %rax
movl (%rax,%r12,4), %ebp
leal (%r14,%r15), %eax
subl %ebp, %eax
xorps %xmm3, %xmm3
cvtsi2sd %ebp, %xmm3
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movapd %xmm3, %xmm0
movsd %xmm1, 0x60(%rsp)
divsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, 0x120(%rsp)
movsd %xmm0, 0xc0(%rsp)
ucomisd %xmm2, %xmm0
xorpd %xmm0, %xmm0
movsd %xmm3, 0x68(%rsp)
jne 0x98fc
jnp 0x993f
movsd 0xc0(%rsp), %xmm1
movapd %xmm1, %xmm0
addsd %xmm1, %xmm0
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x3230
movsd 0x68(%rsp), %xmm3
movsd 0xbdf0(%rip), %xmm2     # 0x15718
xorpd 0xbe20(%rip), %xmm0     # 0x15750
xorps %xmm1, %xmm1
cvtsi2sdl 0x54bbd(%rip), %xmm1 # 0x5e4f8
divsd %xmm1, %xmm0
movapd %xmm0, 0x150(%rsp)
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
movapd %xmm3, %xmm0
movsd %xmm1, 0x70(%rsp)
divsd %xmm1, %xmm0
movsd %xmm0, 0xb8(%rsp)
ucomisd %xmm2, %xmm0
jne 0x996e
jnp 0x999c
movsd 0xb8(%rsp), %xmm0
callq 0x3230
xorpd 0xbdcc(%rip), %xmm0     # 0x15750
xorps %xmm1, %xmm1
cvtsi2sdl 0x54b69(%rip), %xmm1 # 0x5e4f8
divsd %xmm1, %xmm0
movapd %xmm0, 0x120(%rsp)
movl %r15d, %r13d
subl %ebp, %r13d
movl %r14d, %ebx
subl %ebp, %ebx
xorps %xmm0, %xmm0
cvtsi2sdl 0x12e46(%rip), %xmm0 # 0x1c7f8
movl 0x54b40(%rip), %eax     # 0x5e4f8
subl 0x54b3e(%rip), %eax     # 0x5e4fc
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
callq 0x30f0
movsd 0xbd46(%rip), %xmm2     # 0x15718
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r13d, %xmm1
callq 0x30f0
movsd 0xbd21(%rip), %xmm1     # 0x15718
subsd %xmm0, %xmm1
movsd %xmm1, 0x58(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0x12dec(%rip), %xmm0 # 0x1c7f8
movl 0x54ae6(%rip), %eax     # 0x5e4f8
subl 0x54ae4(%rip), %eax     # 0x5e4fc
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
callq 0x30f0
movsd 0xbcec(%rip), %xmm2     # 0x15718
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
callq 0x30f0
movsd 0xbcc8(%rip), %xmm3     # 0x15718
movapd %xmm3, %xmm1
subsd %xmm0, %xmm1
movsd 0x58(%rsp), %xmm4
movapd %xmm4, %xmm0
addl %r13d, %ebx
xorps %xmm2, %xmm2
cvtsi2sd %ebx, %xmm2
mulsd %xmm1, %xmm0
mulsd %xmm0, %xmm2
movapd %xmm4, %xmm0
addsd %xmm1, %xmm0
mulsd 0xbc9c(%rip), %xmm4     # 0x15720
mulsd %xmm1, %xmm4
addsd %xmm0, %xmm4
divsd %xmm4, %xmm2
movsd %xmm2, 0xf0(%rsp)
movsd 0x68(%rsp), %xmm0
subsd %xmm2, %xmm0
movapd %xmm0, %xmm2
movsd 0x60(%rsp), %xmm1
divsd %xmm1, %xmm2
movsd %xmm2, 0x58(%rsp)
divsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
movapd %xmm3, %xmm0
subsd %xmm2, %xmm0
mulsd %xmm2, %xmm0
divsd %xmm1, %xmm0
movsd 0xbc4d(%rip), %xmm1     # 0x15728
callq 0x30f0
movsd %xmm0, 0x60(%rsp)
movsd 0xbc2a(%rip), %xmm0     # 0x15718
movsd 0x68(%rsp), %xmm1
subsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
divsd 0x70(%rsp), %xmm0
movsd 0xbc1e(%rip), %xmm1     # 0x15728
callq 0x30f0
movsd 0x60(%rsp), %xmm4
movsd 0x58(%rsp), %xmm3
movapd %xmm0, %xmm5
movapd %xmm4, %xmm0
mulsd 0xbc0d(%rip), %xmm0     # 0x15738
addsd %xmm3, %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, 0x110(%rsp)
movsd %xmm0, 0xb0(%rsp)
movsd 0xbbcb(%rip), %xmm2     # 0x15718
ucomisd %xmm2, %xmm0
xorpd %xmm0, %xmm0
movsd %xmm5, 0x70(%rsp)
jne 0x9b5f
jnp 0x9bae
movsd 0xb0(%rsp), %xmm1
movapd %xmm1, %xmm0
addsd %xmm1, %xmm0
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x3230
movsd 0x70(%rsp), %xmm5
movsd 0x60(%rsp), %xmm4
movsd 0x58(%rsp), %xmm3
movsd 0xbb81(%rip), %xmm2     # 0x15718
xorpd 0xbbb1(%rip), %xmm0     # 0x15750
xorps %xmm1, %xmm1
cvtsi2sdl 0x5494e(%rip), %xmm1 # 0x5e4f8
divsd %xmm1, %xmm0
movapd %xmm0, 0x140(%rsp)
movapd %xmm4, %xmm0
mulsd 0xbb6d(%rip), %xmm0     # 0x15730
addsd %xmm3, %xmm0
movsd %xmm0, 0xa8(%rsp)
ucomisd %xmm2, %xmm0
movq 0xf8(%rsp), %rbx
jne 0x9be0
jnp 0x9c38
movsd 0xa8(%rsp), %xmm1
movapd %xmm1, %xmm0
addsd %xmm1, %xmm0
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x3230
movsd 0x70(%rsp), %xmm5
movsd 0x60(%rsp), %xmm4
movsd 0x58(%rsp), %xmm3
movsd 0xbb00(%rip), %xmm2     # 0x15718
xorpd 0xbb30(%rip), %xmm0     # 0x15750
xorps %xmm1, %xmm1
cvtsi2sdl 0x548cd(%rip), %xmm1 # 0x5e4f8
divsd %xmm1, %xmm0
movapd %xmm0, 0x110(%rsp)
movapd %xmm5, %xmm0
mulsd 0xbaf4(%rip), %xmm0     # 0x15738
movsd 0x68(%rsp), %xmm1
addsd %xmm1, %xmm0
xorpd %xmm6, %xmm6
movapd %xmm6, 0x100(%rsp)
movsd %xmm0, 0xa0(%rsp)
ucomisd %xmm2, %xmm0
xorpd %xmm0, %xmm0
jne 0x9c70
jnp 0x9cb5
movsd 0xa0(%rsp), %xmm0
callq 0x3230
movsd 0x70(%rsp), %xmm5
movsd 0x60(%rsp), %xmm4
movsd 0x58(%rsp), %xmm3
movsd 0x68(%rsp), %xmm1
movsd 0xba7a(%rip), %xmm2     # 0x15718
xorpd 0xbaaa(%rip), %xmm0     # 0x15750
xorps %xmm6, %xmm6
cvtsi2sdl 0x54847(%rip), %xmm6 # 0x5e4f8
divsd %xmm6, %xmm0
movapd %xmm0, 0x130(%rsp)
mulsd 0xba6a(%rip), %xmm5     # 0x15730
addsd %xmm1, %xmm5
movsd %xmm5, 0x98(%rsp)
ucomisd %xmm2, %xmm5
jne 0x9cdb
jnp 0x9d15
movsd 0x98(%rsp), %xmm0
callq 0x3230
movsd 0x60(%rsp), %xmm4
movsd 0x58(%rsp), %xmm3
xorpd 0xba53(%rip), %xmm0     # 0x15750
xorps %xmm1, %xmm1
cvtsi2sdl 0x547f0(%rip), %xmm1 # 0x5e4f8
divsd %xmm1, %xmm0
movapd %xmm0, 0x100(%rsp)
divsd %xmm4, %xmm3
movsd 0xba1f(%rip), %xmm0     # 0x15740
mulsd %xmm0, %xmm3
movapd %xmm3, %xmm0
callq 0x3030
movapd %xmm0, %xmm1
movsd 0xb9ee(%rip), %xmm0     # 0x15728
mulsd %xmm0, %xmm1
movsd %xmm1, 0x58(%rsp)
movsd 0x68(%rsp), %xmm0
divsd 0x70(%rsp), %xmm0
mulsd 0xb9e8(%rip), %xmm0     # 0x15740
callq 0x3030
mulsd 0xb9c3(%rip), %xmm0     # 0x15728
xorps %xmm1, %xmm1
cvtsi2sdl 0x54780(%rip), %xmm1 # 0x5e4f0
movsd 0x58(%rsp), %xmm4
movapd %xmm4, %xmm2
mulsd %xmm1, %xmm2
xorps %xmm3, %xmm3
cvtsi2sdl 0x5476b(%rip), %xmm3 # 0x5e4f4
mulsd %xmm3, %xmm2
mulsd %xmm0, %xmm1
mulsd %xmm3, %xmm1
cvttsd2si 0xf0(%rsp), %r9
movsd %xmm1, 0x48(%rsp)
movsd %xmm2, 0x40(%rsp)
movsd %xmm0, 0x38(%rsp)
movsd %xmm4, 0x30(%rsp)
movaps 0x100(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movaps 0x130(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0xa0(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x98(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movl %r14d, 0x8(%rsp)
movl %r15d, (%rsp)
movq 0xe0(%rsp), %rdi
leaq 0xc47b(%rip), %rsi      # 0x16284
movq 0x88(%rsp), %rdx
movq %rbx, %rcx
movl %ebp, %r8d
movsd 0xc0(%rsp), %xmm0
movaps 0x150(%rsp), %xmm1
movsd 0xb8(%rsp), %xmm2
movaps 0x120(%rsp), %xmm3
movsd 0xa8(%rsp), %xmm4
movsd 0xb0(%rsp), %xmm5
movaps 0x140(%rsp), %xmm6
movaps 0x110(%rsp), %xmm7
movb $0x8, %al
callq 0x32c0
incq %r12
addq $0x100, %rbx            # imm = 0x100
cmpq %r12, 0xd8(%rsp)
movsd 0xb89c(%rip), %xmm2     # 0x15718
jne 0x9874
movl 0x7c(%rsp), %edi
callq 0x3220
movq 0x90(%rsp), %rdi
movq 0x80(%rsp), %rsi
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3360