// File: 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
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
movq %rdx, -0x30(%rbp)
movq %rcx, -0x38(%rbp)
movq %r8, -0x40(%rbp)
movl %r9d, -0x44(%rbp)
movss %xmm0, -0x48(%rbp)
callq 0x2510
movsd %xmm0, -0x50(%rbp)
movq -0x20(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movl %eax, -0x7c(%rbp)
movl $0x0, -0x80(%rbp)
leaq -0x120(%rbp), %rdi
xorl %esi, %esi
movl $0x68, %edx
callq 0x2100
leaq -0x188(%rbp), %rdi
xorl %esi, %esi
movl $0x68, %edx
callq 0x2100
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jae 0x11a07f
movl -0x5c(%rbp), %eax
movl %eax, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x60(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x11967d
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x60(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movzbl 0x4(%rax,%rcx,8), %eax
cmpl $0x1, %eax
jne 0x119682
jmp 0x11a071
movq -0x20(%rbp), %rdi
movl -0x60(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
cmpl $0x1, %eax
je 0x11969c
jmp 0x11a071
movq -0x20(%rbp), %rdi
movl -0x60(%rbp), %esi
leaq -0x6c(%rbp), %rdx
callq 0x166b50
movq -0x20(%rbp), %rdi
movl -0x6c(%rbp), %esi
xorl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
cmpl $0x1, %eax
jg 0x1196c9
jmp 0x11a071
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x60(%rbp), %edx
xorl $0x1, %edx
leaq -0x64(%rbp), %rcx
leaq -0xa0(%rbp), %r8
leaq -0xa8(%rbp), %r9
leaq -0xb0(%rbp), %r10
leaq -0xb8(%rbp), %rax
xorl %r11d, %r11d
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
callq 0x166c30
cmpl $0x7, %eax
jne 0x119723
jmp 0x11a071
movq -0xa0(%rbp), %rax
movl %eax, -0x68(%rbp)
movq -0x20(%rbp), %rdi
movl -0x64(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
cmpl $0x1, %eax
je 0x119747
jmp 0x11a071
movq -0x20(%rbp), %rdi
movl -0x64(%rbp), %esi
leaq -0x70(%rbp), %rdx
callq 0x166b50
movq -0x20(%rbp), %rdi
movl -0x70(%rbp), %esi
xorl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
cmpl $0x1, %eax
jg 0x119774
jmp 0x11a071
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x6c(%rbp), %edx
movl -0x44(%rbp), %ecx
movq %rsp, %rax
movl %ecx, 0x10(%rax)
leaq -0xb8(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0xb0(%rbp), %rcx
movq %rcx, (%rax)
movq $0x0, 0x18(%rax)
leaq -0x84(%rbp), %rcx
leaq -0xa0(%rbp), %r8
leaq -0xa8(%rbp), %r9
callq 0x166c30
cvtsi2ssq -0xa0(%rbp), %xmm1
movss -0x48(%rbp), %xmm0
mulss %xmm0, %xmm1
movl -0x68(%rbp), %eax
cvtsi2ss %rax, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x1197e3
jmp 0x11a071
cvtsi2sdq -0xa0(%rbp), %xmm0
movsd 0x268a44(%rip), %xmm1   # 0x382238
mulsd %xmm1, %xmm0
cvtsi2sdq -0xb0(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x11980c
jmp 0x11a071
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x70(%rbp), %edx
movl -0x44(%rbp), %ecx
movq %rsp, %rax
movl %ecx, 0x10(%rax)
leaq -0xb8(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0xb0(%rbp), %rcx
movq %rcx, (%rax)
movq $0x0, 0x18(%rax)
leaq -0x84(%rbp), %rcx
leaq -0xa0(%rbp), %r8
leaq -0xa8(%rbp), %r9
callq 0x166c30
cvtsi2ssq -0xa0(%rbp), %xmm1
movss -0x48(%rbp), %xmm0
mulss %xmm0, %xmm1
movl -0x68(%rbp), %eax
cvtsi2ss %rax, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x11987b
jmp 0x11a071
cvtsi2sdq -0xa0(%rbp), %xmm0
movsd 0x2689ac(%rip), %xmm1   # 0x382238
mulsd %xmm1, %xmm0
cvtsi2sdq -0xb0(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1198a4
jmp 0x11a071
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x6c(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x6c(%rbp)
movl -0x60(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x74(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x6c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x6c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x78(%rbp)
movl $0xffffffff, -0x88(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x78(%rbp), %eax
jae 0x119a1f
movq -0x98(%rbp), %rax
movl -0x54(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x119938
jmp 0x119a11
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x98(%rbp), %rax
movl -0x54(%rbp), %ecx
leaq (%rcx,%rcx,2), %rcx
movl 0x8(%rax,%rcx,8), %edx
movl -0x44(%rbp), %ecx
movq %rsp, %rax
movl %ecx, 0x10(%rax)
leaq -0xb8(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0xb0(%rbp), %rcx
movq %rcx, (%rax)
movq $0x0, 0x18(%rax)
leaq -0x84(%rbp), %rcx
leaq -0xa0(%rbp), %r8
leaq -0xa8(%rbp), %r9
callq 0x166c30
cvtsi2ssq -0xa0(%rbp), %xmm1
movss -0x48(%rbp), %xmm0
mulss %xmm0, %xmm1
movl -0x68(%rbp), %eax
cvtsi2ss %rax, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x1199b3
jmp 0x119a1f
cvtsi2sdq -0xa0(%rbp), %xmm0
movsd 0x268874(%rip), %xmm1   # 0x382238
mulsd %xmm1, %xmm0
cvtsi2sdq -0xb0(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1199d9
jmp 0x119a11
movq -0x98(%rbp), %rax
movl -0x54(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
shrl %eax
movl -0x60(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
jne 0x119a0f
cmpl $-0x1, -0x88(%rbp)
je 0x119a03
jmp 0x119a1f
movl -0x84(%rbp), %eax
movl %eax, -0x88(%rbp)
jmp 0x119a11
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x11990b
movl -0x54(%rbp), %eax
cmpl -0x78(%rbp), %eax
je 0x119a2c
jmp 0x11a071
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x78(%rbp), %eax
jae 0x119bc0
movq -0x98(%rbp), %rax
movl -0x54(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x119a60
jmp 0x119bb2
movq -0x98(%rbp), %rax
movl -0x54(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
shrl %eax
movl -0x60(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
jne 0x119a84
jmp 0x119bb2
movq $0x0, -0xe8(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x98(%rbp), %rax
movl -0x54(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
movl -0x44(%rbp), %r10d
leaq -0x84(%rbp), %rcx
leaq -0xa0(%rbp), %r8
leaq -0xa8(%rbp), %r9
leaq -0xb0(%rbp), %rbx
leaq -0xb8(%rbp), %r11
leaq -0x120(%rbp), %rax
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x166c30
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpq -0xe8(%rbp), %rax
jae 0x119b2e
movq -0xd8(%rbp), %rax
movl -0x58(%rbp), %ecx
movl (%rax,%rcx,4), %eax
shrl %eax
movl -0x88(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
jne 0x119b21
jmp 0x119b2e
jmp 0x119b23
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x119af8
movl -0x58(%rbp), %eax
cmpq -0xe8(%rbp), %rax
je 0x119b3f
jmp 0x119bc0
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl -0x74(%rbp), %ecx
movq -0x98(%rbp), %rax
movl -0x54(%rbp), %r8d
imulq $0x18, %r8, %r8
addq %r8, %rax
movl 0x8(%rax), %r8d
movq -0x38(%rbp), %r9
movq 0x10(%rbp), %rbx
movq 0x20(%rbp), %r11
movq -0x40(%rbp), %rax
movl %eax, %r10d
movl -0x44(%rbp), %eax
leaq -0x120(%rbp), %r15
leaq -0x188(%rbp), %r14
movq %r15, (%rsp)
movq %r14, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movq %r11, 0x18(%rsp)
movl %r10d, 0x20(%rsp)
movl %eax, 0x28(%rsp)
callq 0x1674d0
cmpl $0x0, %eax
jne 0x119bb0
jmp 0x119bc0
jmp 0x119bb2
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x119a33
movl -0x54(%rbp), %eax
cmpl -0x78(%rbp), %eax
je 0x119bcd
jmp 0x11a071
movl -0x70(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x70(%rbp)
movl -0x64(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x74(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x70(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x70(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x78(%rbp)
movl $0xffffffff, -0x88(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x78(%rbp), %eax
jae 0x119d3f
movq -0x98(%rbp), %rax
movl -0x54(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x119c58
jmp 0x119d31
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x98(%rbp), %rax
movl -0x54(%rbp), %ecx
leaq (%rcx,%rcx,2), %rcx
movl 0x8(%rax,%rcx,8), %edx
movl -0x44(%rbp), %ecx
movq %rsp, %rax
movl %ecx, 0x10(%rax)
leaq -0xb8(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0xb0(%rbp), %rcx
movq %rcx, (%rax)
movq $0x0, 0x18(%rax)
leaq -0x84(%rbp), %rcx
leaq -0xa0(%rbp), %r8
leaq -0xa8(%rbp), %r9
callq 0x166c30
cvtsi2ssq -0xa0(%rbp), %xmm1
movss -0x48(%rbp), %xmm0
mulss %xmm0, %xmm1
movl -0x68(%rbp), %eax
cvtsi2ss %rax, %xmm0
ucomiss %xmm1, %xmm0
jbe 0x119cd3
jmp 0x119d3f
cvtsi2sdq -0xa0(%rbp), %xmm0
movsd 0x268554(%rip), %xmm1   # 0x382238
mulsd %xmm1, %xmm0
cvtsi2sdq -0xb0(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x119cf9
jmp 0x119d31
movq -0x98(%rbp), %rax
movl -0x54(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
shrl %eax
movl -0x64(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
jne 0x119d2f
cmpl $-0x1, -0x88(%rbp)
je 0x119d23
jmp 0x119d3f
movl -0x84(%rbp), %eax
movl %eax, -0x88(%rbp)
jmp 0x119d31
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x119c2b
movl -0x54(%rbp), %eax
cmpl -0x78(%rbp), %eax
je 0x119d4c
jmp 0x11a071
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x78(%rbp), %eax
jae 0x119ee0
movq -0x98(%rbp), %rax
movl -0x54(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x119d80
jmp 0x119ed2
movq -0x98(%rbp), %rax
movl -0x54(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
shrl %eax
movl -0x64(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
jne 0x119da4
jmp 0x119ed2
movq $0x0, -0xe8(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x98(%rbp), %rax
movl -0x54(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
movl -0x44(%rbp), %r10d
leaq -0x84(%rbp), %rcx
leaq -0xa0(%rbp), %r8
leaq -0xa8(%rbp), %r9
leaq -0xb0(%rbp), %rbx
leaq -0xb8(%rbp), %r11
leaq -0x120(%rbp), %rax
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movl %r10d, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x166c30
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpq -0xe8(%rbp), %rax
jae 0x119e4e
movq -0xd8(%rbp), %rax
movl -0x58(%rbp), %ecx
movl (%rax,%rcx,4), %eax
shrl %eax
movl -0x88(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
jne 0x119e41
jmp 0x119e4e
jmp 0x119e43
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x119e18
movl -0x58(%rbp), %eax
cmpq -0xe8(%rbp), %rax
je 0x119e5f
jmp 0x119ee0
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movl -0x74(%rbp), %ecx
movq -0x98(%rbp), %rax
movl -0x54(%rbp), %r8d
imulq $0x18, %r8, %r8
addq %r8, %rax
movl 0x8(%rax), %r8d
movq -0x38(%rbp), %r9
movq 0x10(%rbp), %rbx
movq 0x20(%rbp), %r11
movq -0x40(%rbp), %rax
movl %eax, %r10d
movl -0x44(%rbp), %eax
leaq -0x120(%rbp), %r15
leaq -0x188(%rbp), %r14
movq %r15, (%rsp)
movq %r14, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movq %r11, 0x18(%rsp)
movl %r10d, 0x20(%rsp)
movl %eax, 0x28(%rsp)
callq 0x1674d0
cmpl $0x0, %eax
jne 0x119ed0
jmp 0x119ee0
jmp 0x119ed2
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x119d53
movl -0x54(%rbp), %eax
cmpl -0x78(%rbp), %eax
je 0x119eed
jmp 0x11a071
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
movq $0x0, -0xe8(%rbp)
movl $0x0, -0x8c(%rbp)
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x60(%rbp), %edx
xorl $0x1, %edx
leaq -0x64(%rbp), %rcx
leaq -0xa0(%rbp), %r8
leaq -0xa8(%rbp), %r9
leaq -0xb0(%rbp), %r11
leaq -0xb8(%rbp), %r10
leaq -0x120(%rbp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x166c30
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpq -0xe8(%rbp), %rax
jae 0x119fc6
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq -0xd8(%rbp), %rcx
movl -0x58(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
shrl %ecx
movl %ecx, %ecx
movb $0x1, 0x4(%rax,%rcx,8)
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xd8(%rbp), %rcx
movl -0x58(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
addl -0x8c(%rbp), %eax
movl %eax, -0x8c(%rbp)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x119f62
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpq -0xe8(%rbp), %rax
jae 0x11a028
movq -0x20(%rbp), %rdi
movq -0xd8(%rbp), %rax
movl -0x58(%rbp), %ecx
movl (%rax,%rcx,4), %esi
shrl %esi
callq 0xf6800
cmpq $0x0, 0x18(%rbp)
je 0x11a01b
movq 0x18(%rbp), %rax
movq 0x108(%rax), %rax
movq 0x18(%rax), %rdi
movq -0xd8(%rbp), %rax
movl -0x58(%rbp), %ecx
movl (%rax,%rcx,4), %esi
shrl %esi
callq 0xd9510
jmp 0x11a01d
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x119fcd
cmpl $0x4, -0x8c(%rbp)
ja 0x11a06f
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpq -0xe8(%rbp), %rax
jae 0x11a06d
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq -0xd8(%rbp), %rcx
movl -0x58(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
shrl %ecx
movl %ecx, %ecx
movb $0xb, 0x4(%rax,%rcx,8)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x11a038
jmp 0x11a06f
jmp 0x11a071
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x119638
cmpq $0x0, 0x18(%rbp)
je 0x11a09a
movq 0x18(%rbp), %rax
movq 0x108(%rax), %rax
movq 0x18(%rax), %rdi
callq 0xcdd10
movq -0x20(%rbp), %rdi
callq 0xcdd10
movq -0xd8(%rbp), %rdi
callq 0x2210
movq -0x140(%rbp), %rdi
callq 0x2210
movl -0x80(%rbp), %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)