// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: usg_arc_cut_length(usg_t*, asg64_v*, asg64_v*, int, float, unsigned int, unsigned int, unsigned int*)
void usg_arc_cut_length(usg_t *g, asg64_v *in_0, asg64_v *in_1, int32_t max_ext, float len_rat, uint32_t is_trio, 
uint32_t is_topo, uint32_t *max_drop_len)
{
    // if(len_rat > 0.7) {
    //     fprintf(stderr, "+[M::%s::] max_ext::%d, len_rat::%f\n", __func__, max_ext, len_rat);
    // }
    asg64_v tx = {0,0,0}, tz = {0,0,0}, *b = NULL, *ub = NULL;
    uint32_t i, k, v, w, n_vtx = g->n<<1, nv, nw, kv, kw, /**trioF = (uint32_t)-1, ntrioF = (uint32_t)-1,**/ ol_max, ou_max, to_del, cnt = 0, mm_ol;
    usg_arc_t *av, *aw, *ve, *we; uint64_t x, kocc[2], ou; uint8_t *f; CALLOC(f, g->n);
    b = ((in_0)?(in_0):(&tx)); ub = ((in_1)?(in_1):(&tz));
    
    for (v = 0, b->n = ub->n = 0; v < n_vtx; ++v) {
        if (g->a[v>>1].del) continue;
        av = usg_arc_a(g, v); nv = usg_arc_n(g, v);
        if (nv < 2) continue;
        for (i = kv = kocc[0] = kocc[1] = 0; i < nv; ++i) {
            if(av[i].del) continue;
            kv++; 
            if((av[i].ou>>1) > 0) { ///if av[i].ou == 1, ignore it
                if(kocc[1] < (av[i].ou>>1)) kocc[1] = (av[i].ou>>1);
            } else if(av[i].ou == 0) { 
                kocc[0]++;
            }            
        }
        if(kv < 2 || kocc[0] == 0 || kocc[1] == 0) continue;
        ou = kocc[1];
        for (i = 0; i < nv; ++i) {
            if(av[i].del || av[i].ou) continue;
            if(max_drop_len && av[i].ol >= (*max_drop_len)) continue;
            x = (((uint64_t)av[i].ol)*10)/ou; x <<= 32;
            kv_push(uint64_t, *b, ((x)|((uint64_t)(ub->n))));
            kv_push(uint64_t, *ub, ((((uint64_t)(v))<<32)|((uint64_t)(i))));   
        }
    }
    // if(len_rat > 0.7) {
    //     fprintf(stderr, "[M::%s::] max_ext::%d, len_rat::%f, b->n::%u, ub->n::%u\n", 
    //     __func__, max_ext, len_rat, (uint32_t)b->n, (uint32_t)ub->n);
    // }

    radix_sort_srt64(b->a, b->a + b->n);
    for (k = 0; k < b->n; k++) {
        v = ub->a[(uint32_t)b->a[k]]>>32; 
        ve = &(usg_arc_a(g, v)[(uint32_t)(ub->a[(uint32_t)b->a[k]])]);
        w = ve->v^1;
        if(ve->del || g->a[v>>1].del || g->a[w>>1].del || ve->ou) continue;
        nv = usg_arc_n(g, v); nw = usg_arc_n(g, w);
        av = usg_arc_a(g, v); aw = usg_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));
        // }    
        for (i = 0; i < nw; ++i) {
            if (aw[i].v == (v^1)) {
                we = &(aw[i]);
                break;
            }
        }
        mm_ol = MIN(ve->ol, we->ol); kocc[0] = kocc[1] = 0;

        for (i = kv = ol_max = ou_max = 0; i < nv; ++i) {
            if(av[i].del) continue;
            kv++; 
            if(av[i].ou != 1) kocc[!!(av[i].ou)]++; ///if av[i].ou == 1, ignore it
            // if(is_trio && get_tip_trio_infor(g, av[i].v) == ntrioF) continue;
            if(ol_max < av[i].ol) ol_max = av[i].ol;
        }
        if (kv < 1 || kocc[0] < 1 || kocc[1] < 1) continue;
        if (kv >= 2) {
            if (mm_ol > ol_max*len_rat) continue;
        }

        
        for (i = kw = ol_max = ou_max = 0; 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;
        }
        if (kw < 1) continue;
        if (kw >= 2) {
            if (mm_ol > ol_max*len_rat) continue;
        }

        if (kv <= 1 && kw <= 1) continue;
        // if(len_rat > 0.7) {
        //     fprintf(stderr, "0[M::%s::] v>>1::%u(%c), w>>1::%u(%c), kv::%u, kw::%u\n", 
        //                             __func__, v>>1, "+-"[v&1], w>>1, "+-"[w&1], kv, kw);
        // }

        to_del = 1;
        if(is_topo) {
            to_del = 0;
            if (kv > 1 && kw > 1) {
                to_del = 1;
            } else if (kw == 1) {
                if (usg_naive_topocut_aux(g, w^1, max_ext, f, b, ub) < max_ext) to_del = 1;
            } else if (kv == 1) {
                if (usg_naive_topocut_aux(g, v^1, max_ext, f, b, ub) < max_ext) to_del = 1;
            }
        } 
        // if(len_rat > 0.7) {
        //     fprintf(stderr, "1[M::%s::] v>>1::%u(%c), w>>1::%u(%c), kv::%u, kw::%u, to_del::%u\n", 
        //                             __func__, v>>1, "+-"[v&1], w>>1, "+-"[w&1], kv, kw, to_del);
        // }

        if (to_del) {
            ve->del = we->del = 1; 
            if((usg_naive_topocut_aux_sec(g, v, max_ext) < max_ext) && 
                        (usg_naive_topocut_aux_sec(g, w, max_ext) < max_ext)) {
                // if((((v>>1) == 308) && ((w>>1) == 311)) || (((w>>1) == 308) && ((v>>1) == 311))) {
                //     fprintf(stderr, "[M::%s::] v>>1::%u, v&1::%u, kv::%u, w>>1::%u, w&1::%u, kw::%u, max_ext::%d\n", 
                //     __func__, v>>1, v&1, kv, w>>1, w&1, kw, max_ext);
                // }
                // if((((v>>1) == 306) && ((w>>1) == 310)) || (((w>>1) == 306) && ((v>>1) == 310))) {
                //     fprintf(stderr, "[M::%s::] v>>1::%u, v&1::%u, kv::%u, w>>1::%u, w&1::%u, kw::%u, max_ext::%d\n", 
                //     __func__, v>>1, v&1, kv, w>>1, w&1, kw, max_ext);
                // }
                ++cnt;
            } else {
                ve->del = we->del = 0; 
            }
            
        }
        // if(len_rat > 0.7) {
        //     fprintf(stderr, "2[M::%s::] v>>1::%u(%c), w>>1::%u(%c), kv::%u, kw::%u, to_del::%u\n", 
        //                             __func__, v>>1, "+-"[v&1], w>>1, "+-"[w&1], kv, kw, to_del);
        // }
    }

    if(in_0) free(tx.a); if(in_1) free(tz.a);
    if (cnt > 0) usg_cleanup(g);
    free(f);
    // fprintf(stderr, "-[M::%s::] max_ext::%d, len_rat::%f\n", __func__, max_ext, len_rat);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movss %xmm0, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2100
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2100
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movl %eax, -0x7c(%rbp)
movl $0x0, -0x9c(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movl $0x1, %esi
callq 0x2140
movq %rax, -0xf0(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x34fcd0
movq -0x10(%rbp), %rax
movq %rax, -0xf8(%rbp)
jmp 0x34fcdd
leaq -0x40(%rbp), %rax
movq %rax, -0xf8(%rbp)
jmp 0x34fcdd
movq -0xf8(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x34fcfc
movq -0x18(%rbp), %rax
movq %rax, -0x100(%rbp)
jmp 0x34fd09
leaq -0x58(%rbp), %rax
movq %rax, -0x100(%rbp)
jmp 0x34fd09
movq -0x100(%rbp), %rax
movq %rax, -0x68(%rbp)
movl $0x0, -0x74(%rbp)
movq -0x68(%rbp), %rax
movq $0x0, (%rax)
movq -0x60(%rbp), %rax
movq $0x0, (%rax)
movl -0x74(%rbp), %eax
cmpl -0x7c(%rbp), %eax
jae 0x35010d
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x74(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
cmpb $0x0, 0x70(%rax)
je 0x34fd5d
jmp 0x3500ff
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x74(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x10, %rax
movl -0x74(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x74(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x10, %rax
movl -0x74(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, -0x80(%rbp)
cmpl $0x2, -0x80(%rbp)
jae 0x34fdc9
jmp 0x3500ff
movq $0x0, -0xd8(%rbp)
movq $0x0, -0xe0(%rbp)
movl $0x0, -0x88(%rbp)
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x80(%rbp), %eax
jae 0x34fec7
movq -0xa8(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x34fe1d
jmp 0x34feb9
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
movq -0xa8(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
shrl %eax
cmpl $0x0, %eax
jbe 0x34fe8c
movq -0xd8(%rbp), %rax
movq -0xa8(%rbp), %rcx
movl -0x6c(%rbp), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
shrl %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x34fe8a
movq -0xa8(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
shrl %eax
movl %eax, %eax
movq %rax, -0xd8(%rbp)
jmp 0x34feb7
movq -0xa8(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x0, 0x10(%rax)
jne 0x34feb5
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x34feb7
jmp 0x34feb9
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x34fdf0
cmpl $0x2, -0x88(%rbp)
jb 0x34fee4
cmpq $0x0, -0xe0(%rbp)
je 0x34fee4
cmpq $0x0, -0xd8(%rbp)
jne 0x34fee9
jmp 0x3500ff
movq -0xd8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x80(%rbp), %eax
jae 0x3500fd
movq -0xa8(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x34ff3d
movq -0xa8(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x0, 0x10(%rax)
je 0x34ff42
jmp 0x3500ef
cmpq $0x0, 0x10(%rbp)
je 0x34ff6f
movq -0xa8(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq 0x10(%rbp), %rcx
cmpl (%rcx), %eax
jb 0x34ff6f
jmp 0x3500ef
movq -0xa8(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
imulq $0xa, %rax, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0xe8(%rbp)
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
shlq $0x20, %rax
movq %rax, -0xc8(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq -0x60(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x350023
movq -0x60(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x34ffe2
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x108(%rbp)
jmp 0x34fff0
movl $0x2, %eax
movq %rax, -0x108(%rbp)
jmp 0x34fff0
movq -0x108(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0xc8(%rbp), %rdx
movq -0x68(%rbp), %rax
orq (%rax), %rdx
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x350050
movq -0x68(%rbp), %rax
movq (%rax), %rax
movq -0x68(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x3500c1
movq -0x68(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x350080
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x110(%rbp)
jmp 0x35008e
movl $0x2, %eax
movq %rax, -0x110(%rbp)
jmp 0x35008e
movq -0x110(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x74(%rbp), %eax
movl %eax, %edx
shlq $0x20, %rdx
movl -0x6c(%rbp), %eax
orq %rax, %rdx
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x68(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x3500ef
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x34fefe
jmp 0x3500ff
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x34fd31
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x60(%rbp), %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x30ed90
movl $0x0, -0x70(%rbp)
movl -0x70(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x350798
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x70(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl %eax, -0x74(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x74(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x10, %rax
movl -0x74(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq -0x68(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x60(%rbp), %rdx
movq 0x10(%rdx), %rdx
movl -0x70(%rbp), %esi
movq (%rdx,%rsi,8), %rdx
movl %edx, %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movl 0x8(%rax), %eax
xorl $0x1, %eax
movl %eax, -0x78(%rbp)
movq -0xb8(%rbp), %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x350229
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x74(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
cmpb $0x0, 0x70(%rax)
jne 0x350229
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x78(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
cmpb $0x0, 0x70(%rax)
jne 0x350229
movq -0xb8(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x35022e
jmp 0x35078a
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x74(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x10, %rax
movl -0x74(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, -0x80(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x78(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x10, %rax
movl -0x78(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, -0x84(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x74(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x10, %rax
movl -0x74(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x78(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x10, %rax
movl -0x78(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, -0xb0(%rbp)
cmpl $0x1, -0x80(%rbp)
ja 0x350307
cmpl $0x1, -0x84(%rbp)
ja 0x350307
jmp 0x35078a
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x84(%rbp), %eax
jae 0x35035e
movq -0xb0(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl -0x74(%rbp), %ecx
xorl $0x1, %ecx
cmpl %ecx, %eax
jne 0x350351
movq -0xb0(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
jmp 0x35035e
jmp 0x350353
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x35030e
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 0x350398
movq -0xb8(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x114(%rbp)
jmp 0x3503ad
movq -0xc0(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x114(%rbp)
movl -0x114(%rbp), %eax
movl %eax, -0xa0(%rbp)
movq $0x0, -0xd8(%rbp)
movq $0x0, -0xe0(%rbp)
movl $0x0, -0x94(%rbp)
movl $0x0, -0x90(%rbp)
movl $0x0, -0x88(%rbp)
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x80(%rbp), %eax
jae 0x3504cf
movq -0xa8(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x350421
jmp 0x3504c1
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
movq -0xa8(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x1, 0x10(%rax)
je 0x35047c
movq -0xa8(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x0, 0x10(%rax)
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movq -0xe0(%rbp,%rax,8), %rcx
addq $0x1, %rcx
movq %rcx, -0xe0(%rbp,%rax,8)
movl -0x90(%rbp), %eax
movq -0xa8(%rbp), %rcx
movl -0x6c(%rbp), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x3504bf
movq -0xa8(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x90(%rbp)
jmp 0x3504c1
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x3503f4
cmpl $0x1, -0x88(%rbp)
jb 0x3504ec
cmpq $0x1, -0xe0(%rbp)
jb 0x3504ec
cmpq $0x1, -0xd8(%rbp)
jae 0x3504f1
jmp 0x35078a
cmpl $0x2, -0x88(%rbp)
jb 0x350521
movl -0xa0(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0x90(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x20(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x35051f
jmp 0x35078a
jmp 0x350521
movl $0x0, -0x94(%rbp)
movl $0x0, -0x90(%rbp)
movl $0x0, -0x8c(%rbp)
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x84(%rbp), %eax
jae 0x3505d5
movq -0xb0(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x350573
jmp 0x3505c7
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
movl -0x90(%rbp), %eax
movq -0xb0(%rbp), %rcx
movl -0x6c(%rbp), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x3505c5
movq -0xb0(%rbp), %rax
movl -0x6c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, -0x90(%rbp)
jmp 0x3505c7
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x350546
cmpl $0x1, -0x8c(%rbp)
jae 0x3505e3
jmp 0x35078a
cmpl $0x2, -0x8c(%rbp)
jb 0x350613
movl -0xa0(%rbp), %eax
cvtsi2ss %rax, %xmm0
movl -0x90(%rbp), %eax
cvtsi2ss %rax, %xmm1
mulss -0x20(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x350611
jmp 0x35078a
jmp 0x350613
cmpl $0x1, -0x88(%rbp)
ja 0x35062a
cmpl $0x1, -0x8c(%rbp)
ja 0x35062a
jmp 0x35078a
movl $0x1, -0x98(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x3506e2
movl $0x0, -0x98(%rbp)
cmpl $0x1, -0x88(%rbp)
jbe 0x350666
cmpl $0x1, -0x8c(%rbp)
jbe 0x350666
movl $0x1, -0x98(%rbp)
jmp 0x3506e0
cmpl $0x1, -0x8c(%rbp)
jne 0x3506a1
movq -0x8(%rbp), %rdi
movl -0x78(%rbp), %esi
xorl $0x1, %esi
movl -0x1c(%rbp), %edx
movq -0xf0(%rbp), %rcx
movq -0x60(%rbp), %r8
movq -0x68(%rbp), %r9
callq 0x34f5a0
cmpl -0x1c(%rbp), %eax
jge 0x35069f
movl $0x1, -0x98(%rbp)
jmp 0x3506de
cmpl $0x1, -0x88(%rbp)
jne 0x3506dc
movq -0x8(%rbp), %rdi
movl -0x74(%rbp), %esi
xorl $0x1, %esi
movl -0x1c(%rbp), %edx
movq -0xf0(%rbp), %rcx
movq -0x60(%rbp), %r8
movq -0x68(%rbp), %r9
callq 0x34f5a0
cmpl -0x1c(%rbp), %eax
jge 0x3506da
movl $0x1, -0x98(%rbp)
jmp 0x3506dc
jmp 0x3506de
jmp 0x3506e0
jmp 0x3506e2
cmpl $0x0, -0x98(%rbp)
je 0x350788
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)
movq -0x8(%rbp), %rdi
movl -0x74(%rbp), %esi
movl -0x1c(%rbp), %edx
callq 0x34f810
cmpl -0x1c(%rbp), %eax
jge 0x35075a
movq -0x8(%rbp), %rdi
movl -0x78(%rbp), %esi
movl -0x1c(%rbp), %edx
callq 0x34f810
cmpl -0x1c(%rbp), %eax
jge 0x35075a
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x350786
movq -0xc0(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0xc(%rax)
movq -0xb8(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0xc(%rax)
jmp 0x350788
jmp 0x35078a
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x350137
cmpq $0x0, -0x10(%rbp)
je 0x3507a8
movq -0x30(%rbp), %rdi
callq 0x2210
cmpq $0x0, -0x18(%rbp)
je 0x3507b8
movq -0x48(%rbp), %rdi
callq 0x2210
cmpl $0x0, -0x9c(%rbp)
jbe 0x3507ca
movq -0x8(%rbp), %rdi
callq 0x34d830
movq -0xf0(%rbp), %rdi
callq 0x2210
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nop