// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: cal_bub_best_by_len(ug_clean_t*, asg64_v*, unsigned int, unsigned int, unsigned int, double, double, unsigned int, unsigned int)
void cal_bub_best_by_len(ug_clean_t *sl, asg64_v *in, uint32_t max_ext, uint32_t is_trio, uint32_t is_ou, double len_rat, double ou_rat, uint32_t min_ou, 
uint32_t min_node)
{
    // fprintf(stderr, "[M::%s]\tStart\n", __func__);
    ma_ug_t *ug = sl->ug; asg_t *g = sl->ug->g; uint32_t ol_max, ou_max, lnid;
    uint32_t v, w, n_vtx = (g->n_seq<<1), nv, nw, i, k, z, kv, kw, bb, to_del, bn, tip;
    asg64_v tx = {0,0,0}, *b = NULL; asg_arc_t *av, *aw, *ve, *we; ma_utg_t *u;
    uint32_t trioF = (uint32_t)-1, ntrioF = (uint32_t)-1, mm_ol, mm_ou, cnt = 0, del_v, del_w;

    if(in) b = in;
    else b = &tx;
    b->n = 0;

    for (v = 0; v < n_vtx; ++v) {
        if (g->seq[v>>1].del) continue;
        av = asg_arc_a(g, v); 
        nv = asg_arc_n(g, v);
        if (nv < 2) continue;

        for (i = kv = bb = 0; i < nv; ++i) {
            if(av[i].del) continue;
            if(is_best_arc((*sl), v, av[i].v)) bb++;
            kv++;
        }
        if((kv < 2) || (!bb) || (kv<=bb)) continue;///it is impossible that kv <= bv

        for (i = 0; i < nv; ++i) {
            if(av[i].del) continue;
            if(is_best_arc((*sl), v, av[i].v)) continue;
            kv_push(uint64_t, *b, (((uint64_t)av[i].ol)<<32) | ((uint64_t)(av-g->arc+i)));   
        }
    }

    radix_sort_srt64(b->a, b->a + b->n);
    for (k = 0; k < b->n; k++) {
        if(g->arc[(uint32_t)b->a[k]].del) continue;

        v = g->arc[(uint32_t)b->a[k]].ul>>32; w = g->arc[(uint32_t)b->a[k]].v^1;
        if(g->seq[v>>1].del || g->seq[w>>1].del) continue;
        nv = asg_arc_n(g, v); nw = asg_arc_n(g, w);
        av = asg_arc_a(g, v); aw = asg_arc_a(g, w);
        if(nv<=1 && nw <= 1) continue;

        if(is_trio) {
            if(get_arcs(g, v, NULL, 0)<=1 && get_arcs(g, w, NULL, 0)<=1) continue;///speedup
            trioF = get_ug_tip_trio_infor(ug, v^1);
            ntrioF = (trioF==FATHER? MOTHER : (trioF==MOTHER? FATHER : (uint32_t)-1));
        }

        ve = &(g->arc[(uint32_t)b->a[k]]);
        for (i = 0; i < nw; ++i) {
            if (aw[i].v == (v^1)) {
                we = &(aw[i]);
                break;
            }
        }
        ///mm_ol and mm_ou are used to make edge with long indel more easy to be cutted
        mm_ol = MIN(ve->ol, we->ol); mm_ou = MIN(ve->ou, we->ou); lnid = 0;

        for (i = kv = ol_max = ou_max = 0; i < nv; ++i) {
            if(av[i].del) continue;
            kv++; 
            if(is_trio && get_ug_tip_trio_infor(ug, av[i].v) == ntrioF) continue;
            if(ol_max < av[i].ol) ol_max = av[i].ol; 
            if(ou_max < av[i].ou) ou_max = av[i].ou;
            if((!lnid) && ((is_best_arc((*sl), v, av[i].v)))) {
                if((cal_utg_occ(ug, v^1) >= min_node) || (cal_utg_occ(ug, av[i].v) >= min_node)) lnid = 1;
            }
        }
        if (kv < 1) continue;
        if (kv >= 2) {
            if (mm_ol > ol_max*len_rat) continue;
            if ((is_ou) && (mm_ou > min_ou) && (mm_ou > (ou_max*ou_rat))) continue;
        }
        

        for (i = kw = ol_max = ou_max = 0; i < nw; ++i) {
            if(aw[i].del) continue;
            kw++; 
            if(is_trio && get_ug_tip_trio_infor(ug, aw[i].v) == ntrioF) continue;
            if(ol_max < aw[i].ol) ol_max = aw[i].ol; 
            if(ou_max < aw[i].ou) ou_max = aw[i].ou;
            if((!lnid) && ((is_best_arc((*sl), w, aw[i].v)))) {
                if((cal_utg_occ(ug, w^1) >= min_node) || (cal_utg_occ(ug, aw[i].v) >= min_node)) lnid = 1;
            }
        }
        if (kw < 1) continue;
        if (kw >= 2) {
            if (mm_ol > ol_max*len_rat) continue;
            if ((is_ou) && (mm_ou > min_ou) && (mm_ou > (ou_max*ou_rat))) continue;
        }

        if (kv <= 1 && kw <= 1) continue;
        if(!lnid) continue;

        to_del = 0; del_v = del_w = (uint32_t)-1; tip = 0;
        if (kv > 1 && kw > 1) {
            to_del = 1;
        } else if (kw == 1) {
            // tip = asg_topocut_aux(g, w^1, max_ext);
            tip = usg_topocut_aux_del(ug, w^1, max_ext, NULL);
            if (tip < max_ext) {
                to_del = 1; del_w = w^1;
            }
        } else if (kv == 1) {
            // tip = asg_topocut_aux(g, v^1, max_ext);
            tip = usg_topocut_aux_del(ug, v^1, max_ext, NULL);
            if (tip < max_ext) {
                to_del = 1; del_v = v^1;
            }
        }

        
        if (to_del) {
            bn = b->n;
            if(del_v != ((uint32_t)-1)) usg_topocut_aux_del(ug, del_v, max_ext, b);
            if(del_w != ((uint32_t)-1)) usg_topocut_aux_del(ug, del_w, max_ext, b);
            for (i = bn; i < b->n; i++) {
                u = &(ug->u.a[b->a[i]>>1]);
                if(u->m == 0) continue;
                for (z = 0; z < u->n; z++) asg_seq_del(sl->sg, u->a[z]>>33);
                asg_seq_del(ug->g, (b->a[i]>>1));
                if(u->m) {
                    u->m = u->n = 0; free(u->a); u->a = NULL;
                }
            }
            // assert(tip == (b->n-bn));
            b->n = bn;

            ve->del = we->del = 1, ++cnt;
            asg_arc_del_by_ug(sl->sg, ug, ve->ul>>32, ve->v, 1);
            asg_arc_del_by_ug(sl->sg, ug, we->ul>>32, we->v, 1);
            
        }
    }

    if(!in) free(tx.a);
    if (cnt > 0) {
        asg_cleanup(g); asg_cleanup(sl->sg);
    }
    // fprintf(stderr, "[M::%s]\tEnd\n", __func__);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movl %r9d, 0x60(%rsp)
movsd %xmm1, 0x98(%rsp)
movsd %xmm0, 0xa0(%rsp)
movl %r8d, 0x68(%rsp)
movl %ecx, 0x54(%rsp)
movl %edx, 0x40(%rsp)
movq 0x10(%rdi), %rax
movq %rax, 0x8(%rsp)
movq 0x18(%rax), %r10
movl 0x14(%r10), %eax
addl %eax, %eax
xorl %ecx, %ecx
leaq 0xd0(%rsp), %rdx
movq %rcx, 0x10(%rdx)
xorpd %xmm0, %xmm0
movapd %xmm0, (%rdx)
testq %rsi, %rsi
movq %rsi, 0xb0(%rsp)
cmovneq %rsi, %rdx
movq %rdx, 0x20(%rsp)
movq %rcx, (%rdx)
testl %eax, %eax
movq %rdi, 0x10(%rsp)
movq %r10, 0x18(%rsp)
je 0x2203b4
movl %eax, %eax
movq %rax, 0x28(%rsp)
xorl %r15d, %r15d
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
movq 0x20(%rsp), %r12
movq 0x20(%r10), %rax
movl %r15d, %ecx
shrl %ecx
cmpl $0x0, (%rax,%rcx,8)
js 0x2203a6
movq 0x28(%r10), %rax
movq (%rax,%r15,8), %rax
testl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
je 0x2203a6
movq 0x8(%r10), %rcx
movq %rax, %rdx
shrq $0x20, %rdx
leaq (%rdx,%rdx,2), %rdx
leaq (%rcx,%rdx,8), %r14
movl %eax, %ebp
leaq (%rcx,%rdx,8), %r13
addq $0xc, %r13
xorl %eax, %eax
movq %rbp, %rdx
movq %r13, %rsi
xorl %ecx, %ecx
cmpl $0x0, (%rsi)
js 0x2202b4
movq 0x80(%rdi), %r9
movl -0x4(%rsi), %r8d
cmpl %r8d, (%r9,%r15,4)
jne 0x2202b2
xorq $0x1, %r8
movl (%r9,%r8,4), %r9d
xorl %r15d, %r9d
xorl %r8d, %r8d
cmpl $0x1, %r9d
sete %r8b
addl %r8d, %eax
incl %ecx
addq $0x18, %rsi
decq %rdx
jne 0x220283
cmpl $0x2, %ecx
setae %dl
testl %eax, %eax
setne %sil
cmpl %eax, %ecx
seta %al
andb %dl, %sil
andb %al, %sil
cmpb $0x1, %sil
jne 0x2203a6
xorl %ebx, %ebx
cmpl $0x0, (%r13)
js 0x220396
movq 0x80(%rdi), %rax
movl -0x4(%r13), %ecx
cmpl %ecx, (%rax,%r15,4)
jne 0x22030f
xorq $0x1, %rcx
movl (%rax,%rcx,4), %eax
xorl %r15d, %eax
cmpl $0x1, %eax
je 0x220396
movq 0x20(%rsp), %rcx
movq 0x8(%rcx), %rax
cmpq %rax, (%rcx)
jne 0x220355
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r12)
movq 0x10(%r12), %rdi
shlq $0x3, %rsi
callq 0x2370
movl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
movq 0x18(%rsp), %r10
movq 0x10(%rsp), %rdi
movq %rax, 0x10(%r12)
movl (%r13), %eax
andl %r11d, %eax
shlq $0x20, %rax
movq %r14, %rcx
subq 0x8(%r10), %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
addq %rbx, %rcx
orq %rax, %rcx
movq 0x20(%rsp), %r8
movq 0x10(%r8), %rax
movq (%r8), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, (%r8)
movq %rcx, (%rax,%rdx,8)
incq %rbx
addq $0x18, %r13
cmpq %rbx, %rbp
jne 0x2202e0
incq %r15
cmpq 0x28(%rsp), %r15
jne 0x220236
movq 0x20(%rsp), %rbx
movq 0x10(%rbx), %rdi
movq (%rbx), %rax
leaq (%rdi,%rax,8), %rsi
callq 0x1e3b6a
cmpq $0x0, (%rbx)
je 0x220f18
movl $0xffffffff, 0x50(%rsp) # imm = 0xFFFFFFFF
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
xorl %eax, %eax
movl $0x0, 0x64(%rsp)
xorl %r13d, %r13d
movq 0x10(%rsp), %r9
movq 0x18(%rsp), %rdi
movq 0x8(%rdi), %r10
movq 0x20(%rsp), %rcx
movq 0x10(%rcx), %rcx
movl (%rcx,%rax,8), %eax
leaq (%rax,%rax,2), %r15
cmpl $0x0, 0xc(%r10,%r15,8)
js 0x220462
movq (%r10,%r15,8), %r8
movq 0x20(%rdi), %rax
movq %r8, %rcx
shrq $0x21, %rcx
cmpl $0x0, (%rax,%rcx,8)
js 0x220462
movl 0x8(%r10,%r15,8), %ebp
movl %ebp, %ecx
shrl %ecx
cmpl $0x0, (%rax,%rcx,8)
js 0x220462
shrq $0x20, %r8
movq %rbp, %rcx
xorq $0x1, %rcx
movq 0x28(%rdi), %rax
movq (%rax,%r8,8), %r11
movq %rcx, 0xc0(%rsp)
movq (%rax,%rcx,8), %rcx
cmpl $0x1, %r11d
ja 0x220477
cmpl $0x2, %ecx
jae 0x220477
incl %r13d
movq %r13, %rax
movq 0x20(%rsp), %rcx
cmpq %r13, (%rcx)
ja 0x2203f8
jmp 0x220f0e
movq %rcx, %rbx
shrq $0x20, %rbx
cmpl $0x0, 0x54(%rsp)
movq %r8, 0x48(%rsp)
movq %r10, 0x58(%rsp)
movq %rcx, 0x88(%rsp)
je 0x22054b
movq (%rax,%r8,8), %rax
movq %rax, %rcx
andq %r14, %rcx
je 0x2204cc
shrq $0x20, %rax
xorl %edx, %edx
movl %eax, %esi
leaq (%rsi,%rsi,2), %rsi
movl 0xc(%r10,%rsi,8), %esi
notl %esi
shrl $0x1f, %esi
addl %esi, %edx
incq %rax
decq %rcx
jne 0x2204ad
cmpl $0x1, %edx
ja 0x220501
movq 0x88(%rsp), %rax
andq %r14, %rax
je 0x220462
xorl %ecx, %ecx
movq %rbx, %rdx
movl %edx, %esi
leaq (%rsi,%rsi,2), %rsi
movl 0xc(%r10,%rsi,8), %esi
notl %esi
shrl $0x1f, %esi
addl %esi, %ecx
incq %rdx
decq %rax
jne 0x2204de
cmpl $0x2, %ecx
jb 0x220462
movl %r8d, %esi
xorl $0x1, %esi
movq 0x8(%rsp), %rdi
movq %r11, 0x28(%rsp)
callq 0x1ea636
movq 0x28(%rsp), %r11
movq 0x58(%rsp), %r10
movq 0x48(%rsp), %r8
movq 0x18(%rsp), %rdi
xorl %ecx, %ecx
cmpb $0x2, %al
sete %cl
cmpb $0x1, %al
leal -0x1(%rcx,%rcx), %ecx
movl $0x2, %eax
cmovel %eax, %ecx
movl %ecx, 0x50(%rsp)
movq 0x88(%rsp), %rcx
leaq (%rbx,%rbx,2), %rbx
testl %ecx, %ecx
je 0x22056a
leaq (%r10,%rbx,8), %rax
movl 0x8(%rax), %edx
xorl %r8d, %edx
cmpl $0x1, %edx
je 0x22056f
addq $0x18, %rax
decl %ecx
jne 0x220557
movq %r11, %r9
jmp 0x220577
movq %r11, %r9
movq %rax, 0x70(%rsp)
leaq (%r10,%r15,8), %rsi
movl 0xc(%rsi), %eax
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl %ecx, %eax
movq 0x70(%rsp), %rdx
movl 0xc(%rdx), %r11d
andl %ecx, %r11d
cmpl %r11d, %eax
cmovbl %eax, %r11d
movl %r11d, 0x6c(%rsp)
movq %rsi, 0xa8(%rsp)
movzwl 0x10(%rsi), %eax
movl $0x3fff, %ecx           # imm = 0x3FFF
andl %ecx, %eax
movzwl 0x10(%rdx), %edx
andl %ecx, %edx
cmpw %dx, %ax
cmovbl %eax, %edx
movl %edx, 0x44(%rsp)
testl %r9d, %r9d
movq %rbp, 0x80(%rsp)
movq %r13, 0x78(%rsp)
je 0x220785
movq %rbx, 0xb8(%rsp)
movq %r9, %rax
shrq $0x20, %rax
movl %r8d, %ebp
xorl $0x1, %ebp
movl %r9d, %ecx
leaq (%rax,%rax,2), %rax
leaq (%r10,%rax,8), %r12
addq $0x8, %r12
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %r13
xorl %ebx, %ebx
movl $0x0, 0x28(%rsp)
xorl %esi, %esi
xorl %r11d, %r11d
xorl %edx, %edx
movq 0x10(%rsp), %r9
movl %ebp, 0x94(%rsp)
movq %r13, 0xc8(%rsp)
movl 0x4(%r12,%rbx), %r15d
testl %r15d, %r15d
js 0x220757
incl %edx
cmpl $0x0, 0x54(%rsp)
je 0x220696
movl %esi, 0x38(%rsp)
movl (%r12,%rbx), %esi
movq 0x8(%rsp), %rdi
movl %edx, %r13d
movq %r12, %rbp
movl %r11d, %r12d
callq 0x1ea636
movl 0x38(%rsp), %esi
movl %r12d, %r11d
movq %rbp, %r12
movl 0x94(%rsp), %ebp
movl %r13d, %edx
movq 0xc8(%rsp), %r13
movq 0x58(%rsp), %r10
movq 0x48(%rsp), %r8
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %r9
movzbl %al, %eax
cmpl %eax, 0x50(%rsp)
je 0x220757
movl 0x28(%rsp), %eax
cmpl %r15d, %eax
cmovbel %r15d, %eax
movl %eax, 0x28(%rsp)
movzwl 0x8(%r12,%rbx), %eax
andl $0x3fff, %eax           # imm = 0x3FFF
cmpl %eax, %esi
cmovbel %eax, %esi
testl %r11d, %r11d
je 0x2206c5
movl $0x1, %r11d
jmp 0x220757
movq 0x80(%r9), %rax
movl (%r12,%rbx), %r15d
xorl %r11d, %r11d
cmpl %r15d, (%rax,%r8,4)
jne 0x220757
movq %r15, %rcx
xorq $0x1, %rcx
cmpl %ebp, (%rax,%rcx,4)
jne 0x220757
movl %esi, 0x38(%rsp)
movl %edx, 0x34(%rsp)
movq 0x8(%rsp), %rdi
movl %ebp, %esi
callq 0x22006e
cmpl 0x120(%rsp), %eax
jae 0x220735
movq 0x8(%rsp), %rdi
movl %r15d, %esi
callq 0x22006e
cmpl 0x120(%rsp), %eax
jae 0x220735
movq 0x10(%rsp), %r9
movq 0x18(%rsp), %rdi
movq 0x48(%rsp), %r8
movq 0x58(%rsp), %r10
movl 0x34(%rsp), %edx
xorl %r11d, %r11d
jmp 0x220753
movl $0x1, %r11d
movq 0x10(%rsp), %r9
movq 0x18(%rsp), %rdi
movq 0x48(%rsp), %r8
movq 0x58(%rsp), %r10
movl 0x34(%rsp), %edx
movl 0x38(%rsp), %esi
addq $0x18, %rbx
cmpq %rbx, %r13
jne 0x220627
cvtsi2sdl 0x28(%rsp), %xmm1
cvtsi2sd %esi, %xmm0
movq 0x78(%rsp), %r13
movq 0x80(%rsp), %rbp
movq 0xb8(%rsp), %rbx
jmp 0x220797
xorpd %xmm0, %xmm0
xorl %edx, %edx
xorl %r11d, %r11d
xorpd %xmm1, %xmm1
movq 0x10(%rsp), %r9
testl %edx, %edx
je 0x220462
cmpl $0x1, %edx
jne 0x220937
movq 0x88(%rsp), %rax
testl %eax, %eax
je 0x22098a
movl %eax, %eax
leaq (%r10,%rbx,8), %r15
addq $0x8, %r15
shlq $0x3, %rax
leaq (%rax,%rax,2), %r12
xorl %ebp, %ebp
movl $0x0, 0x28(%rsp)
xorl %r13d, %r13d
xorl %r10d, %r10d
movl %edx, 0x34(%rsp)
movq %r12, 0x58(%rsp)
movl 0x4(%r15,%rbp), %ebx
testl %ebx, %ebx
js 0x22090a
incl %r10d
cmpl $0x0, 0x54(%rsp)
je 0x220849
movl (%r15,%rbp), %esi
movq 0x8(%rsp), %rdi
movl %r13d, 0x38(%rsp)
movl %r11d, %r13d
movq %r15, %r12
movl %r10d, %r15d
callq 0x1ea636
movl %r15d, %r10d
movq %r12, %r15
movq 0x58(%rsp), %r12
movl %r13d, %r11d
movl 0x38(%rsp), %r13d
movl 0x34(%rsp), %edx
movq 0x48(%rsp), %r8
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %r9
movzbl %al, %eax
cmpl %eax, 0x50(%rsp)
je 0x22090a
movl 0x28(%rsp), %eax
cmpl %ebx, %eax
cmovbel %ebx, %eax
movl %eax, 0x28(%rsp)
movzwl 0x8(%r15,%rbp), %eax
andl $0x3fff, %eax           # imm = 0x3FFF
cmpl %eax, %r13d
cmovbel %eax, %r13d
testl %r11d, %r11d
je 0x220878
movl $0x1, %r11d
jmp 0x22090a
movq 0x80(%r9), %rax
movl (%r15,%rbp), %ebx
xorl %r11d, %r11d
movq 0xc0(%rsp), %rcx
cmpl %ebx, (%rax,%rcx,4)
jne 0x22090a
movq %rbx, %rcx
xorq $0x1, %rcx
movq 0x80(%rsp), %rsi
cmpl %esi, (%rax,%rcx,4)
jne 0x22090a
movl %r10d, 0x38(%rsp)
movq 0x8(%rsp), %rdi
callq 0x22006e
cmpl 0x120(%rsp), %eax
jae 0x2208ec
movq 0x8(%rsp), %rdi
movl %ebx, %esi
callq 0x22006e
cmpl 0x120(%rsp), %eax
jae 0x2208ec
movq 0x10(%rsp), %r9
movq 0x18(%rsp), %rdi
movq 0x48(%rsp), %r8
movl 0x34(%rsp), %edx
xorl %r11d, %r11d
jmp 0x220905
movl $0x1, %r11d
movq 0x10(%rsp), %r9
movq 0x18(%rsp), %rdi
movq 0x48(%rsp), %r8
movl 0x34(%rsp), %edx
movl 0x38(%rsp), %r10d
addq $0x18, %rbp
cmpq %rbp, %r12
jne 0x2207e3
xorps %xmm1, %xmm1
cvtsi2sdl 0x28(%rsp), %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movq 0x78(%rsp), %r13
movq 0x80(%rsp), %rbp
jmp 0x220995
cvtsi2sdl 0x6c(%rsp), %xmm2
mulsd 0xa0(%rsp), %xmm1
ucomisd %xmm1, %xmm2
ja 0x220462
cmpl $0x0, 0x68(%rsp)
je 0x2207a8
movl 0x44(%rsp), %eax
cmpl 0x60(%rsp), %eax
jbe 0x2207a8
xorps %xmm1, %xmm1
cvtsi2sdl 0x44(%rsp), %xmm1
mulsd 0x98(%rsp), %xmm0
ucomisd %xmm0, %xmm1
ja 0x220462
jmp 0x2207a8
xorpd %xmm0, %xmm0
xorl %r10d, %r10d
xorpd %xmm1, %xmm1
testl %r10d, %r10d
je 0x220462
cmpl $0x1, %r10d
jne 0x2209e7
movl %edx, %eax
xorl $0x1, %eax
movl %r10d, %ecx
xorl $0x1, %ecx
orl %eax, %ecx
setne %al
testl %r11d, %r11d
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x220462
cmpl $0x1, %r10d
setne %al
cmpl $0x1, %edx
setne %cl
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
testb %al, %cl
je 0x220a35
xorl %eax, %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x220aab
xorps %xmm2, %xmm2
cvtsi2sdl 0x6c(%rsp), %xmm2
mulsd 0xa0(%rsp), %xmm1
ucomisd %xmm1, %xmm2
ja 0x220462
cmpl $0x0, 0x68(%rsp)
je 0x2209a4
movl 0x44(%rsp), %eax
cmpl 0x60(%rsp), %eax
jbe 0x2209a4
xorps %xmm1, %xmm1
cvtsi2sdl 0x44(%rsp), %xmm1
mulsd 0x98(%rsp), %xmm0
ucomisd %xmm0, %xmm1
ja 0x220462
jmp 0x2209a4
cmpl $0x1, %r10d
jne 0x220a68
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movl 0x40(%rsp), %ebx
movl %ebx, %edx
xorl %ecx, %ecx
callq 0x21ffa1
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %r9
cmpl %ebx, %eax
setae %al
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
cmovael %esi, %ebp
jmp 0x220aab
movb $0x1, %al
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x1, %edx
jne 0x220aab
xorl $0x1, %r8d
movq 0x8(%rsp), %rdi
movl %r8d, %esi
movl 0x40(%rsp), %ebx
movl %ebx, %edx
xorl %ecx, %ecx
movq %r8, %r15
callq 0x21ffa1
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %r9
cmpl %ebx, %eax
setae %al
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmovael %ebp, %r15d
movl %r15d, %esi
testb %al, %al
jne 0x220462
movq 0x20(%rsp), %rax
movq (%rax), %r15
cmpl $-0x1, %esi
je 0x220ad3
movq 0x8(%rsp), %rdi
movl 0x40(%rsp), %edx
movq 0x20(%rsp), %rcx
callq 0x21ffa1
cmpl $-0x1, %ebp
je 0x220aed
movq 0x8(%rsp), %rdi
movl %ebp, %esi
movl 0x40(%rsp), %edx
movq 0x20(%rsp), %rcx
callq 0x21ffa1
movl %r15d, %eax
movq %rax, 0x38(%rsp)
movq 0x20(%rsp), %rcx
cmpq %rax, (%rcx)
movq 0x10(%rsp), %r9
jbe 0x220d27
movq 0x38(%rsp), %r12
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rdx
movq (%rdx,%r12,8), %rdx
shrq %rdx
leaq (%rdx,%rdx,4), %rdx
cmpl $0x0, 0xc(%rcx,%rdx,8)
je 0x220d13
movq %r15, 0x28(%rsp)
leaq (%rcx,%rdx,8), %r13
cmpl $0x0, 0x10(%r13)
je 0x220c19
xorl %ecx, %ecx
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdx
movq 0x18(%r13), %rsi
movq (%rsi,%rcx,8), %rsi
shrq $0x21, %rsi
movq 0x20(%rdx), %rdi
orl $0x80000000, (%rdi,%rsi,8) # imm = 0x80000000
addl %esi, %esi
xorl %edi, %edi
leaq (%rdi,%rsi), %r8
movq 0x28(%rdx), %r9
movq (%r9,%r8,8), %r10
movq %r10, %r9
andq %r14, %r9
je 0x220bf9
shrq $0x20, %r10
leaq (%r10,%r10,2), %r10
shlq $0x3, %r10
addq 0x8(%rdx), %r10
xorl %r11d, %r11d
leaq (%r11,%r11,2), %rbx
orb $-0x80, 0xf(%r10,%rbx,8)
movl 0x8(%r10,%rbx,8), %ebx
xorq $0x1, %rbx
movq 0x28(%rdx), %r15
movq (%r15,%rbx,8), %r15
movq %r15, %rbx
andq %r14, %rbx
je 0x220bf1
movq 0x8(%rdx), %rbp
shrq $0x20, %r15
shlq $0x3, %rbx
leaq (%rbx,%rbx,2), %rbx
leaq (%r15,%r15,2), %r15
leaq 0xc(%rbp,%r15,8), %rbp
xorl %r15d, %r15d
movl -0x4(%rbp,%r15), %eax
xorl %r8d, %eax
cmpl $0x1, %eax
jne 0x220be8
orb $-0x80, 0x3(%rbp,%r15)
addq $0x18, %r15
cmpq %r15, %rbx
jne 0x220bd5
incq %r11
cmpq %r9, %r11
jne 0x220b96
leaq 0x1(%rdi), %rax
testq %rdi, %rdi
movq %rax, %rdi
je 0x220b6f
incq %rcx
movl 0x10(%r13), %eax
cmpq %rax, %rcx
jb 0x220b4b
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax,%r12,8), %rax
movq 0x20(%rcx), %rdx
movq %rax, %rsi
movabsq $0x1fffffffe, %rdi      # imm = 0x1FFFFFFFE
andq %rdi, %rsi
orl $0x80000000, (%rdx,%rsi,4) # imm = 0x80000000
andl $-0x2, %eax
xorl %edx, %edx
movq 0x28(%rsp), %r15
leaq (%rdx,%rax), %rsi
movq 0x28(%rcx), %rdi
movq (%rdi,%rsi,8), %r8
movq %r8, %rdi
andq %r14, %rdi
je 0x220cdf
shrq $0x20, %r8
leaq (%r8,%r8,2), %r8
shlq $0x3, %r8
addq 0x8(%rcx), %r8
xorl %r9d, %r9d
leaq (%r9,%r9,2), %r10
orb $-0x80, 0xf(%r8,%r10,8)
movl 0x8(%r8,%r10,8), %r10d
xorq $0x1, %r10
movq 0x28(%rcx), %r11
movq (%r11,%r10,8), %r11
movq %r11, %r10
andq %r14, %r10
je 0x220cd7
movq 0x8(%rcx), %rbx
shrq $0x20, %r11
shlq $0x3, %r10
leaq (%r10,%r10,2), %r10
leaq (%r11,%r11,2), %r11
leaq (%rbx,%r11,8), %r11
addq $0xc, %r11
xorl %ebx, %ebx
movl -0x4(%r11,%rbx), %ebp
xorl %esi, %ebp
cmpl $0x1, %ebp
jne 0x220cce
orb $-0x80, 0x3(%r11,%rbx)
addq $0x18, %rbx
cmpq %rbx, %r10
jne 0x220cbc
incq %r9
cmpq %rdi, %r9
jne 0x220c7b
leaq 0x1(%rdx), %rsi
testq %rdx, %rdx
movq %rsi, %rdx
je 0x220c54
cmpl $0x0, 0xc(%r13)
movq 0x10(%rsp), %r9
je 0x220d13
xorl %ebx, %ebx
movq %rbx, 0xc(%r13)
movq 0x18(%r13), %rdi
callq 0x2220
movq 0x10(%rsp), %r9
movq %rbx, 0x18(%r13)
incl %r15d
movq %r15, %r12
movq 0x20(%rsp), %rax
cmpq %r15, (%rax)
ja 0x220b0d
movq 0x38(%rsp), %rax
movq 0x20(%rsp), %rcx
movq %rax, (%rcx)
movq 0x70(%rsp), %rax
orb $-0x80, 0xf(%rax)
movq 0xa8(%rsp), %rcx
orb $-0x80, 0xf(%rcx)
movq 0x8(%r9), %rax
movq (%rcx), %rsi
movl 0x8(%rcx), %ecx
movq %rsi, %rdx
shrq $0x21, %rdx
btq $0x20, %rsi
jb 0x220d78
movq 0x8(%rsp), %rsi
movq 0x10(%rsi), %rsi
leaq (%rdx,%rdx,4), %rdx
leaq (%rsi,%rdx,8), %rdx
addq $0x8, %rdx
jmp 0x220d8d
movq 0x8(%rsp), %rsi
movq 0x10(%rsi), %rsi
leaq (%rdx,%rdx,4), %rdx
leaq (%rsi,%rdx,8), %rdx
addq $0x4, %rdx
movq 0x18(%rsp), %rdi
movq 0x78(%rsp), %r13
movl (%rdx), %edx
movl %ecx, %esi
shrl %esi
testb $0x1, %cl
jne 0x220db9
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
leaq (%rsi,%rsi,4), %rsi
leaq (%rcx,%rsi,8), %rcx
addq $0x4, %rcx
jmp 0x220dce
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
leaq (%rsi,%rsi,4), %rsi
leaq (%rcx,%rsi,8), %rcx
addq $0x8, %rcx
xorq $0x1, %rdx
movq 0x28(%rax), %rsi
movq (%rsi,%rdx,8), %rdx
testl %edx, %edx
je 0x220f6d
incl 0x64(%rsp)
movl (%rcx), %ecx
movq 0x8(%rax), %rax
movq %rdx, %rsi
shrq $0x20, %rsi
movl %edx, %r8d
leaq (%rsi,%rsi,2), %rdx
leaq (%rax,%rdx,8), %rsi
addq $0xc, %rsi
shlq $0x3, %r8
leaq (%r8,%r8,2), %r8
xorl %r10d, %r10d
cmpl %ecx, -0x4(%rsi,%r10)
je 0x220e22
addq $0x18, %r10
cmpq %r10, %r8
jne 0x220e0d
jmp 0x220f6d
leaq (%rax,%rdx,8), %rax
orb $-0x80, 0xf(%r10,%rax)
movq 0x70(%rsp), %rax
movq (%rax), %rcx
movq %rcx, %rax
shrq $0x21, %rax
leaq (%rax,%rax,4), %rax
movabsq $0x100000000, %rdx      # imm = 0x100000000
testq %rdx, %rcx
jne 0x220e61
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
leaq (%rcx,%rax,8), %rcx
addq $0x8, %rcx
jmp 0x220e72
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
leaq (%rcx,%rax,8), %rcx
addq $0x4, %rcx
movq 0x8(%r9), %rax
movq 0x70(%rsp), %rdx
movl 0x8(%rdx), %esi
movl (%rcx), %ecx
movl %esi, %edx
shrl %edx
leaq (%rdx,%rdx,4), %rdx
testb $0x1, %sil
jne 0x220ea1
movq 0x8(%rsp), %rsi
movq 0x10(%rsi), %rsi
leaq (%rsi,%rdx,8), %rdx
addq $0x4, %rdx
jmp 0x220eb2
movq 0x8(%rsp), %rsi
movq 0x10(%rsi), %rsi
leaq (%rsi,%rdx,8), %rdx
addq $0x8, %rdx
xorq $0x1, %rcx
movq 0x28(%rax), %rsi
movq (%rsi,%rcx,8), %rsi
testl %esi, %esi
je 0x220f6d
movl (%rdx), %ecx
movq 0x8(%rax), %rax
movq %rsi, %rdx
shrq $0x20, %rdx
movl %esi, %r8d
leaq (%rdx,%rdx,2), %rdx
leaq (%rax,%rdx,8), %rsi
addq $0xc, %rsi
shlq $0x3, %r8
leaq (%r8,%r8,2), %r8
xorl %r10d, %r10d
cmpl %ecx, -0x4(%rsi,%r10)
je 0x220eff
addq $0x18, %r10
cmpq %r10, %r8
jne 0x220eed
jmp 0x220f6d
leaq (%rax,%rdx,8), %rax
orb $-0x80, 0xf(%r10,%rax)
jmp 0x220462
cmpl $0x0, 0x64(%rsp)
sete %bl
jmp 0x220f24
movb $0x1, %bl
movq 0x10(%rsp), %r9
movq 0x18(%rsp), %rdi
cmpq $0x0, 0xb0(%rsp)
jne 0x220f46
movq 0xe0(%rsp), %rdi
callq 0x2220
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %r9
testb %bl, %bl
jne 0x220f5b
movq %r9, %rbx
callq 0xa02fa
movq 0x8(%rbx), %rdi
callq 0xa02fa
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x913a(%rip), %rdi      # 0x22a0ae
leaq 0x183aa(%rip), %rsi     # 0x239325
leaq 0x1d5f8(%rip), %rcx     # 0x23e57a
movl $0x45ce, %edx           # imm = 0x45CE
callq 0x2110