// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: gradually_renew_g(ma_hit_t_alloc**, ma_hit_t_alloc**, long long*, unsigned long**, ma_sub_t**, R_to_U*, asg_t**, long, long, ug_opt_t*, long, double, double, long, long, long, bub_label_t*, unsigned int, int, char*, char const*, telo_end_t*)
void gradually_renew_g(ma_hit_t_alloc **src, ma_hit_t_alloc **rev_src, long long *n_read, 
uint64_t **readLen, ma_sub_t **cov, R_to_U *ruIndex, asg_t **sg, int64_t mini_overlap_length, 
int64_t max_hang_length, ug_opt_t *uopt, int64_t clean_round, double min_ovlp_drop_ratio, 
double max_ovlp_drop_ratio, int64_t max_tip, int64_t gap_fuzz, int64_t min_dp, 
bub_label_t *b_mask_t, uint32_t is_trio, int32_t ul_aln_round, char *o_file, const char *bin_file, telo_end_t *te)
{
    int32_t k, strl = strlen(bin_file)+1, kt, cl, sl; char *id = NULL;
    renew_g(src, rev_src, n_read, readLen, cov, ruIndex, sg, mini_overlap_length, max_hang_length,
        uopt, clean_round, min_ovlp_drop_ratio, max_ovlp_drop_ratio, asm_opt.max_short_tip, b_mask_t, 
        is_trio, o_file, bin_file, (ul_aln_round<=1)?1:0, 1, /**((is_trio)?(0):(1))**/((asm_opt.polyploidy<=2)?1:0));
    gen_ug_opt_t(uopt, *src, *rev_src, max_hang_length, mini_overlap_length, gap_fuzz, min_dp, *readLen, 
            *cov, ruIndex, (asm_opt.max_short_tip*2), 0.15, 3, 0.05, 0.9, b_mask_t, te);
    ug_ext_gfa(uopt, *sg, ug_ext_len);

    /**if(!ha_opt_triobin(&asm_opt))**/ hic_clean_adv(*sg, uopt);

    cl = strl+1; MALLOC(id, cl);
    for (k = 1; k < ul_aln_round; k++) {
        for(kt = k, sl = strl+1; kt > 0; kt/=10) sl++;
        if(cl < sl) {
            cl = sl; REALLOC(id, cl);
        }

        sprintf(id, "%s%d", bin_file, k);
        renew_g(src, rev_src, n_read, readLen, cov, ruIndex, sg, mini_overlap_length, max_hang_length,
            uopt, clean_round, min_ovlp_drop_ratio, max_ovlp_drop_ratio, asm_opt.max_short_tip, b_mask_t, 
            is_trio, o_file, id, ((k+1)==ul_aln_round)?1:0, 0, 0);
        gen_ug_opt_t(uopt, *src, *rev_src, max_hang_length, mini_overlap_length, gap_fuzz, min_dp, *readLen, 
            *cov, ruIndex, (asm_opt.max_short_tip*2), 0.15, 3, 0.05, 0.9, b_mask_t, te);
        ug_ext_gfa(uopt, *sg, ug_ext_len);
        /**if(!ha_opt_triobin(&asm_opt))**/ hic_clean_adv(*sg, uopt);
    }
    free(id);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq 0x78(%rbp), %rax
movq 0x70(%rbp), %rax
movq 0x68(%rbp), %rax
movl 0x60(%rbp), %eax
movl 0x58(%rbp), %eax
movq 0x50(%rbp), %rax
movq 0x48(%rbp), %rax
movq 0x40(%rbp), %rax
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movq %r9, -0x58(%rbp)
movsd %xmm0, -0x60(%rbp)
movsd %xmm1, -0x68(%rbp)
movq 0x70(%rbp), %rdi
callq 0x20a0
addq $0x1, %rax
movl %eax, -0x70(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x50(%rbp), %r8
movq -0x58(%rbp), %r9
movq 0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq 0x18(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq 0x20(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0x98(%rbp)
movq 0x30(%rbp), %r13
movsd -0x60(%rbp), %xmm0
movsd -0x68(%rbp), %xmm1
leaq 0x25fd31(%rip), %rax    # 0x3c47f8
movslq 0x11c(%rax), %r12
movq 0x50(%rbp), %r15
movl 0x58(%rbp), %r14d
movq 0x68(%rbp), %rbx
movq 0x70(%rbp), %r11
movl 0x60(%rbp), %r10d
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x1, %r10d
cmovlel %ecx, %eax
movslq %eax, %r10
leaq 0x25fcfe(%rip), %rax    # 0x3c47f8
movl 0x1bc(%rax), %eax
xorl %ecx, %ecx
movl %ecx, -0xbc(%rbp)
movl $0x1, %ecx
cmpl $0x2, %eax
movl -0xbc(%rbp), %eax
cmovlel %ecx, %eax
movq -0xb8(%rbp), %rcx
cltq
movq %rax, -0x90(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, (%rsp)
movq -0xa8(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0xa0(%rbp), %rax
movq %rax, 0x10(%rsp)
movq -0x98(%rbp), %rax
movq %rax, 0x18(%rsp)
movq -0x90(%rbp), %rax
movq %r13, 0x20(%rsp)
movq %r12, 0x28(%rsp)
movq %r15, 0x30(%rsp)
movl %r14d, 0x38(%rsp)
movq %rbx, 0x40(%rsp)
movq %r11, 0x48(%rsp)
movq %r10, 0x50(%rsp)
movq $0x1, 0x58(%rsp)
movq %rax, 0x60(%rsp)
callq 0x1647f0
movq 0x28(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq -0x38(%rbp), %rax
movq (%rax), %rdx
movq 0x20(%rbp), %rcx
movq 0x18(%rbp), %r8
movq 0x40(%rbp), %r9
movq 0x48(%rbp), %r12
movq -0x48(%rbp), %rax
movq (%rax), %r15
movq -0x50(%rbp), %rax
movq (%rax), %r14
movq -0x58(%rbp), %rbx
leaq 0x25fc28(%rip), %rax    # 0x3c47f8
movl 0x11c(%rax), %eax
shll %eax
movslq %eax, %r11
movq 0x50(%rbp), %r10
movq 0x78(%rbp), %rax
movss 0x221cb5(%rip), %xmm0   # 0x3868a0
movss 0x221cb1(%rip), %xmm1   # 0x3868a4
movss 0x221ca1(%rip), %xmm2   # 0x38689c
movq %r12, (%rsp)
movq %r15, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movq %rbx, 0x18(%rsp)
movq %r11, 0x20(%rsp)
movq $0x3, 0x28(%rsp)
movq %r10, 0x30(%rsp)
movq %rax, 0x38(%rsp)
callq 0x163d60
movq 0x28(%rbp), %rdi
movq 0x10(%rbp), %rax
movq (%rax), %rsi
movl $0x124f8, %edx          # imm = 0x124F8
callq 0x321cc0
movq 0x10(%rbp), %rax
movq (%rax), %rdi
movq 0x28(%rbp), %rsi
callq 0xfec60
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
movslq -0x78(%rbp), %rdi
shlq $0x0, %rdi
callq 0x2270
movq %rax, -0x88(%rbp)
movl $0x1, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl 0x60(%rbp), %eax
jge 0x164ee1
movl -0x6c(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x74(%rbp)
jle 0x164cae
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
movl -0x74(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl %eax, -0x74(%rbp)
jmp 0x164c8f
movl -0x78(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jge 0x164cd7
movl -0x7c(%rbp), %eax
movl %eax, -0x78(%rbp)
movq -0x88(%rbp), %rdi
movslq -0x78(%rbp), %rsi
shlq $0x0, %rsi
callq 0x2360
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
movq 0x70(%rbp), %rdx
movl -0x6c(%rbp), %ecx
leaq 0x224fb9(%rip), %rsi    # 0x389ca5
movb $0x0, %al
callq 0x2050
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x50(%rbp), %r8
movq -0x58(%rbp), %r9
movq 0x10(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq 0x18(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq 0x20(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq 0x28(%rbp), %r13
movq 0x30(%rbp), %r12
movsd -0x60(%rbp), %xmm0
movsd -0x68(%rbp), %xmm1
leaq 0x25faac(%rip), %rax    # 0x3c47f8
movslq 0x11c(%rax), %r15
movq 0x50(%rbp), %r14
movl 0x58(%rbp), %ebx
movq 0x68(%rbp), %r11
movq -0x88(%rbp), %r10
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf4(%rbp)
movl 0x60(%rbp), %ecx
xorl %eax, %eax
movl %eax, -0xec(%rbp)
movl $0x1, %eax
movl %eax, -0xf0(%rbp)
movl -0xf4(%rbp), %eax
cmpl %ecx, %eax
movl -0xf0(%rbp), %ecx
movl -0xec(%rbp), %eax
cmovel %ecx, %eax
movq -0xe8(%rbp), %rcx
cltq
movq %rax, -0xc8(%rbp)
xorl %eax, %eax
movq -0xe0(%rbp), %rax
movq %rax, (%rsp)
movq -0xd8(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0xd0(%rbp), %rax
movq %rax, 0x10(%rsp)
movq -0xc8(%rbp), %rax
movq %r13, 0x18(%rsp)
movq %r12, 0x20(%rsp)
movq %r15, 0x28(%rsp)
movq %r14, 0x30(%rsp)
movl %ebx, 0x38(%rsp)
movq %r11, 0x40(%rsp)
movq %r10, 0x48(%rsp)
movq %rax, 0x50(%rsp)
movq $0x0, 0x58(%rsp)
movq $0x0, 0x60(%rsp)
callq 0x1647f0
movq 0x28(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq -0x38(%rbp), %rax
movq (%rax), %rdx
movq 0x20(%rbp), %rcx
movq 0x18(%rbp), %r8
movq 0x40(%rbp), %r9
movq 0x48(%rbp), %r12
movq -0x48(%rbp), %rax
movq (%rax), %r15
movq -0x50(%rbp), %rax
movq (%rax), %r14
movq -0x58(%rbp), %rbx
leaq 0x25f9a5(%rip), %rax    # 0x3c47f8
movl 0x11c(%rax), %eax
shll %eax
movslq %eax, %r11
movq 0x50(%rbp), %r10
movq 0x78(%rbp), %rax
movss 0x221a32(%rip), %xmm0   # 0x3868a0
movss 0x221a2e(%rip), %xmm1   # 0x3868a4
movss 0x221a1e(%rip), %xmm2   # 0x38689c
movq %r12, (%rsp)
movq %r15, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movq %rbx, 0x18(%rsp)
movq %r11, 0x20(%rsp)
movq $0x3, 0x28(%rsp)
movq %r10, 0x30(%rsp)
movq %rax, 0x38(%rsp)
callq 0x163d60
movq 0x28(%rbp), %rdi
movq 0x10(%rbp), %rax
movq (%rax), %rsi
movl $0x124f8, %edx          # imm = 0x124F8
callq 0x321cc0
movq 0x10(%rbp), %rax
movq (%rax), %rdi
movq 0x28(%rbp), %rsi
callq 0xfec60
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x164c74
movq -0x88(%rbp), %rdi
callq 0x2210
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop