// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Assembly.cpp
// Function: Output_PAF0(ma_hit_t_alloc*, char const*)
void Output_PAF0(ma_hit_t_alloc* sources, const char *prefix)
{
    fprintf(stderr, "Writing PAF to disk ...... \n");
    char* paf_name = (char*)malloc(strlen(asm_opt.output_file_name)+strlen(prefix)+50);
    sprintf(paf_name, "%s.%s.ovlp.paf", asm_opt.output_file_name, prefix);
    FILE* output_file = fopen(paf_name, "w");
    uint64_t i, j;

    for (i = 0; i < R_INF.total_reads; i++)
    {
        for (j = 0; j < sources[i].length; j++)
        {
            fwrite(Get_NAME(R_INF, Get_qn(sources[i].buffer[j])), 1, 
            Get_NAME_LENGTH(R_INF, Get_qn(sources[i].buffer[j])), output_file);
            fwrite("\t", 1, 1, output_file);
            fprintf(output_file, "%lu\t", (unsigned long)Get_READ_LENGTH(R_INF, Get_qn(sources[i].buffer[j])));
            fprintf(output_file, "%d\t", Get_qs(sources[i].buffer[j]));
            fprintf(output_file, "%d\t", Get_qe(sources[i].buffer[j]));
            if(sources[i].buffer[j].rev)
            {
                fprintf(output_file, "-\t");
            }
            else
            {
                fprintf(output_file, "+\t");
            }
            fwrite(Get_NAME(R_INF, Get_tn(sources[i].buffer[j])), 1, 
            Get_NAME_LENGTH(R_INF, Get_tn(sources[i].buffer[j])), output_file);
            fwrite("\t", 1, 1, output_file);
            fprintf(output_file, "%lu\t", (unsigned long)Get_READ_LENGTH(R_INF, Get_tn(sources[i].buffer[j])));
            fprintf(output_file, "%d\t", Get_ts(sources[i].buffer[j]));
            fprintf(output_file, "%d\t", Get_te(sources[i].buffer[j]));
            fprintf(output_file, "%d\t", sources[i].buffer[j].ml);
            fprintf(output_file, "%d\t", sources[i].buffer[j].bl);
            fprintf(output_file, "255\n");

        }
    }

    free(paf_name);
    fclose(output_file);

    fprintf(stderr, "PAF has been written.\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
movq 0x2860ad(%rip), %rax    # 0x289fe0
movq (%rax), %rcx
leaq 0x220ec5(%rip), %rdi    # 0x224e02
pushq $0x1c
popq %rsi
pushq $0x1
popq %rdx
callq 0x2410
leaq 0x286809(%rip), %rax    # 0x28a758
movq 0x10(%rax), %r14
movq %r14, %rdi
callq 0x2090
movq %rax, %r15
movq %rbx, %rdi
callq 0x2090
leaq (%r15,%rax), %rdi
addq $0x32, %rdi
callq 0x2280
movq %rax, %r15
leaq 0x220ec3(%rip), %rsi    # 0x224e40
movq %rax, %rdi
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2050
leaq 0x23846a(%rip), %rsi    # 0x23c3fe
movq %r15, 0x10(%rsp)
movq %r15, %rdi
callq 0x2210
movq %rax, %r15
cmpq $0x0, 0x2872d4(%rip)    # 0x28b280
je 0x41ac
pushq $0x1
popq %r12
leaq 0x220e62(%rip), %r14    # 0x224e1f
xorl %eax, %eax
movq %rax, 0x18(%rsp)
imulq $0x18, %rax, %rbx
movq 0x8(%rsp), %rax
cmpl $0x0, 0xc(%rax,%rbx)
je 0x4197
addq 0x8(%rsp), %rbx
xorl %ebp, %ebp
xorl %ecx, %ecx
movq %rcx, 0x20(%rsp)
movq 0x287283(%rip), %rax    # 0x28b270
movq (%rbx), %rcx
movq (%rcx,%rbp), %rcx
shrq $0x20, %rcx
movq (%rax,%rcx,8), %rsi
movq 0x287235(%rip), %rdi    # 0x28b238
addq %rsi, %rdi
incl %ecx
movq (%rax,%rcx,8), %rdx
subq %rsi, %rdx
movq %r12, %rsi
movq %r15, %rcx
callq 0x2410
movq %r14, %r13
movq %r12, %r14
pushq $0x9
popq %r12
movl %r12d, %edi
movq %r15, %rsi
callq 0x2270
movq 0x287212(%rip), %rax    # 0x28b248
movq (%rbx), %rcx
movl 0x4(%rcx,%rbp), %ecx
movq (%rax,%rcx,8), %rdx
movq %r15, %rdi
leaq 0x22f510(%rip), %rsi    # 0x23355b
xorl %eax, %eax
callq 0x22b0
movq (%rbx), %rax
movl (%rax,%rbp), %edx
movq %r15, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x22b0
movq (%rbx), %rax
movl 0x8(%rax,%rbp), %edx
movq %r15, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x22b0
movq (%rbx), %rax
cmpl $0x0, 0x18(%rax,%rbp)
leaq 0x220d9b(%rip), %rdi    # 0x224e23
leaq 0x220d97(%rip), %rax    # 0x224e26
cmovnsq %rax, %rdi
pushq $0x2
popq %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x2410
movq 0x2871c8(%rip), %rax    # 0x28b270
movq (%rbx), %rcx
movl 0xc(%rcx,%rbp), %ecx
movq (%rax,%rcx,8), %rsi
movq 0x28717e(%rip), %rdi    # 0x28b238
addq %rsi, %rdi
incl %ecx
movq (%rax,%rcx,8), %rdx
subq %rsi, %rdx
movq %r14, %rsi
movq %r15, %rcx
callq 0x2410
movl %r12d, %edi
movq %r14, %r12
movq %r13, %r14
leaq 0x22f47a(%rip), %r13    # 0x23355b
movq %r15, %rsi
callq 0x2270
movq 0x287158(%rip), %rax    # 0x28b248
movq (%rbx), %rcx
movl 0xc(%rcx,%rbp), %ecx
movq (%rax,%rcx,8), %rdx
movq %r15, %rdi
movq %r13, %rsi
movl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %eax, %eax
callq 0x22b0
movq (%rbx), %rax
movl 0x10(%rax,%rbp), %edx
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x22b0
movq (%rbx), %rax
movl 0x14(%rax,%rbp), %edx
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x22b0
movq (%rbx), %rax
movl 0x18(%rax,%rbp), %edx
shrl $0x1e, %edx
andl $0x1, %edx
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x22b0
movq (%rbx), %rax
movl 0x1c(%rax,%rbp), %edx
andl %r13d, %edx
leaq 0x228d24(%rip), %r13    # 0x22ce85
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x22b0
movq %r13, %rdi
pushq $0x4
popq %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x2410
movq 0x20(%rsp), %rcx
incq %rcx
movl 0xc(%rbx), %eax
addq $0x28, %rbp
cmpq %rax, %rcx
jb 0x3fe1
movq 0x18(%rsp), %rax
incq %rax
cmpq 0x2870da(%rip), %rax    # 0x28b280
jb 0x3fbf
movq 0x10(%rsp), %rdi
callq 0x2220
movq %r15, %rdi
callq 0x2190
movq 0x285e1b(%rip), %rax    # 0x289fe0
movq (%rax), %rcx
leaq 0x220c5a(%rip), %rdi    # 0x224e29
pushq $0x16
popq %rsi
pushq $0x1
popq %rdx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2410