// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: asg_arc_del_short_false_link(asg_t*, float, float, int, ma_hit_t_alloc*, long long, R_to_U*)
int asg_arc_del_short_false_link(asg_t *g, float drop_ratio, float o_drop_ratio, int max_dist, 
ma_hit_t_alloc* reverse_sources, long long miniedgeLen, R_to_U* ruIndex)
{
    double startTime = Get_T();
    
    kvec_t(uint64_t) b;
    memset(&b, 0, sizeof(b));


    kvec_t(uint32_t) b_f;
    memset(&b_f, 0, sizeof(b_f));

    kvec_t(uint32_t) b_r;
    memset(&b_r, 0, sizeof(b_r));


	uint32_t v, w, n_vtx = g->n_seq * 2, n_cut = 0;
    uint32_t sink;

    buf_t bub;
    if (!g->is_symm) asg_symm(g);
    memset(&bub, 0, sizeof(buf_t));
    bub.a = (binfo_t*)calloc(n_vtx, sizeof(binfo_t));
    
    for (v = 0; v < n_vtx; ++v) 
    {
        if(g->seq_vis[v] == 0)
        {
            asg_arc_t *av = asg_arc_a(g, v);
            uint32_t nv = asg_arc_n(g, v);
            if(nv == 1 && asg_arc_n(g, v^1) == 1) continue;

            uint64_t t_ol = 0;
            long long i;
            for (i = 0; i < nv; ++i)
            {
                t_ol += av[i].ol;
            }
            kv_push(uint64_t, b, (uint64_t)(t_ol << 32 | v));  
        }
	}

    radix_sort_arch64(b.a, b.a + b.n);

    uint32_t min_edge;
    
    
    uint64_t k, t;
    for (k = 0; k < b.n; k++)
    {
        ///v is the node
        v = (uint32_t)b.a[k];
        if (g->seq[v>>1].del) continue;
        uint32_t nv = asg_arc_n(g, v), nw, to_del_l, to_del_r;
        if (nv < 2) continue;
        uint32_t kv = get_real_length(g, v, NULL), kw;
        if (kv < 2) continue;
        uint32_t i;
        asg_arc_t *av = asg_arc_a(g, v), *aw;

        b_f.n = 0;
        b_r.n = 0;
        to_del_l = 0;
        for (i = 0; i < nv; i++)
        {
            if (av[i].del) continue;
            
            w = av[i].v^1;
            nw = asg_arc_n(g, w);
            if(nw < 2) break;
            kw = get_real_length(g, w, NULL);
            if(kw < 2) break;

            kv_push(uint32_t, b_f, av[i].v);
            kv_push(uint32_t, b_r, w);

            aw = asg_arc_a(g, w);
            min_edge = (uint32_t)-1;
            for (t = 0; t < nw; t++)
            {
                if(aw[t].del) continue;
                if((aw[t].v>>1) == (v>>1)) continue;
                if(aw[t].ol < min_edge) min_edge = aw[t].ol;
                ///kv_push(uint32_t, b_r, aw[t].v);
            }

            if(av[i].ol < min_edge * drop_ratio) to_del_l++;
        }












        /****************************may have bugs********************************/
        if(to_del_l != kv)
        {
            b_f.n = 0;
            b_r.n = 0;
            to_del_l = 0;

            for (i = 0; i < nv; i++)
            {
                if (av[i].del) continue;

                w = av[i].v^1;
                nw = asg_arc_n(g, w);
                if(nw < 2) break;
                kw = get_real_length(g, w, NULL);
                if(kw < 2) break;

                kv_push(uint32_t, b_f, av[i].v);
                kv_push(uint32_t, b_r, w);

                aw = asg_arc_a(g, w);
                min_edge = (uint32_t)-1;
                for (t = 0; t < nw; t++)
                {
                    if(aw[t].del) continue;
                    if((aw[t].v>>1) == (v>>1)) continue;
                    if(aw[t].ol < min_edge) min_edge = aw[t].ol;
                }

                if(av[i].ol < min_edge * o_drop_ratio) to_del_l++;
            }

            if(to_del_l == kv)
            {
                ///forward
                to_del_l = 1;
                for (i = 1; i < b_f.n; i++)
                {
                    if(check_if_diploid(b_f.a[0], b_f.a[i], g, reverse_sources, miniedgeLen, ruIndex) == 1)
                    {
                        to_del_l++;
                    }
                }

                ///backward
                if(to_del_l != kv && b_r.n >= 2)
                {
                    to_del_l = 0;
                    uint32_t w0 = 0, w1 = 0;


                    w = b_r.a[0];
                    kw = get_real_length(g, w, NULL);
                    if(kw != 2) goto terminal;
                    aw = asg_arc_a(g, w);
                    nw = asg_arc_n(g, w);
                    for (t = 0; t < nw; t++)
                    {
                        if(aw[t].del) continue;
                        if((aw[t].v>>1) == (v>>1)) continue;
                        w0 = aw[t].v;
                    }
                    to_del_l = 1;


                    for (i = 1; i < b_r.n; i++)
                    {
                        w = b_r.a[i];
                        kw = get_real_length(g, w, NULL);
                        if(kw != 2) goto terminal;
                        aw = asg_arc_a(g, w);
                        nw = asg_arc_n(g, w);
                        for (t = 0; t < nw; t++)
                        {
                            if(aw[t].del) continue;
                            if((aw[t].v>>1) == (v>>1)) continue;
                            w1 = aw[t].v;
                        }

                        if(check_if_diploid(w0, w1, g, reverse_sources, miniedgeLen, ruIndex) == 1)
                        {
                            to_del_l++;
                        }
                    }

                }
            }
        }

        terminal:
        /****************************may have bugs********************************/


        if(to_del_l != kv) continue;





        uint32_t convex1;
        long long l1;




        ////forward bubble
        to_del_l = 0;
        for (i = 0; i < b_f.n; i++)
        {
            if(b_f.a[i] == b_f.a[0])
            {
                to_del_l = 1;
            } 
            else
            {
                to_del_l = 0;
                break;
            }
        }
        //check the length
        if(to_del_l == 0 && asg_bub_end_finder_with_del_advance(g, 
        b_f.a, b_f.n, max_dist, &bub, 0, (uint32_t)-1, &sink)==1)
        {
            to_del_l = 1;
        }
        if(to_del_l == 0 && detect_mul_bubble_end_with_bubbles(g, b_f.a, b_f.n, &convex1, &l1, NULL))
        {
            to_del_l = 1;
        }

        ////backward bubble
        to_del_r = 0;
        for (i = 0; i < b_r.n; i++)
        {
            if(b_r.a[i] == b_r.a[0])
            {
                to_del_r = 1;
            } 
            else
            {
                to_del_r = 0;
                break;
            }
        }
        if(to_del_r == 0 && asg_bub_end_finder_with_del_advance
        (g, b_r.a, b_r.n, max_dist, &bub, 1, v^1, &sink)==1)
        {
            to_del_r = 1;
        }
        if(to_del_r == 0 && detect_mul_bubble_end_with_bubbles(g, b_r.a, b_r.n, &convex1, &l1, NULL))
        {
            to_del_r = 1;
        }

        
    



		if (to_del_l && to_del_r)
        {
            for (i = 0; i < nv; ++i) 
            {
			    if (av[i].del) continue;
                ++n_cut;
                av[i].del = 1;
                asg_arc_del(g, av[i].v^1, av[i].ul>>32^1, 1);
		    }

        }
    }
    
    free(b.a); free(b_f.a); free(b_r.a);
    free(bub.a); free(bub.S.a); free(bub.T.a); free(bub.b.a); free(bub.e.a);
	if (n_cut) 
    {
		asg_cleanup(g);
		asg_symm(g);
	}

    if(VERBOSE >= 1)
    {
        fprintf(stderr, "[M::%s] removed %u false overlaps\n", __func__, n_cut);
        fprintf(stderr, "[M::%s] takes %0.2f s\n\n", __func__, Get_T()-startTime);
    }
	return n_cut;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdi, -0x8(%rbp)
movss %xmm0, -0xc(%rbp)
movss %xmm1, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
callq 0x2510
movsd %xmm0, -0x38(%rbp)
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2100
leaq -0x68(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2100
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2100
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movl %eax, -0x8c(%rbp)
movl $0x0, -0x90(%rbp)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0xdf5a8
movq -0x8(%rbp), %rdi
callq 0xce020
leaq -0x100(%rbp), %rdi
xorl %esi, %esi
movl $0x68, %edx
callq 0x2100
movl -0x8c(%rbp), %eax
movl %eax, %edi
movl $0x1c, %esi
callq 0x2140
movq %rax, -0x100(%rbp)
movl $0x0, -0x84(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x8c(%rbp), %eax
jae 0xdf773
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x84(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0xdf75d
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x84(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x108(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x84(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x10c(%rbp)
cmpl $0x1, -0x10c(%rbp)
jne 0xdf679
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x84(%rbp), %ecx
xorl $0x1, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
cmpl $0x1, %eax
jne 0xdf679
jmp 0xdf75f
movq $0x0, -0x118(%rbp)
movq $0x0, -0x120(%rbp)
movq -0x120(%rbp), %rax
movl -0x10c(%rbp), %ecx
cmpq %rcx, %rax
jge 0xdf6df
movq -0x108(%rbp), %rax
imulq $0x18, -0x120(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
addq -0x118(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x120(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x120(%rbp)
jmp 0xdf68f
jmp 0xdf6e1
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
jne 0xdf730
cmpq $0x0, -0x48(%rbp)
je 0xdf702
movq -0x48(%rbp), %rax
shlq %rax
movq %rax, -0x188(%rbp)
jmp 0xdf710
movl $0x2, %eax
movq %rax, -0x188(%rbp)
jmp 0xdf710
movq -0x188(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, -0x40(%rbp)
movq -0x118(%rbp), %rdx
shlq $0x20, %rdx
movl -0x84(%rbp), %eax
orq %rax, %rdx
movq -0x40(%rbp), %rax
movq -0x50(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x50(%rbp)
movq %rdx, (%rax,%rcx,8)
jmp 0xdf75d
jmp 0xdf75f
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0xdf5de
movq -0x40(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x50(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0xc90e0
movq $0x0, -0x130(%rbp)
movq -0x130(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0xe04af
movq -0x40(%rbp), %rax
movq -0x130(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, -0x84(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x84(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0xdf7de
jmp 0xe0498
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x84(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x13c(%rbp)
cmpl $0x2, -0x13c(%rbp)
jae 0xdf804
jmp 0xe0498
movq -0x8(%rbp), %rdi
movl -0x84(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
movl %eax, -0x14c(%rbp)
cmpl $0x2, -0x14c(%rbp)
jae 0xdf82b
jmp 0xe0498
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x84(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x160(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x80(%rbp)
movl $0x0, -0x144(%rbp)
movl $0x0, -0x154(%rbp)
movl -0x154(%rbp), %eax
cmpl -0x13c(%rbp), %eax
jae 0xdfb57
movq -0x160(%rbp), %rax
movl -0x154(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0xdf8b1
jmp 0xdfb43
movq -0x160(%rbp), %rax
movl -0x154(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
xorl $0x1, %eax
movl %eax, -0x88(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x88(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x140(%rbp)
cmpl $0x2, -0x140(%rbp)
jae 0xdf8f7
jmp 0xdfb57
movq -0x8(%rbp), %rdi
movl -0x88(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
movl %eax, -0x150(%rbp)
cmpl $0x2, -0x150(%rbp)
jae 0xdf91e
jmp 0xdfb57
jmp 0xdf920
movq -0x68(%rbp), %rax
cmpq -0x60(%rbp), %rax
jne 0xdf96f
cmpq $0x0, -0x60(%rbp)
je 0xdf941
movq -0x60(%rbp), %rax
shlq %rax
movq %rax, -0x190(%rbp)
jmp 0xdf94f
movl $0x2, %eax
movq %rax, -0x190(%rbp)
jmp 0xdf94f
movq -0x190(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, -0x58(%rbp)
movq -0x160(%rbp), %rax
movl -0x154(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
movq -0x58(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x68(%rbp)
movl %edx, (%rax,%rcx,4)
jmp 0xdf99e
movq -0x80(%rbp), %rax
cmpq -0x78(%rbp), %rax
jne 0xdf9ed
cmpq $0x0, -0x78(%rbp)
je 0xdf9bf
movq -0x78(%rbp), %rax
shlq %rax
movq %rax, -0x198(%rbp)
jmp 0xdf9cd
movl $0x2, %eax
movq %rax, -0x198(%rbp)
jmp 0xdf9cd
movq -0x198(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, -0x70(%rbp)
movl -0x88(%rbp), %edx
movq -0x70(%rbp), %rax
movq -0x80(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x80(%rbp)
movl %edx, (%rax,%rcx,4)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x88(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x168(%rbp)
movl $0xffffffff, -0x124(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x138(%rbp)
movq -0x138(%rbp), %rax
movl -0x140(%rbp), %ecx
cmpq %rcx, %rax
jae 0xdfaff
movq -0x168(%rbp), %rax
imulq $0x18, -0x138(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0xdfa7f
jmp 0xdfae8
movq -0x168(%rbp), %rax
imulq $0x18, -0x138(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
shrl %eax
movl -0x84(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
jne 0xdfaa4
jmp 0xdfae8
movq -0x168(%rbp), %rax
imulq $0x18, -0x138(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl -0x124(%rbp), %eax
jae 0xdfae6
movq -0x168(%rbp), %rax
imulq $0x18, -0x138(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x124(%rbp)
jmp 0xdfae8
movq -0x138(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x138(%rbp)
jmp 0xdfa4a
movq -0x160(%rbp), %rax
movl -0x154(%rbp), %ecx
leaq (%rcx,%rcx,2), %rcx
movl 0xc(%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cvtsi2ss %eax, %xmm1
movl -0x124(%rbp), %eax
cvtsi2ss %rax, %xmm0
mulss -0xc(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0xdfb41
movl -0x144(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x144(%rbp)
jmp 0xdfb43
movl -0x154(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x154(%rbp)
jmp 0xdf87b
movl -0x144(%rbp), %eax
cmpl -0x14c(%rbp), %eax
je 0xe01b7
movq $0x0, -0x68(%rbp)
movq $0x0, -0x80(%rbp)
movl $0x0, -0x144(%rbp)
movl $0x0, -0x154(%rbp)
movl -0x154(%rbp), %eax
cmpl -0x13c(%rbp), %eax
jae 0xdfe69
movq -0x160(%rbp), %rax
movl -0x154(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0xdfbc3
jmp 0xdfe55
movq -0x160(%rbp), %rax
movl -0x154(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
xorl $0x1, %eax
movl %eax, -0x88(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x88(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x140(%rbp)
cmpl $0x2, -0x140(%rbp)
jae 0xdfc09
jmp 0xdfe69
movq -0x8(%rbp), %rdi
movl -0x88(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
movl %eax, -0x150(%rbp)
cmpl $0x2, -0x150(%rbp)
jae 0xdfc30
jmp 0xdfe69
jmp 0xdfc32
movq -0x68(%rbp), %rax
cmpq -0x60(%rbp), %rax
jne 0xdfc81
cmpq $0x0, -0x60(%rbp)
je 0xdfc53
movq -0x60(%rbp), %rax
shlq %rax
movq %rax, -0x1a0(%rbp)
jmp 0xdfc61
movl $0x2, %eax
movq %rax, -0x1a0(%rbp)
jmp 0xdfc61
movq -0x1a0(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, -0x58(%rbp)
movq -0x160(%rbp), %rax
movl -0x154(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
movq -0x58(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x68(%rbp)
movl %edx, (%rax,%rcx,4)
jmp 0xdfcb0
movq -0x80(%rbp), %rax
cmpq -0x78(%rbp), %rax
jne 0xdfcff
cmpq $0x0, -0x78(%rbp)
je 0xdfcd1
movq -0x78(%rbp), %rax
shlq %rax
movq %rax, -0x1a8(%rbp)
jmp 0xdfcdf
movl $0x2, %eax
movq %rax, -0x1a8(%rbp)
jmp 0xdfcdf
movq -0x1a8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, -0x70(%rbp)
movl -0x88(%rbp), %edx
movq -0x70(%rbp), %rax
movq -0x80(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x80(%rbp)
movl %edx, (%rax,%rcx,4)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x88(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x168(%rbp)
movl $0xffffffff, -0x124(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x138(%rbp)
movq -0x138(%rbp), %rax
movl -0x140(%rbp), %ecx
cmpq %rcx, %rax
jae 0xdfe11
movq -0x168(%rbp), %rax
imulq $0x18, -0x138(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0xdfd91
jmp 0xdfdfa
movq -0x168(%rbp), %rax
imulq $0x18, -0x138(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
shrl %eax
movl -0x84(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
jne 0xdfdb6
jmp 0xdfdfa
movq -0x168(%rbp), %rax
imulq $0x18, -0x138(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl -0x124(%rbp), %eax
jae 0xdfdf8
movq -0x168(%rbp), %rax
imulq $0x18, -0x138(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x124(%rbp)
jmp 0xdfdfa
movq -0x138(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x138(%rbp)
jmp 0xdfd5c
movq -0x160(%rbp), %rax
movl -0x154(%rbp), %ecx
leaq (%rcx,%rcx,2), %rcx
movl 0xc(%rax,%rcx,8), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cvtsi2ss %eax, %xmm1
movl -0x124(%rbp), %eax
cvtsi2ss %rax, %xmm0
mulss -0x10(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0xdfe53
movl -0x144(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x144(%rbp)
jmp 0xdfe55
movl -0x154(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x154(%rbp)
jmp 0xdfb8d
movl -0x144(%rbp), %eax
cmpl -0x14c(%rbp), %eax
jne 0xe01b5
movl $0x1, -0x144(%rbp)
movl $0x1, -0x154(%rbp)
movl -0x154(%rbp), %eax
cmpq -0x68(%rbp), %rax
jae 0xdfeeb
movq -0x58(%rbp), %rax
movl (%rax), %edi
movq -0x58(%rbp), %rax
movl -0x154(%rbp), %ecx
movl (%rax,%rcx,4), %esi
movq -0x8(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
callq 0xdbff0
cmpq $0x1, %rax
jne 0xdfed8
movl -0x144(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x144(%rbp)
jmp 0xdfeda
movl -0x154(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x154(%rbp)
jmp 0xdfe8f
movl -0x144(%rbp), %eax
cmpl -0x14c(%rbp), %eax
je 0xe01b3
cmpq $0x2, -0x80(%rbp)
jb 0xe01b3
movl $0x0, -0x144(%rbp)
movl $0x0, -0x16c(%rbp)
movl $0x0, -0x170(%rbp)
movq -0x70(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
movl -0x88(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
movl %eax, -0x150(%rbp)
cmpl $0x2, -0x150(%rbp)
je 0xdff59
jmp 0xe01b9
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x88(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x168(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x88(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x140(%rbp)
movq $0x0, -0x138(%rbp)
movq -0x138(%rbp), %rax
movl -0x140(%rbp), %ecx
cmpq %rcx, %rax
jae 0xe0030
movq -0x168(%rbp), %rax
imulq $0x18, -0x138(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0xdffd9
jmp 0xe0019
movq -0x168(%rbp), %rax
imulq $0x18, -0x138(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
shrl %eax
movl -0x84(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
jne 0xdfffe
jmp 0xe0019
movq -0x168(%rbp), %rax
imulq $0x18, -0x138(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x16c(%rbp)
movq -0x138(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x138(%rbp)
jmp 0xdffa8
movl $0x1, -0x144(%rbp)
movl $0x1, -0x154(%rbp)
movl -0x154(%rbp), %eax
cmpq -0x80(%rbp), %rax
jae 0xe01b1
movq -0x70(%rbp), %rax
movl -0x154(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
movl -0x88(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x166b50
movl %eax, -0x150(%rbp)
cmpl $0x2, -0x150(%rbp)
je 0xe008e
jmp 0xe01b9
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x88(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x168(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x88(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x140(%rbp)
movq $0x0, -0x138(%rbp)
movq -0x138(%rbp), %rax
movl -0x140(%rbp), %ecx
cmpq %rcx, %rax
jae 0xe0165
movq -0x168(%rbp), %rax
imulq $0x18, -0x138(%rbp), %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0xe010e
jmp 0xe014e
movq -0x168(%rbp), %rax
imulq $0x18, -0x138(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
shrl %eax
movl -0x84(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
jne 0xe0133
jmp 0xe014e
movq -0x168(%rbp), %rax
imulq $0x18, -0x138(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x170(%rbp)
movq -0x138(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x138(%rbp)
jmp 0xe00dd
movl -0x16c(%rbp), %edi
movl -0x170(%rbp), %esi
movq -0x8(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
callq 0xdbff0
cmpq $0x1, %rax
jne 0xe019b
movl -0x144(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x144(%rbp)
jmp 0xe019d
movl -0x154(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x154(%rbp)
jmp 0xe0044
jmp 0xe01b3
jmp 0xe01b5
jmp 0xe01b7
jmp 0xe01b9
movl -0x144(%rbp), %eax
cmpl -0x14c(%rbp), %eax
je 0xe01cc
jmp 0xe0498
movl $0x0, -0x144(%rbp)
movl $0x0, -0x154(%rbp)
movl -0x154(%rbp), %eax
cmpq -0x68(%rbp), %rax
jae 0xe022c
movq -0x58(%rbp), %rax
movl -0x154(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movq -0x58(%rbp), %rcx
cmpl (%rcx), %eax
jne 0xe020d
movl $0x1, -0x144(%rbp)
jmp 0xe0219
movl $0x0, -0x144(%rbp)
jmp 0xe022c
jmp 0xe021b
movl -0x154(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x154(%rbp)
jmp 0xe01e0
cmpl $0x0, -0x144(%rbp)
jne 0xe0278
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x68(%rbp), %rax
movl %eax, %edx
movl -0x14(%rbp), %ecx
leaq -0x100(%rbp), %r8
xorl %r9d, %r9d
leaq -0x94(%rbp), %rax
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
movq %rax, 0x8(%rsp)
callq 0xd5db0
cmpq $0x1, %rax
jne 0xe0278
movl $0x1, -0x144(%rbp)
cmpl $0x0, -0x144(%rbp)
jne 0xe02b6
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x68(%rbp), %rax
movl %eax, %edx
leaq -0x174(%rbp), %rcx
leaq -0x180(%rbp), %r8
xorl %eax, %eax
movl %eax, %r9d
callq 0xd52b0
cmpl $0x0, %eax
je 0xe02b6
movl $0x1, -0x144(%rbp)
movl $0x0, -0x148(%rbp)
movl $0x0, -0x154(%rbp)
movl -0x154(%rbp), %eax
cmpq -0x80(%rbp), %rax
jae 0xe0316
movq -0x70(%rbp), %rax
movl -0x154(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movq -0x70(%rbp), %rcx
cmpl (%rcx), %eax
jne 0xe02f7
movl $0x1, -0x148(%rbp)
jmp 0xe0303
movl $0x0, -0x148(%rbp)
jmp 0xe0316
jmp 0xe0305
movl -0x154(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x154(%rbp)
jmp 0xe02ca
cmpl $0x0, -0x148(%rbp)
jne 0xe036d
movq -0x8(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x80(%rbp), %rax
movl %eax, %edx
movl -0x14(%rbp), %ecx
movl -0x84(%rbp), %r10d
xorl $0x1, %r10d
leaq -0x100(%rbp), %r8
movl $0x1, %r9d
leaq -0x94(%rbp), %rax
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xd5db0
cmpq $0x1, %rax
jne 0xe036d
movl $0x1, -0x148(%rbp)
cmpl $0x0, -0x148(%rbp)
jne 0xe03ab
movq -0x8(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x80(%rbp), %rax
movl %eax, %edx
leaq -0x174(%rbp), %rcx
leaq -0x180(%rbp), %r8
xorl %eax, %eax
movl %eax, %r9d
callq 0xd52b0
cmpl $0x0, %eax
je 0xe03ab
movl $0x1, -0x148(%rbp)
cmpl $0x0, -0x144(%rbp)
je 0xe0496
cmpl $0x0, -0x148(%rbp)
je 0xe0496
movl $0x0, -0x154(%rbp)
movl -0x154(%rbp), %eax
cmpl -0x13c(%rbp), %eax
jae 0xe0494
movq -0x160(%rbp), %rax
movl -0x154(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0xe0402
jmp 0xe0480
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
movq -0x160(%rbp), %rax
movl -0x154(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rdi
movq -0x160(%rbp), %rax
movl -0x154(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
movq -0x160(%rbp), %rax
movl -0x154(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
xorq $0x1, %rax
movl %eax, %edx
movl $0x1, %ecx
callq 0xd6530
movl -0x154(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x154(%rbp)
jmp 0xe03cf
jmp 0xe0496
jmp 0xe0498
movq -0x130(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x130(%rbp)
jmp 0xdf796
movq -0x40(%rbp), %rdi
callq 0x2210
movq -0x58(%rbp), %rdi
callq 0x2210
movq -0x70(%rbp), %rdi
callq 0x2210
movq -0x100(%rbp), %rdi
callq 0x2210
movq -0xe8(%rbp), %rdi
callq 0x2210
movq -0xd0(%rbp), %rdi
callq 0x2210
movq -0xb8(%rbp), %rdi
callq 0x2210
movq -0xa0(%rbp), %rdi
callq 0x2210
cmpl $0x0, -0x90(%rbp)
je 0xe0521
movq -0x8(%rbp), %rdi
callq 0xcdd10
movq -0x8(%rbp), %rdi
callq 0xce020
movl -0x90(%rbp), %eax
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq