// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: ulg_arc_cut_misjoin(ul_resolve_t*, ma_ug_t*, int, unsigned int, float, unsigned int, unsigned int, unsigned int*, asg64_v*, asg64_v*)
uint32_t ulg_arc_cut_misjoin(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 *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, i, k, kv, nv, kw, nw, cnt = 0, n_vtx = g->n_seq<<1, mm_ul, ul_max, to_del;
    asg_arc_t *av, *aw, *ve, *we; uint32_t ul_cnt, 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, ul_max = -1; i < nv; ++i) {
                if(av[i].del) continue; kv++;
                get_ul_path_info(uidx, ug, av[i].v, NULL, NULL, &ul_cnt, NULL, NULL, NULL);
                if(ul_cnt > ul_max) ul_max = ul_cnt;
            }
            // if((v>>1) == 5958) {
            //     fprintf(stderr, "[M::%s::] v>>1::%u, v&1::%u, kv::%u, ul_max::%u\n", 
            //     __func__, v>>1, v&1, kv, ul_max);
            // }
            if(kv < 2 || ul_max == 0) continue; //note: ul_cnt/ul_max might be 0

            for (i = 0; i < nv; ++i) {
                if(av[i].del) continue;
                get_ul_path_info(uidx, ug, av[i].v, NULL, NULL, &ul_cnt, NULL, NULL, NULL);
                // if((v>>1) == 5958) {
                //     fprintf(stderr, "+++[M::%s::] v>>1::%u, v&1::%u, av[i].v>>1::%u, av[i].v&1::%u, ul_cnt::%u\n", 
                //     __func__, v>>1, v&1, av[i].v>>1, av[i].v&1, ul_cnt);
                // }
                if(ul_cnt > 0) ul_cnt = ul_max/ul_cnt;
                else ul_cnt = ul_max<<2;
                ul_cnt = ((uint32_t)-1) - ul_cnt;
                kv_push(uint64_t, *b, (((uint64_t)ul_cnt)<<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); 
        if(nv<=1 && asg_arc_n(g, w) <= 1) continue;

        ve = &(g->arc[(uint32_t)b->a[k]]); pb = b->n; ub->n = 0;
        get_ul_path_info(uidx, ug, ve->v, NULL, NULL, &mm_ul, NULL, NULL, NULL);
        // if((v>>1) == 5958 && (w>>1) == 11105) {
        //     fprintf(stderr, ">>>[M::%s::] v>>1::%u, v&1::%u, w>>1::%u, w&1::%u, mm_ul::%u\n", 
        //     __func__, v>>1, v&1, w>>1, w&1, mm_ul);
        // }
        if(mm_ul == 0) continue;///no UL read support this path

        for (i = kv = 0; i < nv; ++i) {
            if(av[i].del) continue; 
            kv++;
            if(av[i].v == ve->v) continue;
            get_ul_path_info(uidx, ug, av[i].v, NULL, NULL, &ul_cnt, NULL, NULL, NULL);
            // if((v>>1) == 5958 && (w>>1) == 11105) {
            //     fprintf(stderr, "*[M::%s::i->%u] v>>1::%u, v&1::%u, w>>1::%u, w&1::%u, av[i].v>>1::%u, av[i].v&1::%u, ul_cnt::%u\n", 
            //     __func__, i, v>>1, v&1, w>>1, w&1, av[i].v>>1, av[i].v&1, ul_cnt);
            // }
            if (mm_ul <= ul_cnt*len_rat) {
                ul_cnt = ((uint32_t)-1) - ul_cnt;
                kv_push(uint64_t, *b, (((uint64_t)ul_cnt)<<32)|((uint64_t)(i)));
            }
        }
        if(b->n == pb) continue;
        to_del = 0; assert(kv >= 2); 

        aw = asg_arc_a(g, w); nw = asg_arc_n(g, w);
        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) || (usg_bridge_topocut_aux(uidx, ug, ve->v, max_ext, max_ext_hifi, topo_level, 0, b, ub))) {
            radix_sort_srt64(b->a + pb, b->a + b->n);
            for (i = pb; i < b->n; i++) {
                // if((v>>1) == 5958 && (w>>1) == 11105) {
                //     fprintf(stderr, "#[M::%s::srt_i->%u] v>>1::%u, v&1::%u, w>>1::%u, w&1::%u, av[(uint32_t)b->a[i]].v>>1::%u, av[(uint32_t)b->a[i]].v&1::%u\n", 
                //     __func__, (uint32_t)b->a[i], v>>1, v&1, w>>1, w&1, av[(uint32_t)b->a[i]].v>>1, av[(uint32_t)b->a[i]].v&1);
                // }
                if(usg_misjoin_topocut_aux(uidx, ug, ve->v, av[(uint32_t)b->a[i]].v, v, b, ub)) {
                    to_del = 1;
                    break;
                }
            }
        }   

        b->n = pb;
        if(to_del) {
            if(kv > 1 && kw > 1) {
                ve->del = we->del = 1; ++cnt;
            } else {
                pb = b->n; 
                get_ul_path_info(uidx, ug, ve->v, NULL, NULL, NULL, NULL, NULL, b);
                for (i = pb; i < b->n; i++) ulg_seq_del(ug, (b->a[i]>>1));
                cnt += b->n - pb; b->n = pb; 
            }
        }
    }


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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movss %xmm0, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%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 -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x70(%rbp)
movl $0x0, -0x94(%rbp)
movq -0x70(%rbp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shll %eax
movl %eax, -0x98(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x3477d0
movq 0x18(%rbp), %rax
movq %rax, -0xd8(%rbp)
jmp 0x3477dd
leaq -0x40(%rbp), %rax
movq %rax, -0xd8(%rbp)
jmp 0x3477dd
movq -0xd8(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, 0x20(%rbp)
je 0x3477fc
movq 0x20(%rbp), %rax
movq %rax, -0xe0(%rbp)
jmp 0x347809
leaq -0x58(%rbp), %rax
movq %rax, -0xe0(%rbp)
jmp 0x347809
movq -0xe0(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x98(%rbp), %eax
jae 0x347b47
movq -0x70(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x74(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x347854
jmp 0x347b39
movq -0x70(%rbp), %rax
movq 0x30(%rax), %rax
movl -0x74(%rbp), %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x347b37
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x70(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x74(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
movq -0x70(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x74(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x88(%rbp)
cmpl $0x2, -0x88(%rbp)
jae 0x3478b8
jmp 0x347b39
movl $0x0, -0x84(%rbp)
movl $0x0, -0x7c(%rbp)
movl $0xffffffff, -0xa0(%rbp) # imm = 0xFFFFFFFF
movl -0x7c(%rbp), %eax
cmpl -0x88(%rbp), %eax
jae 0x347983
movq -0xb0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x347900
jmp 0x347975
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0xb0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
xorl %eax, %eax
movl %eax, %r8d
leaq -0xcc(%rbp), %r9
movq %r8, %rcx
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
callq 0x344830
movl -0xcc(%rbp), %eax
cmpl -0xa0(%rbp), %eax
jbe 0x347973
movl -0xcc(%rbp), %eax
movl %eax, -0xa0(%rbp)
jmp 0x347975
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x3478d3
cmpl $0x2, -0x84(%rbp)
jb 0x347995
cmpl $0x0, -0xa0(%rbp)
jne 0x34799a
jmp 0x347b39
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x88(%rbp), %eax
jae 0x347b35
movq -0xb0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x3479d1
jmp 0x347b27
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0xb0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
xorl %eax, %eax
movl %eax, %r8d
leaq -0xcc(%rbp), %r9
movq %r8, %rcx
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
callq 0x344830
cmpl $0x0, -0xcc(%rbp)
jbe 0x347a3a
movl -0xa0(%rbp), %eax
xorl %edx, %edx
divl -0xcc(%rbp)
movl %eax, -0xcc(%rbp)
jmp 0x347a49
movl -0xa0(%rbp), %eax
shll $0x2, %eax
movl %eax, -0xcc(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
subl -0xcc(%rbp), %eax
movl %eax, -0xcc(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq -0x60(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x347acb
movq -0x60(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x347a8a
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xe8(%rbp)
jmp 0x347a98
movl $0x2, %eax
movq %rax, -0xe8(%rbp)
jmp 0x347a98
movq -0xe8(%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)
movl -0xcc(%rbp), %eax
shlq $0x20, %rax
movq %rax, -0xf0(%rbp)
movq -0xb0(%rbp), %rax
movq -0x70(%rbp), %rcx
movq 0x8(%rcx), %rcx
subq %rcx, %rax
movl $0x18, %ecx
cqto
idivq %rcx
movq -0xf0(%rbp), %rdx
movl -0x7c(%rbp), %ecx
addq %rcx, %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 0x347b27
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x3479a1
jmp 0x347b37
jmp 0x347b39
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x347826
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, -0x80(%rbp)
movl -0x80(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x34822e
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x80(%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 0x347bb1
jmp 0x348220
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x80(%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, -0x74(%rbp)
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x80(%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, -0x78(%rbp)
movq -0x70(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x74(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x347c38
movq -0x70(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x78(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x347c3d
jmp 0x348220
movq -0x70(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x74(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x88(%rbp)
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x70(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x74(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
cmpl $0x1, -0x88(%rbp)
ja 0x347c9d
movq -0x70(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x78(%rbp), %ecx
movq (%rax,%rcx,8), %rax
cmpl $0x1, %eax
ja 0x347c9d
jmp 0x348220
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x80(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc0(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl %eax, -0xd0(%rbp)
movq -0x68(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0xc0(%rbp), %rax
movl 0x8(%rax), %edx
xorl %eax, %eax
movl %eax, %r8d
leaq -0x9c(%rbp), %r9
movq %r8, %rcx
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
callq 0x344830
cmpl $0x0, -0x9c(%rbp)
jne 0x347d2a
jmp 0x348220
movl $0x0, -0x84(%rbp)
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x88(%rbp), %eax
jae 0x347ece
movq -0xb0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x347d6b
jmp 0x347ec0
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
movq -0xb0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0xc0(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x347d9f
jmp 0x347ec0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0xb0(%rbp), %rax
movl -0x7c(%rbp), %ecx
leaq (%rcx,%rcx,2), %rcx
movl 0x8(%rax,%rcx,8), %edx
movq %rsp, %rax
movq $0x0, 0x10(%rax)
movq $0x0, 0x8(%rax)
movq $0x0, (%rax)
xorl %eax, %eax
movl %eax, %r8d
leaq -0xcc(%rbp), %r9
movq %r8, %rcx
callq 0x344830
movl -0x9c(%rbp), %eax
cvtsi2ss %rax, %xmm1
movl -0xcc(%rbp), %eax
cvtsi2ss %rax, %xmm0
mulss -0x1c(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jb 0x347ebe
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
subl -0xcc(%rbp), %eax
movl %eax, -0xcc(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq -0x60(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x347e8d
movq -0x60(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x347e4c
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0xf8(%rbp)
jmp 0x347e5a
movl $0x2, %eax
movq %rax, -0xf8(%rbp)
jmp 0x347e5a
movq -0xf8(%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)
movl -0xcc(%rbp), %eax
movl %eax, %edx
shlq $0x20, %rdx
movl -0x7c(%rbp), %eax
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 0x347ebe
jmp 0x347ec0
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x347d3b
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl -0xd0(%rbp), %ecx
cmpq %rcx, %rax
jne 0x347ee5
jmp 0x348220
movl $0x0, -0xa4(%rbp)
cmpl $0x2, -0x84(%rbp)
jb 0x347efa
jmp 0x347f19
leaq 0x50efc(%rip), %rdi     # 0x398dfd
leaq 0x4e2b1(%rip), %rsi     # 0x3961b9
movl $0x2528, %edx           # imm = 0x2528
leaq 0x50ef1(%rip), %rcx     # 0x398e05
callq 0x2130
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x70(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x78(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb8(%rbp)
movq -0x70(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x78(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x90(%rbp)
movl $0x0, -0x8c(%rbp)
movl $0x0, -0x7c(%rbp)
movq $0x0, -0xc8(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x90(%rbp), %eax
jae 0x347fec
movq -0xb8(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x347f9c
jmp 0x347fe1
movq -0xb8(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl -0x74(%rbp), %ecx
xorl $0x1, %ecx
cmpl %ecx, %eax
jne 0x347fd2
movq -0xb8(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc8(%rbp)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x347f73
cmpl $0x1, -0x84(%rbp)
jbe 0x347ffe
cmpl $0x1, -0x8c(%rbp)
ja 0x348045
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0xc0(%rbp), %rax
movl 0x8(%rax), %edx
movl -0x14(%rbp), %ecx
movl -0x18(%rbp), %r8d
movl -0x24(%rbp), %r9d
movq -0x60(%rbp), %r10
movq -0x68(%rbp), %rax
xorl %r11d, %r11d
movl $0x0, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x344c90
cmpl $0x0, %eax
je 0x3480f4
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rdi
movl -0xd0(%rbp), %eax
shlq $0x3, %rax
addq %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 -0xd0(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x3480f2
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0xc0(%rbp), %rax
movl 0x8(%rax), %edx
movq -0xb0(%rbp), %rax
movq -0x60(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x7c(%rbp), %r8d
movq (%rcx,%r8,8), %rcx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movl -0x74(%rbp), %r8d
movq -0x60(%rbp), %r9
movq -0x68(%rbp), %rax
movq %rax, (%rsp)
callq 0x347170
cmpl $0x0, %eax
je 0x3480e5
movl $0x1, -0xa4(%rbp)
jmp 0x3480f2
jmp 0x3480e7
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x34807e
jmp 0x3480f4
movl -0xd0(%rbp), %eax
movl %eax, %ecx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
cmpl $0x0, -0xa4(%rbp)
je 0x34821e
cmpl $0x1, -0x84(%rbp)
jbe 0x348168
cmpl $0x1, -0x8c(%rbp)
jbe 0x348168
movq -0xc8(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movq -0xc0(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0xc(%rax)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x34821c
movq -0x60(%rbp), %rax
movq (%rax), %rax
movl %eax, -0xd0(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0xc0(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x60(%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
movl -0xd0(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x3481ee
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x7c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq %rax
movl %eax, %esi
callq 0x342d10
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x3481ba
movq -0x60(%rbp), %rax
movq (%rax), %rcx
movl -0xd0(%rbp), %eax
subq %rax, %rcx
movl -0x94(%rbp), %eax
addq %rcx, %rax
movl %eax, -0x94(%rbp)
movl -0xd0(%rbp), %eax
movl %eax, %ecx
movq -0x60(%rbp), %rax
movq %rcx, (%rax)
jmp 0x34821e
jmp 0x348220
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x347b71
cmpq $0x0, 0x18(%rbp)
jne 0x34823e
movq -0x30(%rbp), %rdi
callq 0x2210
cmpq $0x0, 0x20(%rbp)
jne 0x34824e
movq -0x48(%rbp), %rdi
callq 0x2210
cmpl $0x0, -0x94(%rbp)
jbe 0x348260
movq -0x70(%rbp), %rdi
callq 0xcdd10
movl -0x94(%rbp), %eax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nop