// File: /workspace/github_cpp_makefile_star2_O2/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, 0x74(%rsp)
movsd %xmm1, 0x88(%rsp)
movsd %xmm0, 0x90(%rsp)
movl %r8d, 0x78(%rsp)
movl %ecx, 0x5c(%rsp)
movq 0x10(%rdi), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rax), %r11
movl 0x14(%r11), %eax
addl %eax, %eax
movq %rax, 0x48(%rsp)
xorpd %xmm0, %xmm0
leaq 0xd0(%rsp), %rax
andq $0x0, 0x10(%rax)
movapd %xmm0, (%rax)
testq %rsi, %rsi
movq %rsi, 0xa8(%rsp)
cmovneq %rsi, %rax
movl %edx, 0x30(%rsp)
movq %rax, 0x20(%rsp)
andq $0x0, (%rax)
xorl %r12d, %r12d
movq %rdi, (%rsp)
movq %r11, 0x28(%rsp)
movq 0x20(%rsp), %r15
cmpq 0x48(%rsp), %r12
je 0x1ddb7b
movq 0x20(%r11), %rax
movl %r12d, %ecx
shrl %ecx
cmpl $0x0, (%rax,%rcx,8)
js 0x1ddb73
movq 0x28(%r11), %rax
movq (%rax,%r12,8), %rax
testl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
je 0x1ddb73
movq 0x8(%r11), %rcx
movq %rax, %rdx
shrq $0x20, %rdx
imulq $0x18, %rdx, %rsi
leaq (%rcx,%rsi), %r13
movl %eax, %r14d
imulq $0x18, %r14, %rdx
leaq (%rcx,%rsi), %rbp
addq $0xc, %rbp
xorl %r10d, %r10d
xorl %eax, %eax
xorl %esi, %esi
cmpq %r10, %rdx
je 0x1ddaa2
cmpl $0x0, (%rbp,%r10)
js 0x1dda9c
movq 0x80(%rdi), %r8
movl (%r8,%r12,4), %r9d
cmpl -0x4(%rbp,%r10), %r9d
jne 0x1dda9a
xorq $0x1, %r9
movl (%r8,%r9,4), %r8d
xorl %r12d, %r8d
xorl %r9d, %r9d
cmpl $0x1, %r8d
sete %r9b
addl %r9d, %esi
incl %eax
addq $0x18, %r10
jmp 0x1dda62
cmpl $0x2, %eax
setae %dl
testl %esi, %esi
setne %r8b
cmpl %esi, %eax
seta %al
andb %dl, %r8b
andb %al, %r8b
cmpb $0x1, %r8b
jne 0x1ddb73
xorl %ebx, %ebx
cmpq %rbx, %r14
je 0x1ddb73
movl (%rbp), %esi
testl %esi, %esi
js 0x1ddb67
movq 0x80(%rdi), %rax
movl (%rax,%r12,4), %edx
cmpl -0x4(%rbp), %edx
jne 0x1ddaf8
xorq $0x1, %rdx
movl (%rax,%rdx,4), %eax
xorl %r12d, %eax
cmpl $0x1, %eax
je 0x1ddb67
movq (%r15), %r8
movq 0x10(%r15), %r9
cmpq 0x8(%r15), %r8
jne 0x1ddb3d
leaq (%r8,%r8), %rsi
testq %r8, %r8
pushq $0x2
popq %rax
cmoveq %rax, %rsi
movq %rsi, 0x8(%r15)
shlq $0x3, %rsi
movq %r9, %rdi
callq 0x2370
movq 0x28(%rsp), %r11
movq (%rsp), %rdi
movq %rax, %r9
movq %rax, 0x10(%r15)
movl (%rbp), %esi
movq 0x8(%r11), %rcx
movq (%r15), %r8
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
shlq $0x20, %rsi
movq %r13, %rax
subq %rcx, %rax
cqto
pushq $0x18
popq %r10
idivq %r10
addq %rbx, %rax
orq %rsi, %rax
leaq 0x1(%r8), %rdx
movq %rdx, (%r15)
movq %rax, (%r9,%r8,8)
incq %rbx
addq $0x18, %rbp
jmp 0x1ddac5
incq %r12
jmp 0x1dda08
movq 0x20(%rsp), %r12
movq 0x10(%r12), %rdi
movq (%r12), %rax
leaq (%rdi,%rax,8), %rsi
callq 0x1a3def
movq 0x28(%rsp), %r15
movq (%rsp), %r8
pushq $-0x1
popq %rax
movl %eax, 0x58(%rsp)
xorl %r13d, %r13d
movl $0x0, 0x7c(%rsp)
movl %r13d, %r13d
cmpq %r13, (%r12)
jbe 0x1de311
movq 0x8(%r15), %rbp
movq 0x10(%r12), %rax
movl (%rax,%r13,8), %ecx
imulq $0x18, %rcx, %rdx
cmpl $0x0, 0xc(%rbp,%rdx)
js 0x1de136
movq (%rbp,%rdx), %rsi
movq 0x20(%r15), %rax
movq %rsi, %rdi
shrq $0x21, %rsi
cmpl $0x0, (%rax,%rsi,8)
js 0x1de136
movl 0x8(%rbp,%rdx), %esi
movl %esi, %edx
shrl %edx
cmpl $0x0, (%rax,%rdx,8)
js 0x1de136
movq %r13, 0x40(%rsp)
shrq $0x20, %rdi
movq %rsi, 0x98(%rsp)
xorq $0x1, %rsi
movq 0x28(%r15), %rax
movq %rdi, 0x68(%rsp)
movq (%rax,%rdi,8), %r13
movq %rsi, 0xa0(%rsp)
movq (%rax,%rsi,8), %rbx
movl %ebx, %eax
orl %r13d, %eax
testl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jne 0x1ddc46
movq 0x40(%rsp), %r13
jmp 0x1de136
cmpl $0x0, 0x5c(%rsp)
je 0x1ddcc4
movq %r15, %rdi
movq 0x68(%rsp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1a5422
cmpl $0x1, %eax
ja 0x1ddc82
movq %r15, %rdi
movq 0xa0(%rsp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1a5422
cmpl $0x2, %eax
jae 0x1ddc82
movq (%rsp), %r8
jmp 0x1ddc3c
movq 0x68(%rsp), %rax
movl %eax, %esi
xorl $0x1, %esi
movq 0x10(%rsp), %rdi
callq 0x1aa250
xorl %ecx, %ecx
cmpb $0x2, %al
sete %cl
cmpb $0x1, %al
leal -0x1(%rcx,%rcx), %ecx
pushq $0x2
popq %rax
cmovel %eax, %ecx
movl %ecx, 0x58(%rsp)
movq 0x8(%r15), %rdx
movq 0x10(%r12), %rax
movq 0x40(%rsp), %rcx
movl (%rax,%rcx,8), %ecx
movq (%rsp), %r8
jmp 0x1ddcc7
movq %rbp, %rdx
movq %r13, %rax
shrq $0x20, %rax
movq %rbx, %rsi
shrq $0x20, %rsi
imulq $0x18, %rcx, %rdi
addq %rdx, %rdi
movl %ebx, %ecx
movq %rcx, 0xc0(%rsp)
incq %rcx
imulq $0x18, %rsi, %rdx
movq %rdx, 0xb8(%rsp)
leaq (%rdx,%rbp), %rsi
addq $-0x18, %rsi
movq 0x68(%rsp), %r10
decq %rcx
je 0x1ddd18
movl 0x20(%rsi), %edx
xorl %r10d, %edx
addq $0x18, %rsi
cmpl $0x1, %edx
jne 0x1ddd02
jmp 0x1ddd1b
movq %r14, %rsi
movl 0xc(%rsi), %edx
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl %ecx, %edx
movl %edx, 0x60(%rsp)
movzwl 0x10(%rdi), %ecx
movl $0x3fff, %edx           # imm = 0x3FFF
andl %edx, %ecx
movq %rsi, 0x18(%rsp)
movzwl 0x10(%rsi), %esi
andl %edx, %esi
cmpw %si, %cx
cmovbl %ecx, %esi
movl %esi, 0x34(%rsp)
movq %rdi, 0xb0(%rsp)
movl 0xc(%rdi), %ecx
movl %ecx, 0x80(%rsp)
movl %r10d, %ecx
xorl $0x1, %ecx
movl %ecx, 0x54(%rsp)
movl %r13d, %ecx
imulq $0x18, %rcx, %rcx
movq %rcx, 0x38(%rsp)
imulq $0x18, %rax, %rax
movq %rbp, 0xc8(%rsp)
leaq (%rax,%rbp), %r13
addq $0x8, %r13
xorl %ebp, %ebp
xorl %edx, %edx
xorl %edi, %edi
xorl %r12d, %r12d
xorl %r14d, %r14d
cmpq %rbp, 0x38(%rsp)
je 0x1ddea2
movl 0x4(%r13,%rbp), %ebx
testl %ebx, %ebx
js 0x1ddde5
incl %edx
cmpl $0x0, 0x5c(%rsp)
je 0x1dde01
movl %edi, 0x48(%rsp)
movl %edx, 0xc(%rsp)
movl (%r13,%rbp), %esi
movq 0x10(%rsp), %rdi
callq 0x1aa250
movzbl %al, %eax
cmpl %eax, 0x58(%rsp)
jne 0x1dddf0
movl %r12d, %r15d
movl %r14d, %ebx
movq (%rsp), %r8
movl 0xc(%rsp), %edx
movl 0x48(%rsp), %edi
jmp 0x1dde93
movl %r12d, %r15d
movl %r14d, %ebx
jmp 0x1dde93
movl 0x4(%r13,%rbp), %ebx
movq (%rsp), %r8
movl 0xc(%rsp), %edx
movl 0x48(%rsp), %edi
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
cmpl %ebx, %r14d
cmoval %r14d, %ebx
movzwl 0x8(%r13,%rbp), %r15d
andl $0x3fff, %r15d          # imm = 0x3FFF
cmpl %r15d, %r12d
cmoval %r12d, %r15d
testl %edi, %edi
je 0x1dde2b
pushq $0x1
popq %rdi
jmp 0x1dde93
movq 0x80(%r8), %rax
movq 0x68(%rsp), %rcx
movl (%rax,%rcx,4), %ecx
xorl %edi, %edi
cmpl (%r13,%rbp), %ecx
jne 0x1dde93
xorq $0x1, %rcx
movl 0x54(%rsp), %esi
cmpl %esi, (%rax,%rcx,4)
jne 0x1dde93
movl %edx, %r14d
movq 0x10(%rsp), %rdi
callq 0x1dd902
cmpl 0x120(%rsp), %eax
jae 0x1dde89
movl (%r13,%rbp), %esi
movq 0x10(%rsp), %rdi
callq 0x1dd902
cmpl 0x120(%rsp), %eax
jae 0x1dde89
movq (%rsp), %r8
movl %r14d, %edx
xorl %edi, %edi
jmp 0x1dde93
pushq $0x1
popq %rdi
movq (%rsp), %r8
movl %r14d, %edx
addq $0x18, %rbp
movl %r15d, %r12d
movl %ebx, %r14d
jmp 0x1ddd91
movl 0x80(%rsp), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movl 0x60(%rsp), %eax
cmpl %eax, %esi
cmovael %eax, %esi
testl %edx, %edx
je 0x1de0a9
movzwl 0x34(%rsp), %ecx
cvtsi2sd %esi, %xmm0
movsd %xmm0, 0x80(%rsp)
cmpl $0x1, %edx
movq 0x28(%rsp), %r15
movq 0x40(%rsp), %r13
movq 0xc8(%rsp), %rax
jne 0x1de0ba
movl %ecx, 0x34(%rsp)
imulq $0x18, 0xc0(%rsp), %r9
movq 0xb8(%rsp), %rcx
leaq (%rax,%rcx), %r14
addq $0x8, %r14
xorl %r13d, %r13d
movl $0x0, 0x38(%rsp)
xorl %r15d, %r15d
xorl %r12d, %r12d
movl %edx, 0xc(%rsp)
movq %r9, 0x60(%rsp)
cmpq %r13, %r9
je 0x1de045
movl 0x4(%r14,%r13), %ebp
testl %ebp, %ebp
js 0x1ddf78
incl 0x38(%rsp)
cmpl $0x0, 0x5c(%rsp)
je 0x1ddf99
movl %edi, 0x48(%rsp)
movl (%r14,%r13), %esi
movq 0x10(%rsp), %rdi
callq 0x1aa250
movzbl %al, %eax
cmpl %eax, 0x58(%rsp)
jne 0x1ddf83
movl %r15d, %ebx
movl %r12d, %ebp
movq (%rsp), %r8
movl 0xc(%rsp), %edx
movl 0x48(%rsp), %edi
movq 0x60(%rsp), %r9
jmp 0x1de026
movl %r15d, %ebx
movl %r12d, %ebp
jmp 0x1de026
movl 0x4(%r14,%r13), %ebp
movq (%rsp), %r8
movl 0xc(%rsp), %edx
movl 0x48(%rsp), %edi
movq 0x60(%rsp), %r9
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
cmpl %ebp, %r12d
cmoval %r12d, %ebp
movzwl 0x8(%r14,%r13), %ebx
andl $0x3fff, %ebx           # imm = 0x3FFF
cmpl %ebx, %r15d
cmoval %r15d, %ebx
testl %edi, %edi
je 0x1ddfc2
pushq $0x1
popq %rdi
jmp 0x1de026
movq 0x80(%r8), %rax
movq 0xa0(%rsp), %rcx
movl (%rax,%rcx,4), %ecx
xorl %edi, %edi
cmpl (%r14,%r13), %ecx
jne 0x1de026
xorq $0x1, %rcx
movq 0x98(%rsp), %rsi
cmpl %esi, (%rax,%rcx,4)
jne 0x1de026
movq 0x10(%rsp), %rdi
callq 0x1dd902
cmpl 0x120(%rsp), %eax
jae 0x1de035
movl (%r14,%r13), %esi
movq 0x10(%rsp), %rdi
callq 0x1dd902
cmpl 0x120(%rsp), %eax
jae 0x1de035
movq (%rsp), %r8
movl 0xc(%rsp), %edx
xorl %edi, %edi
jmp 0x1ddf6e
addq $0x18, %r13
movl %ebx, %r15d
movl %ebp, %r12d
jmp 0x1ddf24
pushq $0x1
popq %rdi
movq (%rsp), %r8
movl 0xc(%rsp), %edx
jmp 0x1ddf6e
cmpl $0x0, 0x38(%rsp)
je 0x1de0a9
cmpl $0x1, 0x38(%rsp)
movq 0x40(%rsp), %r13
jne 0x1de10a
movl %edx, %eax
xorl $0x1, %eax
movl 0x38(%rsp), %ecx
xorl $0x1, %ecx
orl %eax, %ecx
setne %al
testl %edi, %edi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x1de127
cmpl $0x1, 0x38(%rsp)
setne %al
cmpl $0x1, %edx
setne %cl
andb %al, %cl
cmpb $0x1, %cl
movq 0x28(%rsp), %r15
movq 0x20(%rsp), %r12
jne 0x1de177
movl (%r12), %r14d
jmp 0x1de1ff
movq 0x28(%rsp), %r15
movq 0x20(%rsp), %r12
movq 0x40(%rsp), %r13
jmp 0x1de131
cvtsi2sd %r14d, %xmm0
mulsd 0x90(%rsp), %xmm0
movsd 0x80(%rsp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x1de12c
cmpl $0x0, 0x78(%rsp)
je 0x1ddeed
cmpl 0x74(%rsp), %ecx
jbe 0x1ddeed
cvtsi2sd %ecx, %xmm0
cvtsi2sd %r12d, %xmm1
mulsd 0x88(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1ddeed
jmp 0x1de12c
cvtsi2sd %r12d, %xmm0
mulsd 0x90(%rsp), %xmm0
movsd 0x80(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x1de13e
movq 0x28(%rsp), %r15
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %r14
incl %r13d
jmp 0x1ddbad
cmpl $0x0, 0x78(%rsp)
je 0x1de05c
movl 0x34(%rsp), %eax
cmpl 0x74(%rsp), %eax
jbe 0x1de05c
cvtsi2sdl 0x34(%rsp), %xmm0
cvtsi2sd %r15d, %xmm1
mulsd 0x88(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1de05c
jmp 0x1de127
cmpl $0x1, 0x38(%rsp)
jne 0x1de1b4
movq 0x10(%rsp), %rdi
movq 0x98(%rsp), %rbp
movl %ebp, %esi
movl 0x30(%rsp), %ebx
movl %ebx, %edx
xorl %ecx, %ecx
callq 0x1dd83f
cmpl %ebx, %eax
jae 0x1de308
movl (%r12), %r14d
cmpl $-0x1, %ebp
je 0x1de1fb
movq 0x10(%rsp), %rdi
movl %ebp, %esi
jmp 0x1de1ef
cmpl $0x1, %edx
jne 0x1de131
movq 0x10(%rsp), %rdi
movl 0x54(%rsp), %esi
movl 0x30(%rsp), %ebx
movl %ebx, %edx
xorl %ecx, %ecx
callq 0x1dd83f
cmpl %ebx, %eax
jae 0x1de308
movl (%r12), %r14d
cmpl $-0x2, 0x68(%rsp)
je 0x1de1fb
movq 0x10(%rsp), %rdi
movl 0x54(%rsp), %esi
movl 0x30(%rsp), %edx
movq %r12, %rcx
callq 0x1dd83f
movq (%rsp), %r8
movl %r14d, %ebx
movl %ebx, %ebx
cmpq %rbx, (%r12)
jbe 0x1de2a9
movq 0x10(%rsp), %rax
movq 0x10(%rax), %r15
movq 0x10(%r12), %rax
movq (%rax,%rbx,8), %rax
shrq %rax
imulq $0x28, %rax, %rax
cmpl $0x0, 0xc(%r15,%rax)
je 0x1de29d
addq %rax, %r15
xorl %r12d, %r12d
movl 0x10(%r15), %eax
cmpq %rax, %r12
jae 0x1de25c
movq 0x8(%r8), %rdi
movq 0x18(%r15), %rax
movq (%rax,%r12,8), %rsi
shrq $0x21, %rsi
callq 0x1a606e
movq (%rsp), %r8
incq %r12
jmp 0x1de235
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x20(%rsp), %r12
movq 0x10(%r12), %rax
movq (%rax,%rbx,8), %rsi
shrq %rsi
callq 0x1a606e
movq (%rsp), %r8
cmpl $0x0, 0xc(%r15)
je 0x1de29d
andq $0x0, 0xc(%r15)
movq 0x18(%r15), %rdi
callq 0x2220
movq (%rsp), %r8
andq $0x0, 0x18(%r15)
incl %ebx
movq 0x28(%rsp), %r15
jmp 0x1de202
movq %r14, (%r12)
movq 0x18(%rsp), %r14
orb $-0x80, 0xf(%r14)
movq 0xb0(%rsp), %rax
orb $-0x80, 0xf(%rax)
incl 0x7c(%rsp)
movq 0x8(%r8), %rdi
movl 0x4(%rax), %edx
movl 0x8(%rax), %ecx
movq 0x10(%rsp), %rbx
movq %rbx, %rsi
pushq $0x1
popq %rbp
movl %ebp, %r8d
callq 0x1df26a
movq (%rsp), %rax
movq 0x8(%rax), %rdi
movl 0x4(%r14), %edx
movl 0x8(%r14), %ecx
movq %rbx, %rsi
movl %ebp, %r8d
callq 0x1df26a
movq (%rsp), %r8
jmp 0x1de136
movq (%rsp), %r8
jmp 0x1de131
cmpq $0x0, 0xa8(%rsp)
jne 0x1de32d
movq 0xe0(%rsp), %rdi
callq 0x2220
movq (%rsp), %r8
cmpl $0x0, 0x7c(%rsp)
je 0x1de348
movq %r15, %rdi
movq %r8, %rbx
callq 0x694eb
movq 0x8(%rbx), %rdi
callq 0x694eb
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq