// File: /workspace/github_c_makefile_star2_O3/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, 0xe0(%rsp)
movq %rcx, 0x68(%rsp)
movl %esi, %r8d
movl %edi, %ecx
movq 0x238(%rsp), %rax
movq %rax, 0xd8(%rsp)
movq 0x230(%rsp), %rax
movq %rax, 0x88(%rsp)
leaq 0x54b45(%rip), %r12     # 0x5e500
leaq 0xc583(%rip), %rsi      # 0x15f45
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 0xb7ae(%rip), %rsi      # 0x151af
movl %r13d, %edi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xbf3d
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 0xb759(%rip), %rsi      # 0x151c2
movl %r14d, %edi
movq %r12, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xbf3d
movq %r15, 0x80(%rsp)
cmpq $0x4, %r15
jb 0xa0f0
movq 0x80(%rsp), %rax
shrq $0x2, %rax
movq %rax, 0xd0(%rsp)
movl 0x60(%rsp), %r12d
shll $0x10, %r12d
movslq %r12d, %rax
movslq 0x58(%rsp), %rcx
movq %rcx, 0xc8(%rsp)
shlq $0x8, %rcx
addq %rcx, 0x88(%rsp)
movq 0x68(%rsp), %rcx
leaq (%rcx,%rax,4), %rcx
movq %rcx, 0xc0(%rsp)
shlq $0x8, %rax
addq %rax, %rbx
xorl %r12d, %r12d
movsd 0xbc81(%rip), %xmm2     # 0x15768
movq %rbx, 0xf8(%rsp)
movq 0xc0(%rsp), %rax
movl (%rax,%r12,4), %r15d
movq 0xe0(%rsp), %rax
movq 0xc8(%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
xorps %xmm3, %xmm3
cvtsi2sd %ebp, %xmm3
subl %ebp, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movapd %xmm3, %xmm1
movsd %xmm0, 0x60(%rsp)
divsd %xmm0, %xmm1
xorpd %xmm0, %xmm0
movsd %xmm1, 0xb8(%rsp)
ucomisd %xmm2, %xmm1
movsd %xmm3, 0x68(%rsp)
jne 0x9b62
jnp 0x9ba5
movsd 0xb8(%rsp), %xmm1
movapd %xmm1, %xmm0
addsd %xmm1, %xmm0
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
callq 0x3230
movsd 0x68(%rsp), %xmm3
movsd 0xbbda(%rip), %xmm2     # 0x15768
xorpd 0xbc0a(%rip), %xmm0     # 0x157a0
xorps %xmm1, %xmm1
cvtsi2sdl 0x54957(%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
ucomisd %xmm2, %xmm0
movsd %xmm0, 0xf0(%rsp)
jne 0x9be9
jp 0x9be9
xorpd %xmm0, %xmm0
movapd %xmm0, 0x100(%rsp)
movl 0x54911(%rip), %eax     # 0x5e4f8
jmp 0x9c10
callq 0x3230
xorpd 0xbbaa(%rip), %xmm0     # 0x157a0
movl 0x548fc(%rip), %eax     # 0x5e4f8
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movapd %xmm0, 0x100(%rsp)
movl %r15d, %r13d
subl %ebp, %r13d
movl %r14d, %ebx
subl %ebp, %ebx
xorps %xmm0, %xmm0
cvtsi2sdl 0x12bd2(%rip), %xmm0 # 0x1c7f8
subl 0x548d0(%rip), %eax     # 0x5e4fc
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
callq 0x30f0
movsd 0xbb28(%rip), %xmm2     # 0x15768
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r13d, %xmm1
callq 0x30f0
movsd 0xbb03(%rip), %xmm1     # 0x15768
subsd %xmm0, %xmm1
movsd %xmm1, 0x58(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0x12b7e(%rip), %xmm0 # 0x1c7f8
movl 0x54878(%rip), %eax     # 0x5e4f8
subl 0x54876(%rip), %eax     # 0x5e4fc
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
callq 0x30f0
movsd 0xbace(%rip), %xmm2     # 0x15768
movapd %xmm2, %xmm1
divsd %xmm0, %xmm1
movapd %xmm2, %xmm0
subsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %ebx, %xmm1
callq 0x30f0
movsd 0xbaaa(%rip), %xmm3     # 0x15768
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 0xba7e(%rip), %xmm4     # 0x15770
mulsd %xmm1, %xmm4
addsd %xmm0, %xmm4
divsd %xmm4, %xmm2
movsd 0x68(%rsp), %xmm0
movsd %xmm2, 0xe8(%rsp)
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 0xba2f(%rip), %xmm1     # 0x15778
callq 0x30f0
movsd %xmm0, 0x60(%rsp)
movsd 0xba0c(%rip), %xmm0     # 0x15768
movsd 0x68(%rsp), %xmm1
subsd %xmm1, %xmm0
mulsd %xmm1, %xmm0
divsd 0x70(%rsp), %xmm0
movsd 0xba00(%rip), %xmm1     # 0x15778
callq 0x30f0
movsd 0x60(%rsp), %xmm4
movsd 0x58(%rsp), %xmm3
movsd 0xb9d7(%rip), %xmm2     # 0x15768
movapd %xmm0, %xmm5
movapd %xmm4, %xmm0
mulsd 0xb9e7(%rip), %xmm0     # 0x15788
addsd %xmm3, %xmm0
xorpd %xmm1, %xmm1
movapd %xmm1, 0x120(%rsp)
movsd %xmm0, 0xb0(%rsp)
ucomisd %xmm2, %xmm0
xorpd %xmm0, %xmm0
movsd %xmm5, 0x70(%rsp)
jne 0x9dcd
jnp 0x9e1c
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 0xb963(%rip), %xmm2     # 0x15768
xorpd 0xb993(%rip), %xmm0     # 0x157a0
xorps %xmm1, %xmm1
cvtsi2sdl 0x546e0(%rip), %xmm1 # 0x5e4f8
divsd %xmm1, %xmm0
movapd %xmm0, 0x140(%rsp)
movapd %xmm4, %xmm0
mulsd 0xb94f(%rip), %xmm0     # 0x15780
addsd %xmm3, %xmm0
movsd %xmm0, 0xa8(%rsp)
ucomisd %xmm2, %xmm0
movq 0xf8(%rsp), %rbx
jne 0x9e4e
jnp 0x9ea6
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 0xb8e2(%rip), %xmm2     # 0x15768
xorpd 0xb912(%rip), %xmm0     # 0x157a0
xorps %xmm1, %xmm1
cvtsi2sdl 0x5465f(%rip), %xmm1 # 0x5e4f8
divsd %xmm1, %xmm0
movapd %xmm0, 0x120(%rsp)
movapd %xmm5, %xmm0
mulsd 0xb8d6(%rip), %xmm0     # 0x15788
movsd 0x68(%rsp), %xmm1
addsd %xmm1, %xmm0
xorpd %xmm6, %xmm6
movapd %xmm6, 0x110(%rsp)
movsd %xmm0, 0xa0(%rsp)
ucomisd %xmm2, %xmm0
xorpd %xmm0, %xmm0
jne 0x9ede
jnp 0x9f23
movsd 0xa0(%rsp), %xmm0
callq 0x3230
movsd 0x70(%rsp), %xmm5
movsd 0x60(%rsp), %xmm4
movsd 0x58(%rsp), %xmm3
movsd 0x68(%rsp), %xmm1
movsd 0xb85c(%rip), %xmm2     # 0x15768
xorpd 0xb88c(%rip), %xmm0     # 0x157a0
xorps %xmm6, %xmm6
cvtsi2sdl 0x545d9(%rip), %xmm6 # 0x5e4f8
divsd %xmm6, %xmm0
movapd %xmm0, 0x130(%rsp)
mulsd 0xb84c(%rip), %xmm5     # 0x15780
addsd %xmm1, %xmm5
movsd %xmm5, 0x98(%rsp)
ucomisd %xmm2, %xmm5
jne 0x9f49
jnp 0x9f83
movsd 0x98(%rsp), %xmm0
callq 0x3230
movsd 0x60(%rsp), %xmm4
movsd 0x58(%rsp), %xmm3
xorpd 0xb835(%rip), %xmm0     # 0x157a0
xorps %xmm1, %xmm1
cvtsi2sdl 0x54582(%rip), %xmm1 # 0x5e4f8
divsd %xmm1, %xmm0
movapd %xmm0, 0x110(%rsp)
divsd %xmm4, %xmm3
movsd 0xb801(%rip), %xmm0     # 0x15790
mulsd %xmm0, %xmm3
movapd %xmm3, %xmm0
callq 0x3030
movapd %xmm0, %xmm1
movsd 0xb7d0(%rip), %xmm0     # 0x15778
mulsd %xmm0, %xmm1
movsd %xmm1, 0x58(%rsp)
movsd 0x68(%rsp), %xmm0
divsd 0x70(%rsp), %xmm0
mulsd 0xb7ca(%rip), %xmm0     # 0x15790
callq 0x3030
mulsd 0xb7a5(%rip), %xmm0     # 0x15778
xorps %xmm1, %xmm1
cvtsi2sdl 0x54512(%rip), %xmm1 # 0x5e4f0
movsd 0x58(%rsp), %xmm4
movapd %xmm4, %xmm2
mulsd %xmm1, %xmm2
xorps %xmm3, %xmm3
cvtsi2sdl 0x544fd(%rip), %xmm3 # 0x5e4f4
mulsd %xmm3, %xmm2
mulsd %xmm0, %xmm1
mulsd %xmm3, %xmm1
cvttsd2si 0xe8(%rsp), %r9
movsd %xmm1, 0x48(%rsp)
movsd %xmm2, 0x40(%rsp)
movsd %xmm0, 0x38(%rsp)
movsd %xmm4, 0x30(%rsp)
movaps 0x110(%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 0xd8(%rsp), %rdi
leaq 0xc25d(%rip), %rsi      # 0x162d4
movq 0x88(%rsp), %rdx
movq %rbx, %rcx
movl %ebp, %r8d
movsd 0xb8(%rsp), %xmm0
movaps 0x150(%rsp), %xmm1
movsd 0xf0(%rsp), %xmm2
movaps 0x100(%rsp), %xmm3
movsd 0xa8(%rsp), %xmm4
movsd 0xb0(%rsp), %xmm5
movaps 0x140(%rsp), %xmm6
movaps 0x120(%rsp), %xmm7
movb $0x8, %al
callq 0x32c0
incq %r12
addq $0x100, %rbx            # imm = 0x100
cmpq %r12, 0xd0(%rsp)
movsd 0xb67e(%rip), %xmm2     # 0x15768
jne 0x9ae7
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