// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Overlaps.cpp
// Function: hic_clean_adv(asg_t*, ug_opt_t*)
void hic_clean_adv(asg_t *sg, ug_opt_t *uopt)
{
    uint32_t i, k, m, z, v, w, mk; ma_utg_t *u = NULL; uint32_t *ba, bn, n_vtx, beg, end, n0, n1; ma_utg_t *mz = NULL;
    ma_ug_t *ug = ma_ug_gen_primary(sg, PRIMARY_LABLE); n_vtx = ug->g->n_seq<<1; double bub_rate = 0.1;
    uint8_t *bf = NULL; bubble_type *bub = gen_bubble_chain(sg, ug, uopt, &bf, ((asm_opt.polyploidy>2)?1:0)); 
    uint64_t tLen, vocc, socc, pocc; buf_t b; memset(&b, 0, sizeof(buf_t)); CALLOC(b.a, n_vtx);
    REALLOC(bf, n_vtx); memset(bf, 0, sizeof((*bf))*n_vtx);
    kvec_t(uint64_t) buf; kv_init(buf); n0 = n1 = 0;
    for (i = 0; i < ug->g->n_seq; ++i) {
        if(ug->g->seq[i].del) continue;
        ug->g->seq[i].c = PRIMARY_LABLE;
    }

    for (i = 0; i < bub->b_ug->u.n; i++) {
        u = &(bub->b_ug->u.a[i]);
        if(u->n == 0) continue;
        for (k = 0; k < u->n; k++) {///bubble chain
            get_bubbles(bub, u->a[k]>>33, &beg, &end, &ba, &bn, NULL);///bubble
			for (m = vocc = tLen = 0; m < bn; m++) {
                bf[ba[m]] = bf[ba[m]^1] = 1; 
                tLen += ug->u.a[ba[m]>>1].len;
                if(IF_HOM((ba[m]>>1), *bub)) continue;
                if(ug->g->seq[ba[m]>>1].del) continue;
                vocc += ug->u.a[ba[m]>>1].n;
            }
            if(beg != (uint32_t)-1) tLen += ug->u.a[beg>>1].len;
            if(end != (uint32_t)-1) tLen += ug->u.a[end>>1].len;

            if(vocc) {
                for (m = buf.n = 0; m < bn; m++) {
                    v = ba[m];
                    if(ug->g->seq[v>>1].del) continue;
                    if(asg_arc_n(ug->g, v) < 2) continue;
                    if(get_real_length(ug->g, v, NULL) < 2) continue;
                    if(asg_bub_pop1_primary_trio(ug->g, NULL, v, tLen, &b, (uint32_t)-1, (uint32_t)-1, 0, NULL, NULL, NULL, 0, 0, NULL)) {
                        //beg is v, end is b.S.a[0]
                        //note b.b include end, does not include beg
                        for (z = socc = 0; z < b.b.n; z++) {
                            if(b.b.a[z]==v || b.b.a[z]==b.S.a[0]) continue;
                            socc += ug->u.a[b.b.a[z]>>1].n;
                            if((!bf[b.b.a[z]])&&(!bf[b.b.a[z]^1])) break;
                        }
                        if(z < b.b.n) continue;
                        kv_push(uint64_t, buf, ((socc<<32)|v));
                    }

                    v ^= 1;
                    if(asg_arc_n(ug->g, v) < 2) continue;
                    if(get_real_length(ug->g, v, NULL) < 2) continue;
                    if(asg_bub_pop1_primary_trio(ug->g, NULL, v, tLen, &b, (uint32_t)-1, (uint32_t)-1, 0, NULL, NULL, NULL, 0, 0, NULL)) {
                        //beg is v, end is b.S.a[0]
                        //note b.b include end, does not include beg
                        for (z = socc = 0; z < b.b.n; z++) {
                            if(b.b.a[z]==v || b.b.a[z]==b.S.a[0]) continue;
                            socc += ug->u.a[b.b.a[z]>>1].n;
                            if((!bf[b.b.a[z]])&&(!bf[b.b.a[z]^1])) break;
                        }
                        if(z < b.b.n) continue;
                        kv_push(uint64_t, buf, ((socc<<32)|v));
                    }
                }

                radix_sort_arch64(buf.a, buf.a + buf.n); 
                for (m = pocc = 0; m < buf.n; m++) {
                    v = (uint32_t)buf.a[m];
                    if(ug->g->seq[v>>1].del) continue;
                    if(asg_arc_n(ug->g, v) < 2) continue;
                    if(get_real_length(ug->g, v, NULL) < 2) continue;
                    if(asg_bub_pop1_primary_trio(ug->g, NULL, v, tLen, &b, (uint32_t)-1, (uint32_t)-1, 0, NULL, NULL, NULL, 0, 0, NULL)) {
                        //beg is v, end is b.S.a[0]
                        //note b.b include end, does not include beg
                        for (z = socc = 0; z < b.b.n; z++) {
                            if(b.b.a[z]==v || b.b.a[z]==b.S.a[0]) continue;
                            socc += ug->u.a[b.b.a[z]>>1].n;
                            if((!bf[b.b.a[z]])&&(!bf[b.b.a[z]^1])) break;
                        }
                        if(z < b.b.n) continue;
                        if((pocc+socc) >= (vocc*bub_rate)) continue;
                        pocc += socc;
                        asg_bub_pop1_primary_trio(ug->g, NULL, v, tLen, &b, (uint32_t)-1, (uint32_t)-1, 1, NULL, NULL, NULL, 0, 0, NULL);
                        for (z = 0; z < b.b.n; z++) {
                            if(b.b.a[z]==v || b.b.a[z]==b.S.a[0]) continue;
                            // socc += ug->u.a[b.b.a[i]>>1].n;
                            if(ug->g->seq[b.b.a[z]>>1].del) continue;
                            if(ug->g->seq[b.b.a[z]>>1].c != ALTER_LABLE) continue;
                            mz = &(ug->u.a[b.b.a[z]>>1]);
                            if(mz->m == 0) continue;
                            for (mk = 0; mk < mz->n; mk++) asg_seq_del(sg, mz->a[mk]>>33);
                            asg_seq_del(ug->g, b.b.a[z]>>1);
                            if(ug->u.a[b.b.a[z]>>1].m) {
                                ug->u.a[b.b.a[z]>>1].m = ug->u.a[b.b.a[z]>>1].n = 0;
                                free(ug->u.a[b.b.a[z]>>1].a); ug->u.a[b.b.a[z]>>1].a = NULL;
                            }
                        }
                        // fprintf(stderr, "+utg%.6dl\tutg%.6dl\n", (int32_t)(v>>1)+1, (int32_t)(b.S.a[0]>>1)+1);
                        n0++;
                    }
                }
            }
            for (m = 0; m < bn; m++) {
                bf[ba[m]] = bf[ba[m]^1] = 0; 
            }
        }
    }

    for (v = 0; v < ug->g->n_seq; ++v) {
        if(ug->g->seq[v].del) continue;
        if(ug->g->seq[v].c != ALTER_LABLE) continue;
        mz = &(ug->u.a[v]);
        if(mz->m == 0) continue;
        for (k = 0; k < mz->n; k++) asg_seq_del(sg, mz->a[k]>>33);
        asg_seq_del(ug->g, v);
        if(ug->u.a[v].m) {
            ug->u.a[v].m = ug->u.a[v].n = 0;
            free(ug->u.a[v].a); ug->u.a[v].a = NULL;
        }
    }
    asg_cleanup(ug->g);



    tLen = get_bub_pop_max_dist_advance(ug->g, &b);
    for (v = buf.n = 0; v < n_vtx; ++v) {
        if(ug->g->seq[v>>1].del) continue;
        if(asg_arc_n(ug->g, v) < 2) continue;
        if(get_real_length(ug->g, v, NULL) < 2) continue;
        if(asg_bub_pop1_primary_trio(ug->g, NULL, v, tLen, &b, (uint32_t)-1, (uint32_t)-1, 0, NULL, NULL, NULL, 0, 0, NULL)) {
            //beg is v, end is b.S.a[0]
            //note b.b include end, does not include beg
            for (i = socc = 0; i < b.b.n; i++) {
                if(b.b.a[i]==v || b.b.a[i]==b.S.a[0]) continue;
                socc += ug->u.a[b.b.a[i]>>1].n;
            }
            if(socc <= 16) kv_push(uint64_t, buf, ((socc<<32)|v));
        }
    }

    uint32_t convex; long long ll, tmp, max_stop_nodeLen, max_stop_baseLen;
    radix_sort_arch64(buf.a, buf.a + buf.n); 
    for (m = 0; m < buf.n; m++) {
        v = (uint32_t)buf.a[m];
        if(ug->g->seq[v>>1].del) continue;
        if(asg_arc_n(ug->g, v) < 2) continue;
        if(get_real_length(ug->g, v, NULL) < 2) continue;
        if(asg_bub_pop1_primary_trio(ug->g, NULL, v, tLen, &b, (uint32_t)-1, (uint32_t)-1, 0, NULL, NULL, NULL, 0, 0, NULL)) {
            w = b.S.a[0]^1;
            for (i = socc = 0; i < b.b.n; i++) {
                if(b.b.a[i]==v || b.b.a[i]==b.S.a[0]) continue;
                socc += ug->u.a[b.b.a[i]>>1].n;
            }
            if(socc <= 16) {
                b.b.n = 0;
                get_unitig(ug->g, NULL, v^1, &convex, &ll, &tmp, &max_stop_nodeLen, &max_stop_baseLen, 1, &b);
                for (k = vocc = 0; k < b.b.n; k++) {
                    if(IF_HOM((b.b.a[k]>>1), *bub)) break;
                    vocc += ug->u.a[b.b.a[k]>>1].n;
                }
                if((socc) >= (vocc*bub_rate)) continue;

                b.b.n = 0;
                get_unitig(ug->g, NULL, w^1, &convex, &ll, &tmp, &max_stop_nodeLen, &max_stop_baseLen, 1, &b);
                for (k = vocc = 0; k < b.b.n; k++) {
                    if(IF_HOM((b.b.a[k]>>1), *bub)) break;
                    vocc += ug->u.a[b.b.a[k]>>1].n;
                }
                if((socc) >= (vocc*bub_rate)) continue;

                asg_bub_pop1_primary_trio(ug->g, NULL, v, tLen, &b, (uint32_t)-1, (uint32_t)-1, 1, NULL, NULL, NULL, 0, 0, NULL);
                for (i = 0; i < b.b.n; i++) {
                    if(b.b.a[i]==v || b.b.a[i]==b.S.a[0]) continue;
                    // socc += ug->u.a[b.b.a[i]>>1].n;
                    if(ug->g->seq[b.b.a[i]>>1].del) continue;
                    if(ug->g->seq[b.b.a[i]>>1].c != ALTER_LABLE) continue;
                    mz = &(ug->u.a[b.b.a[i]>>1]);
                    if(mz->m == 0) continue;
                    for (mk = 0; mk < mz->n; mk++) asg_seq_del(sg, mz->a[mk]>>33);
                    asg_seq_del(ug->g, b.b.a[i]>>1);
                    if(ug->u.a[b.b.a[i]>>1].m) {
                        ug->u.a[b.b.a[i]>>1].m = ug->u.a[b.b.a[i]>>1].n = 0;
                        free(ug->u.a[b.b.a[i]>>1].a); ug->u.a[b.b.a[i]>>1].a = NULL;
                    }
                }
                // fprintf(stderr, "-utg%.6dl\tutg%.6dl\n", (int32_t)(v>>1)+1, (int32_t)(b.S.a[0]>>1)+1);
                n1++;
            }
        }
    }
    // filter_sg_by_ug(sg, ug, uopt);
    for (v = 0; v < ug->g->n_seq; ++v) {
        if(ug->g->seq[v].del) continue;
        if(ug->g->seq[v].c != ALTER_LABLE) continue;
        mz = &(ug->u.a[v]);
        if(mz->m == 0) continue;
        for (k = 0; k < mz->n; k++) asg_seq_del(sg, mz->a[k]>>33);
        asg_seq_del(ug->g, v);
        if(ug->u.a[v].m) {
            ug->u.a[v].m = ug->u.a[v].n = 0;
            free(ug->u.a[v].a); ug->u.a[v].a = NULL;
        }
    }
    asg_cleanup(ug->g);

    asg_cleanup(sg);
    free(b.a); free(b.S.a); free(b.T.a); free(b.b.a); free(b.e.a); 
    ma_ug_destroy(ug); free(bf); kv_destroy(buf);
    destory_bubbles(bub); free(bub);
    // fprintf(stderr, "[M::%s::] # type0::%u, # type1::%u\n", __func__, n0, n1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rsi, %r14
movq %rdi, %rbx
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x781bd
movq %rax, %rbp
movq 0x18(%rax), %rax
movl 0x14(%rax), %r13d
addl %r13d, %r13d
leaq 0x68(%rsp), %r12
andq $0x0, (%r12)
leaq 0x1cdf48(%rip), %rax    # 0x253758
xorl %r8d, %r8d
cmpl $0x3, 0x1bc(%rax)
setge %r8b
movq %rbx, 0x90(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rdx
movq %r12, %rcx
callq 0x1afe25
movq %rax, %rbx
xorpd %xmm0, %xmm0
movupd %xmm0, 0xf8(%rsp)
movupd %xmm0, 0xe8(%rsp)
movupd %xmm0, 0xd8(%rsp)
movupd %xmm0, 0xc8(%rsp)
movupd %xmm0, 0xb8(%rsp)
movupd %xmm0, 0xa8(%rsp)
pushq $0x1c
popq %rsi
movq %r13, %rdi
callq 0x2120
movq %rax, 0xa0(%rsp)
movq (%r12), %rdi
movq %r13, %rsi
callq 0x2370
movq %rax, (%r12)
movq %rax, %rdi
xorl %esi, %esi
movq %r13, 0x80(%rsp)
movq %r13, %rdx
callq 0x20e0
movq 0x18(%rbp), %rax
movl 0x14(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpq %rcx, %r15
jae 0x858d4
movq 0x20(%rax), %rcx
cmpl $0x0, (%rcx,%r15,8)
js 0x858cf
movb $0x0, 0x4(%rcx,%r15,8)
incq %r15
jmp 0x858b0
xorl %r14d, %r14d
xorl %ecx, %ecx
xorl %r12d, %r12d
movq $0x0, 0x70(%rsp)
movq %rbp, 0x48(%rsp)
movq %rbx, 0x60(%rsp)
movl %ecx, %ecx
movq 0xc0(%rbx), %rax
cmpq %rcx, (%rax)
jbe 0x86086
movq 0x10(%rax), %rdx
movq %rcx, 0x118(%rsp)
imulq $0x28, %rcx, %rcx
movl 0x10(%rdx,%rcx), %eax
testl %eax, %eax
je 0x86077
addq %rcx, %rdx
xorl %esi, %esi
movq %rdx, %rcx
movq %rdx, 0x120(%rsp)
movl %eax, %eax
cmpq %rax, %rsi
jae 0x86077
movq 0x18(%rcx), %rax
movq %rsi, 0x128(%rsp)
movq (%rax,%rsi,8), %rsi
shrq $0x21, %rsi
andq $0x0, (%rsp)
movq %rbx, %rdi
leaq 0x114(%rsp), %rdx
leaq 0x110(%rsp), %rcx
leaq 0x88(%rsp), %r8
leaq 0x7c(%rsp), %r9
callq 0xf6ab5
xorl %ecx, %ecx
xorl %r9d, %r9d
xorl %r15d, %r15d
movl 0x7c(%rsp), %eax
cmpq %rax, %rcx
jae 0x85a0f
movq 0x68(%rsp), %rax
movq 0x88(%rsp), %rdx
movl (%rdx,%rcx,4), %edx
xorq $0x1, %rdx
movb $0x1, %sil
movb %sil, (%rax,%rdx)
movq 0x68(%rsp), %rax
movq 0x88(%rsp), %rdx
movl (%rdx,%rcx,4), %edx
movb %sil, (%rax,%rdx)
movq 0x10(%rbp), %rax
movq 0x88(%rsp), %rdx
movl (%rdx,%rcx,4), %esi
shrl %esi
imulq $0x28, %rsi, %rdx
movq (%rbx), %rdi
movq 0x80(%rbx), %r8
movl (%rdi,%rsi,4), %edi
incq %r8
cmpq %rdi, %r8
jb 0x859fc
movq 0x18(%rbp), %rdi
movq 0x20(%rdi), %rdi
cmpl $0x0, (%rdi,%rsi,8)
js 0x859fc
leaq (%rax,%rdx), %rsi
movl 0x10(%rsi), %esi
addq %rsi, %r15
movl (%rax,%rdx), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addq %rax, %r9
incq %rcx
jmp 0x8597e
movl 0x114(%rsp), %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpq %rdx, %rcx
je 0x85a36
movq 0x10(%rbp), %rdx
shrl %ecx
imulq $0x28, %rcx, %rcx
movl (%rdx,%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r9
movl 0x110(%rsp), %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpq %rdx, %rcx
je 0x85a5d
movq 0x10(%rbp), %rdx
shrl %ecx
imulq $0x28, %rcx, %rcx
movl (%rdx,%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r9
testq %r15, %r15
je 0x86020
xorl %r14d, %r14d
movq $0x0, 0x50(%rsp)
movq %r9, 0x58(%rsp)
movl %eax, %eax
cmpq %rax, %r14
jae 0x85d12
movq 0x88(%rsp), %rax
movl (%rax,%r14,4), %r13d
movq 0x18(%rbp), %rdi
movq 0x20(%rdi), %rax
movl %r13d, %ecx
shrl %ecx
cmpl $0x0, (%rax,%rcx,8)
js 0x85d06
movq 0x28(%rdi), %rax
testl $0xfffffffe, (%rax,%r13,8) # imm = 0xFFFFFFFE
je 0x85d06
movl %r13d, %esi
xorl %edx, %edx
callq 0xc2e7a
cmpl $0x2, %eax
jl 0x85d06
movq 0x18(%rbp), %rdi
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rsp)
andq $0x0, 0x38(%rsp)
andl $0x0, 0x30(%rsp)
andl $0x0, 0x28(%rsp)
andq $0x0, 0x20(%rsp)
andl $0x0, 0x8(%rsp)
orl $-0x1, (%rsp)
xorl %esi, %esi
movl %r13d, %edx
movq 0x58(%rsp), %rcx
leaq 0xa0(%rsp), %r8
pushq $-0x1
popq %r9
callq 0x84a86
testq %rax, %rax
je 0x85bd1
movq %r12, %rdi
movq 0xb8(%rsp), %rax
movq 0xd8(%rsp), %rcx
movq 0xe8(%rsp), %rdx
xorl %esi, %esi
movq 0x68(%rsp), %r11
xorl %r12d, %r12d
movl %esi, %esi
cmpq %rsi, %rcx
jbe 0x85b85
movl (%rdx,%rsi,4), %r8d
cmpl %r13d, %r8d
je 0x85b81
cmpl (%rax), %r8d
je 0x85b81
movq 0x10(%rbp), %r9
movl %r8d, %r10d
shrl %r10d
imulq $0x28, %r10, %r10
movl 0x10(%r9,%r10), %r9d
addq %r9, %r12
cmpb $0x0, (%r11,%r8)
jne 0x85b81
xorq $0x1, %r8
cmpb $0x0, (%r11,%r8)
je 0x85d03
incl %esi
jmp 0x85b40
movq 0x70(%rsp), %rax
cmpq %rax, 0x50(%rsp)
jne 0x85bb3
leaq (%rax,%rax), %rbx
testq %rax, %rax
pushq $0x2
popq %rax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
callq 0x2370
movq %rbx, 0x70(%rsp)
jmp 0x85bb6
movq %rdi, %rax
shlq $0x20, %r12
orq %r13, %r12
movq 0x50(%rsp), %rcx
movq %r12, (%rax,%rcx,8)
incq %rcx
movq %rcx, 0x50(%rsp)
movq %rax, %r12
xorl $0x1, %r13d
movq 0x18(%rbp), %rdi
movq 0x28(%rdi), %rax
testl $0xfffffffe, (%rax,%r13,8) # imm = 0xFFFFFFFE
je 0x85d06
movl %r13d, %esi
xorl %edx, %edx
callq 0xc2e7a
cmpl $0x2, %eax
jl 0x85d06
movq 0x18(%rbp), %rdi
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rsp)
andq $0x0, 0x38(%rsp)
andl $0x0, 0x30(%rsp)
andl $0x0, 0x28(%rsp)
andq $0x0, 0x20(%rsp)
andl $0x0, 0x8(%rsp)
orl $-0x1, (%rsp)
xorl %esi, %esi
movl %r13d, %edx
movq 0x58(%rsp), %rcx
leaq 0xa0(%rsp), %r8
pushq $-0x1
popq %r9
callq 0x84a86
testq %rax, %rax
je 0x85d06
movq %r12, %rdi
movq 0xb8(%rsp), %rax
movq 0xd8(%rsp), %rcx
movq 0xe8(%rsp), %rdx
xorl %esi, %esi
movq 0x68(%rsp), %r11
xorl %r12d, %r12d
movl %esi, %esi
cmpq %rsi, %rcx
jbe 0x85cb5
movl (%rdx,%rsi,4), %r8d
cmpl %r13d, %r8d
je 0x85cb1
cmpl (%rax), %r8d
je 0x85cb1
movq 0x10(%rbp), %r9
movl %r8d, %r10d
shrl %r10d
imulq $0x28, %r10, %r10
movl 0x10(%r9,%r10), %r9d
addq %r9, %r12
cmpb $0x0, (%r11,%r8)
jne 0x85cb1
xorq $0x1, %r8
cmpb $0x0, (%r11,%r8)
je 0x85d03
incl %esi
jmp 0x85c74
movq 0x70(%rsp), %rax
cmpq %rax, 0x50(%rsp)
jne 0x85ce3
leaq (%rax,%rax), %rbx
testq %rax, %rax
pushq $0x2
popq %rax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
callq 0x2370
movq %rbx, 0x70(%rsp)
jmp 0x85ce6
movq %rdi, %rax
shlq $0x20, %r12
orq %r13, %r12
movq 0x50(%rsp), %rcx
movq %r12, (%rax,%rcx,8)
incq %rcx
movq %rcx, 0x50(%rsp)
movq %rax, %r12
jmp 0x85d06
movq %rdi, %r12
incq %r14
movl 0x7c(%rsp), %eax
jmp 0x85a77
movq 0x50(%rsp), %rax
leaq (%r12,%rax,8), %rsi
movq %r12, %rdi
callq 0x66c25
movq %r15, %xmm0
punpckldq 0x15d540(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x15d548(%rip), %xmm0   # 0x1e3280
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x15cea4(%rip), %xmm1   # 0x1e2bf0
movapd %xmm1, 0x150(%rsp)
xorl %r14d, %r14d
xorl %ebx, %ebx
movq %r12, 0x98(%rsp)
movl %r14d, %r14d
cmpq %r14, 0x50(%rsp)
jbe 0x86018
movq (%r12,%r14,8), %r13
movq 0x18(%rbp), %rdi
movq 0x20(%rdi), %rax
movl %r13d, %ecx
shrl %ecx
cmpl $0x0, (%rax,%rcx,8)
js 0x86010
movq 0x28(%rdi), %rax
movl %r13d, %ecx
testl $0xfffffffe, (%rax,%rcx,8) # imm = 0xFFFFFFFE
je 0x86010
movl %r13d, %esi
xorl %edx, %edx
callq 0xc2e7a
cmpl $0x2, %eax
jl 0x86010
movq 0x18(%rbp), %rdi
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rsp)
andq $0x0, 0x38(%rsp)
andl $0x0, 0x30(%rsp)
andl $0x0, 0x28(%rsp)
andq $0x0, 0x20(%rsp)
andl $0x0, 0x8(%rsp)
orl $-0x1, (%rsp)
xorl %esi, %esi
movl %r13d, %edx
movq 0x58(%rsp), %rcx
leaq 0xa0(%rsp), %r8
pushq $-0x1
popq %r9
callq 0x84a86
testq %rax, %rax
je 0x86010
movq 0xb8(%rsp), %rax
movq 0xd8(%rsp), %r11
movq 0xe8(%rsp), %rdx
xorl %esi, %esi
movq 0x68(%rsp), %rdi
xorl %r15d, %r15d
movq 0x58(%rsp), %rcx
movl %esi, %esi
cmpq %rsi, %r11
jbe 0x85e6f
movl (%rdx,%rsi,4), %r8d
cmpl %r13d, %r8d
je 0x85e6b
cmpl (%rax), %r8d
je 0x85e6b
movq 0x10(%rbp), %r9
movl %r8d, %r10d
shrl %r10d
imulq $0x28, %r10, %r10
movl 0x10(%r9,%r10), %r9d
addq %r9, %r15
cmpb $0x0, (%rdi,%r8)
jne 0x85e6b
xorq $0x1, %r8
cmpb $0x0, (%rdi,%r8)
je 0x86010
incl %esi
jmp 0x85e2a
addq %rbx, %r15
movq %r15, %xmm0
punpckldq 0x15d3f1(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x15d3f9(%rip), %xmm0   # 0x1e3280
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
ucomisd 0x150(%rsp), %xmm1
jae 0x86010
movq 0x18(%rbp), %rdi
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rsp)
andq $0x0, 0x38(%rsp)
andl $0x0, 0x30(%rsp)
andl $0x0, 0x28(%rsp)
andq $0x0, 0x20(%rsp)
orl $-0x1, (%rsp)
movl $0x1, 0x8(%rsp)
xorl %r12d, %r12d
xorl %esi, %esi
movl %r13d, %edx
leaq 0xa0(%rsp), %r8
pushq $-0x1
popq %r9
callq 0x84a86
movl %r12d, %r12d
cmpq %r12, 0xd8(%rsp)
jbe 0x86005
movq 0xe8(%rsp), %rax
movl (%rax,%r12,4), %eax
cmpl %r13d, %eax
je 0x85ffd
movq 0xb8(%rsp), %rcx
cmpl (%rcx), %eax
je 0x85ffd
movq 0x18(%rbp), %rcx
movq 0x20(%rcx), %rcx
shrl %eax
cmpl $0x0, (%rcx,%rax,8)
js 0x85ffd
cmpb $0x1, 0x4(%rcx,%rax,8)
jne 0x85ffd
movq 0x10(%rbp), %rbx
imulq $0x28, %rax, %rax
cmpl $0x0, 0xc(%rbx,%rax)
je 0x85ffd
addq %rax, %rbx
xorl %ebp, %ebp
movl 0x10(%rbx), %eax
cmpq %rax, %rbp
jae 0x85f7e
movq 0x18(%rbx), %rax
movq (%rax,%rbp,8), %rsi
shrq $0x21, %rsi
movq 0x90(%rsp), %rdi
callq 0x6f8da
incq %rbp
jmp 0x85f58
movq 0x48(%rsp), %rbp
movq 0x18(%rbp), %rdi
movq 0xe8(%rsp), %rax
movl (%rax,%r12,4), %esi
shrl %esi
callq 0x6f8da
movq 0x10(%rbp), %rax
movq 0xe8(%rsp), %rcx
movl (%rcx,%r12,4), %edx
shrl %edx
imulq $0x28, %rdx, %rdx
cmpl $0x0, 0xc(%rax,%rdx)
je 0x85ffd
addq %rax, %rdx
andl $0x0, 0x10(%rdx)
movl (%rcx,%r12,4), %edx
shrl %edx
imulq $0x28, %rdx, %rdx
andl $0x0, 0xc(%rax,%rdx)
movl (%rcx,%r12,4), %ecx
shrl %ecx
imulq $0x28, %rcx, %rcx
movq 0x18(%rax,%rcx), %rdi
callq 0x2220
movq 0x10(%rbp), %rax
movq 0xe8(%rsp), %rcx
movl (%rcx,%r12,4), %ecx
shrl %ecx
imulq $0x28, %rcx, %rcx
andq $0x0, 0x18(%rax,%rcx)
incl %r12d
jmp 0x85eeb
movq %r15, %rbx
movq 0x98(%rsp), %r12
incl %r14d
jmp 0x85d62
movq 0x60(%rsp), %rbx
xorl %r14d, %r14d
xorl %eax, %eax
movl 0x7c(%rsp), %ecx
cmpq %rcx, %rax
jae 0x8605c
movq 0x68(%rsp), %rcx
movq 0x88(%rsp), %rdx
movl (%rdx,%rax,4), %edx
xorq $0x1, %rdx
movb %r14b, (%rcx,%rdx)
movq 0x68(%rsp), %rcx
movq 0x88(%rsp), %rdx
movl (%rdx,%rax,4), %edx
movb %r14b, (%rcx,%rdx)
incq %rax
jmp 0x86022
movq 0x128(%rsp), %rsi
incq %rsi
movq 0x120(%rsp), %rcx
movl 0x10(%rcx), %eax
jmp 0x8592d
movq 0x118(%rsp), %rcx
incl %ecx
jmp 0x858ef
xorl %r13d, %r13d
movq 0x18(%rbp), %rdi
movl 0x14(%rdi), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %r13
jae 0x86134
movq 0x20(%rdi), %rax
cmpl $0x0, (%rax,%r13,8)
js 0x86127
cmpb $0x1, 0x4(%rax,%r13,8)
jne 0x86127
movq 0x10(%rbp), %rbx
imulq $0x28, %r13, %r14
cmpl $0x0, 0xc(%rbx,%r14)
je 0x86127
addq %r14, %rbx
xorl %r15d, %r15d
movl 0x10(%rbx), %eax
cmpq %rax, %r15
jae 0x860ed
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %rsi
shrq $0x21, %rsi
movq 0x90(%rsp), %rdi
callq 0x6f8da
incq %r15
jmp 0x860c7
movq 0x18(%rbp), %rdi
movl %r13d, %esi
callq 0x6f8da
movq 0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax,%r14)
je 0x86127
leaq (%rax,%r14), %rcx
andl $0x0, 0x10(%rcx)
andl $0x0, 0xc(%rax,%r14)
movq 0x18(%rax,%r14), %rdi
callq 0x2220
movq 0x10(%rbp), %rax
andq $0x0, 0x18(%rax,%r14)
incq %r13
movq 0x60(%rsp), %rbx
jmp 0x86089
callq 0x694eb
movq 0x18(%rbp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x84975
movq %rax, 0x50(%rsp)
xorl %r13d, %r13d
movq $0x0, 0x58(%rsp)
movq 0x80(%rsp), %rdx
movq 0x70(%rsp), %r15
cmpq %rdx, %r13
je 0x862b1
movq 0x18(%rbp), %rdi
movq 0x20(%rdi), %rax
movl %r13d, %ecx
shrl %ecx
cmpl $0x0, (%rax,%rcx,8)
js 0x862a9
movq 0x28(%rdi), %rax
testl $0xfffffffe, (%rax,%r13,8) # imm = 0xFFFFFFFE
je 0x862a9
movl %r13d, %esi
xorl %edx, %edx
callq 0xc2e7a
cmpl $0x2, %eax
jl 0x862a1
movq 0x18(%rbp), %rdi
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rsp)
andq $0x0, 0x38(%rsp)
andl $0x0, 0x30(%rsp)
andl $0x0, 0x28(%rsp)
andq $0x0, 0x20(%rsp)
andl $0x0, 0x8(%rsp)
orl $-0x1, (%rsp)
xorl %esi, %esi
movl %r13d, %edx
movq 0x50(%rsp), %rcx
leaq 0xa0(%rsp), %r8
pushq $-0x1
popq %r9
callq 0x84a86
testq %rax, %rax
je 0x862a1
movq 0xb8(%rsp), %rax
movq 0xd8(%rsp), %rcx
movq 0xe8(%rsp), %rdx
xorl %esi, %esi
xorl %r14d, %r14d
movl %esi, %esi
cmpq %rsi, %rcx
jbe 0x86244
movl (%rdx,%rsi,4), %edi
cmpq %rdi, %r13
je 0x86240
cmpl (%rax), %edi
je 0x86240
movq 0x10(%rbp), %r8
shrl %edi
imulq $0x28, %rdi, %rdi
movl 0x10(%r8,%rdi), %edi
addq %rdi, %r14
incl %esi
jmp 0x8621b
cmpq $0x10, %r14
ja 0x8629c
cmpq %r15, 0x58(%rsp)
jne 0x86275
leaq (%r15,%r15), %rbx
testq %r15, %r15
pushq $0x2
popq %rax
cmoveq %rax, %rbx
leaq (,%rbx,8), %rsi
movq %r12, %rdi
callq 0x2370
movq %rax, %r12
movq %rbx, %r15
movq 0x80(%rsp), %rdx
shlq $0x20, %r14
orq %r13, %r14
movq 0x58(%rsp), %rax
movq %r14, (%r12,%rax,8)
incq %rax
movq %rax, 0x58(%rsp)
movq 0x60(%rsp), %rbx
jmp 0x862a9
movq 0x60(%rsp), %rbx
movq 0x80(%rsp), %rdx
incq %r13
jmp 0x86168
movq 0x58(%rsp), %r15
leaq (%r12,%r15,8), %rsi
movq %r12, 0x98(%rsp)
movq %r12, %rdi
callq 0x66c25
xorl %r12d, %r12d
movl %r12d, %r12d
cmpq %r12, %r15
jbe 0x86757
movq 0x98(%rsp), %rax
movq (%rax,%r12,8), %r13
movq 0x18(%rbp), %rdi
movq 0x20(%rdi), %rax
movl %r13d, %ecx
shrl %ecx
cmpl $0x0, (%rax,%rcx,8)
js 0x86745
movq 0x28(%rdi), %rax
movl %r13d, %ecx
testl $0xfffffffe, (%rax,%rcx,8) # imm = 0xFFFFFFFE
je 0x86745
movl %r13d, %esi
xorl %edx, %edx
callq 0xc2e7a
cmpl $0x2, %eax
jl 0x86745
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rdi
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rsp)
andq $0x0, 0x38(%rsp)
andl $0x0, 0x30(%rsp)
andl $0x0, 0x28(%rsp)
andq $0x0, 0x20(%rsp)
andl $0x0, 0x8(%rsp)
orl $-0x1, (%rsp)
xorl %esi, %esi
movl %r13d, %edx
movq 0x50(%rsp), %rcx
leaq 0xa0(%rsp), %r8
pushq $-0x1
popq %r9
callq 0x84a86
testq %rax, %rax
je 0x86745
movq 0xb8(%rsp), %rcx
movq 0xd8(%rsp), %rax
movl (%rcx), %ebp
xorl %ecx, %ecx
movq 0xe8(%rsp), %rdx
xorl %r14d, %r14d
movl %ecx, %ecx
cmpq %rcx, %rax
jbe 0x863d0
movl (%rdx,%rcx,4), %esi
cmpl %r13d, %esi
sete %dil
cmpl %ebp, %esi
sete %r8b
orb %dil, %r8b
jne 0x863cc
movl %esi, %esi
movq 0x48(%rsp), %rdi
movq 0x10(%rdi), %rdi
shrl %esi
imulq $0x28, %rsi, %rsi
movl 0x10(%rdi,%rsi), %esi
addq %rsi, %r14
incl %ecx
jmp 0x86398
cmpq $0x10, %r14
ja 0x86745
andq $0x0, 0xd8(%rsp)
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rdi
movl %r13d, %edx
xorl $0x1, %edx
leaq 0xa0(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x130(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x138(%rsp), %rax
movq %rax, (%rsp)
movl $0x1, 0x10(%rsp)
xorl %r15d, %r15d
xorl %esi, %esi
leaq 0x10c(%rsp), %rcx
leaq 0x148(%rsp), %r8
leaq 0x140(%rsp), %r9
callq 0xc2ebf
movq 0xd8(%rsp), %rax
movq 0xe8(%rsp), %rdx
xorl %ecx, %ecx
movl %r15d, %r15d
cmpq %r15, %rax
jbe 0x86495
movl (%rdx,%r15,4), %esi
shrl %esi
movq 0x60(%rsp), %r8
movq (%r8), %rdi
movq 0x80(%r8), %r8
movl (%rdi,%rsi,4), %edi
incq %r8
cmpq %rdi, %r8
jb 0x86495
movq 0x48(%rsp), %rdi
movq 0x10(%rdi), %rdi
imulq $0x28, %rsi, %rsi
movl 0x10(%rdi,%rsi), %esi
addq %rsi, %rcx
incl %r15d
jmp 0x86454
cvtsi2sd %r14, %xmm2
movq %rcx, %xmm0
punpckldq 0x15cdc9(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x15cdd1(%rip), %xmm0   # 0x1e3280
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x15c72d(%rip), %xmm1   # 0x1e2bf0
ucomisd %xmm1, %xmm2
movq 0x58(%rsp), %r15
jae 0x86745
andq $0x0, 0xd8(%rsp)
movq 0x48(%rsp), %rbx
movq 0x18(%rbx), %rdi
leaq 0xa0(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x130(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x138(%rsp), %rax
movq %rax, (%rsp)
movl $0x1, 0x10(%rsp)
xorl %r14d, %r14d
xorl %esi, %esi
movl %ebp, %edx
leaq 0x10c(%rsp), %rcx
leaq 0x148(%rsp), %r8
leaq 0x140(%rsp), %r9
movsd %xmm2, 0x70(%rsp)
callq 0xc2ebf
movsd 0x70(%rsp), %xmm2
movq 0xd8(%rsp), %rax
movq 0xe8(%rsp), %rcx
xorl %edx, %edx
movl %r14d, %r14d
cmpq %r14, %rax
jbe 0x86590
movl (%rcx,%r14,4), %esi
shrl %esi
movq 0x60(%rsp), %r8
movq (%r8), %rdi
movq 0x80(%r8), %r8
movl (%rdi,%rsi,4), %edi
incq %r8
cmpq %rdi, %r8
jb 0x86590
movq 0x10(%rbx), %rdi
imulq $0x28, %rsi, %rsi
movl 0x10(%rdi,%rsi), %esi
addq %rsi, %rdx
incl %r14d
jmp 0x86554
movq %rdx, %xmm0
punpckldq 0x15ccd3(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x15ccdb(%rip), %xmm0   # 0x1e3280
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd 0x15c637(%rip), %xmm1   # 0x1e2bf0
ucomisd %xmm1, %xmm2
jae 0x86745
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rdi
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rsp)
andq $0x0, 0x38(%rsp)
andl $0x0, 0x30(%rsp)
andl $0x0, 0x28(%rsp)
andq $0x0, 0x20(%rsp)
orl $-0x1, (%rsp)
movl $0x1, 0x8(%rsp)
xorl %r14d, %r14d
xorl %esi, %esi
movl %r13d, %edx
movq 0x50(%rsp), %rcx
leaq 0xa0(%rsp), %r8
pushq $-0x1
popq %r9
callq 0x84a86
movl %r14d, %r14d
cmpq %r14, 0xd8(%rsp)
jbe 0x86745
movq 0xe8(%rsp), %rax
movl (%rax,%r14,4), %eax
cmpl %r13d, %eax
je 0x8673d
movq 0xb8(%rsp), %rcx
cmpl (%rcx), %eax
je 0x8673d
movq 0x48(%rsp), %rcx
movq 0x18(%rcx), %rcx
movq 0x20(%rcx), %rcx
shrl %eax
cmpl $0x0, (%rcx,%rax,8)
js 0x8673d
cmpb $0x1, 0x4(%rcx,%rax,8)
jne 0x8673d
movq 0x48(%rsp), %rcx
movq 0x10(%rcx), %rbx
imulq $0x28, %rax, %rax
cmpl $0x0, 0xc(%rbx,%rax)
je 0x8673d
addq %rax, %rbx
xorl %r15d, %r15d
movq 0x48(%rsp), %rbp
movl 0x10(%rbx), %eax
cmpq %rax, %r15
jae 0x866b9
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %rsi
shrq $0x21, %rsi
movq 0x90(%rsp), %rdi
callq 0x6f8da
incq %r15
jmp 0x86693
movq 0x18(%rbp), %rdi
movq 0xe8(%rsp), %rax
movl (%rax,%r14,4), %esi
shrl %esi
callq 0x6f8da
movq 0x10(%rbp), %rax
movq 0xe8(%rsp), %rcx
movl (%rcx,%r14,4), %edx
shrl %edx
imulq $0x28, %rdx, %rdx
cmpl $0x0, 0xc(%rax,%rdx)
movq 0x58(%rsp), %r15
je 0x8673d
addq %rax, %rdx
andl $0x0, 0x10(%rdx)
movl (%rcx,%r14,4), %edx
shrl %edx
imulq $0x28, %rdx, %rdx
andl $0x0, 0xc(%rax,%rdx)
movl (%rcx,%r14,4), %ecx
shrl %ecx
imulq $0x28, %rcx, %rcx
movq 0x18(%rax,%rcx), %rdi
callq 0x2220
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rax
movq 0xe8(%rsp), %rcx
movl (%rcx,%r14,4), %ecx
shrl %ecx
imulq $0x28, %rcx, %rcx
andq $0x0, 0x18(%rax,%rcx)
incl %r14d
jmp 0x86616
incl %r12d
movq 0x48(%rsp), %rbp
movq 0x60(%rsp), %rbx
jmp 0x862cd
xorl %r13d, %r13d
movq 0x98(%rsp), %r12
movq 0x18(%rbp), %rdi
movl 0x14(%rdi), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %r13
jae 0x8680d
movq 0x20(%rdi), %rax
cmpl $0x0, (%rax,%r13,8)
js 0x86800
cmpb $0x1, 0x4(%rax,%r13,8)
jne 0x86800
movq 0x10(%rbp), %rbx
imulq $0x28, %r13, %r14
cmpl $0x0, 0xc(%rbx,%r14)
je 0x86800
addq %r14, %rbx
xorl %r15d, %r15d
movl 0x10(%rbx), %eax
cmpq %rax, %r15
jae 0x867c6
movq 0x18(%rbx), %rax
movq (%rax,%r15,8), %rsi
shrq $0x21, %rsi
movq 0x90(%rsp), %rdi
callq 0x6f8da
incq %r15
jmp 0x867a0
movq 0x18(%rbp), %rdi
movl %r13d, %esi
callq 0x6f8da
movq 0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax,%r14)
je 0x86800
leaq (%rax,%r14), %rcx
andl $0x0, 0x10(%rcx)
andl $0x0, 0xc(%rax,%r14)
movq 0x18(%rax,%r14), %rdi
callq 0x2220
movq 0x10(%rbp), %rax
andq $0x0, 0x18(%rax,%r14)
incq %r13
movq 0x60(%rsp), %rbx
jmp 0x86762
callq 0x694eb
movq 0x90(%rsp), %rdi
callq 0x694eb
movq 0xa0(%rsp), %rdi
callq 0x2220
movq 0xb8(%rsp), %rdi
callq 0x2220
movq 0xd0(%rsp), %rdi
callq 0x2220
movq 0xe8(%rsp), %rdi
callq 0x2220
movq 0x100(%rsp), %rdi
callq 0x2220
movq %rbp, %rdi
callq 0x6921d
movq 0x68(%rsp), %rdi
callq 0x2220
movq %r12, %rdi
callq 0x2220
movq %rbx, %rdi
callq 0xf6a60
movq %rbx, %rdi
callq 0x2220
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq