// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: asg_arc_cut_length(asg_t*, asg64_v*, int, float, float, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, ma_hit_t_alloc*, R_to_U*, unsigned int*)
void asg_arc_cut_length(asg_t *g, asg64_v *in, int32_t max_ext, float len_rat, float ou_rat, uint32_t is_ou, uint32_t is_trio, 
uint32_t is_topo, uint32_t min_diff, uint32_t min_ou, ma_hit_t_alloc *rev, R_to_U* rI, uint32_t *max_drop_len)
{
    asg64_v tx = {0,0,0}, *b = NULL;
    uint32_t i, k, v, w, n_vtx = g->n_seq<<1, nv, nw, kv, kw, trioF = (uint32_t)-1, ntrioF = (uint32_t)-1, ol_max, ou_max, to_del, cnt = 0, mm_ol, mm_ou;
    asg_arc_t *av, *aw, *ve, *we, *vl_max, *wl_max;

    if(in) b = in;
    else b = &tx;
	b->n = 0;

    for (v = 0; v < n_vtx; ++v) {
        // if((v>>1)==17078) fprintf(stderr, "[M::%s::] v:%u, del:%u, seq_vis:%u\n", __func__, v, g->seq[v>>1].del, g->seq_vis[v]);
        if (g->seq[v>>1].del) continue;
        if(g->seq_vis[v] == 0) {
            av = asg_arc_a(g, v); nv = asg_arc_n(g, v);
            if (nv < 2) continue;

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

            for (i = 0; i < nv; ++i) {
                if(av[i].del) continue;
                // if((av[i].ul>>33)==287) {
                //     fprintf(stderr, "++++++%.*s(%c)\t%.*s(%c)\tol:%u\tou:%u\n", 
                //     (int32_t)Get_NAME_LENGTH(R_INF, (av[i].ul>>33)), Get_NAME(R_INF, (av[i].ul>>33)), "+-"[(av[i].ul>>32)&1], 
                //     (int32_t)Get_NAME_LENGTH(R_INF, (av[i].v>>1)), Get_NAME(R_INF, (av[i].v>>1)), "+-"[av[i].v&1], av[i].ol, av[i].ou);
                // }
                if(max_drop_len && av[i].ol >= (*max_drop_len)) continue;
                kv_push(uint64_t, *b, (((uint64_t)av[i].ol)<<32) | ((uint64_t)(av-g->arc+i)));   
            }
        }
	}

    if(rev && rI) memset(g->seq_vis, 0, g->n_seq*2*sizeof(uint8_t));
    radix_sort_srt64(b->a, b->a + b->n);
    for (k = 0; k < b->n; k++) {
        if(g->arc[(uint32_t)b->a[k]].del) continue;

        v = g->arc[(uint32_t)b->a[k]].ul>>32; w = g->arc[(uint32_t)b->a[k]].v^1;
        if(g->seq[v>>1].del || g->seq[w>>1].del) continue;
        nv = asg_arc_n(g, v); nw = asg_arc_n(g, w);
        av = asg_arc_a(g, v); aw = asg_arc_a(g, w);
        if(nv<=1 && nw <= 1) continue;

        if(is_trio) {
            if(get_arcs(g, v, NULL, 0)<=1 && get_arcs(g, w, NULL, 0)<=1) continue;///speedup
            trioF = get_tip_trio_infor(g, v^1);
            ntrioF = (trioF==FATHER? MOTHER : (trioF==MOTHER? FATHER : (uint32_t)-1));
        }

        ve = &(g->arc[(uint32_t)b->a[k]]);
        for (i = 0; i < nw; ++i) {
            if (aw[i].v == (v^1)) {
                we = &(aw[i]);
                break;
            }
        }
        ///mm_ol and mm_ou are used to make edge with long indel more easy to be cutted
        mm_ol = MIN(ve->ol, we->ol); mm_ou = MIN(ve->ou, we->ou);

        for (i = kv = ol_max = ou_max = 0, /**ve =**/ vl_max = NULL; i < nv; ++i) {
            if(av[i].del) continue;
            // if(av[i].v == (w^1)) ve = &(av[i]);
            // if((av[i].ul>>33)==287) {
            //     fprintf(stderr, "++++++%.*s(%c)\t%.*s(%c)\tol:%u\tou:%u\n", 
            //     (int32_t)Get_NAME_LENGTH(R_INF, (av[i].ul>>33)), Get_NAME(R_INF, (av[i].ul>>33)), "+-"[(av[i].ul>>32)&1], 
            //     (int32_t)Get_NAME_LENGTH(R_INF, (av[i].v>>1)), Get_NAME(R_INF, (av[i].v>>1)), "+-"[av[i].v&1], av[i].ol, av[i].ou);
            // }
            kv++;
            if(is_trio && get_tip_trio_infor(g, av[i].v) == ntrioF) continue;
            if(ol_max < av[i].ol) ol_max = av[i].ol, vl_max = &(av[i]);
            if(ou_max < av[i].ou) ou_max = av[i].ou;
        }
        if (kv < 1) continue;
        if (kv >= 2) {
            if (mm_ol > ol_max*len_rat) continue;
            if (is_ou && mm_ou > ou_max*ou_rat && mm_ou > min_ou) continue;
            if ((mm_ol + min_diff) > ol_max) continue;
        }
        

        for (i = kw = ol_max = ou_max = 0, wl_max = NULL; i < nw; ++i) {
            if(aw[i].del) continue;
            kw++;
            if(is_trio && get_tip_trio_infor(g, aw[i].v) == ntrioF) continue;
            if(ol_max < aw[i].ol) ol_max = aw[i].ol, wl_max = &(aw[i]);
            if(ou_max < aw[i].ou) ou_max = aw[i].ou;
        }
        if (kw < 1) continue;
        if (kw >= 2) {
            if (mm_ol > ol_max*len_rat) continue;
            if (is_ou && mm_ou > ou_max*ou_rat && mm_ou > min_ou) continue;
            if ((mm_ol + min_diff) > ol_max) continue;
        }

        if (kv <= 1 && kw <= 1) continue;

        to_del = 0;
        if(is_topo) {
            if (kv > 1 && kw > 1) {
                to_del = 1;
            } else if (kw == 1) {
                if (asg_topocut_aux(g, w^1, max_ext) < max_ext) to_del = 1;
            } else if (kv == 1) {
                if (asg_topocut_aux(g, v^1, max_ext) < max_ext) to_del = 1;
            }
        }

        if(rev && rI) {
            if((to_del == 0) && vl_max && (ve->v!=vl_max->v) && (trans_path_check(ve->v, vl_max->v, g, rev, rI, max_ext, b)==0)) {
                to_del = 1;
            }
            if((to_del == 0) && wl_max && (we->v!=wl_max->v) && (trans_path_check(we->v, wl_max->v, g, rev, rI, max_ext, b)==0)) {
                to_del = 1;
            }
            if(vl_max && wl_max) assert(ve->v!=vl_max->v||we->v!=wl_max->v);
        }
        

        if (to_del) {
            ve->del = we->del = 1, ++cnt;
        }
    }
    // stats_sysm(g);
    if(!in) free(tx.a);
    if (cnt > 0) asg_cleanup(g);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movss %xmm0, -0x18(%rbp)
movss %xmm1, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2100
movq $0x0, -0x48(%rbp)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movl %eax, -0x5c(%rbp)
movl $0xffffffff, -0x70(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x74(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x84(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x315aff
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x315b07
leaq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jae 0x315d5a
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x54(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x315b44
jmp 0x315d4c
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x54(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x315d4a
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x54(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x54(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x60(%rbp)
cmpl $0x2, -0x60(%rbp)
jae 0x315ba2
jmp 0x315d4c
movl $0x0, -0x68(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x60(%rbp), %eax
jae 0x315bea
movq -0x98(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x315bd6
jmp 0x315bdf
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x315bb0
cmpl $0x2, -0x68(%rbp)
jae 0x315bf5
jmp 0x315d4c
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x60(%rbp), %eax
jae 0x315d48
movq -0x98(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x315c29
jmp 0x315d3a
cmpq $0x0, 0x30(%rbp)
je 0x315c56
movq -0x98(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq 0x30(%rbp), %rcx
cmpl (%rcx), %eax
jb 0x315c56
jmp 0x315d3a
jmp 0x315c58
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x315cc9
movq -0x48(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x315c88
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xc8(%rbp)
jmp 0x315c96
movl $0x2, %eax
movq %rax, -0xc8(%rbp)
jmp 0x315c96
movq -0xc8(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x98(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
shlq $0x20, %rax
movq %rax, -0xd0(%rbp)
movq -0x98(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
subq %rcx, %rax
movl $0x18, %ecx
cqto
idivq %rcx
movq -0xd0(%rbp), %rdx
movl -0x4c(%rbp), %ecx
addq %rcx, %rax
orq %rax, %rdx
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x48(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x315d3a
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x315bfc
jmp 0x315d4a
jmp 0x315d4c
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x315b19
cmpq $0x0, 0x20(%rbp)
je 0x315d8c
cmpq $0x0, 0x28(%rbp)
je 0x315d8c
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movslq %eax, %rdx
shlq $0x0, %rdx
xorl %esi, %esi
callq 0x2100
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x48(%rbp), %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x30ed90
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x316661
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x48(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x50(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x315df6
jmp 0x316653
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x48(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x50(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x20, %rax
movl %eax, -0x54(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x48(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x50(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
xorl $0x1, %eax
movl %eax, -0x58(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x54(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x315e7d
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x58(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x315e82
jmp 0x316653
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x54(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x58(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x64(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x54(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x58(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
cmpl $0x1, -0x60(%rbp)
ja 0x315f09
cmpl $0x1, -0x64(%rbp)
ja 0x315f09
jmp 0x316653
cmpl $0x0, -0x24(%rbp)
je 0x315f8c
movq -0x8(%rbp), %rdi
movl -0x54(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x311ba0
cmpl $0x1, %eax
ja 0x315f42
movq -0x8(%rbp), %rdi
movl -0x58(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x311ba0
cmpl $0x1, %eax
ja 0x315f42
jmp 0x316653
movq -0x8(%rbp), %rdi
movl -0x54(%rbp), %esi
xorl $0x1, %esi
callq 0xde900
movzbl %al, %eax
movl %eax, -0x70(%rbp)
cmpl $0x1, -0x70(%rbp)
jne 0x315f6a
movl $0x2, %eax
movl %eax, -0xd4(%rbp)
jmp 0x315f83
movl -0x70(%rbp), %edx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0x1, %ecx
cmpl $0x2, %edx
cmovel %ecx, %eax
movl %eax, -0xd4(%rbp)
movl -0xd4(%rbp), %eax
movl %eax, -0x74(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x48(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x50(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x64(%rbp), %eax
jae 0x316007
movq -0xa0(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl -0x54(%rbp), %ecx
xorl $0x1, %ecx
cmpl %ecx, %eax
jne 0x315ffa
movq -0xa0(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
jmp 0x316007
jmp 0x315ffc
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x315fba
movq -0xa8(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq -0xb0(%rbp), %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jg 0x316041
movq -0xa8(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0xd8(%rbp)
jmp 0x316056
movq -0xb0(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0xd8(%rbp)
movl -0xd8(%rbp), %eax
movl %eax, -0x88(%rbp)
movq -0xa8(%rbp), %rax
movw 0x10(%rax), %ax
andw $0x3fff, %ax            # imm = 0x3FFF
movzwl %ax, %eax
movq -0xb0(%rbp), %rcx
movw 0x10(%rcx), %cx
andw $0x3fff, %cx            # imm = 0x3FFF
movzwl %cx, %ecx
cmpl %ecx, %eax
jg 0x3160a3
movq -0xa8(%rbp), %rax
movw 0x10(%rax), %ax
andw $0x3fff, %ax            # imm = 0x3FFF
movw %ax, -0xda(%rbp)
jmp 0x3160b9
movq -0xb0(%rbp), %rax
movw 0x10(%rax), %ax
andw $0x3fff, %ax            # imm = 0x3FFF
movw %ax, -0xda(%rbp)
movw -0xda(%rbp), %ax
movzwl %ax, %eax
movl %eax, -0x8c(%rbp)
movl $0x0, -0x7c(%rbp)
movl $0x0, -0x78(%rbp)
movl $0x0, -0x68(%rbp)
movl $0x0, -0x4c(%rbp)
movq $0x0, -0xb8(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x60(%rbp), %eax
jae 0x3161fe
movq -0x98(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x31611d
jmp 0x3161f0
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x316156
movq -0x8(%rbp), %rdi
movq -0x98(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
callq 0xde900
movzbl %al, %eax
cmpl -0x74(%rbp), %eax
jne 0x316156
jmp 0x3161f0
movl -0x78(%rbp), %eax
movq -0x98(%rbp), %rcx
movl -0x4c(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x3161ab
movq -0x98(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x78(%rbp)
movq -0x98(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
movl -0x7c(%rbp), %eax
movq -0x98(%rbp), %rcx
movl -0x4c(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movw 0x10(%rcx), %cx
andw $0x3fff, %cx            # imm = 0x3FFF
movzwl %cx, %ecx
cmpl %ecx, %eax
jae 0x3161ee
movq -0x98(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movw 0x10(%rax), %ax
andw $0x3fff, %ax            # imm = 0x3FFF
movzwl %ax, %eax
movl %eax, -0x7c(%rbp)
jmp 0x3161f0
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x3160f0
cmpl $0x1, -0x68(%rbp)
jae 0x316209
jmp 0x316653
cmpl $0x2, -0x68(%rbp)
jb 0x316279
movl -0x88(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0x78(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x18(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x316231
jmp 0x316653
cmpl $0x0, -0x20(%rbp)
je 0x316264
movl -0x8c(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0x7c(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x1c(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x316264
movl -0x8c(%rbp), %eax
cmpl 0x18(%rbp), %eax
jbe 0x316264
jmp 0x316653
movl -0x88(%rbp), %eax
addl 0x10(%rbp), %eax
cmpl -0x78(%rbp), %eax
jbe 0x316277
jmp 0x316653
jmp 0x316279
movl $0x0, -0x7c(%rbp)
movl $0x0, -0x78(%rbp)
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x4c(%rbp)
movq $0x0, -0xc0(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x64(%rbp), %eax
jae 0x3163ae
movq -0xa0(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x3162cd
jmp 0x3163a0
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x316306
movq -0x8(%rbp), %rdi
movq -0xa0(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
callq 0xde900
movzbl %al, %eax
cmpl -0x74(%rbp), %eax
jne 0x316306
jmp 0x3163a0
movl -0x78(%rbp), %eax
movq -0xa0(%rbp), %rcx
movl -0x4c(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x31635b
movq -0xa0(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x78(%rbp)
movq -0xa0(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movl -0x7c(%rbp), %eax
movq -0xa0(%rbp), %rcx
movl -0x4c(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movw 0x10(%rcx), %cx
andw $0x3fff, %cx            # imm = 0x3FFF
movzwl %cx, %ecx
cmpl %ecx, %eax
jae 0x31639e
movq -0xa0(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movw 0x10(%rax), %ax
andw $0x3fff, %ax            # imm = 0x3FFF
movzwl %ax, %eax
movl %eax, -0x7c(%rbp)
jmp 0x3163a0
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x3162a0
cmpl $0x1, -0x6c(%rbp)
jae 0x3163b9
jmp 0x316653
cmpl $0x2, -0x6c(%rbp)
jb 0x316429
movl -0x88(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0x78(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x18(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x3163e1
jmp 0x316653
cmpl $0x0, -0x20(%rbp)
je 0x316414
movl -0x8c(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0x7c(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x1c(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x316414
movl -0x8c(%rbp), %eax
cmpl 0x18(%rbp), %eax
jbe 0x316414
jmp 0x316653
movl -0x88(%rbp), %eax
addl 0x10(%rbp), %eax
cmpl -0x78(%rbp), %eax
jbe 0x316427
jmp 0x316653
jmp 0x316429
cmpl $0x1, -0x68(%rbp)
ja 0x31643a
cmpl $0x1, -0x6c(%rbp)
ja 0x31643a
jmp 0x316653
movl $0x0, -0x80(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x3164ae
cmpl $0x1, -0x68(%rbp)
jbe 0x31645c
cmpl $0x1, -0x6c(%rbp)
jbe 0x31645c
movl $0x1, -0x80(%rbp)
jmp 0x3164ac
cmpl $0x1, -0x6c(%rbp)
jne 0x316482
movq -0x8(%rbp), %rdi
movl -0x58(%rbp), %esi
xorl $0x1, %esi
movl -0x14(%rbp), %edx
callq 0xdd220
cmpl -0x14(%rbp), %eax
jge 0x316480
movl $0x1, -0x80(%rbp)
jmp 0x3164aa
cmpl $0x1, -0x68(%rbp)
jne 0x3164a8
movq -0x8(%rbp), %rdi
movl -0x54(%rbp), %esi
xorl $0x1, %esi
movl -0x14(%rbp), %edx
callq 0xdd220
cmpl -0x14(%rbp), %eax
jge 0x3164a6
movl $0x1, -0x80(%rbp)
jmp 0x3164a8
jmp 0x3164aa
jmp 0x3164ac
jmp 0x3164ae
cmpq $0x0, 0x20(%rbp)
je 0x31660a
cmpq $0x0, 0x28(%rbp)
je 0x31660a
cmpl $0x0, -0x80(%rbp)
jne 0x316527
cmpq $0x0, -0xb8(%rbp)
je 0x316527
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xb8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0x316527
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %edi
movq -0xb8(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x8(%rbp), %rdx
movq 0x20(%rbp), %rcx
movq 0x28(%rbp), %r8
movl -0x14(%rbp), %r9d
movq -0x48(%rbp), %rax
movq %rax, (%rsp)
callq 0x3156e0
cmpl $0x0, %eax
jne 0x316527
movl $0x1, -0x80(%rbp)
cmpl $0x0, -0x80(%rbp)
jne 0x31658a
cmpq $0x0, -0xc0(%rbp)
je 0x31658a
movq -0xb0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xc0(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0x31658a
movq -0xb0(%rbp), %rax
movl 0x8(%rax), %edi
movq -0xc0(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x8(%rbp), %rdx
movq 0x20(%rbp), %rcx
movq 0x28(%rbp), %r8
movl -0x14(%rbp), %r9d
movq -0x48(%rbp), %rax
movq %rax, (%rsp)
callq 0x3156e0
cmpl $0x0, %eax
jne 0x31658a
movl $0x1, -0x80(%rbp)
cmpq $0x0, -0xb8(%rbp)
je 0x316608
cmpq $0x0, -0xc0(%rbp)
je 0x316608
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0xb8(%rbp), %rdx
movb $0x1, %al
cmpl 0x8(%rdx), %ecx
movb %al, -0xdb(%rbp)
jne 0x3165d9
movq -0xb0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xc0(%rbp), %rcx
cmpl 0x8(%rcx), %eax
setne %al
movb %al, -0xdb(%rbp)
movb -0xdb(%rbp), %al
testb $0x1, %al
jne 0x3165e5
jmp 0x3165e7
jmp 0x316606
leaq 0x7fece(%rip), %rdi     # 0x3964bc
leaq 0x7fbc4(%rip), %rsi     # 0x3961b9
movl $0x575, %edx            # imm = 0x575
leaq 0x7fede(%rip), %rcx     # 0x3964df
callq 0x2130
jmp 0x316608
jmp 0x31660a
cmpl $0x0, -0x80(%rbp)
je 0x316651
movq -0xb0(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movq -0xa8(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x316653
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x315db6
cmpq $0x0, -0x10(%rbp)
jne 0x316671
movq -0x30(%rbp), %rdi
callq 0x2210
cmpl $0x0, -0x84(%rbp)
jbe 0x316683
movq -0x8(%rbp), %rdi
callq 0xcdd10
addq $0xf0, %rsp
popq %rbp
retq
nopl (%rax)