// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Overlaps.cpp
// Function: write_yak_binning(char*, char*, char*)
void write_yak_binning(char *ou, char *fn_bin_yak1, char *fn_bin_yak2)
{
    fprintf(stderr, "Writing binning to disk ...... \n");
    char* paf_name = (char*)malloc(strlen(ou)+50);
    sprintf(paf_name, "%s.hap1.phase.bin", ou);
    FILE* oh1 = fopen(paf_name, "w");
    sprintf(paf_name, "%s.hap2.phase.bin", ou);
    FILE* oh2 = fopen(paf_name, "w");
    uint64_t i, s1, s2;

    for (i = s1 = s2 = 0; i < R_INF.total_reads; i++) {
        if(R_INF.trio_flag[i]==FATHER) {
            if(s1) {
                fprintf(oh1, "%.*s\n", (int)Get_NAME_LENGTH(R_INF, i), Get_NAME(R_INF, i));
            } else {
                fprintf(oh1, "%.*s\t%s\n", (int)Get_NAME_LENGTH(R_INF, i), Get_NAME(R_INF, i), fn_bin_yak1);
            }
            s1 = 1;
        }
        if(R_INF.trio_flag[i]==MOTHER) {
            if(s2) {
                fprintf(oh2, "%.*s\n", (int)Get_NAME_LENGTH(R_INF, i), Get_NAME(R_INF, i));
            } else {
                fprintf(oh2, "%.*s\t%s\n", (int)Get_NAME_LENGTH(R_INF, i), Get_NAME(R_INF, i), fn_bin_yak2);
            }
            s2 = 1;
        }
    }
    free(paf_name);
    fclose(oh1); fclose(oh2);
    fprintf(stderr, "Binning has been written.\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, %r14
movq 0x27de8e(%rip), %rax    # 0x289fe0
movq (%rax), %rcx
leaq 0x21fa74(%rip), %rdi    # 0x22bbd0
pushq $0x20
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
movq %r14, %rdi
callq 0x2090
leaq 0x32(%rax), %rdi
callq 0x2280
movq %rax, %rbx
leaq 0x21fa6f(%rip), %rsi    # 0x22bbf1
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x230268(%rip), %r12    # 0x23c3fe
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2210
movq %rax, %r13
leaq 0x21fa58(%rip), %rsi    # 0x22bc03
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
movq %rbx, (%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2210
movq %rax, %rbp
leaq 0x27f05f(%rip), %r14    # 0x28b230
cmpq $0x0, 0x50(%r14)
je 0xc28a
xorl %r15d, %r15d
xorl %ebx, %ebx
xorl %r12d, %r12d
movq 0x28(%r14), %rax
cmpb $0x1, (%rax,%r12)
jne 0xc230
movq 0x40(%r14), %rax
movl 0x8(%rax,%r12,8), %edx
movq (%rax,%r12,8), %rcx
subl %ecx, %edx
addq 0x8(%r14), %rcx
movq %r13, %rdi
testq %rbx, %rbx
je 0xc21a
leaq 0x22dca5(%rip), %rsi    # 0x239eb6
xorl %eax, %eax
callq 0x22b0
jmp 0xc22d
leaq 0x21f9f4(%rip), %rsi    # 0x22bc15
movq 0x8(%rsp), %r8
xorl %eax, %eax
callq 0x22b0
pushq $0x1
popq %rbx
movq 0x28(%r14), %rax
cmpb $0x2, (%rax,%r12)
jne 0xc27d
movq 0x40(%r14), %rax
movl 0x8(%rax,%r12,8), %edx
movq (%rax,%r12,8), %rcx
subl %ecx, %edx
addq 0x8(%r14), %rcx
movq %rbp, %rdi
testq %r15, %r15
je 0xc266
leaq 0x22dc59(%rip), %rsi    # 0x239eb6
xorl %eax, %eax
callq 0x22b0
jmp 0xc279
leaq 0x21f9a8(%rip), %rsi    # 0x22bc15
movq 0x10(%rsp), %r8
xorl %eax, %eax
callq 0x22b0
pushq $0x1
popq %r15
incq %r12
cmpq 0x50(%r14), %r12
jb 0xc1e4
movq (%rsp), %rdi
callq 0x2220
movq %r13, %rdi
callq 0x2190
movq %rbp, %rdi
callq 0x2190
movq 0x27dd36(%rip), %rax    # 0x289fe0
movq (%rax), %rcx
leaq 0x21f96a(%rip), %rdi    # 0x22bc1e
pushq $0x1a
popq %rsi
pushq $0x1
popq %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2410