// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Overlaps.cpp
// Function: build_string_graph_without_clean(int, ma_hit_t_alloc*, ma_hit_t_alloc*, unsigned long, unsigned long*, long long, long long, long long, long long, float, float, char*, long long, int, int)
void build_string_graph_without_clean(
int min_dp, ma_hit_t_alloc* sources, ma_hit_t_alloc* reverse_sources, 
uint64_t n_read, uint64_t* readLen, long long mini_overlap_length, 
long long max_hang_length, long long clean_round, long long gap_fuzz,
float min_ovlp_drop_ratio, float max_ovlp_drop_ratio, char* output_file_name, 
long long bubble_dist, int read_graph, int write)
{
    R_to_U ruIndex;
    init_R_to_U(&ruIndex, n_read);
    asg_t *sg = NULL; uint8_t *cmk = NULL;
    ma_sub_t* coverage_cut = NULL;
    init_aux_table();
    ///actually min_thres = asm_opt.max_short_tip + 1 there are asm_opt.max_short_tip reads
    min_thres = asm_opt.max_short_tip + 1;
    if (asm_opt.flag & HA_F_VERBOSE_GFA)
    {
        if(load_debug_graph(/**NULL**/&sg, &sources, /**NULL**/&coverage_cut, output_file_name, &reverse_sources, &ruIndex, &UL_INF))
        {
            fprintf(stderr, "debug gfa has been loaded\n");
            
            clean_graph(min_dp, sources, reverse_sources, n_read, readLen, mini_overlap_length, 
            max_hang_length, clean_round, gap_fuzz, min_ovlp_drop_ratio, max_ovlp_drop_ratio, 
            output_file_name, bubble_dist, read_graph, &ruIndex, &sg, &coverage_cut, cmk, 1);
            asg_destroy(sg);
            free(coverage_cut);
            destory_R_to_U(&ruIndex);
            return;
        }
    }
    if (asm_opt.write_index_to_disk && write)
    {
        write_all_data_to_disk(sources, reverse_sources, 
        &R_INF, output_file_name);
    }
    ///debug_info_of_specfic_read("m64011_190830_220126/31720629/ccs", sources, reverse_sources, -1, "beg");

    if (!(asm_opt.flag & HA_F_BAN_ASSEMBLY))
    {
        // if(asm_opt.is_ont) handle_chemical_r(asm_opt.thread_num, R_INF.total_reads);
        if(asm_opt.is_ont) {
            uint64_t i = 0, j = 0;
            memset(ruIndex.index, -1, sizeof(uint32_t)*(ruIndex.len));
            for (i = 0; i < n_read; i++) {
                for (j = 0; j < sources[i].length; j++) sources[i].buffer[j].del = 0;
                for (j = 0; j < reverse_sources[i].length; j++) reverse_sources[i].buffer[j].del = 0;
            }
            if(asm_opt.is_ont) cmk = gen_chemical_arc_rf(asm_opt.thread_num, R_INF.total_reads);
        }
        try_rescue_overlaps(sources, reverse_sources, n_read, 4, asm_opt.is_ont); 
        
        clean_graph(min_dp, sources, reverse_sources, n_read, readLen, mini_overlap_length, 
        max_hang_length, clean_round, gap_fuzz, min_ovlp_drop_ratio, max_ovlp_drop_ratio, 
        output_file_name, bubble_dist, read_graph, &ruIndex, &sg, &coverage_cut, cmk, 0);
        
        asg_destroy(sg);
        free(coverage_cut);
    }

    destory_R_to_U(&ruIndex); free(cmk);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movss %xmm1, 0x7c(%rsp)
movss %xmm0, 0x78(%rsp)
movq %r9, 0x98(%rsp)
movq %r8, 0x90(%rsp)
movq %rcx, %r15
movl %edi, 0x74(%rsp)
movq 0x108(%rsp), %r12
movq %rsi, 0x68(%rsp)
movq %rdx, 0x60(%rsp)
movq %rcx, 0xa0(%rsp)
movl $0x4, %esi
movq %rcx, %rdi
callq 0x2120
movq %rax, 0xa8(%rsp)
xorl %eax, %eax
movq %rax, 0xb0(%rsp)
movq %rax, 0x88(%rsp)
movq %rax, 0x80(%rsp)
callq 0x3366f
leaq 0x189b78(%rip), %r14    # 0x28a758
movslq 0x11c(%r14), %rax
incq %rax
movq %rax, 0x18a82f(%rip)    # 0x28b420
testb $0x4, (%r14)
je 0x100c3d
leaq 0x18a71a(%rip), %rax    # 0x28b318
movq %rax, (%rsp)
leaq 0x88(%rsp), %r13
leaq 0x68(%rsp), %rsi
leaq 0x80(%rsp), %rbp
leaq 0x60(%rsp), %r8
leaq 0xa0(%rsp), %rbx
movq %r13, %rdi
movq %rbp, %rdx
movq %r12, %rcx
movq %rbx, %r9
callq 0xe032a
testl %eax, %eax
jne 0x100d70
cmpl $0x0, 0x120(%rsp)
je 0x100c51
cmpl $0x0, 0xf4(%r14)
jne 0x100c82
testb $0x2, 0x1(%r14)
je 0x100c9d
xorl %r13d, %r13d
movq 0xa8(%rsp), %rdi
callq 0x2220
movq %r13, %rdi
callq 0x2220
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x68(%rsp), %rdi
movq 0x60(%rsp), %rsi
leaq 0x18a59d(%rip), %rdx    # 0x28b230
movq %r12, %rcx
callq 0xc2cd
jmp 0x100c51
cmpq $0x0, 0x2a8(%r14)
je 0x100d68
movq 0xa0(%rsp), %rdx
movq 0xa8(%rsp), %rdi
shlq $0x2, %rdx
movl $0xff, %esi
callq 0x20e0
testq %r15, %r15
je 0x100d5a
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
xorl %ecx, %ecx
movq 0x68(%rsp), %rsi
leaq (%rcx,%rcx,2), %rdx
cmpl $0x0, 0xc(%rsi,%rdx,8)
je 0x100d1a
leaq (%rsi,%rdx,8), %rdi
movl $0x18, %esi
xorl %r8d, %r8d
movq (%rdi), %rdi
andq %rax, (%rdi,%rsi)
incq %r8
movq 0x68(%rsp), %rdi
leaq (%rdi,%rdx,8), %rdi
movl 0xc(%rdi), %r9d
addq $0x28, %rsi
cmpq %r9, %r8
jb 0x100cfa
movq 0x60(%rsp), %rsi
cmpl $0x0, 0xc(%rsi,%rdx,8)
je 0x100d52
leaq (%rsi,%rdx,8), %rdi
movl $0x18, %esi
xorl %r8d, %r8d
movq (%rdi), %rdi
andq %rax, (%rdi,%rsi)
incq %r8
movq 0x60(%rsp), %rdi
leaq (%rdi,%rdx,8), %rdi
movl 0xc(%rdi), %r9d
addq $0x28, %rsi
cmpq %r9, %r8
jb 0x100d32
incq %rcx
cmpq %r15, %rcx
jne 0x100cde
cmpq $0x0, 0x2a8(%r14)
jne 0x100e34
xorl %r13d, %r13d
jmp 0x100e4b
movq 0x189269(%rip), %rax    # 0x289fe0
movq (%rax), %rcx
leaq 0x12c152(%rip), %rdi    # 0x22ced3
movl $0x1a, %esi
movl $0x1, %edx
callq 0x2410
movq 0x68(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq %rbp, 0x40(%rsp)
movq %r13, 0x38(%rsp)
movq %rbx, 0x30(%rsp)
movq %r12, 0x18(%rsp)
movq 0x100(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0xf8(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, (%rsp)
movl $0x1, 0x50(%rsp)
movq $0x0, 0x48(%rsp)
movl 0x74(%rsp), %edi
movq %r15, %rcx
movq 0x90(%rsp), %r8
movq 0x98(%rsp), %r9
movss 0x78(%rsp), %xmm0
movss 0x7c(%rsp), %xmm1
callq 0xf0d4
movq 0x88(%rsp), %rdi
callq 0x9fcdb
movq 0x80(%rsp), %rdi
callq 0x2220
movq 0xa8(%rsp), %r13
jmp 0x100c68
movslq 0x7c(%r14), %rdi
leaq 0x18a3f1(%rip), %rax    # 0x28b230
movq 0x50(%rax), %rsi
callq 0x2330b
movq %rax, %r13
movq 0x68(%rsp), %rdi
movq 0x60(%rsp), %rsi
movl 0x2a8(%r14), %r8d
movl $0x4, %ecx
movq %r15, %rdx
callq 0xf1681
movq 0x68(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq %r13, 0x48(%rsp)
leaq 0x80(%rsp), %rbx
movq %rbx, 0x40(%rsp)
leaq 0x88(%rsp), %r14
movq %r14, 0x38(%rsp)
leaq 0xa0(%rsp), %rax
movq %rax, 0x30(%rsp)
movq %r12, 0x18(%rsp)
movq 0x100(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0xf8(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0xf0(%rsp), %rax
movq %rax, (%rsp)
movl $0x0, 0x50(%rsp)
movl 0x74(%rsp), %edi
movq %r15, %rcx
movq 0x90(%rsp), %r8
movq 0x98(%rsp), %r9
movss 0x78(%rsp), %xmm0
movss 0x7c(%rsp), %xmm1
callq 0xf0d4
movq (%r14), %rdi
callq 0x9fcdb
movq (%rbx), %rdi
callq 0x2220
jmp 0x100c5b