// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: asg_arc_cut_length_adv(asg_t*, asg64_v*, int, float, float, unsigned int, unsigned int, unsigned int, unsigned int, ma_hit_t_alloc*, R_to_U*, unsigned int*)
void asg_arc_cut_length_adv(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, 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 (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(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;
            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) 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) 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 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
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 0x3182ec
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x3182f4
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 0x318547
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 0x318331
jmp 0x318539
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x54(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x318537
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 0x31838f
jmp 0x318539
movl $0x0, -0x68(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x60(%rbp), %eax
jae 0x3183d7
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 0x3183c3
jmp 0x3183cc
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x31839d
cmpl $0x2, -0x68(%rbp)
jae 0x3183e2
jmp 0x318539
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x60(%rbp), %eax
jae 0x318535
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 0x318416
jmp 0x318527
cmpq $0x0, 0x28(%rbp)
je 0x318443
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 0x28(%rbp), %rcx
cmpl (%rcx), %eax
jb 0x318443
jmp 0x318527
jmp 0x318445
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x3184b6
movq -0x48(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x318475
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xc8(%rbp)
jmp 0x318483
movl $0x2, %eax
movq %rax, -0xc8(%rbp)
jmp 0x318483
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 0x318527
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x3183e9
jmp 0x318537
jmp 0x318539
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x318306
cmpq $0x0, 0x18(%rbp)
je 0x318579
cmpq $0x0, 0x20(%rbp)
je 0x318579
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 0x318e38
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 0x3185e3
jmp 0x318e2a
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 0x31866a
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 0x31866f
jmp 0x318e2a
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 0x3186f6
cmpl $0x1, -0x64(%rbp)
ja 0x3186f6
jmp 0x318e2a
cmpl $0x0, -0x24(%rbp)
je 0x318779
movq -0x8(%rbp), %rdi
movl -0x54(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x311ba0
cmpl $0x1, %eax
ja 0x31872f
movq -0x8(%rbp), %rdi
movl -0x58(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x311ba0
cmpl $0x1, %eax
ja 0x31872f
jmp 0x318e2a
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 0x318757
movl $0x2, %eax
movl %eax, -0xd4(%rbp)
jmp 0x318770
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 0x3187f4
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 0x3187e7
movq -0xa0(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
jmp 0x3187f4
jmp 0x3187e9
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x3187a7
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 0x31882e
movq -0xa8(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0xd8(%rbp)
jmp 0x318843
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 0x318890
movq -0xa8(%rbp), %rax
movw 0x10(%rax), %ax
andw $0x3fff, %ax            # imm = 0x3FFF
movw %ax, -0xda(%rbp)
jmp 0x3188a6
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 0x3189eb
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 0x31890a
jmp 0x3189dd
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x318943
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 0x318943
jmp 0x3189dd
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 0x318998
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 0x3189db
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 0x3189dd
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x3188dd
cmpl $0x1, -0x68(%rbp)
jae 0x3189f6
jmp 0x318e2a
cmpl $0x2, -0x68(%rbp)
jb 0x318a5b
movl -0x88(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0x78(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x18(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x318a1e
jmp 0x318e2a
cmpl $0x0, -0x20(%rbp)
je 0x318a46
movl -0x8c(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0x7c(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x1c(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x318a46
jmp 0x318e2a
movl -0x88(%rbp), %eax
addl 0x10(%rbp), %eax
cmpl -0x78(%rbp), %eax
jbe 0x318a59
jmp 0x318e2a
jmp 0x318a5b
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 0x318b90
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 0x318aaf
jmp 0x318b82
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x318ae8
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 0x318ae8
jmp 0x318b82
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 0x318b3d
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 0x318b80
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 0x318b82
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x318a82
cmpl $0x1, -0x6c(%rbp)
jae 0x318b9b
jmp 0x318e2a
cmpl $0x2, -0x6c(%rbp)
jb 0x318c00
movl -0x88(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0x78(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x18(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x318bc3
jmp 0x318e2a
cmpl $0x0, -0x20(%rbp)
je 0x318beb
movl -0x8c(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0x7c(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x1c(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x318beb
jmp 0x318e2a
movl -0x88(%rbp), %eax
addl 0x10(%rbp), %eax
cmpl -0x78(%rbp), %eax
jbe 0x318bfe
jmp 0x318e2a
jmp 0x318c00
cmpl $0x1, -0x68(%rbp)
ja 0x318c11
cmpl $0x1, -0x6c(%rbp)
ja 0x318c11
jmp 0x318e2a
movl $0x0, -0x80(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x318c85
cmpl $0x1, -0x68(%rbp)
jbe 0x318c33
cmpl $0x1, -0x6c(%rbp)
jbe 0x318c33
movl $0x1, -0x80(%rbp)
jmp 0x318c83
cmpl $0x1, -0x6c(%rbp)
jne 0x318c59
movq -0x8(%rbp), %rdi
movl -0x58(%rbp), %esi
xorl $0x1, %esi
movl -0x14(%rbp), %edx
callq 0xdd220
cmpl -0x14(%rbp), %eax
jge 0x318c57
movl $0x1, -0x80(%rbp)
jmp 0x318c81
cmpl $0x1, -0x68(%rbp)
jne 0x318c7f
movq -0x8(%rbp), %rdi
movl -0x54(%rbp), %esi
xorl $0x1, %esi
movl -0x14(%rbp), %edx
callq 0xdd220
cmpl -0x14(%rbp), %eax
jge 0x318c7d
movl $0x1, -0x80(%rbp)
jmp 0x318c7f
jmp 0x318c81
jmp 0x318c83
jmp 0x318c85
cmpq $0x0, 0x18(%rbp)
je 0x318de1
cmpq $0x0, 0x20(%rbp)
je 0x318de1
cmpl $0x0, -0x80(%rbp)
jne 0x318cfe
cmpq $0x0, -0xb8(%rbp)
je 0x318cfe
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xb8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0x318cfe
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %edi
movq -0xb8(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x8(%rbp), %rdx
movq 0x18(%rbp), %rcx
movq 0x20(%rbp), %r8
movl -0x14(%rbp), %r9d
movq -0x48(%rbp), %rax
movq %rax, (%rsp)
callq 0x3156e0
cmpl $0x0, %eax
jne 0x318cfe
movl $0x1, -0x80(%rbp)
cmpl $0x0, -0x80(%rbp)
jne 0x318d61
cmpq $0x0, -0xc0(%rbp)
je 0x318d61
movq -0xb0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xc0(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0x318d61
movq -0xb0(%rbp), %rax
movl 0x8(%rax), %edi
movq -0xc0(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x8(%rbp), %rdx
movq 0x18(%rbp), %rcx
movq 0x20(%rbp), %r8
movl -0x14(%rbp), %r9d
movq -0x48(%rbp), %rax
movq %rax, (%rsp)
callq 0x3156e0
cmpl $0x0, %eax
jne 0x318d61
movl $0x1, -0x80(%rbp)
cmpq $0x0, -0xb8(%rbp)
je 0x318ddf
cmpq $0x0, -0xc0(%rbp)
je 0x318ddf
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0xb8(%rbp), %rdx
movb $0x1, %al
cmpl 0x8(%rdx), %ecx
movb %al, -0xdb(%rbp)
jne 0x318db0
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 0x318dbc
jmp 0x318dbe
jmp 0x318ddd
leaq 0x7d6f7(%rip), %rdi     # 0x3964bc
leaq 0x7d3ed(%rip), %rsi     # 0x3961b9
movl $0x6fa, %edx            # imm = 0x6FA
leaq 0x7d849(%rip), %rcx     # 0x396621
callq 0x2130
jmp 0x318ddf
jmp 0x318de1
cmpl $0x0, -0x80(%rbp)
je 0x318e28
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 0x318e2a
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x3185a3
cmpq $0x0, -0x10(%rbp)
jne 0x318e48
movq -0x30(%rbp), %rdi
callq 0x2210
cmpl $0x0, -0x84(%rbp)
jbe 0x318e5a
movq -0x8(%rbp), %rdi
callq 0xcdd10
addq $0xf0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)