// File: /workspace/github_cpp_makefile_star2_O2/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)
pushq $0x4
popq %rsi
movq %rcx, %rdi
callq 0x2120
movq %rax, 0xa8(%rsp)
andq $0x0, 0xb0(%rsp)
andq $0x0, 0x88(%rsp)
andq $0x0, 0x80(%rsp)
callq 0x6b0f
leaq 0x190dd3(%rip), %r14    # 0x253758
movslq 0x11c(%r14), %rax
incq %rax
movq %rax, 0x191a8a(%rip)    # 0x254420
testb $0x4, (%r14)
je 0xc29e2
leaq 0x191975(%rip), %rax    # 0x254318
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 0xa4597
testl %eax, %eax
jne 0xc2bc6
cmpl $0x0, 0x120(%rsp)
je 0xc2a0f
cmpl $0x0, 0xf4(%r14)
je 0xc2a0f
movq 0x68(%rsp), %rdi
movq 0x60(%rsp), %rsi
leaq 0x191829(%rip), %rdx    # 0x254230
movq %r12, %rcx
callq 0xa4333
xorl %r8d, %r8d
testb $0x2, 0x1(%r14)
jne 0xc2ab4
cmpq $0x0, 0x2a8(%r14)
je 0xc2ae9
movabsq $0x7fffffffffffffff, %rbx # imm = 0x7FFFFFFFFFFFFFFF
movq 0xa0(%rsp), %rdx
movq 0xa8(%rsp), %rdi
shlq $0x2, %rdx
movl $0xff, %esi
callq 0x20e0
xorl %eax, %eax
pushq $0x18
popq %rcx
cmpq %r15, %rax
je 0xc2abc
imulq $0x18, %rax, %rdx
movq %rcx, %rsi
xorl %edi, %edi
movq 0x68(%rsp), %r8
movl 0xc(%r8,%rdx), %r9d
cmpq %r9, %rdi
jae 0xc2a88
addq %rdx, %r8
movq (%r8), %r8
andq %rbx, (%r8,%rsi)
incq %rdi
addq $0x28, %rsi
jmp 0xc2a66
movq %rcx, %rsi
xorl %edi, %edi
movq 0x60(%rsp), %r8
movl 0xc(%r8,%rdx), %r9d
cmpq %r9, %rdi
jae 0xc2aaf
addq %rdx, %r8
movq (%r8), %r8
andq %rbx, (%r8,%rsi)
incq %rdi
addq $0x28, %rsi
jmp 0xc2a8d
incq %rax
jmp 0xc2a58
xorl %r13d, %r13d
jmp 0xc2b9f
cmpq $0x0, 0x2a8(%r14)
je 0xc2ae6
movslq 0x7c(%r14), %rdi
leaq 0x19175f(%rip), %rax    # 0x254230
movq 0x50(%rax), %rsi
callq 0x14e799
movq %rax, %r13
movl 0x2a8(%r14), %r8d
jmp 0xc2aec
xorl %r8d, %r8d
xorl %r13d, %r13d
movq 0x68(%rsp), %rdi
movq 0x60(%rsp), %rsi
pushq $0x4
popq %rcx
movq %r15, %rdx
callq 0xb4807
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)
andl $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 0xc1d71
movq (%r14), %rdi
callq 0x68f68
movq (%rbx), %rdi
callq 0x2220
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 0x190413(%rip), %rax    # 0x252fe0
movq (%rax), %rcx
leaq 0x1283ec(%rip), %rdi    # 0x1eafc3
pushq $0x1a
popq %rsi
pushq $0x1
popq %rdx
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)
andq $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 0xc1d71
movq 0x88(%rsp), %rdi
callq 0x68f68
movq 0x80(%rsp), %rdi
callq 0x2220
movq 0xa8(%rsp), %r13
jmp 0xc2bac