// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: ulg_arc_cut_z(ul_resolve_t*, ma_ug_t*, unsigned int, unsigned int, float, float, unsigned int, float, unsigned int, unsigned int, unsigned int*, asg64_v*, asg64_v*)
uint32_t ulg_arc_cut_z(ul_resolve_t *uidx, ma_ug_t *ug, uint32_t max_ext, uint32_t max_ext_hifi, 
float len_rat, float small_occ_rate, uint32_t raw_ug_occ, float raw_match_rate, uint32_t is_trio, 
uint32_t skip_hom, uint32_t *max_drop_len, asg64_v *in, asg64_v *ib)
{
    asg64_v tx = {0,0,0}, tb = {0,0,0}, *b = NULL, *ub = NULL; asg_t *g = ug->g; 
    uint32_t v, w, wt, z, i, k, kv, nv, kw, kwt, nw, cnt = 0, n_vtx = g->n_seq<<1, ul, vp[2], wp[2];
    asg_arc_t *av, *aw, *ve, *we, *wte; uint64_t w_q, w_t, pb, raw_ul, raw_hifi;

    b = (in?(in):(&tx)); ub = (ib?(ib):(&tb));
    for (v = b->n = 0; v < n_vtx; ++v) {
        if (g->seq[v>>1].del) continue;
        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; 
            kw = get_arcs(ug->g, av[i].v^1, NULL, 0);
            // if((v>>1) == 16783) {
            //     fprintf(stderr, "sss[M::%s::] v>>1::%u, v&1::%u, av[i].v>>1::%u, av[i].v&1::%u, kw::%u\n", 
            //     __func__, v>>1, v&1, av[i].v>>1, av[i].v&1, kw);
            // }
            if(kw == 2) {
                kv_push(uint64_t, *b, ((uint64_t)(av-g->arc+i)));
            } else if(kw == 1) {
                ub->n = 0;
                if(get_ul_path_info(uidx, ug, av[i].v, NULL, NULL, NULL, NULL, NULL, ub)==TWO_INPUT) {
                    for (z = raw_ul = 0; z < ub->n; z++) {
                        get_iug_u_raw_occ(uidx, ub->a[z]>>1, &ul, NULL); raw_ul += ul;
                    }
                    kv_push(uint64_t, *b, ((raw_ul<<32)|((uint64_t)(av-g->arc+i))));
                }
            }
        }
    }

    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;

        vp[0] = v^1; vp[1] = (uint32_t)-1;
        ve = &(g->arc[(uint32_t)b->a[k]]);
        for (i = kv = 0; i < nv; ++i) {
            if(av[i].del) continue; 
            if(av[i].v != (w^1)) vp[1] = av[i].v;
            kv++;
        }

        wp[0] = w^1; wp[1] = (uint32_t)-1;
        for (i = kw = 0, we = NULL; i < nw; ++i) {
            if (aw[i].del) continue;
            if (aw[i].v == (v^1)) we = &(aw[i]);
            else wp[1] = aw[i].v;
            kw++;
        }
        if(kv <= 1 && kw <= 1) continue;
        if(kv != 2 || kw > 2) continue;
        // if((v>>1) == 16783) {
        //     fprintf(stderr, "bbb[M::%s::] v>>1::%u, v&1::%u, w>>1::%u, w&1::%u, kv::%u, kw::%u\n", 
        //     __func__, v>>1, v&1, w>>1, w&1, kv, kw);
        // }
        raw_ul = 0; wt = w; wte = we; kwt = kw; pb = b->n; ub->n = 0;
        if(kw == 1) {
            if(get_ul_path_info(uidx, ug, w^1, &wt, NULL, NULL, NULL, NULL, b)==TWO_INPUT) {
                for (z = pb, raw_ul = 0; z < b->n; z++) {
                    get_iug_u_raw_occ(uidx, b->a[z]>>1, &ul, NULL); raw_ul += ul;
                }
                ul = wt; get_arcs(ug->g, wt, &wt, 1); wt = ug->g->arc[wt].v^1;
                wp[0] = wt^1; wp[1] = (uint32_t)-1;
                nw = asg_arc_n(g, wt); aw = asg_arc_a(g, wt); 
                for (i = kwt = 0; i < nw; ++i) {
                    if (aw[i].del) continue;
                    if (aw[i].v == (ul^1)) wte = &(aw[i]);
                    else wp[1] = aw[i].v;
                    kwt++;
                }
                // if((v>>1) == 16783) {
                //     fprintf(stderr, "bbb[M::%s::] v>>1::%u, v&1::%u, w>>1::%u, w&1::%u, wt>>1::%u, wt&1::%u, kwt::%u\n", 
                //     __func__, v>>1, v&1, w>>1, w&1, wt>>1, wt&1, kwt);
                // }
                nw = asg_arc_n(g, w); aw = asg_arc_a(g, w); 
            } else {
                b->n = pb;
                continue;
            }
        }
        // if((v>>1) == 16783) {
        //     fprintf(stderr, "bbb[M::%s::] v>>1::%u, v&1::%u, raw_ul::%lu, max_ext::%u, ***1***\n", 
        //     __func__, v>>1, v&1, raw_ul, max_ext);
        // }
        assert(kv == 2 && kwt == 2);
        if(raw_ul <= max_ext && get_remove_hifi_occ(uidx, max_ext_hifi, b->a + pb, b->n - pb, ub, NULL)) {
            raw_hifi = get_ug_integer_seq_occ(uidx, b->a + pb, b->n - pb, ub);
            // if((v>>1) == 16783) {
            //     fprintf(stderr, "bbb[M::%s::] v>>1::%u, v&1::%u, ***2***\n", 
            //     __func__, v>>1, v&1);
            // }

            b->n = pb;
            if(raw_ul > 0) {
                if(!ul_occ_check(uidx, ug, raw_ul, raw_hifi, vp[0], small_occ_rate, b, ub)) continue;
                if(!ul_occ_check(uidx, ug, raw_ul, raw_hifi, vp[1], small_occ_rate, b, ub)) continue;
                if(!ul_occ_check(uidx, ug, raw_ul, raw_hifi, wp[0], small_occ_rate, b, ub)) continue;
                if(!ul_occ_check(uidx, ug, raw_ul, raw_hifi, wp[1], small_occ_rate, b, ub)) continue;
            }
            
            // if((v>>1) == 16783) {
            //     fprintf(stderr, "bbb[M::%s::] v>>1::%u, v&1::%u, ***3***\n", 
            //     __func__, v>>1, v&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((w_q == (uint64_t)-1) || (w_q > w_t*len_rat)) continue;

            // if((v>>1) == 16783) {
            //     fprintf(stderr, "bbb[M::%s::] v>>1::%u, v&1::%u, ***4***\n", 
            //     __func__, v>>1, v&1);
            // }

            pb = b->n; ub->n = 0;
            get_ul_arc_supports(uidx, wte, b, ub, skip_hom, &w_q, &w_t);
            b->n = pb; ub->n = 0;
            if((w_q == (uint64_t)-1) || (w_q > w_t*len_rat)) continue;

            // if((v>>1) == 16783) {
            //     fprintf(stderr, "bbb[M::%s::] v>>1::%u, v&1::%u, ***5***\n", 
            //     __func__, v>>1, v&1);
            // }

            if(!ul_homo_path_check(uidx, ug, vp[0], wp[1], raw_ug_occ, raw_match_rate, b, ub)) continue;


            // if((v>>1) == 16783) {
            //     fprintf(stderr, "bbb[M::%s::] v>>1::%u, v&1::%u, ***6***\n", 
            //     __func__, v>>1, v&1);
            // }
            if(!ul_homo_path_check(uidx, ug, wp[0], vp[1], raw_ug_occ, raw_match_rate, b, ub)) continue;

            // if((v>>1) == 16783) {
            //     fprintf(stderr, "bbb[M::%s::] v>>1::%u, v&1::%u, ***7***\n", 
            //     __func__, v>>1, v&1);
            // }

            if(kw == 1) {
                get_ul_path_info(uidx, ug, w^1, &wt, NULL, NULL, NULL, NULL, b);
                for (z = pb; z < b->n; z++) ulg_seq_del(ug, (b->a[z]>>1));
            }
            ve->del = we->del = 1; cnt++;
        }

        b->n = pb;
    }



    if(!in) free(tx.a); if(!ib) free(tb.a);
    if (cnt > 0) asg_cleanup(g);
    // fprintf(stderr, "[M::%s::] cnt::%u\n", __func__, cnt);
    return cnt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
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)
movl %ecx, -0x18(%rbp)
movss %xmm0, -0x1c(%rbp)
movss %xmm1, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movss %xmm2, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
leaq -0x48(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2100
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x2100
movq $0x0, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x78(%rbp)
movl $0x0, -0xa8(%rbp)
movq -0x78(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movl %eax, -0xac(%rbp)
cmpq $0x0, 0x20(%rbp)
je 0x34c37d
movq 0x20(%rbp), %rax
movq %rax, -0x118(%rbp)
jmp 0x34c38a
leaq -0x48(%rbp), %rax
movq %rax, -0x118(%rbp)
jmp 0x34c38a
movq -0x118(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, 0x28(%rbp)
je 0x34c3a9
movq 0x28(%rbp), %rax
movq %rax, -0x120(%rbp)
jmp 0x34c3b6
leaq -0x60(%rbp), %rax
movq %rax, -0x120(%rbp)
jmp 0x34c3b6
movq -0x120(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x68(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0xac(%rbp), %eax
jae 0x34c7fa
movq -0x78(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x7c(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x34c401
jmp 0x34c7ec
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x7c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc8(%rbp)
movq -0x78(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x7c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x98(%rbp)
cmpl $0x2, -0x98(%rbp)
jae 0x34c44d
jmp 0x34c7ec
movl $0x0, -0x94(%rbp)
movl $0x0, -0x8c(%rbp)
movl -0x8c(%rbp), %ecx
xorl %eax, %eax
cmpl -0x98(%rbp), %ecx
movb %al, -0x121(%rbp)
jae 0x34c487
cmpl $0x2, -0x94(%rbp)
setbe %al
movb %al, -0x121(%rbp)
movb -0x121(%rbp), %al
testb $0x1, %al
jne 0x34c493
jmp 0x34c4d4
movq -0xc8(%rbp), %rax
movl -0x8c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x34c4b4
jmp 0x34c4c3
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x34c461
cmpl $0x2, -0x94(%rbp)
je 0x34c4e2
jmp 0x34c7ec
movl $0x0, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x98(%rbp), %eax
jae 0x34c7ea
movq -0xc8(%rbp), %rax
movl -0x8c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x34c522
jmp 0x34c7d6
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0xc8(%rbp), %rax
movl -0x8c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %esi
xorl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x311ba0
movl %eax, -0x9c(%rbp)
cmpl $0x2, -0x9c(%rbp)
jne 0x34c61f
jmp 0x34c564
movq -0x68(%rbp), %rax
movq (%rax), %rax
movq -0x68(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x34c5d5
movq -0x68(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x34c594
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x130(%rbp)
jmp 0x34c5a2
movl $0x2, %eax
movq %rax, -0x130(%rbp)
jmp 0x34c5a2
movq -0x130(%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)
movq -0xc8(%rbp), %rax
movq -0x78(%rbp), %rcx
movq 0x8(%rcx), %rcx
subq %rcx, %rax
movl $0x18, %ecx
cqto
idivq %rcx
movq %rax, %rdx
movl -0x8c(%rbp), %eax
addq %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 0x34c7d4
cmpl $0x1, -0x9c(%rbp)
jne 0x34c7d2
movq -0x70(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0xc8(%rbp), %rax
movl -0x8c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
movq -0x70(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %r9d
movq %r9, %rcx
movq %r9, %r8
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x344830
cmpl $0x1, %eax
jne 0x34c7d0
movq $0x0, -0x108(%rbp)
movl $0x0, -0x88(%rbp)
movl -0x88(%rbp), %eax
movq -0x70(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x34c6fd
movq -0x8(%rbp), %rdi
movq -0x70(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x88(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq %rax
movl %eax, %esi
leaq -0xb0(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x37beb0
movl -0xb0(%rbp), %eax
addq -0x108(%rbp), %rax
movq %rax, -0x108(%rbp)
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x34c69e
jmp 0x34c6ff
movq -0x68(%rbp), %rax
movq (%rax), %rax
movq -0x68(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x34c770
movq -0x68(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x34c72f
movq -0x68(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x138(%rbp)
jmp 0x34c73d
movl $0x2, %eax
movq %rax, -0x138(%rbp)
jmp 0x34c73d
movq -0x138(%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)
movq -0x108(%rbp), %rax
shlq $0x20, %rax
movq %rax, -0x140(%rbp)
movq -0xc8(%rbp), %rax
movq -0x78(%rbp), %rcx
movq 0x8(%rcx), %rcx
subq %rcx, %rax
movl $0x18, %ecx
cqto
idivq %rcx
movq -0x140(%rbp), %rdx
movl -0x8c(%rbp), %ecx
addq %rcx, %rax
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 0x34c7d0
jmp 0x34c7d2
jmp 0x34c7d4
jmp 0x34c7d6
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x34c4ec
jmp 0x34c7ec
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x34c3d3
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x68(%rbp), %rax
movq (%rax), %rax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x30ed90
movl $0x0, -0x90(%rbp)
movl -0x90(%rbp), %eax
movq -0x68(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x34d433
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x68(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x90(%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 0x34c86d
jmp 0x34d41f
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x68(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x90(%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, -0x7c(%rbp)
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x68(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x90(%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, -0x80(%rbp)
movq -0x78(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x7c(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x34c8fa
movq -0x78(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x80(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x34c8ff
jmp 0x34d41f
movq -0x78(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x7c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x98(%rbp)
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x7c(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc8(%rbp)
movq -0x78(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x80(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0xa4(%rbp)
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x80(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd0(%rbp)
cmpl $0x1, -0x98(%rbp)
ja 0x34c992
cmpl $0x1, -0xa4(%rbp)
ja 0x34c992
jmp 0x34d41f
movl -0x7c(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0xb8(%rbp)
movl $0xffffffff, -0xb4(%rbp) # imm = 0xFFFFFFFF
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x68(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x90(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movl $0x0, -0x94(%rbp)
movl $0x0, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0x98(%rbp), %eax
jae 0x34ca7a
movq -0xc8(%rbp), %rax
movl -0x8c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x34ca19
jmp 0x34ca66
movq -0xc8(%rbp), %rax
movl -0x8c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl -0x80(%rbp), %ecx
xorl $0x1, %ecx
cmpl %ecx, %eax
je 0x34ca57
movq -0xc8(%rbp), %rax
movl -0x8c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0xb4(%rbp)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x34c9e6
movl -0x80(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0xc0(%rbp)
movl $0xffffffff, -0xbc(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x9c(%rbp)
movl $0x0, -0x8c(%rbp)
movq $0x0, -0xe0(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0xa4(%rbp), %eax
jae 0x34cb60
movq -0xd0(%rbp), %rax
movl -0x8c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x34cae2
jmp 0x34cb4c
movq -0xd0(%rbp), %rax
movl -0x8c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl -0x7c(%rbp), %ecx
xorl $0x1, %ecx
cmpl %ecx, %eax
jne 0x34cb20
movq -0xd0(%rbp), %rax
movl -0x8c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xe0(%rbp)
jmp 0x34cb3d
movq -0xd0(%rbp), %rax
movl -0x8c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0xbc(%rbp)
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x34caaf
cmpl $0x1, -0x94(%rbp)
ja 0x34cb77
cmpl $0x1, -0x9c(%rbp)
ja 0x34cb77
jmp 0x34d41f
cmpl $0x2, -0x94(%rbp)
jne 0x34cb89
cmpl $0x2, -0x9c(%rbp)
jbe 0x34cb8e
jmp 0x34d41f
movq $0x0, -0x108(%rbp)
movl -0x80(%rbp), %eax
movl %eax, -0x84(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0xe8(%rbp)
movl -0x9c(%rbp), %eax
movl %eax, -0xa0(%rbp)
movq -0x68(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x100(%rbp)
movq -0x70(%rbp), %rax
movq $0x0, (%rax)
cmpl $0x1, -0x9c(%rbp)
jne 0x34ce69
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x80(%rbp), %edx
xorl $0x1, %edx
movq -0x68(%rbp), %rax
leaq -0x84(%rbp), %rcx
xorl %r8d, %r8d
movl %r8d, %r9d
movq %r9, %r8
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x344830
cmpl $0x1, %eax
jne 0x34ce54
movq -0x100(%rbp), %rax
movl %eax, -0x88(%rbp)
movq $0x0, -0x108(%rbp)
movl -0x88(%rbp), %eax
movq -0x68(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x34cc9f
movq -0x8(%rbp), %rdi
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x88(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq %rax
movl %eax, %esi
leaq -0xb0(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x37beb0
movl -0xb0(%rbp), %eax
addq -0x108(%rbp), %rax
movq %rax, -0x108(%rbp)
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x34cc40
movl -0x84(%rbp), %eax
movl %eax, -0xb0(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl -0x84(%rbp), %esi
leaq -0x84(%rbp), %rdx
movl $0x1, %ecx
callq 0x311ba0
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movl -0x84(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
xorl $0x1, %eax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0xc0(%rbp)
movl $0xffffffff, -0xbc(%rbp) # imm = 0xFFFFFFFF
movq -0x78(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x84(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0xa4(%rbp)
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x84(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd0(%rbp)
movl $0x0, -0xa0(%rbp)
movl $0x0, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
cmpl -0xa4(%rbp), %eax
jae 0x34ce14
movq -0xd0(%rbp), %rax
movl -0x8c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x34cd93
jmp 0x34ce00
movq -0xd0(%rbp), %rax
movl -0x8c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl -0xb0(%rbp), %ecx
xorl $0x1, %ecx
cmpl %ecx, %eax
jne 0x34cdd4
movq -0xd0(%rbp), %rax
movl -0x8c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xe8(%rbp)
jmp 0x34cdf1
movq -0xd0(%rbp), %rax
movl -0x8c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0xbc(%rbp)
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x34cd60
movq -0x78(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x80(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0xa4(%rbp)
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x78(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x80(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd0(%rbp)
jmp 0x34ce67
movq -0x100(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, (%rax)
jmp 0x34d41f
jmp 0x34ce69
xorl %eax, %eax
cmpl $0x2, -0x94(%rbp)
movb %al, -0x141(%rbp)
jne 0x34ce8a
cmpl $0x2, -0xa0(%rbp)
sete %al
movb %al, -0x141(%rbp)
movb -0x141(%rbp), %al
testb $0x1, %al
jne 0x34ce96
jmp 0x34ce98
jmp 0x34ceb7
leaq 0x4c27c(%rip), %rdi     # 0x39911b
leaq 0x49313(%rip), %rsi     # 0x3961b9
movl $0x28c2, %edx           # imm = 0x28C2
leaq 0x4c27d(%rip), %rcx     # 0x39912f
callq 0x2130
movq -0x108(%rbp), %rax
movl -0x14(%rbp), %ecx
cmpq %rcx, %rax
ja 0x34d411
movq -0x8(%rbp), %rdi
movl -0x18(%rbp), %eax
movl %eax, %esi
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x100(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdx
movq -0x68(%rbp), %rax
movq (%rax), %rcx
subq -0x100(%rbp), %rcx
movq -0x70(%rbp), %r8
xorl %eax, %eax
movl %eax, %r9d
callq 0x37bf20
cmpq $0x0, %rax
je 0x34d411
movq -0x8(%rbp), %rdi
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x100(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x68(%rbp), %rax
movq (%rax), %rdx
subq -0x100(%rbp), %rdx
movq -0x70(%rbp), %rcx
callq 0x34b530
movq %rax, -0x110(%rbp)
movq -0x100(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x108(%rbp)
jbe 0x34d069
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x108(%rbp), %rax
movl %eax, %edx
movq -0x110(%rbp), %rax
movl %eax, %ecx
movl -0xb8(%rbp), %r8d
movss -0x20(%rbp), %xmm0
movq -0x68(%rbp), %r9
movq -0x70(%rbp), %rax
movq %rax, (%rsp)
callq 0x34b5e0
cmpl $0x0, %eax
jne 0x34cfa4
jmp 0x34d41f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x108(%rbp), %rax
movl %eax, %edx
movq -0x110(%rbp), %rax
movl %eax, %ecx
movl -0xb4(%rbp), %r8d
movss -0x20(%rbp), %xmm0
movq -0x68(%rbp), %r9
movq -0x70(%rbp), %rax
movq %rax, (%rsp)
callq 0x34b5e0
cmpl $0x0, %eax
jne 0x34cfe5
jmp 0x34d41f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x108(%rbp), %rax
movl %eax, %edx
movq -0x110(%rbp), %rax
movl %eax, %ecx
movl -0xc0(%rbp), %r8d
movss -0x20(%rbp), %xmm0
movq -0x68(%rbp), %r9
movq -0x70(%rbp), %rax
movq %rax, (%rsp)
callq 0x34b5e0
cmpl $0x0, %eax
jne 0x34d026
jmp 0x34d41f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x108(%rbp), %rax
movl %eax, %edx
movq -0x110(%rbp), %rax
movl %eax, %ecx
movl -0xbc(%rbp), %r8d
movss -0x20(%rbp), %xmm0
movq -0x68(%rbp), %r9
movq -0x70(%rbp), %rax
movq %rax, (%rsp)
callq 0x34b5e0
cmpl $0x0, %eax
jne 0x34d067
jmp 0x34d41f
jmp 0x34d069
movq -0x68(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x100(%rbp)
movq -0x70(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rdi
movq -0xd8(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x70(%rbp), %rcx
movl 0x10(%rbp), %eax
movl %eax, %r8d
leaq -0xf0(%rbp), %r9
leaq -0xf8(%rbp), %rax
movq %rax, (%rsp)
callq 0x348390
movq -0x100(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, (%rax)
movq -0x70(%rbp), %rax
movq $0x0, (%rax)
cmpq $-0x1, -0xf0(%rbp)
je 0x34d193
movq -0xf0(%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, -0x14c(%rbp)
testq %rax, %rax
movss %xmm0, -0x148(%rbp)
js 0x34d121
movss -0x14c(%rbp), %xmm0
movss %xmm0, -0x148(%rbp)
movss -0x148(%rbp), %xmm0
movss %xmm0, -0x158(%rbp)
movq -0xf8(%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, -0x154(%rbp)
testq %rax, %rax
movss %xmm0, -0x150(%rbp)
js 0x34d179
movss -0x154(%rbp), %xmm0
movss %xmm0, -0x150(%rbp)
movss -0x158(%rbp), %xmm0
movss -0x150(%rbp), %xmm1
mulss -0x1c(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x34d198
jmp 0x34d41f
movq -0x68(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x100(%rbp)
movq -0x70(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rdi
movq -0xe8(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x70(%rbp), %rcx
movl 0x10(%rbp), %eax
movl %eax, %r8d
leaq -0xf0(%rbp), %r9
leaq -0xf8(%rbp), %rax
movq %rax, (%rsp)
callq 0x348390
movq -0x100(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, (%rax)
movq -0x70(%rbp), %rax
movq $0x0, (%rax)
cmpq $-0x1, -0xf0(%rbp)
je 0x34d2c2
movq -0xf0(%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, -0x160(%rbp)
testq %rax, %rax
movss %xmm0, -0x15c(%rbp)
js 0x34d250
movss -0x160(%rbp), %xmm0
movss %xmm0, -0x15c(%rbp)
movss -0x15c(%rbp), %xmm0
movss %xmm0, -0x16c(%rbp)
movq -0xf8(%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, -0x168(%rbp)
testq %rax, %rax
movss %xmm0, -0x164(%rbp)
js 0x34d2a8
movss -0x168(%rbp), %xmm0
movss %xmm0, -0x164(%rbp)
movss -0x16c(%rbp), %xmm0
movss -0x164(%rbp), %xmm1
mulss -0x1c(%rbp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x34d2c7
jmp 0x34d41f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0xb8(%rbp), %edx
movl -0xbc(%rbp), %ecx
movl -0x24(%rbp), %r8d
movss -0x28(%rbp), %xmm0
movq -0x68(%rbp), %r9
movq -0x70(%rbp), %rax
movq %rax, (%rsp)
callq 0x34ba50
cmpl $0x0, %eax
jne 0x34d2ff
jmp 0x34d41f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0xc0(%rbp), %edx
movl -0xb4(%rbp), %ecx
movl -0x24(%rbp), %r8d
movss -0x28(%rbp), %xmm0
movq -0x68(%rbp), %r9
movq -0x70(%rbp), %rax
movq %rax, (%rsp)
callq 0x34ba50
cmpl $0x0, %eax
jne 0x34d337
jmp 0x34d41f
cmpl $0x1, -0x9c(%rbp)
jne 0x34d3d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x80(%rbp), %edx
xorl $0x1, %edx
movq -0x68(%rbp), %rax
leaq -0x84(%rbp), %rcx
xorl %r8d, %r8d
movl %r8d, %r9d
movq %r9, %r8
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x344830
movq -0x100(%rbp), %rax
movl %eax, -0x88(%rbp)
movl -0x88(%rbp), %eax
movq -0x68(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x34d3ce
movq -0x10(%rbp), %rdi
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x88(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq %rax
movl %eax, %esi
callq 0x342d10
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x34d38e
jmp 0x34d3d0
movq -0xe0(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movq -0xd8(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
movq -0x100(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, (%rax)
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x34c827
cmpq $0x0, 0x20(%rbp)
jne 0x34d443
movq -0x38(%rbp), %rdi
callq 0x2210
cmpq $0x0, 0x28(%rbp)
jne 0x34d453
movq -0x50(%rbp), %rdi
callq 0x2210
cmpl $0x0, -0xa8(%rbp)
jbe 0x34d465
movq -0x78(%rbp), %rdi
callq 0xcdd10
movl -0xa8(%rbp), %eax
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
nopw %cs:(%rax,%rax)