// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: asg_arc_cut_weak(asg_t*, asg64_v*, int, float, float, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, ma_hit_t_alloc*, R_to_U*, unsigned int*)
void asg_arc_cut_weak(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, uint32_t test_bub, 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, wz, 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, olw[2], m;
    asg_arc_t *av, *aw, *ve, *we, *vl_max, *wl_max; ma_hit_t_alloc *z = NULL;

    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((test_bub == 0) || (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 = olw[1] = 0, olw[0] = (uint32_t)-1; i < nv; ++i) {
                if(av[i].del) continue;
                if(av[i].strong) {
                    if(av[i].ol > olw[av[i].strong]) olw[av[i].strong] = av[i].ol;
                } else {
                    if(av[i].ol < olw[av[i].strong]) olw[av[i].strong] = av[i].ol;
                }
            }
            if(olw[1] <= olw[0]) continue;
            for (i = 0; i < nv; ++i) {
                if(av[i].del || av[i].strong) continue;
                if(av[i].ol >= olw[1]) continue;
                if(max_drop_len && av[i].ol >= (*max_drop_len)) continue;
                if(is_dedup_weak_arc(av, nv, i, rev)) {
                    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, vl_max = NULL; i < nv; ++i) {
            if(av[i].del) continue;
            kv++;
            if((av[i].v == ve->v) || (!av[i].strong) || (av[i].ol <= ve->ol)) continue;
            if(is_trio && get_tip_trio_infor(g, av[i].v) == ntrioF) continue;

            z = &(rev[av[i].v>>1]); wz = (ve->v^(av[i].v&1));
            for (m = 0; m < z->length; m++) {
                if((z->buffer[m].tn<<1|(z->buffer[m].rev)) == wz) break;
            }
            if(m >= z->length) 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((aw[i].v == we->v) || (!aw[i].strong) || (aw[i].ol <= we->ol)) continue;
            if(is_trio && get_tip_trio_infor(g, aw[i].v) == ntrioF) continue;

            z = &(rev[aw[i].v>>1]); wz = (we->v^(aw[i].v&1));
            for (m = 0; m < z->length; m++) {
                if((z->buffer[m].tn<<1|(z->buffer[m].rev)) == wz) break;
            }
            if(m >= z->length) 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 $0x100, %rsp            # imm = 0x100
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movl 0x20(%rbp), %eax
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, -0x60(%rbp)
movl $0xffffffff, -0x74(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x78(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x88(%rbp)
movq $0x0, -0xd8(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x3168bd
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x3168c5
leaq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x60(%rbp), %eax
jae 0x316d27
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 0x316902
jmp 0x316d19
cmpl $0x0, 0x20(%rbp)
je 0x316920
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x54(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x316d17
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, -0xa8(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x54(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x64(%rbp)
cmpl $0x2, -0x64(%rbp)
jae 0x316966
jmp 0x316d19
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x64(%rbp), %eax
jae 0x3169ae
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x31699a
jmp 0x3169a3
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x316974
cmpl $0x2, -0x6c(%rbp)
jae 0x3169b9
jmp 0x316d19
movl $0x0, -0x94(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0xffffffff, -0x98(%rbp) # imm = 0xFFFFFFFF
movl -0x4c(%rbp), %eax
cmpl -0x64(%rbp), %eax
jae 0x316b45
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x316a01
jmp 0x316b37
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movw 0x10(%rax), %ax
shrw $0xe, %ax
andw $0x1, %ax
cmpw $0x0, %ax
je 0x316ab0
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq -0xa8(%rbp), %rcx
movl -0x4c(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movw 0x10(%rcx), %cx
shrw $0xe, %cx
andw $0x1, %cx
movzwl %cx, %ecx
cmpl -0x98(%rbp,%rcx,4), %eax
jbe 0x316aab
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movw 0x10(%rax), %ax
shrw $0xe, %ax
andw $0x1, %ax
movzwl %ax, %eax
movl %ecx, -0x98(%rbp,%rax,4)
jmp 0x316b35
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq -0xa8(%rbp), %rcx
movl -0x4c(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movw 0x10(%rcx), %cx
shrw $0xe, %cx
andw $0x1, %cx
movzwl %cx, %ecx
cmpl -0x98(%rbp,%rcx,4), %eax
jae 0x316b33
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movw 0x10(%rax), %ax
shrw $0xe, %ax
andw $0x1, %ax
movzwl %ax, %eax
movl %ecx, -0x98(%rbp,%rax,4)
jmp 0x316b35
jmp 0x316b37
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x3169d4
movl -0x94(%rbp), %eax
cmpl -0x98(%rbp), %eax
ja 0x316b58
jmp 0x316d19
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x64(%rbp), %eax
jae 0x316d15
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x316baa
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movw 0x10(%rax), %ax
shrw $0xe, %ax
andw $0x1, %ax
cmpw $0x0, %ax
je 0x316baf
jmp 0x316d07
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpl -0x94(%rbp), %eax
jb 0x316bd5
jmp 0x316d07
cmpq $0x0, 0x38(%rbp)
je 0x316c02
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq 0x38(%rbp), %rcx
cmpl (%rcx), %eax
jb 0x316c02
jmp 0x316d07
movq -0xa8(%rbp), %rdi
movl -0x64(%rbp), %esi
movl -0x4c(%rbp), %edx
movq 0x28(%rbp), %rcx
callq 0x316690
cmpl $0x0, %eax
je 0x316d05
jmp 0x316c23
movq -0x48(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x316c94
movq -0x48(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x316c53
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xe0(%rbp)
jmp 0x316c61
movl $0x2, %eax
movq %rax, -0xe0(%rbp)
jmp 0x316c61
movq -0xe0(%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 -0xa8(%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, -0xe8(%rbp)
movq -0xa8(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
subq %rcx, %rax
movl $0x18, %ecx
cqto
idivq %rcx
movq -0xe8(%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 0x316d05
jmp 0x316d07
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x316b5f
jmp 0x316d17
jmp 0x316d19
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x3168d7
cmpq $0x0, 0x28(%rbp)
je 0x316d59
cmpq $0x0, 0x30(%rbp)
je 0x316d59
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 0x3178ef
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 0x316dc3
jmp 0x3178e1
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 0x316e4a
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 0x316e4f
jmp 0x3178e1
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x54(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x64(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x58(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x68(%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, -0xa8(%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, -0xb0(%rbp)
cmpl $0x1, -0x64(%rbp)
ja 0x316ed6
cmpl $0x1, -0x68(%rbp)
ja 0x316ed6
jmp 0x3178e1
cmpl $0x0, -0x24(%rbp)
je 0x316f59
movq -0x8(%rbp), %rdi
movl -0x54(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x311ba0
cmpl $0x1, %eax
ja 0x316f0f
movq -0x8(%rbp), %rdi
movl -0x58(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x311ba0
cmpl $0x1, %eax
ja 0x316f0f
jmp 0x3178e1
movq -0x8(%rbp), %rdi
movl -0x54(%rbp), %esi
xorl $0x1, %esi
callq 0xde900
movzbl %al, %eax
movl %eax, -0x74(%rbp)
cmpl $0x1, -0x74(%rbp)
jne 0x316f37
movl $0x2, %eax
movl %eax, -0xec(%rbp)
jmp 0x316f50
movl -0x74(%rbp), %edx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0x1, %ecx
cmpl $0x2, %edx
cmovel %ecx, %eax
movl %eax, -0xec(%rbp)
movl -0xec(%rbp), %eax
movl %eax, -0x78(%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, -0xb8(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x68(%rbp), %eax
jae 0x316fd4
movq -0xb0(%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 0x316fc7
movq -0xb0(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
jmp 0x316fd4
jmp 0x316fc9
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x316f87
movq -0xb8(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq -0xc0(%rbp), %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jg 0x31700e
movq -0xb8(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0xf0(%rbp)
jmp 0x317023
movq -0xc0(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0xf0(%rbp)
movl -0xf0(%rbp), %eax
movl %eax, -0x8c(%rbp)
movq -0xb8(%rbp), %rax
movw 0x10(%rax), %ax
andw $0x3fff, %ax            # imm = 0x3FFF
movzwl %ax, %eax
movq -0xc0(%rbp), %rcx
movw 0x10(%rcx), %cx
andw $0x3fff, %cx            # imm = 0x3FFF
movzwl %cx, %ecx
cmpl %ecx, %eax
jg 0x317070
movq -0xb8(%rbp), %rax
movw 0x10(%rax), %ax
andw $0x3fff, %ax            # imm = 0x3FFF
movw %ax, -0xf2(%rbp)
jmp 0x317086
movq -0xc0(%rbp), %rax
movw 0x10(%rax), %ax
andw $0x3fff, %ax            # imm = 0x3FFF
movw %ax, -0xf2(%rbp)
movw -0xf2(%rbp), %ax
movzwl %ax, %eax
movl %eax, -0x90(%rbp)
movl $0x0, -0x80(%rbp)
movl $0x0, -0x7c(%rbp)
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x4c(%rbp)
movq $0x0, -0xc8(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x64(%rbp), %eax
jae 0x31731e
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x3170ea
jmp 0x317310
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0xb8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0x317163
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movw 0x10(%rax), %ax
shrw $0xe, %ax
andw $0x1, %ax
cmpw $0x0, %ax
je 0x317163
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq -0xb8(%rbp), %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jg 0x317168
jmp 0x317310
cmpl $0x0, -0x24(%rbp)
je 0x317198
movq -0x8(%rbp), %rdi
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
callq 0xde900
movzbl %al, %eax
cmpl -0x78(%rbp), %eax
jne 0x317198
jmp 0x317310
movq 0x28(%rbp), %rax
movq -0xa8(%rbp), %rcx
movl -0x4c(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0xb8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xa8(%rbp), %rcx
movl -0x4c(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
andl $0x1, %ecx
xorl %ecx, %eax
movl %eax, -0x5c(%rbp)
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movq -0xd8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jae 0x31725f
movq -0xd8(%rbp), %rax
movq (%rax), %rax
movl -0x9c(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shll %eax
movq -0xd8(%rbp), %rcx
movq (%rcx), %rcx
movl -0x9c(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
movq 0x18(%rcx), %rcx
shrq $0x1f, %rcx
andq $0x1, %rcx
orl %ecx, %eax
cmpl -0x5c(%rbp), %eax
jne 0x31724c
jmp 0x31725f
jmp 0x31724e
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x3171f2
movl -0x9c(%rbp), %eax
movq -0xd8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jb 0x317276
jmp 0x317310
movl -0x7c(%rbp), %eax
movq -0xa8(%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 0x3172cb
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x7c(%rbp)
movq -0xa8(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc8(%rbp)
movl -0x80(%rbp), %eax
movq -0xa8(%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 0x31730e
movq -0xa8(%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, -0x80(%rbp)
jmp 0x317310
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x3170bd
cmpl $0x1, -0x6c(%rbp)
jae 0x317329
jmp 0x3178e1
cmpl $0x2, -0x6c(%rbp)
jb 0x317399
movl -0x8c(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0x7c(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x18(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x317351
jmp 0x3178e1
cmpl $0x0, -0x20(%rbp)
je 0x317384
movl -0x90(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0x80(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x1c(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x317384
movl -0x90(%rbp), %eax
cmpl 0x18(%rbp), %eax
jbe 0x317384
jmp 0x3178e1
movl -0x8c(%rbp), %eax
addl 0x10(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jbe 0x317397
jmp 0x3178e1
jmp 0x317399
movl $0x0, -0x80(%rbp)
movl $0x0, -0x7c(%rbp)
movl $0x0, -0x70(%rbp)
movl $0x0, -0x4c(%rbp)
movq $0x0, -0xd0(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x68(%rbp), %eax
jae 0x317621
movq -0xb0(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x3173ed
jmp 0x317613
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
movq -0xb0(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0xc0(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0x317466
movq -0xb0(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movw 0x10(%rax), %ax
shrw $0xe, %ax
andw $0x1, %ax
cmpw $0x0, %ax
je 0x317466
movq -0xb0(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq -0xc0(%rbp), %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jg 0x31746b
jmp 0x317613
cmpl $0x0, -0x24(%rbp)
je 0x31749b
movq -0x8(%rbp), %rdi
movq -0xb0(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
callq 0xde900
movzbl %al, %eax
cmpl -0x78(%rbp), %eax
jne 0x31749b
jmp 0x317613
movq 0x28(%rbp), %rax
movq -0xb0(%rbp), %rcx
movl -0x4c(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0xc0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xb0(%rbp), %rcx
movl -0x4c(%rbp), %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movl 0x8(%rcx), %ecx
andl $0x1, %ecx
xorl %ecx, %eax
movl %eax, -0x5c(%rbp)
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movq -0xd8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jae 0x317562
movq -0xd8(%rbp), %rax
movq (%rax), %rax
movl -0x9c(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shll %eax
movq -0xd8(%rbp), %rcx
movq (%rcx), %rcx
movl -0x9c(%rbp), %edx
imulq $0x28, %rdx, %rdx
addq %rdx, %rcx
movq 0x18(%rcx), %rcx
shrq $0x1f, %rcx
andq $0x1, %rcx
orl %ecx, %eax
cmpl -0x5c(%rbp), %eax
jne 0x31754f
jmp 0x317562
jmp 0x317551
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x3174f5
movl -0x9c(%rbp), %eax
movq -0xd8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jb 0x317579
jmp 0x317613
movl -0x7c(%rbp), %eax
movq -0xb0(%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 0x3175ce
movq -0xb0(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x7c(%rbp)
movq -0xb0(%rbp), %rax
movl -0x4c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd0(%rbp)
movl -0x80(%rbp), %eax
movq -0xb0(%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 0x317611
movq -0xb0(%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, -0x80(%rbp)
jmp 0x317613
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x3173c0
cmpl $0x1, -0x70(%rbp)
jae 0x31762c
jmp 0x3178e1
cmpl $0x2, -0x70(%rbp)
jb 0x31769c
movl -0x8c(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0x7c(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x18(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x317654
jmp 0x3178e1
cmpl $0x0, -0x20(%rbp)
je 0x317687
movl -0x90(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0x80(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x1c(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x317687
movl -0x90(%rbp), %eax
cmpl 0x18(%rbp), %eax
jbe 0x317687
jmp 0x3178e1
movl -0x8c(%rbp), %eax
addl 0x10(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jbe 0x31769a
jmp 0x3178e1
jmp 0x31769c
cmpl $0x1, -0x6c(%rbp)
ja 0x3176ad
cmpl $0x1, -0x70(%rbp)
ja 0x3176ad
jmp 0x3178e1
movl $0x0, -0x84(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x31772d
cmpl $0x1, -0x6c(%rbp)
jbe 0x3176d5
cmpl $0x1, -0x70(%rbp)
jbe 0x3176d5
movl $0x1, -0x84(%rbp)
jmp 0x31772b
cmpl $0x1, -0x70(%rbp)
jne 0x3176fe
movq -0x8(%rbp), %rdi
movl -0x58(%rbp), %esi
xorl $0x1, %esi
movl -0x14(%rbp), %edx
callq 0xdd220
cmpl -0x14(%rbp), %eax
jge 0x3176fc
movl $0x1, -0x84(%rbp)
jmp 0x317729
cmpl $0x1, -0x6c(%rbp)
jne 0x317727
movq -0x8(%rbp), %rdi
movl -0x54(%rbp), %esi
xorl $0x1, %esi
movl -0x14(%rbp), %edx
callq 0xdd220
cmpl -0x14(%rbp), %eax
jge 0x317725
movl $0x1, -0x84(%rbp)
jmp 0x317727
jmp 0x317729
jmp 0x31772b
jmp 0x31772d
cmpq $0x0, 0x28(%rbp)
je 0x317895
cmpq $0x0, 0x30(%rbp)
je 0x317895
cmpl $0x0, -0x84(%rbp)
jne 0x3177ac
cmpq $0x0, -0xc8(%rbp)
je 0x3177ac
movq -0xb8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xc8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0x3177ac
movq -0xb8(%rbp), %rax
movl 0x8(%rax), %edi
movq -0xc8(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x8(%rbp), %rdx
movq 0x28(%rbp), %rcx
movq 0x30(%rbp), %r8
movl -0x14(%rbp), %r9d
movq -0x48(%rbp), %rax
movq %rax, (%rsp)
callq 0x3156e0
cmpl $0x0, %eax
jne 0x3177ac
movl $0x1, -0x84(%rbp)
cmpl $0x0, -0x84(%rbp)
jne 0x317815
cmpq $0x0, -0xd0(%rbp)
je 0x317815
movq -0xc0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xd0(%rbp), %rcx
cmpl 0x8(%rcx), %eax
je 0x317815
movq -0xc0(%rbp), %rax
movl 0x8(%rax), %edi
movq -0xd0(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x8(%rbp), %rdx
movq 0x28(%rbp), %rcx
movq 0x30(%rbp), %r8
movl -0x14(%rbp), %r9d
movq -0x48(%rbp), %rax
movq %rax, (%rsp)
callq 0x3156e0
cmpl $0x0, %eax
jne 0x317815
movl $0x1, -0x84(%rbp)
cmpq $0x0, -0xc8(%rbp)
je 0x317893
cmpq $0x0, -0xd0(%rbp)
je 0x317893
movq -0xb8(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0xc8(%rbp), %rdx
movb $0x1, %al
cmpl 0x8(%rdx), %ecx
movb %al, -0xf3(%rbp)
jne 0x317864
movq -0xc0(%rbp), %rax
movl 0x8(%rax), %eax
movq -0xd0(%rbp), %rcx
cmpl 0x8(%rcx), %eax
setne %al
movb %al, -0xf3(%rbp)
movb -0xf3(%rbp), %al
testb $0x1, %al
jne 0x317870
jmp 0x317872
jmp 0x317891
leaq 0x7ec43(%rip), %rdi     # 0x3964bc
leaq 0x7e939(%rip), %rsi     # 0x3961b9
movl $0x61b, %edx            # imm = 0x61B
leaq 0x7ecf0(%rip), %rcx     # 0x39657c
callq 0x2130
jmp 0x317893
jmp 0x317895
cmpl $0x0, -0x84(%rbp)
je 0x3178df
movq -0xc0(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movq -0xb8(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x3178e1
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x316d83
cmpq $0x0, -0x10(%rbp)
jne 0x3178ff
movq -0x30(%rbp), %rdi
callq 0x2210
cmpl $0x0, -0x88(%rbp)
jbe 0x317911
movq -0x8(%rbp), %rdi
callq 0xcdd10
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw (%rax,%rax)