// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Overlaps.cpp
// Function: detect_chimeric_by_topo(asg_t*, ma_ug_t*, asg_t*, ma_hit_t_alloc*, long long, unsigned int, float, R_to_U*, utg_trans_t*, unsigned char*)
int detect_chimeric_by_topo(asg_t *g, ma_ug_t *ug, asg_t *read_sg, 
ma_hit_t_alloc* reverse_sources, long long miniedgeLen, uint32_t stops_threshold, float drop_rate,
R_to_U* ruIndex, utg_trans_t *o, uint8_t* is_r_het)
{
    double startTime = Get_T();
    uint32_t i, k, v_i, v_beg, v_end, selfLen, w1, w2, wv, nw, n_vtx = g->n_seq * 2, n_reduced = 0, convex, convex_T, read_num;
    asg_arc_t *aw;
    long long ll, tmp, max_stop_nodeLen, max_stop_baseLen;

    buf_t b_0, b_1;
    memset(&b_0, 0, sizeof(buf_t));
    memset(&b_1, 0, sizeof(buf_t));


    for (v_i = 0; v_i < n_vtx; ++v_i) 
    {
        v_beg = v_i;
        ///some node could be deleted
        if (g->seq[v_beg>>1].del || g->seq[v_beg>>1].c == ALTER_LABLE) continue;
        if(get_real_length(g, v_beg, NULL) != 1) continue;

        get_real_length(g, v_beg, &w1);
        if(get_real_length(g, w1^1, NULL)<=1) continue;

        if(get_unitig(g, ug, v_beg^1, &v_end, &ll, &tmp, &max_stop_nodeLen, &max_stop_baseLen, 
        1, NULL)==LOOP)
        {
            continue;
        }
        selfLen = ll;
        if(get_real_length(g, v_end, NULL) != 1) continue;


        get_real_length(g, v_end, &w2);
        if(get_real_length(g, w2^1, NULL)<=1) continue;

        get_unitig(g, ug, w1, &convex, &ll, &tmp, &max_stop_nodeLen, &max_stop_baseLen, 
        stops_threshold, NULL);
        if(ll*drop_rate < selfLen) continue;
        if(ll*0.4 > max_stop_nodeLen) continue;

        get_unitig(g, ug, w2, &convex, &ll, &tmp, &max_stop_nodeLen, &max_stop_baseLen, 
        stops_threshold, NULL);
        if(ll*drop_rate < selfLen) continue;
        if(ll*0.4 > max_stop_nodeLen) continue;

        stops_threshold++;


        w1 = w1^1;wv=v_beg^1;aw = asg_arc_a(g, w1); nw = asg_arc_n(g, w1);convex_T = (uint32_t)-1;
        for (i = 0; i < nw; i++)
        {
            if(aw[i].del) continue;

            get_unitig(g, ug, aw[i].v, &convex, &ll, &tmp, &max_stop_nodeLen, &max_stop_baseLen, 
            stops_threshold, NULL);
            if(ll*drop_rate < selfLen) break;
            if(ll*0.4 > max_stop_nodeLen) continue;

            if((aw[i].v>>1)==(v_beg>>1))
            {
                if(convex_T != (uint32_t)-1) break;
                convex_T = convex;
            }
        }
        if(i!=nw) continue;

        for (i = 0; i < nw; i++)
        {
            if(aw[i].del) continue;
            if((aw[i].v>>1) == (v_beg>>1)) continue;

            b_0.b.n = 0;
            get_unitig(g, ug, aw[i].v, &convex, &ll, &tmp, &max_stop_nodeLen, &max_stop_baseLen, 
            stops_threshold, &b_0);
            ///if(convex == convex_T) break;
            for (k = 0; k < b_0.b.n; k++)
            {
                if((b_0.b.a[k]>>1) == (convex_T>>1)) break;
            }
            if(k != b_0.b.n) break;
            
            if(check_different_haps(g, ug, read_sg, wv, aw[i].v, reverse_sources, &b_0, &b_1, 
            ruIndex, is_r_het, miniedgeLen, stops_threshold)==PLOID)
            {
                break;
            }
        }
        if(i!=nw) continue;





        w2 = w2^1;wv=v_end^1;aw = asg_arc_a(g, w2); nw = asg_arc_n(g, w2);convex_T = (uint32_t)-1;
        for (i = 0; i < nw; i++)
        {
            if(aw[i].del) continue;

            
            get_unitig(g, ug, aw[i].v, &convex, &ll, &tmp, &max_stop_nodeLen, &max_stop_baseLen, 
            stops_threshold, NULL);
            if(ll*drop_rate < selfLen) break;
            if(ll*0.4 > max_stop_nodeLen) continue;

            if((aw[i].v>>1) == (v_end>>1))
            {
                if(convex_T != (uint32_t)-1) break;
                convex_T = convex;
            }
        }
        if(i!=nw) continue;

        for (i = 0; i < nw; i++)
        {
            if(aw[i].del) continue;
            if((aw[i].v>>1) == (v_end>>1)) continue;

            b_0.b.n = 0;
            get_unitig(g, ug, aw[i].v, &convex, &ll, &tmp, &max_stop_nodeLen, &max_stop_baseLen, 
            stops_threshold, &b_0);
            ///if(convex == convex_T) break;
            for (k = 0; k < b_0.b.n; k++)
            {
                if((b_0.b.a[k]>>1) == (convex_T>>1)) break;
            }
            if(k != b_0.b.n) break;

            if(check_different_haps(g, ug, read_sg, wv, aw[i].v, reverse_sources, &b_0, &b_1, 
            ruIndex, is_r_het, miniedgeLen, stops_threshold)==PLOID)
            {
                break;
            }
        }
        if(i!=nw) continue;

        n_reduced++;
        b_0.b.n = 0;
        read_num = 0;
        get_unitig(g, ug, v_beg^1, &v_end, &ll, &tmp, &max_stop_nodeLen, &max_stop_baseLen, 1, &b_0);
        for (k = 0; k < b_0.b.n; k++)
        {
            g->seq[b_0.b.a[k]>>1].c = ALTER_LABLE;
            read_num += ug->u.a[b_0.b.a[k]>>1].n;
        }

        for (k = 0; k < b_0.b.n; k++)
        {
            asg_seq_drop(g, b_0.b.a[k]>>1);
            if(o) asg_seq_del(o->cug->g, b_0.b.a[k]>>1);
        }

        if(read_num <= CHIMERIC_TRIM_THRES)
        {
            for (k = 0; k < b_0.b.n; k++)
            {
                g->seq[b_0.b.a[k]>>1].c = CUT;
            }
        }

    }

    if(o) asg_cleanup(o->cug->g);
    asg_cleanup(g);
    free(b_0.b.a);
    free(b_1.b.a);
    
    if(VERBOSE >= 1)
    {
        fprintf(stderr, "[M::%s] removed %d long tips\n", 
        __func__, n_reduced);
        fprintf(stderr, "[M::%s] takes %0.2f s\n\n", __func__, Get_T()-startTime);
    }
    

    return n_reduced;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movss %xmm0, 0x74(%rsp)
movq %r9, 0x58(%rsp)
movq %r8, 0xb8(%rsp)
movq %rcx, 0xb0(%rsp)
movq %rdx, 0xa8(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdi, %rbx
callq 0x300fc
movl 0x14(%rbx), %eax
xorl %ecx, %ecx
xorps %xmm0, %xmm0
movaps %xmm0, 0xc0(%rsp)
movaps %xmm0, 0xd0(%rsp)
movaps %xmm0, 0xe0(%rsp)
movaps %xmm0, 0xf0(%rsp)
movaps %xmm0, 0x100(%rsp)
movaps %xmm0, 0x110(%rsp)
movq %rcx, 0x120(%rsp)
movaps %xmm0, 0x130(%rsp)
movaps %xmm0, 0x140(%rsp)
movaps %xmm0, 0x150(%rsp)
movaps %xmm0, 0x160(%rsp)
movaps %xmm0, 0x170(%rsp)
movaps %xmm0, 0x180(%rsp)
movq $0x0, 0x98(%rsp)
movq %rcx, 0x190(%rsp)
addl %eax, %eax
je 0xd0a8a
movl %eax, %ebp
xorl %r13d, %r13d
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
movq $0x0, 0x98(%rsp)
movq 0x20(%rbx), %rax
movl %r13d, %r12d
shrl %r12d
cmpl $0x0, (%rax,%r12,8)
js 0xd0046
cmpb $0x1, 0x4(%rax,%r12,8)
je 0xd0046
movq 0x28(%rbx), %rax
movq (%rax,%r13,8), %rcx
movq %rcx, %rdx
andq %r11, %rdx
je 0xd0046
movq 0x8(%rbx), %rdi
shrq $0x20, %rcx
leaq (%rcx,%rcx,2), %rsi
leaq (%rdi,%rsi,8), %rdi
addq $0xc, %rdi
leaq (,%rdx,8), %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
movl (%rdi,%r8), %r10d
notl %r10d
shrl $0x1f, %r10d
addl %r10d, %r9d
addq $0x18, %r8
cmpq %r8, %rcx
jne 0xcfe76
cmpl $0x1, %r9d
jne 0xd0046
testq %rdx, %rdx
je 0xcfebe
movq 0x8(%rbx), %rdx
leaq (%rdx,%rsi,8), %rdx
addq $0xc, %rdx
xorl %esi, %esi
cmpl $0x0, (%rdx,%rsi)
js 0xcfeb5
movl -0x4(%rdx,%rsi), %r14d
addq $0x18, %rsi
cmpq %rsi, %rcx
jne 0xcfeaa
movl %r14d, %r15d
xorl $0x1, %r15d
movq (%rax,%r15,8), %rax
movq %rax, %rcx
andq %r11, %rcx
je 0xd0046
movq 0x8(%rbx), %rdx
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
leaq (%rdx,%rax,8), %rax
addq $0xc, %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %edx, %edx
xorl %esi, %esi
movl (%rax,%rdx), %edi
notl %edi
shrl $0x1f, %edi
addl %edi, %esi
addq $0x18, %rdx
cmpq %rdx, %rcx
jne 0xcfef5
cmpl $0x2, %esi
jl 0xd0046
movl %r13d, %edx
xorl $0x1, %edx
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
movl %edx, 0x90(%rsp)
leaq 0x44(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x80(%rsp), %r9
pushq $0x0
pushq $0x1
leaq 0x88(%rsp), %rax
pushq %rax
leaq 0x50(%rsp), %rax
pushq %rax
callq 0x10109f
addq $0x20, %rsp
cmpl $0x7, %eax
jne 0xcff64
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
jmp 0xd0046
movl 0x44(%rsp), %ecx
movq 0x28(%rbx), %rax
movq (%rax,%rcx,8), %rcx
movq %rcx, %rdx
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
andq %r11, %rdx
je 0xd0046
movl 0x20(%rsp), %esi
movl %esi, 0x50(%rsp)
movq 0x8(%rbx), %rdi
shrq $0x20, %rcx
leaq (%rcx,%rcx,2), %rsi
leaq (%rdi,%rsi,8), %rdi
addq $0xc, %rdi
leaq (,%rdx,8), %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
movl (%rdi,%r8), %r10d
notl %r10d
shrl $0x1f, %r10d
addl %r10d, %r9d
addq $0x18, %r8
cmpq %r8, %rcx
jne 0xcffb0
cmpl $0x1, %r9d
jne 0xd0046
testq %rdx, %rdx
je 0xcfff7
movq 0x8(%rbx), %rdx
leaq (%rdx,%rsi,8), %rdx
addq $0xc, %rdx
xorl %esi, %esi
cmpl $0x0, (%rdx,%rsi)
js 0xcffee
movl -0x4(%rdx,%rsi), %edi
movl %edi, 0x8(%rsp)
addq $0x18, %rsi
cmpq %rsi, %rcx
jne 0xcffe0
movl 0x8(%rsp), %ecx
movl %ecx, %r8d
xorl $0x1, %r8d
movq (%rax,%r8,8), %rax
movq %rax, %rcx
andq %r11, %rcx
je 0xd0046
movq 0x8(%rbx), %rdx
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
leaq (%rdx,%rax,8), %rax
addq $0xc, %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %edx, %edx
xorl %esi, %esi
movl (%rax,%rdx), %edi
notl %edi
shrl $0x1f, %edi
addl %edi, %esi
addq $0x18, %rdx
cmpq %rdx, %rcx
jne 0xd002e
cmpl $0x2, %esi
jge 0xd0057
incq %r13
cmpq %rbp, %r13
jne 0xcfe1b
jmp 0xd0a8a
movq %r8, 0x18(%rsp)
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
movl %r14d, %edx
leaq 0x14(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x80(%rsp), %r9
pushq $0x0
pushq 0x60(%rsp)
leaq 0x88(%rsp), %rax
pushq %rax
leaq 0x50(%rsp), %rax
pushq %rax
callq 0x10109f
addq $0x20, %rsp
movq 0x20(%rsp), %rax
cvtsi2ss %rax, %xmm0
movl 0x50(%rsp), %ecx
cvtsi2ss %rcx, %xmm1
mulss 0x74(%rsp), %xmm0
movss %xmm1, 0x50(%rsp)
ucomiss %xmm0, %xmm1
ja 0xcff59
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x1553f1(%rip), %xmm0   # 0x2254c0
xorps %xmm1, %xmm1
cvtsi2sdq 0x38(%rsp), %xmm1
ucomisd %xmm1, %xmm0
ja 0xcff59
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
movl 0x8(%rsp), %edx
leaq 0x14(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x80(%rsp), %r9
pushq $0x0
pushq 0x60(%rsp)
leaq 0x88(%rsp), %rax
pushq %rax
leaq 0x50(%rsp), %rax
pushq %rax
callq 0x10109f
addq $0x20, %rsp
movq 0x20(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
mulss 0x74(%rsp), %xmm0
movss 0x50(%rsp), %xmm1
ucomiss %xmm0, %xmm1
ja 0xcff59
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x15536f(%rip), %xmm0   # 0x2254c0
xorps %xmm1, %xmm1
cvtsi2sdq 0x38(%rsp), %xmm1
ucomisd %xmm1, %xmm0
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
ja 0xd0046
movq 0x58(%rsp), %rax
incl %eax
movq %rax, 0x58(%rsp)
movq 0x8(%rbx), %rsi
movq 0x28(%rbx), %rax
movq (%rax,%r15,8), %rdx
movq %rdx, %rax
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
testl %edx, %edx
movq %rdx, 0x48(%rsp)
je 0xd02ae
movl %edx, %ecx
movq %rcx, 0x88(%rsp)
movq %rsi, 0x60(%rsp)
movq %rax, 0xa0(%rsp)
leaq (%rsi,%rax,8), %r14
addq $0x8, %r14
movl $0xffffffff, 0x28(%rsp) # imm = 0xFFFFFFFF
xorl %edi, %edi
movq 0x18(%rsp), %rcx
cmpl $0x0, 0x4(%r14)
js 0xd0283
movq %rdi, 0x68(%rsp)
movl (%r14), %edx
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
leaq 0x14(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x80(%rsp), %r9
pushq $0x0
pushq 0x60(%rsp)
leaq 0x88(%rsp), %rax
pushq %rax
leaq 0x50(%rsp), %rax
pushq %rax
callq 0x10109f
addq $0x20, %rsp
movq 0x20(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
mulss 0x74(%rsp), %xmm0
movss 0x50(%rsp), %xmm1
ucomiss %xmm0, %xmm1
ja 0xd02bf
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x15527a(%rip), %xmm0   # 0x2254c0
xorps %xmm1, %xmm1
cvtsi2sdq 0x38(%rsp), %xmm1
ucomisd %xmm1, %xmm0
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
movq 0x18(%rsp), %rcx
movq 0x68(%rsp), %rdi
ja 0xd0283
movl (%r14), %eax
shrl %eax
cmpl %r12d, %eax
jne 0xd0283
cmpl $-0x1, 0x28(%rsp)
jne 0xd070e
movl 0x14(%rsp), %eax
movl %eax, 0x28(%rsp)
incq %rdi
addq $0x18, %r14
cmpq %rdi, 0x88(%rsp)
jne 0xd01c9
movq 0x48(%rsp), %rdx
movl %edx, %edi
movq 0x60(%rsp), %rsi
movq 0xa0(%rsp), %rax
jmp 0xd02e1
movl $0xffffffff, 0x28(%rsp) # imm = 0xFFFFFFFF
xorl %edi, %edi
movq 0x18(%rsp), %rcx
jmp 0xd02e1
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
movq 0x18(%rsp), %rcx
movq 0x48(%rsp), %rdx
movq 0x60(%rsp), %rsi
movq 0xa0(%rsp), %rax
movq 0x68(%rsp), %rdi
cmpl %edx, %edi
jne 0xd07dd
testl %edx, %edx
je 0xd044b
leaq (%rsi,%rax,8), %rsi
movl %edx, %edi
xorl %r14d, %r14d
movq %rsi, 0x88(%rsp)
movq %rdi, 0x60(%rsp)
leaq (%r14,%r14,2), %rax
cmpl $0x0, 0xc(%rsi,%rax,8)
js 0xd0435
leaq (%rsi,%rax,8), %r8
movl 0x8(%r8), %edx
movl %edx, %eax
shrl %eax
cmpl %r12d, %eax
je 0xd0435
movq %r8, 0x68(%rsp)
movq $0x0, 0xf8(%rsp)
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
leaq 0x14(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x80(%rsp), %r9
leaq 0xc0(%rsp), %rax
pushq %rax
pushq 0x60(%rsp)
leaq 0x88(%rsp), %rax
pushq %rax
leaq 0x50(%rsp), %rax
pushq %rax
callq 0x10109f
addq $0x20, %rsp
movq 0xf8(%rsp), %rax
testq %rax, %rax
je 0xd03b2
movl $0x1, %ecx
movq 0x108(%rsp), %rdx
xorl %esi, %esi
movl 0x28(%rsp), %r8d
movl (%rdx,%rsi,4), %edi
xorl %r8d, %edi
cmpl $0x1, %edi
jbe 0xd03b4
movl %ecx, %esi
incl %ecx
cmpq %rsi, %rax
ja 0xd039c
jmp 0xd03b4
xorl %esi, %esi
cmpq %rsi, %rax
jne 0xd0450
movq 0x68(%rsp), %rax
movl 0x8(%rax), %r8d
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movl 0x90(%rsp), %ecx
movq 0xb0(%rsp), %r9
pushq 0x58(%rsp)
pushq 0xc0(%rsp)
pushq 0x1f0(%rsp)
pushq 0x1e8(%rsp)
leaq 0x150(%rsp), %rax
pushq %rax
leaq 0xe8(%rsp), %rax
pushq %rax
callq 0x1015d1
addq $0x30, %rsp
testl %eax, %eax
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
movq 0x18(%rsp), %rcx
movq 0x88(%rsp), %rsi
movq 0x60(%rsp), %rdi
je 0xd045b
incq %r14
cmpq %rdi, %r14
jne 0xd0307
movq 0x48(%rsp), %rdx
movl %edx, %r14d
jmp 0xd0460
xorl %r14d, %r14d
jmp 0xd0460
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
movq 0x18(%rsp), %rcx
movq 0x48(%rsp), %rdx
cmpl %edx, %r14d
jne 0xd07dd
movl 0x44(%rsp), %eax
movl %eax, 0x88(%rsp)
movq 0x8(%rbx), %rsi
movq 0x28(%rbx), %rax
movq (%rax,%rcx,8), %rdx
movq %rdx, %rax
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
testl %edx, %edx
movq %rdx, 0x28(%rsp)
je 0xd0582
movl %edx, %edx
movq %rdx, 0x8(%rsp)
movq %rsi, 0x60(%rsp)
movq %rax, 0x48(%rsp)
leaq (%rsi,%rax,8), %r14
addq $0x8, %r14
movl $0xffffffff, 0x68(%rsp) # imm = 0xFFFFFFFF
xorl %r12d, %r12d
cmpl $0x0, 0x4(%r14)
js 0xd0566
movl (%r14), %edx
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
leaq 0x14(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x80(%rsp), %r9
pushq $0x0
pushq 0x60(%rsp)
leaq 0x88(%rsp), %rax
pushq %rax
leaq 0x50(%rsp), %rax
pushq %rax
callq 0x10109f
addq $0x20, %rsp
movq 0x20(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
mulss 0x74(%rsp), %xmm0
movss 0x50(%rsp), %xmm1
ucomiss %xmm0, %xmm1
ja 0xd058f
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x154f90(%rip), %xmm0   # 0x2254c0
xorps %xmm1, %xmm1
cvtsi2sdq 0x38(%rsp), %xmm1
ucomisd %xmm1, %xmm0
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
movq 0x18(%rsp), %rcx
ja 0xd0566
movl 0x44(%rsp), %eax
xorl (%r14), %eax
cmpl $0x1, %eax
ja 0xd0566
cmpl $-0x1, 0x68(%rsp)
jne 0xd059a
movl 0x14(%rsp), %eax
movl %eax, 0x68(%rsp)
incq %r12
addq $0x18, %r14
cmpq %r12, 0x8(%rsp)
jne 0xd04bc
movq 0x28(%rsp), %rdx
movl %edx, %r12d
jmp 0xd059f
movl $0xffffffff, 0x68(%rsp) # imm = 0xFFFFFFFF
xorl %r12d, %r12d
jmp 0xd05a9
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
movq 0x18(%rsp), %rcx
movq 0x28(%rsp), %rdx
movq 0x60(%rsp), %rsi
movq 0x48(%rsp), %rax
cmpl %edx, %r12d
jne 0xd07d9
testl %edx, %edx
je 0xd0718
xorl $0x1, 0x88(%rsp)
leaq (%rsi,%rax,8), %rsi
movl %edx, %edi
xorl %r12d, %r12d
movq %rsi, 0x8(%rsp)
movq %rdi, 0x50(%rsp)
leaq (%r12,%r12,2), %rax
cmpl $0x0, 0xc(%rsi,%rax,8)
js 0xd06f8
leaq (%rsi,%rax,8), %r14
movl 0x8(%r14), %edx
movl 0x44(%rsp), %eax
xorl %edx, %eax
cmpl $0x2, %eax
jb 0xd06f8
movq $0x0, 0xf8(%rsp)
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
leaq 0x14(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x80(%rsp), %r9
leaq 0xc0(%rsp), %rax
pushq %rax
pushq 0x60(%rsp)
leaq 0x88(%rsp), %rax
pushq %rax
leaq 0x50(%rsp), %rax
pushq %rax
callq 0x10109f
addq $0x20, %rsp
movq 0xf8(%rsp), %rax
testq %rax, %rax
je 0xd067d
movl $0x1, %ecx
movq 0x108(%rsp), %rdx
xorl %esi, %esi
movl 0x68(%rsp), %r8d
movl (%rdx,%rsi,4), %edi
xorl %r8d, %edi
cmpl $0x1, %edi
jbe 0xd067f
movl %ecx, %esi
incl %ecx
cmpq %rsi, %rax
ja 0xd0667
jmp 0xd067f
xorl %esi, %esi
cmpq %rsi, %rax
jne 0xd071d
movl 0x8(%r14), %r8d
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movl 0x88(%rsp), %ecx
movq 0xb0(%rsp), %r9
pushq 0x58(%rsp)
pushq 0xc0(%rsp)
pushq 0x1f0(%rsp)
pushq 0x1e8(%rsp)
leaq 0x150(%rsp), %rax
pushq %rax
leaq 0xe8(%rsp), %rax
pushq %rax
callq 0x1015d1
addq $0x30, %rsp
testl %eax, %eax
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
movq 0x18(%rsp), %rcx
movq 0x8(%rsp), %rsi
movq 0x50(%rsp), %rdi
je 0xd0728
incq %r12
cmpq %rdi, %r12
jne 0xd05d5
movq 0x28(%rsp), %rdx
movl %edx, %r12d
jmp 0xd072d
movq 0x48(%rsp), %rdx
jmp 0xd029f
xorl %r12d, %r12d
jmp 0xd072d
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
movq 0x18(%rsp), %rcx
movq 0x28(%rsp), %rdx
cmpl %edx, %r12d
jne 0xd07d9
movq $0x0, 0xf8(%rsp)
movq %rbx, %rdi
movq 0x30(%rsp), %rsi
movl 0x90(%rsp), %edx
leaq 0x44(%rsp), %rcx
leaq 0x20(%rsp), %r8
leaq 0x80(%rsp), %r9
leaq 0xc0(%rsp), %rax
pushq %rax
pushq $0x1
leaq 0x88(%rsp), %rax
pushq %rax
leaq 0x50(%rsp), %rax
pushq %rax
callq 0x10109f
addq $0x20, %rsp
movq 0xf8(%rsp), %rax
testq %rax, %rax
je 0xd07e5
movq 0x20(%rbx), %rcx
movq 0x108(%rsp), %rdx
movq 0x30(%rsp), %rsi
movq 0x10(%rsi), %rsi
xorl %edi, %edi
xorl %r8d, %r8d
movl (%rdx,%rdi,4), %r9d
shrl %r9d
movb $0x1, 0x4(%rcx,%r9,8)
leaq (%r9,%r9,4), %r9
addl 0x10(%rsi,%r9,8), %r8d
incq %rdi
movl %edi, %r9d
cmpq %r9, %rax
ja 0xd07ad
cmpl $0x5, %r8d
setb 0x50(%rsp)
jmp 0xd07ea
movl %ecx, 0x8(%rsp)
movl %r15d, %r14d
jmp 0xd0046
movb $0x1, 0x50(%rsp)
movq 0xf8(%rsp), %rdx
testq %rdx, %rdx
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
je 0xd0a26
xorl %ecx, %ecx
movq 0x108(%rsp), %rax
movq %rcx, 0x90(%rsp)
movl (%rax,%rcx,4), %eax
movq %rax, 0x8(%rsp)
shrl %eax
movq 0x20(%rbx), %rsi
cmpb $0x1, 0x4(%rsi,%rax,8)
jne 0xd0911
movq 0x8(%rsp), %rax
andl $-0x2, %eax
movq %rax, 0x8(%rsp)
xorl %esi, %esi
movq 0x8(%rsp), %rax
leaq (%rsi,%rax), %rdi
movq 0x28(%rbx), %rax
movq (%rax,%rdi,8), %rax
movq %rax, %r8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
andq %r11, %r8
je 0xd08fb
shrq $0x20, %rax
leaq (%rax,%rax,2), %r9
shlq $0x3, %r9
addq 0x8(%rbx), %r9
xorl %r10d, %r10d
leaq (%r10,%r10,2), %rax
movl 0xc(%r9,%rax,8), %r11d
testl %r11d, %r11d
js 0xd08ef
leaq (%r9,%rax,8), %r14
movq 0x20(%rbx), %r12
movl 0x8(%r14), %ecx
movl %ecx, %eax
shrl %eax
cmpb $0x1, 0x4(%r12,%rax,8)
je 0xd08ef
orl $0x80000000, %r11d      # imm = 0x80000000
movl %r11d, 0xc(%r14)
xorq $0x1, %rcx
movq 0x28(%rbx), %rax
movq (%rax,%rcx,8), %rax
movq %rax, %r11
andq %rdx, %r11
je 0xd08ef
movq 0x8(%rbx), %rcx
shrq $0x20, %rax
shlq $0x3, %r11
leaq (%r11,%r11,2), %r11
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %r14
addq $0xc, %r14
xorl %r12d, %r12d
movl -0x4(%r14,%r12), %eax
xorl %edi, %eax
cmpl $0x1, %eax
jne 0xd08e6
orb $-0x80, 0x3(%r14,%r12)
addq $0x18, %r12
cmpq %r12, %r11
jne 0xd08d4
incq %r10
cmpq %r8, %r10
jne 0xd0870
leaq 0x1(%rsi), %rax
testq %rsi, %rsi
movq %rax, %rsi
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
je 0xd083b
cmpq $0x0, 0x1d8(%rsp)
je 0xd0a0b
movq 0x1d8(%rsp), %rax
movq 0x108(%rax), %rax
movq 0x18(%rax), %rdx
movq 0x108(%rsp), %rax
movq 0x90(%rsp), %rcx
movl (%rax,%rcx,4), %esi
movl %esi, %eax
shrl %eax
movq 0x20(%rdx), %rcx
orl $0x80000000, (%rcx,%rax,8) # imm = 0x80000000
andl $-0x2, %esi
movq %rsi, 0x8(%rsp)
xorl %edi, %edi
movq 0x8(%rsp), %rax
leaq (%rdi,%rax), %r8
movq 0x28(%rdx), %rax
movq (%rax,%r8,8), %rax
movq %rax, %r9
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
andq %r11, %r9
je 0xd09f5
shrq $0x20, %rax
leaq (%rax,%rax,2), %r10
shlq $0x3, %r10
addq 0x8(%rdx), %r10
xorl %r11d, %r11d
leaq (%r11,%r11,2), %rax
orb $-0x80, 0xf(%r10,%rax,8)
movl 0x8(%r10,%rax,8), %eax
xorq $0x1, %rax
movq 0x28(%rdx), %rcx
movq (%rcx,%rax,8), %rax
movq %rax, %r14
andq %rsi, %r14
je 0xd09ed
movq 0x8(%rdx), %rcx
shrq $0x20, %rax
shlq $0x3, %r14
leaq (%r14,%r14,2), %r14
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %r12
addq $0xc, %r12
xorl %eax, %eax
movl -0x4(%r12,%rax), %ecx
xorl %r8d, %ecx
cmpl $0x1, %ecx
jne 0xd09e4
orb $-0x80, 0x3(%r12,%rax)
addq $0x18, %rax
cmpq %rax, %r14
jne 0xd09d1
incq %r11
cmpq %r9, %r11
jne 0xd0990
leaq 0x1(%rdi), %rax
testq %rdi, %rdi
movq %rax, %rdi
movl $0xffffffff, %r11d      # imm = 0xFFFFFFFF
je 0xd095f
movq 0x90(%rsp), %rcx
incl %ecx
movq 0xf8(%rsp), %rdx
cmpq %rcx, %rdx
ja 0xd0803
movq 0x98(%rsp), %rax
incl %eax
movq %rax, 0x98(%rsp)
testq %rdx, %rdx
sete %al
movb 0x50(%rsp), %cl
xorb $0x1, %cl
orb %al, %cl
jne 0xd0a7c
movq 0x20(%rbx), %rax
movq 0x108(%rsp), %rcx
xorl %esi, %esi
movl (%rcx,%rsi,4), %edi
shrl %edi
movb $0xb, 0x4(%rax,%rdi,8)
incq %rsi
movl %esi, %edi
cmpq %rdi, %rdx
ja 0xd0a57
movq 0x18(%rsp), %rax
movl %eax, 0x8(%rsp)
movl %r15d, %r14d
jmp 0xcff59
movq 0x18(%rsp), %rax
movl %eax, 0x8(%rsp)
jmp 0xd07dd
movq 0x1d8(%rsp), %rax
testq %rax, %rax
je 0xd0aa7
movq 0x108(%rax), %rax
movq 0x18(%rax), %rdi
callq 0xa02fa
movq %rbx, %rdi
callq 0xa02fa
movq 0x108(%rsp), %rdi
callq 0x2220
movq 0x178(%rsp), %rdi
callq 0x2220
movq 0x98(%rsp), %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq