// File: /workspace/github_cpp_makefile_star2_O3/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 $0x188, %rsp            # imm = 0x188
movss %xmm0, 0x4c(%rsp)
movq %r9, 0x30(%rsp)
movq %r8, 0xa8(%rsp)
movq %rcx, 0xa0(%rsp)
movq %rdx, 0x98(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdi, %rbx
callq 0x2f3fc
movl 0x14(%rbx), %eax
xorl %ecx, %ecx
xorpd %xmm0, %xmm0
movapd %xmm0, 0xb0(%rsp)
movapd %xmm0, 0xc0(%rsp)
movapd %xmm0, 0xd0(%rsp)
movapd %xmm0, 0xe0(%rsp)
movapd %xmm0, 0xf0(%rsp)
movapd %xmm0, 0x100(%rsp)
movq %rcx, 0x110(%rsp)
movapd %xmm0, 0x120(%rsp)
movapd %xmm0, 0x130(%rsp)
movapd %xmm0, 0x140(%rsp)
movapd %xmm0, 0x150(%rsp)
movapd %xmm0, 0x160(%rsp)
movapd %xmm0, 0x170(%rsp)
movq $0x0, 0x90(%rsp)
movq %rcx, 0x180(%rsp)
addl %eax, %eax
je 0xd1bfd
movl %eax, %r15d
xorl %r13d, %r13d
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movq $0x0, 0x90(%rsp)
movq 0x20(%rbx), %rax
movl %r13d, %r12d
shrl %r12d
cmpl $0x0, (%rax,%r12,8)
js 0xd12e8
cmpb $0x1, 0x4(%rax,%r12,8)
je 0xd12e8
movq 0x28(%rbx), %rcx
movq (%rcx,%r13,8), %rdx
movq %rdx, %rsi
andq %r10, %rsi
je 0xd12e8
movq 0x8(%rbx), %rax
shrq $0x20, %rdx
leaq (%rdx,%rdx,2), %rdx
leaq (%rax,%rdx,8), %rdx
addq $0xc, %rdx
shlq $0x3, %rsi
leaq (%rsi,%rsi,2), %rsi
xorl %edi, %edi
xorl %r8d, %r8d
movl (%rdx,%rdi), %r9d
notl %r9d
shrl $0x1f, %r9d
addl %r9d, %r8d
addq $0x18, %rdi
cmpq %rdi, %rsi
jne 0xd10a6
cmpl $0x1, %r8d
jne 0xd12e8
xorl %edi, %edi
cmpl $0x0, (%rdx,%rdi)
js 0xd10d4
movl -0x4(%rdx,%rdi), %r14d
addq $0x18, %rdi
cmpq %rdi, %rsi
jne 0xd10c9
movl %r14d, %r8d
xorl $0x1, %r8d
movq (%rcx,%r8,8), %rdx
movq %rdx, %rcx
andq %r10, %rcx
je 0xd12e8
shrq $0x20, %rdx
leaq (%rdx,%rdx,2), %rdx
leaq (%rax,%rdx,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 0xd1110
cmpl $0x2, %esi
jl 0xd12e8
movq %r8, 0x40(%rsp)
movl %r11d, %ebp
movl %r13d, %edx
xorl $0x1, %edx
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
movl %edx, 0x88(%rsp)
leaq 0x2c(%rsp), %rcx
leaq 0x18(%rsp), %r8
leaq 0x68(%rsp), %r9
pushq $0x0
pushq $0x1
leaq 0x70(%rsp), %rax
pushq %rax
leaq 0x38(%rsp), %rax
pushq %rax
callq 0x1053a7
addq $0x20, %rsp
cmpl $0x7, %eax
jne 0xd1184
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movl %ebp, %r11d
jmp 0xd12e8
movl 0x2c(%rsp), %eax
movq 0x28(%rbx), %rcx
movq (%rcx,%rax,8), %rdx
movq %rdx, %rsi
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
andq %r10, %rsi
movl %ebp, %r11d
je 0xd12e8
movl 0x18(%rsp), %ebp
movq 0x8(%rbx), %rax
shrq $0x20, %rdx
leaq (%rdx,%rdx,2), %rdx
leaq (%rax,%rdx,8), %rdx
addq $0xc, %rdx
shlq $0x3, %rsi
leaq (%rsi,%rsi,2), %rsi
xorl %edi, %edi
xorl %r8d, %r8d
movl (%rdx,%rdi), %r9d
notl %r9d
shrl $0x1f, %r9d
addl %r9d, %r8d
addq $0x18, %rdi
cmpq %rdi, %rsi
jne 0xd11ca
cmpl $0x1, %r8d
jne 0xd12e8
xorl %edi, %edi
cmpl $0x0, (%rdx,%rdi)
js 0xd11f8
movl -0x4(%rdx,%rdi), %r11d
addq $0x18, %rdi
cmpq %rdi, %rsi
jne 0xd11ed
movl %r11d, %edx
xorl $0x1, %edx
movq %rdx, 0x78(%rsp)
movq (%rcx,%rdx,8), %rdx
movq %rdx, %rcx
andq %r10, %rcx
je 0xd12e8
shrq $0x20, %rdx
leaq (%rdx,%rdx,2), %rdx
leaq (%rax,%rdx,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 0xd1238
cmpl $0x2, %esi
jl 0xd12e8
movl %r11d, 0x8(%rsp)
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
movl %r14d, %edx
leaq 0x14(%rsp), %rcx
leaq 0x18(%rsp), %r8
leaq 0x68(%rsp), %r9
pushq $0x0
pushq 0x38(%rsp)
leaq 0x70(%rsp), %rax
pushq %rax
leaq 0x38(%rsp), %rax
pushq %rax
callq 0x1053a7
addq $0x20, %rsp
movq 0x18(%rsp), %rax
cvtsi2ss %rax, %xmm0
movl %ebp, %ecx
cvtsi2ss %rcx, %xmm1
mulss 0x4c(%rsp), %xmm0
movss %xmm1, 0x74(%rsp)
ucomiss %xmm0, %xmm1
jbe 0xd12bd
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movl 0x8(%rsp), %r11d
jmp 0xd12e8
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x1602f3(%rip), %xmm0   # 0x2315c0
xorps %xmm1, %xmm1
cvtsi2sdq 0x20(%rsp), %xmm1
ucomisd %xmm1, %xmm0
movl 0x8(%rsp), %r11d
jbe 0xd12f9
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
incq %r13
cmpq %r15, %r13
jne 0xd1050
jmp 0xd1bfd
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
movl %r11d, %edx
leaq 0x14(%rsp), %rcx
leaq 0x18(%rsp), %r8
leaq 0x68(%rsp), %r9
pushq $0x0
pushq 0x38(%rsp)
leaq 0x70(%rsp), %rax
pushq %rax
leaq 0x38(%rsp), %rax
pushq %rax
callq 0x1053a7
addq $0x20, %rsp
movq 0x18(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
mulss 0x4c(%rsp), %xmm0
movss 0x74(%rsp), %xmm1
ucomiss %xmm0, %xmm1
ja 0xd12b0
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x160260(%rip), %xmm0   # 0x2315c0
xorps %xmm1, %xmm1
cvtsi2sdq 0x20(%rsp), %xmm1
ucomisd %xmm1, %xmm0
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
ja 0xd12b6
movq 0x30(%rsp), %rax
incl %eax
movq %rax, 0x30(%rsp)
movq 0x8(%rbx), %rdx
movq 0x28(%rbx), %rax
movq 0x40(%rsp), %rsi
movq (%rax,%rsi,8), %rcx
movq %rcx, %rax
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
testl %ecx, %ecx
movq %rcx, 0x80(%rsp)
movq %rax, 0x50(%rsp)
movq %rdx, 0x118(%rsp)
je 0xd1498
movl %ecx, %ecx
movq %rcx, 0x58(%rsp)
leaq (%rdx,%rax,8), %r14
addq $0x8, %r14
movl $0xffffffff, 0x10(%rsp) # imm = 0xFFFFFFFF
xorl %ebp, %ebp
movl 0x8(%rsp), %r11d
cmpl $0x0, 0x4(%r14)
js 0xd1484
movl (%r14), %edx
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
leaq 0x14(%rsp), %rcx
leaq 0x18(%rsp), %r8
leaq 0x68(%rsp), %r9
pushq $0x0
pushq 0x38(%rsp)
leaq 0x70(%rsp), %rax
pushq %rax
leaq 0x38(%rsp), %rax
pushq %rax
callq 0x1053a7
movq 0x60(%rsp), %rsi
movl 0x28(%rsp), %r11d
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
addq $0x20, %rsp
movq 0x18(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
mulss 0x4c(%rsp), %xmm0
movss 0x74(%rsp), %xmm1
ucomiss %xmm0, %xmm1
ja 0xd14a9
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x160165(%rip), %xmm0   # 0x2315c0
xorps %xmm1, %xmm1
cvtsi2sdq 0x20(%rsp), %xmm1
ucomisd %xmm1, %xmm0
ja 0xd1484
movl (%r14), %eax
shrl %eax
cmpl %r12d, %eax
jne 0xd1484
cmpl $-0x1, 0x10(%rsp)
jne 0xd14a9
movl 0x14(%rsp), %eax
movl %eax, 0x10(%rsp)
incq %rbp
addq $0x18, %r14
cmpq %rbp, 0x58(%rsp)
jne 0xd13dd
jmp 0xd14b9
movl $0xffffffff, 0x10(%rsp) # imm = 0xFFFFFFFF
xorl %ebp, %ebp
movl 0x8(%rsp), %r11d
jmp 0xd14b1
movq 0x80(%rsp), %rcx
cmpl %ecx, %ebp
jne 0xd1be0
movq 0x80(%rsp), %rax
testl %eax, %eax
je 0xd162c
movq 0x50(%rsp), %rcx
movq 0x118(%rsp), %rdx
leaq (%rdx,%rcx,8), %rbp
movl %eax, %eax
movq %rax, 0x58(%rsp)
xorl %r14d, %r14d
leaq (%r14,%r14,2), %rax
cmpl $0x0, 0xc(%rbp,%rax,8)
js 0xd161c
leaq (,%rax,8), %rcx
addq %rbp, %rcx
movl 0x8(%rcx), %edx
movl %edx, %eax
shrl %eax
cmpl %r12d, %eax
je 0xd161c
movq %rcx, 0x50(%rsp)
movq $0x0, 0xe8(%rsp)
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
leaq 0x14(%rsp), %rcx
leaq 0x18(%rsp), %r8
leaq 0x68(%rsp), %r9
leaq 0xb0(%rsp), %rax
pushq %rax
pushq 0x38(%rsp)
leaq 0x70(%rsp), %rax
pushq %rax
leaq 0x38(%rsp), %rax
pushq %rax
callq 0x1053a7
addq $0x20, %rsp
movq 0xe8(%rsp), %rax
testq %rax, %rax
je 0xd15ac
movl $0x1, %ecx
movq 0xf8(%rsp), %rdx
xorl %esi, %esi
movl 0x10(%rsp), %r8d
movl (%rdx,%rsi,4), %edi
xorl %r8d, %edi
cmpl $0x1, %edi
jbe 0xd158d
movl %ecx, %esi
incl %ecx
cmpq %rsi, %rax
ja 0xd1579
cmpq %rsi, %rax
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movl 0x8(%rsp), %r11d
movq 0x40(%rsp), %rsi
movq 0x50(%rsp), %rax
je 0xd15b1
jmp 0xd162f
movq 0x50(%rsp), %rax
movl 0x8(%rax), %r8d
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
movq 0x98(%rsp), %rdx
movl 0x88(%rsp), %ecx
movq 0xa0(%rsp), %r9
pushq 0x30(%rsp)
pushq 0xb0(%rsp)
pushq 0x1e0(%rsp)
pushq 0x1d8(%rsp)
leaq 0x140(%rsp), %rax
pushq %rax
leaq 0xd8(%rsp), %rax
pushq %rax
callq 0x105913
movq 0x70(%rsp), %rsi
movl 0x38(%rsp), %r11d
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
addq $0x30, %rsp
testl %eax, %eax
je 0xd162f
incq %r14
cmpq 0x58(%rsp), %r14
jne 0xd14e4
jmp 0xd163d
xorl %r14d, %r14d
cmpl 0x80(%rsp), %r14d
jne 0xd1be0
movl 0x2c(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x8(%rbx), %rbp
movq 0x28(%rbx), %rax
movq 0x78(%rsp), %rcx
movq (%rax,%rcx,8), %rcx
movq %rcx, %rax
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
testl %ecx, %ecx
movq %rcx, 0x50(%rsp)
movq %rax, 0x80(%rsp)
je 0xd174b
movl %ecx, %ecx
movq %rcx, 0x8(%rsp)
leaq 0x8(,%rax,8), %r14
addq %rbp, %r14
movl $0xffffffff, 0x58(%rsp) # imm = 0xFFFFFFFF
xorl %r12d, %r12d
cmpl $0x0, 0x4(%r14)
js 0xd1737
movl (%r14), %edx
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
leaq 0x14(%rsp), %rcx
leaq 0x18(%rsp), %r8
leaq 0x68(%rsp), %r9
pushq $0x0
pushq 0x38(%rsp)
leaq 0x70(%rsp), %rax
pushq %rax
leaq 0x38(%rsp), %rax
pushq %rax
callq 0x1053a7
movq 0x60(%rsp), %rsi
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
addq $0x20, %rsp
movq 0x18(%rsp), %rax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
mulss 0x4c(%rsp), %xmm0
movss 0x74(%rsp), %xmm1
ucomiss %xmm0, %xmm1
ja 0xd1758
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x15feb4(%rip), %xmm0   # 0x2315c0
xorps %xmm1, %xmm1
cvtsi2sdq 0x20(%rsp), %xmm1
ucomisd %xmm1, %xmm0
ja 0xd1737
movl 0x2c(%rsp), %eax
xorl (%r14), %eax
cmpl $0x1, %eax
ja 0xd1737
cmpl $-0x1, 0x58(%rsp)
jne 0xd1758
movl 0x14(%rsp), %eax
movl %eax, 0x58(%rsp)
incq %r12
addq $0x18, %r14
cmpq %r12, 0x8(%rsp)
jne 0xd1693
jmp 0xd1766
movl $0xffffffff, 0x58(%rsp) # imm = 0xFFFFFFFF
xorl %r12d, %r12d
jmp 0xd175d
movq 0x50(%rsp), %rcx
cmpl %ecx, %r12d
jne 0xd1bd8
movq 0x50(%rsp), %rax
testl %eax, %eax
je 0xd18b9
xorl $0x1, 0x10(%rsp)
movq 0x80(%rsp), %rcx
leaq (%rbp,%rcx,8), %rbp
movl %eax, %eax
movq %rax, 0x8(%rsp)
xorl %r12d, %r12d
leaq (%r12,%r12,2), %rax
cmpl $0x0, 0xc(%rbp,%rax,8)
js 0xd18a9
leaq (,%rax,8), %r14
addq %rbp, %r14
movl 0x8(%r14), %edx
movl 0x2c(%rsp), %eax
xorl %edx, %eax
cmpl $0x2, %eax
jb 0xd18a9
movq $0x0, 0xe8(%rsp)
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
leaq 0x14(%rsp), %rcx
leaq 0x18(%rsp), %r8
leaq 0x68(%rsp), %r9
leaq 0xb0(%rsp), %rax
pushq %rax
pushq 0x38(%rsp)
leaq 0x70(%rsp), %rax
pushq %rax
leaq 0x38(%rsp), %rax
pushq %rax
callq 0x1053a7
addq $0x20, %rsp
movq 0xe8(%rsp), %rax
testq %rax, %rax
je 0xd1846
movl $0x1, %ecx
movq 0xf8(%rsp), %rdx
xorl %esi, %esi
movl 0x58(%rsp), %r8d
movl (%rdx,%rsi,4), %edi
xorl %r8d, %edi
cmpl $0x1, %edi
jbe 0xd1836
movl %ecx, %esi
incl %ecx
cmpq %rsi, %rax
ja 0xd1822
cmpq %rsi, %rax
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movq 0x40(%rsp), %rsi
jne 0xd18bc
movl 0x8(%r14), %r8d
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
movq 0x98(%rsp), %rdx
movl 0x10(%rsp), %ecx
movq 0xa0(%rsp), %r9
pushq 0x30(%rsp)
pushq 0xb0(%rsp)
pushq 0x1e0(%rsp)
pushq 0x1d8(%rsp)
leaq 0x140(%rsp), %rax
pushq %rax
leaq 0xd8(%rsp), %rax
pushq %rax
callq 0x105913
movq 0x70(%rsp), %rsi
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
addq $0x30, %rsp
testl %eax, %eax
je 0xd18bc
incq %r12
cmpq 0x8(%rsp), %r12
jne 0xd178f
jmp 0xd18c7
xorl %r12d, %r12d
cmpl 0x50(%rsp), %r12d
jne 0xd1bd8
movq 0x90(%rsp), %rax
incl %eax
movq %rax, 0x90(%rsp)
movq $0x0, 0xe8(%rsp)
movq %rbx, %rdi
movq 0x38(%rsp), %r14
movq %r14, %rsi
movl 0x88(%rsp), %edx
leaq 0x2c(%rsp), %rcx
leaq 0x18(%rsp), %r8
leaq 0x68(%rsp), %r9
leaq 0xb0(%rsp), %rax
pushq %rax
pushq $0x1
leaq 0x70(%rsp), %rax
pushq %rax
leaq 0x38(%rsp), %rax
pushq %rax
callq 0x1053a7
addq $0x20, %rsp
movq 0xe8(%rsp), %rcx
testq %rcx, %rcx
je 0xd1be8
movq 0x20(%rbx), %rdx
movq 0xf8(%rsp), %rsi
movq 0x10(%r14), %rdi
xorl %r8d, %r8d
xorl %r9d, %r9d
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
movl (%rsi,%r8,4), %eax
shrl %eax
movb $0x1, 0x4(%rdx,%rax,8)
leaq (%rax,%rax,4), %rax
addl 0x10(%rdi,%rax,8), %r9d
incq %r8
movl %r8d, %eax
cmpq %rax, %rcx
ja 0xd1953
movl %r9d, 0x8(%rsp)
xorl %ecx, %ecx
movq 0xf8(%rsp), %rax
movq %rcx, 0x88(%rsp)
movl (%rax,%rcx,4), %eax
movq %rax, %rbp
shrl %eax
movq 0x20(%rbx), %rsi
cmpb $0x1, 0x4(%rsi,%rax,8)
jne 0xd1a7c
andl $-0x2, %ebp
movb $0x1, %sil
xorl %edi, %edi
orq %rbp, %rdi
movq 0x28(%rbx), %rax
movq (%rax,%rdi,8), %rax
movq %rax, %r8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
andq %r10, %r8
je 0xd1a62
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 0xd1a56
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 0xd1a56
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 0xd1a56
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 0xd1a4d
orb $-0x80, 0x3(%r14,%r12)
addq $0x18, %r12
cmpq %r12, %r11
jne 0xd1a3b
incq %r10
cmpq %r8, %r10
jne 0xd19d7
movl $0x1, %edi
testb $0x1, %sil
movl $0x0, %esi
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
jne 0xd19a8
cmpq $0x0, 0x1c8(%rsp)
je 0xd1b74
movq 0x1c8(%rsp), %rax
movq 0x108(%rax), %rax
movq 0x18(%rax), %rdx
movq 0xf8(%rsp), %rax
movq 0x88(%rsp), %rcx
movl (%rax,%rcx,4), %ebp
movl %ebp, %eax
shrl %eax
movq 0x20(%rdx), %rcx
orl $0x80000000, (%rcx,%rax,8) # imm = 0x80000000
andl $-0x2, %ebp
movb $0x1, %dil
xorl %r8d, %r8d
orq %rbp, %r8
movq 0x28(%rdx), %rax
movq (%rax,%r8,8), %rax
movq %rax, %r9
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
andq %r10, %r9
je 0xd1b59
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 0xd1b51
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 0xd1b48
orb $-0x80, 0x3(%r12,%rax)
addq $0x18, %rax
cmpq %rax, %r14
jne 0xd1b35
incq %r11
cmpq %r9, %r11
jne 0xd1af4
movl $0x1, %r8d
testb $0x1, %dil
movl $0x0, %edi
movl $0xffffffff, %r10d      # imm = 0xFFFFFFFF
jne 0xd1ac9
movq 0x88(%rsp), %rcx
incl %ecx
movq 0xe8(%rsp), %rdx
cmpq %rcx, %rdx
ja 0xd1979
cmpl $0x5, 0x8(%rsp)
setae %al
testq %rdx, %rdx
sete %cl
orb %al, %cl
movq 0x40(%rsp), %r8
jne 0xd1bc8
movq 0x20(%rbx), %rax
movq 0xf8(%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 0xd1bb4
movq 0x78(%rsp), %rax
movl %eax, %r11d
movl %r8d, %r14d
jmp 0xd12e8
movq 0x78(%rsp), %rax
movl %eax, %r11d
movl %esi, %r14d
jmp 0xd12e8
movq 0x78(%rsp), %rax
movl %eax, %r11d
movq 0x40(%rsp), %rax
movl %eax, %r14d
jmp 0xd12e2
movq 0x1c8(%rsp), %rax
testq %rax, %rax
je 0xd1c1a
movq 0x108(%rax), %rax
movq 0x18(%rax), %rdi
callq 0xa0a7d
movq %rbx, %rdi
callq 0xa0a7d
movq 0xf8(%rsp), %rdi
callq 0x2220
movq 0x168(%rsp), %rdi
callq 0x2220
movq 0x90(%rsp), %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq