// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: ulg_arc_cut_supports(ul_resolve_t*, ma_ug_t*, int, unsigned int, float, unsigned int, unsigned int, unsigned int, unsigned int*, unsigned int, asg64_v*, asg64_v*)
uint32_t ulg_arc_cut_supports(ul_resolve_t *uidx, ma_ug_t *ug, int32_t max_ext, uint32_t max_ext_hifi, 
float len_rat, uint32_t is_trio, uint32_t topo_level, uint32_t skip_hom, uint32_t *max_drop_len, uint32_t collapse_check,
asg64_v *in, asg64_v *ib)
{
    // fprintf(stderr, "\n[M::%s::] max_ext::%d, max_ext_hifi::%d, len_rat::%f, is_trio::%u, topo_level::%u, skip_hom::%u, collapse_check::%u\n", 
    //         __func__, max_ext, max_ext_hifi, len_rat, is_trio, topo_level, skip_hom, collapse_check);

    asg64_v tx = {0,0,0}, tb = {0,0,0}, *b = NULL, *ub = NULL; asg_t *g = ug->g;
    uint32_t v, w, i, k, kv, nv, kw, nw, cnt = 0, n_vtx = g->n_seq<<1, to_del, collapse;
    asg_arc_t *av, *aw, *ve, *we; uint64_t w_q, w_t, pb;

    b = (in?(in):(&tx)); ub = (ib?(ib):(&tb));
    for (v = b->n = 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 && kv < 2; ++i) {
                if(av[i].del) continue; kv++;
            }
            if(kv < 2) continue;

            for (i = 0; i < nv; ++i) {
                if(av[i].del) continue;
                kv_push(uint64_t, *b, ((uint64_t)(av-g->arc+i)));
            }
        }
    }

    // fprintf(stderr, "\n#[M::%s::] Starting...\n", __func__);
    uidx->uovl.iug_tra = b;
    kt_for(uidx->str_b.n_thread, worker_update_ul_arc_supports, uidx, b->n);///all ul + ug
    uidx->uovl.iug_tra = NULL;
    // fprintf(stderr, "#[M::%s::] Done\n", __func__);
    // fprintf(stderr, "#[M::%s::] collapse_check::%u, len_rat::%f\n", __func__, collapse_check, len_rat);
    
    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); av = asg_arc_a(g, v); 
        nw = asg_arc_n(g, w); aw = asg_arc_a(g, w); 
        if(nv <= 1 && nw <= 1) continue;
        ve = &(g->arc[(uint32_t)b->a[k]]);
        for (i = kv = 0; i < nv; ++i) {
            if(av[i].del) continue; 
            kv++;
        }
        for (i = kw = 0, we = NULL; i < nw; ++i) {
            if (aw[i].del) continue;
            if (aw[i].v == (v^1)) we = &(aw[i]);
            kw++;
        }
        if(kv <= 1 && kw <= 1) continue;
        collapse = 0;

        if(collapse_check) {
            if(kv > 1) {
                pb = b->n; ub->n = 0;
                collapse = check_ul_contain_arc_supports(uidx, ve, b, ub, skip_hom, &w_q, &w_t);
                b->n = pb; ub->n = 0;
            }

            if(collapse == 0 && kw > 1) {
                pb = b->n; ub->n = 0;
                collapse = check_ul_contain_arc_supports(uidx, we, b, ub, skip_hom, &w_q, &w_t);
                b->n = pb; ub->n = 0;
            }
        }

        // if(((v>>1) == 6788 && (w>>1) == 17213) || ((w>>1) == 6788 && (v>>1) == 17213)) {
        //     fprintf(stderr, "#[M::%s::] v>>1::%u, v&1::%u, kv::%u, w>>1::%u, w&1::%u, kw::%u, collapse::%u\n", 
        //     __func__, v>>1, v&1, kv, w>>1, w&1, kw, collapse);
        // }

        if(collapse == 0) {
            if(kv > 1) {
                pb = b->n; ub->n = 0;
                get_ul_arc_supports(uidx, ve, b, ub, skip_hom, &w_q, &w_t);
                b->n = pb; ub->n = 0;
                // if((v>>1) == 409 && (w>>1) == 407) {
                //     fprintf(stderr, "+[M::%s::] v>>1::%u, v&1::%u, kv::%u, w>>1::%u, w&1::%u, kw::%u, w_q::%lu, w_t::%lu\n", 
                //     __func__, v>>1, v&1, kv, w>>1, w&1, kw, w_q, w_t);
                // }
                // if(((v>>1) == 6788 && (w>>1) == 17213) || ((w>>1) == 6788 && (v>>1) == 17213)) {
                //     fprintf(stderr, "+[M::%s::] v>>1::%u, v&1::%u, w_q::%lu, w>>1::%u, w&1::%u, w_t::%lu\n", 
                //     __func__, v>>1, v&1, w_q, w>>1, w&1, w_t);
                // }
                if(w_q == (uint64_t)-1) continue;
                if(w_q > w_t*len_rat) continue;
            }

            if(kw > 1) {
                pb = b->n; ub->n = 0;
                get_ul_arc_supports(uidx, we, b, ub, skip_hom, &w_q, &w_t);
                b->n = pb; ub->n = 0;
                // if((v>>1) == 409 && (w>>1) == 407) {
                //     fprintf(stderr, "-[M::%s::] v>>1::%u, v&1::%u, kv::%u, w>>1::%u, w&1::%u, kw::%u, w_q::%lu, w_t::%lu\n", 
                //     __func__, v>>1, v&1, kv, w>>1, w&1, kw, w_q, w_t);
                // }
                // if(((v>>1) == 6788 && (w>>1) == 17213) || ((w>>1) == 6788 && (v>>1) == 17213)) {
                //     fprintf(stderr, "-[M::%s::] v>>1::%u, v&1::%u, w_q::%lu, w>>1::%u, w&1::%u, w_t::%lu\n", 
                //     __func__, v>>1, v&1, w_q, w>>1, w&1, w_t);
                // }
                if(w_q == (uint64_t)-1) continue;
                if(w_q > w_t*len_rat) continue;
            }
        }

        to_del = check_ulg_to_del(uidx, ug, v, w, kv, kw, max_ext, max_ext_hifi, topo_level, collapse, b, ub);
        
        // if(((v>>1) == 6788 && (w>>1) == 17213) || ((w>>1) == 6788 && (v>>1) == 17213)) {
        //     fprintf(stderr, "#[M::%s::] v>>1::%u, v&1::%u, kv::%u, w>>1::%u, w&1::%u, kw::%u, to_del::%u\n", 
        //     __func__, v>>1, v&1, kv, w>>1, w&1, kw, to_del);
        // }
        if (to_del) {
            ve->del = we->del = 1, ++cnt;
        }
    }

    if(!in) free(tx.a); if(!ib) free(tb.a);
    if (cnt > 0) asg_cleanup(g);
    return cnt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movl 0x20(%rbp), %eax
movq 0x18(%rbp), %rax
movl 0x10(%rbp), %eax
movq %rdi, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
movl %edx, -0x2c(%rbp)
movl %ecx, -0x30(%rbp)
movss %xmm0, -0x34(%rbp)
movl %r8d, -0x38(%rbp)
movl %r9d, -0x3c(%rbp)
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2100
leaq -0x70(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2100
movq $0x0, -0x78(%rbp)
movq $0x0, -0x80(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x88(%rbp)
movl $0x0, -0xac(%rbp)
movq -0x88(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movl %eax, -0xb0(%rbp)
cmpq $0x0, 0x28(%rbp)
je 0x349121
movq 0x28(%rbp), %rax
movq %rax, -0xf8(%rbp)
jmp 0x34912e
leaq -0x58(%rbp), %rax
movq %rax, -0xf8(%rbp)
jmp 0x34912e
movq -0xf8(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, 0x30(%rbp)
je 0x34914d
movq 0x30(%rbp), %rax
movq %rax, -0x100(%rbp)
jmp 0x34915a
leaq -0x70(%rbp), %rax
movq %rax, -0x100(%rbp)
jmp 0x34915a
movq -0x100(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0xb0(%rbp), %eax
jae 0x3493e8
movq -0x88(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x8c(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x3491b1
jmp 0x3493d4
movq -0x88(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x8c(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x3493d2
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x88(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x8c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movq -0x88(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x8c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0xa0(%rbp)
cmpl $0x2, -0xa0(%rbp)
jae 0x34922a
jmp 0x3493d4
movl $0x0, -0x9c(%rbp)
movl $0x0, -0x94(%rbp)
movl -0x94(%rbp), %ecx
xorl %eax, %eax
cmpl -0xa0(%rbp), %ecx
movb %al, -0x101(%rbp)
jae 0x349264
cmpl $0x2, -0x9c(%rbp)
setb %al
movb %al, -0x101(%rbp)
movb -0x101(%rbp), %al
testb $0x1, %al
jne 0x349270
jmp 0x3492b1
movq -0xc0(%rbp), %rax
movl -0x94(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x349291
jmp 0x3492a0
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x34923e
cmpl $0x2, -0x9c(%rbp)
jae 0x3492bf
jmp 0x3493d4
movl $0x0, -0x94(%rbp)
movl -0x94(%rbp), %eax
cmpl -0xa0(%rbp), %eax
jae 0x3493d0
movq -0xc0(%rbp), %rax
movl -0x94(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x3492ff
jmp 0x3493bc
jmp 0x349301
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq -0x78(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x349372
movq -0x78(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x349331
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x110(%rbp)
jmp 0x34933f
movl $0x2, %eax
movq %rax, -0x110(%rbp)
jmp 0x34933f
movq -0x110(%rbp), %rcx
movq -0x78(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x78(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x78(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0xc0(%rbp), %rax
movq -0x88(%rbp), %rcx
movq 0x8(%rcx), %rcx
subq %rcx, %rax
movl $0x18, %ecx
cqto
idivq %rcx
movq %rax, %rdx
movl -0x94(%rbp), %eax
addq %rax, %rdx
movq -0x78(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x78(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x3493bc
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x3492c9
jmp 0x3493d2
jmp 0x3493d4
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x34917a
movq -0x78(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x290(%rax)
movq -0x20(%rbp), %rax
movq 0x1e0(%rax), %rax
movl %eax, %edi
movq -0x20(%rbp), %rdx
movq -0x78(%rbp), %rax
movq (%rax), %rcx
leaq 0x7da(%rip), %rsi       # 0x349bf0
callq 0x16d710
movq -0x20(%rbp), %rax
movq $0x0, 0x290(%rax)
movq -0x78(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x78(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x78(%rbp), %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x30ed90
movl $0x0, -0x98(%rbp)
movl -0x98(%rbp), %eax
movq -0x78(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x349ba7
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x98(%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 0x3494a0
jmp 0x349b93
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x98(%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, -0x8c(%rbp)
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x98(%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, -0x90(%rbp)
movq -0x88(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x8c(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x349545
movq -0x88(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x90(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x34954a
jmp 0x349b93
movq -0x88(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x8c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0xa0(%rbp)
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x88(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x8c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movq -0x88(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x90(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0xa8(%rbp)
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x88(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x90(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc8(%rbp)
cmpl $0x1, -0xa0(%rbp)
ja 0x3495fb
cmpl $0x1, -0xa8(%rbp)
ja 0x3495fb
jmp 0x349b93
movq -0x88(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x98(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd0(%rbp)
movl $0x0, -0x9c(%rbp)
movl $0x0, -0x94(%rbp)
movl -0x94(%rbp), %eax
cmpl -0xa0(%rbp), %eax
jae 0x34968b
movq -0xc0(%rbp), %rax
movl -0x94(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x34966b
jmp 0x34967a
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x34963c
movl $0x0, -0xa4(%rbp)
movl $0x0, -0x94(%rbp)
movq $0x0, -0xd8(%rbp)
movl -0x94(%rbp), %eax
cmpl -0xa8(%rbp), %eax
jae 0x34973f
movq -0xc8(%rbp), %rax
movl -0x94(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x3496dd
jmp 0x34972b
movq -0xc8(%rbp), %rax
movl -0x94(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl -0x8c(%rbp), %ecx
xorl $0x1, %ecx
cmpl %ecx, %eax
jne 0x34971c
movq -0xc8(%rbp), %rax
movl -0x94(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x3496aa
cmpl $0x1, -0x9c(%rbp)
ja 0x349756
cmpl $0x1, -0xa4(%rbp)
ja 0x349756
jmp 0x349b93
movl $0x0, -0xb8(%rbp)
cmpl $0x0, 0x20(%rbp)
je 0x349857
cmpl $0x1, -0x9c(%rbp)
jbe 0x3497db
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xf0(%rbp)
movq -0x80(%rbp), %rax
movq $0x0, (%rax)
movq -0x20(%rbp), %rdi
movq -0xd0(%rbp), %rsi
movq -0x78(%rbp), %rdx
movq -0x80(%rbp), %rcx
movl 0x10(%rbp), %eax
movl %eax, %r8d
leaq -0xe0(%rbp), %r9
leaq -0xe8(%rbp), %rax
movq %rax, (%rsp)
callq 0x348980
movl %eax, -0xb8(%rbp)
movq -0xf0(%rbp), %rcx
movq -0x78(%rbp), %rax
movq %rcx, (%rax)
movq -0x80(%rbp), %rax
movq $0x0, (%rax)
cmpl $0x0, -0xb8(%rbp)
jne 0x349855
cmpl $0x1, -0xa4(%rbp)
jbe 0x349855
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xf0(%rbp)
movq -0x80(%rbp), %rax
movq $0x0, (%rax)
movq -0x20(%rbp), %rdi
movq -0xd8(%rbp), %rsi
movq -0x78(%rbp), %rdx
movq -0x80(%rbp), %rcx
movl 0x10(%rbp), %eax
movl %eax, %r8d
leaq -0xe0(%rbp), %r9
leaq -0xe8(%rbp), %rax
movq %rax, (%rsp)
callq 0x348980
movl %eax, -0xb8(%rbp)
movq -0xf0(%rbp), %rcx
movq -0x78(%rbp), %rax
movq %rcx, (%rax)
movq -0x80(%rbp), %rax
movq $0x0, (%rax)
jmp 0x349857
cmpl $0x0, -0xb8(%rbp)
jne 0x349ae4
cmpl $0x1, -0x9c(%rbp)
jbe 0x3499a3
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xf0(%rbp)
movq -0x80(%rbp), %rax
movq $0x0, (%rax)
movq -0x20(%rbp), %rdi
movq -0xd0(%rbp), %rsi
movq -0x78(%rbp), %rdx
movq -0x80(%rbp), %rcx
movl 0x10(%rbp), %eax
movl %eax, %r8d
leaq -0xe0(%rbp), %r9
leaq -0xe8(%rbp), %rax
movq %rax, (%rsp)
callq 0x348390
movq -0xf0(%rbp), %rcx
movq -0x78(%rbp), %rax
movq %rcx, (%rax)
movq -0x80(%rbp), %rax
movq $0x0, (%rax)
cmpq $-0x1, -0xe0(%rbp)
jne 0x3498e2
jmp 0x349b93
movq -0xe0(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x118(%rbp)
testq %rax, %rax
movss %xmm0, -0x114(%rbp)
js 0x34992a
movss -0x118(%rbp), %xmm0
movss %xmm0, -0x114(%rbp)
movss -0x114(%rbp), %xmm0
movss %xmm0, -0x124(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x120(%rbp)
testq %rax, %rax
movss %xmm0, -0x11c(%rbp)
js 0x349982
movss -0x120(%rbp), %xmm0
movss %xmm0, -0x11c(%rbp)
movss -0x124(%rbp), %xmm0
movss -0x11c(%rbp), %xmm1
mulss -0x34(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x3499a1
jmp 0x349b93
jmp 0x3499a3
cmpl $0x1, -0xa4(%rbp)
jbe 0x349ae2
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xf0(%rbp)
movq -0x80(%rbp), %rax
movq $0x0, (%rax)
movq -0x20(%rbp), %rdi
movq -0xd8(%rbp), %rsi
movq -0x78(%rbp), %rdx
movq -0x80(%rbp), %rcx
movl 0x10(%rbp), %eax
movl %eax, %r8d
leaq -0xe0(%rbp), %r9
leaq -0xe8(%rbp), %rax
movq %rax, (%rsp)
callq 0x348390
movq -0xf0(%rbp), %rcx
movq -0x78(%rbp), %rax
movq %rcx, (%rax)
movq -0x80(%rbp), %rax
movq $0x0, (%rax)
cmpq $-0x1, -0xe0(%rbp)
jne 0x349a21
jmp 0x349b93
movq -0xe0(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x12c(%rbp)
testq %rax, %rax
movss %xmm0, -0x128(%rbp)
js 0x349a69
movss -0x12c(%rbp), %xmm0
movss %xmm0, -0x128(%rbp)
movss -0x128(%rbp), %xmm0
movss %xmm0, -0x138(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x134(%rbp)
testq %rax, %rax
movss %xmm0, -0x130(%rbp)
js 0x349ac1
movss -0x134(%rbp), %xmm0
movss %xmm0, -0x130(%rbp)
movss -0x138(%rbp), %xmm0
movss -0x130(%rbp), %xmm1
mulss -0x34(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x349ae0
jmp 0x349b93
jmp 0x349ae2
jmp 0x349ae4
movq -0x20(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x8c(%rbp), %edx
movl -0x90(%rbp), %ecx
movl -0x9c(%rbp), %r8d
movl -0xa4(%rbp), %r9d
movl -0x2c(%rbp), %r15d
movl -0x30(%rbp), %r14d
movl -0x3c(%rbp), %ebx
movl -0xb8(%rbp), %r11d
movq -0x78(%rbp), %r10
movq -0x80(%rbp), %rax
movl %r15d, (%rsp)
movl %r14d, 0x8(%rsp)
movl %ebx, 0x10(%rsp)
movl %r11d, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
callq 0x348f60
movl %eax, -0xb4(%rbp)
cmpl $0x0, -0xb4(%rbp)
je 0x349b91
movq -0xd8(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movq -0xd0(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x349b93
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x349457
cmpq $0x0, 0x28(%rbp)
jne 0x349bb7
movq -0x48(%rbp), %rdi
callq 0x2210
cmpq $0x0, 0x30(%rbp)
jne 0x349bc7
movq -0x60(%rbp), %rdi
callq 0x2210
cmpl $0x0, -0xac(%rbp)
jbe 0x349bdc
movq -0x88(%rbp), %rdi
callq 0xcdd10
movl -0xac(%rbp), %eax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r14
popq %r15
popq %rbp
retq