// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: ulg_bub_pop1(ul_resolve_t*, ma_ug_t*, unsigned int, unsigned long, buf_t*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, asg64_v*, asg64_v*, unsigned int*, unsigned int*)
uint64_t ulg_bub_pop1(ul_resolve_t *uidx, ma_ug_t *ug, uint32_t v0, uint64_t max_dist, buf_t *x, 
uint32_t max_ext, uint32_t max_ext_hifi, uint32_t check_bubble_only, uint32_t is_pop, uint32_t skip_hom, 
asg64_v *b, asg64_v *ub, uint32_t *r_w_c, uint32_t *r_w_m)
{
    asg_t *g = ug->g; uint32_t pb = b->n; uint64_t w_q, w_t, wc, wm, ww; (*r_w_c) = (*r_w_m) = (uint32_t)-1;
    uint32_t v, w, i, kv, nv, kw, cnt = 0, fail_b = 0, n_tips = 0, tip_end = (uint32_t)-1;
    uint32_t l, d, c, m, n_pending = 0, z, to_replace; asg_arc_t *av, *ve, *we; binfo_t *t;
    if(g->seq[v0>>1].del || get_arcs(g, v0, NULL, 0) < 2) return 0; // already deleted
    // fprintf(stderr, "sbsbsbsbsbsbsb[M::%s::(v0>>1)->%u::(v0&1)->%u] check_bubble_only::%u, is_pop::%u\n", 
    //             __func__, v0>>1, v0&1, check_bubble_only, is_pop);

    x->S.n = x->T.n = x->b.n = x->e.n = 0;
    x->a[v0].c = x->a[v0].d = x->a[v0].m = x->a[v0].nc = x->a[v0].np = 0;
    kv_push(uint32_t, x->S, v0);

    do {
        v = kv_pop(x->S); d = x->a[v].d; c = x->a[v].c; m = x->a[v].m;
        nv = asg_arc_n(g, v); av = asg_arc_a(g, v); kv = get_arcs(g, v, NULL, 0);
        for (i = 0; i < nv; ++i) {
            if (av[i].del) continue;
            w = av[i].v; t = &(x->a[w]); l = ((v == v0)?(0):((uint32_t)av[i].ul));
            if ((w>>1) == (v0>>1)) {
                fail_b = 1;
                break;
            }
            kv_push(uint32_t, x->e, (g->idx[v]>>32) + i); ///for backtracking
            if (d + l > max_dist) {
                fail_b = 1;
                break;
            }
            kw = get_arcs(g, w^1, NULL, 0);
            wc = 0; wm = get_ul_occ(uidx, w>>1);
            if(!check_bubble_only) {
                if(kv > 1) {
                    pb = b->n; ub->n = 0; ve = &(av[i]);
                    // fprintf(stderr, "[M::%s::] ve->v>>1::%lu, ve->v&1::%lu, ve->w>>1::%u, ve->w&1::%u\n", 
                    // __func__, ve->ul>>33, (ve->ul>>32)&1, ve->v>>1, ve->v&1);
                    get_ul_arc_supports(uidx, ve, b, ub, skip_hom, &w_q, &w_t);
                    b->n = pb; ub->n = 0;
                    if(w_q < w_t) {
                        if(w_q == 0) {
                            ww = 10;
                        } else {
                            if(w_t != 0) ww = ((w_t - w_q)*10)/w_t;
                            else ww = 0;
                        } 
                        if(ww > wc) wc = ww;
                    }
                }

                if(kw > 1) {
                    pb = b->n; ub->n = 0; we = get_specfic_edge(g, w^1, v^1); assert(we);
                    // fprintf(stderr, "[M::%s::] we->v>>1::%lu, we->v&1::%lu, we->w>>1::%u, we->w&1::%u\n", 
                    // __func__, we->ul>>33, (we->ul>>32)&1, we->v>>1, we->v&1);
                    get_ul_arc_supports(uidx, we, b, ub, skip_hom, &w_q, &w_t);
                    b->n = pb; ub->n = 0;
                    if(w_q < w_t) {
                        if(w_q == 0) {
                            ww = 10;
                        } else {
                            if(w_t != 0) ww = ((w_t - w_q)*10)/w_t;
                            else ww = 0;
                        } 
                        if(ww > wc) wc = ww;
                    }
                }
            }

            if (t->s == 0) {
                kv_push(uint32_t, x->b, w); 
                t->p = v, t->s = 1, t->d = d + l;
                t->c = c + wc; t->m = m + wm;
                t->r = kw;
				++n_pending;
            } else {
                to_replace = 0;
                if((c + wc) < t->c) {
                    to_replace = 1;
                } else if(((c + wc) == t->c) && (m + wm > t->m)) {
                    to_replace = 1;
                } else if(((c + wc) == t->c) && (m + wm == t->m) && (d + l > t->d)) {
                    to_replace = 1;
                }
                if(to_replace) {
                    t->p = v; t->c = c + wc; t->m = m + wm;
                }
                if (d + l < t->d) t->d = d + l; // update dist
            }

            if (--(t->r) == 0) {
                z = get_arcs(g, w, NULL, 0);
                if(z > 0) {
                    kv_push(uint32_t, x->S, w);
                }
                else {
                    ///at most one tip
                    if(n_tips != 0) {
                        fail_b = 1;
                        break;
                    }
                    n_tips++; tip_end = w;
                }
				--n_pending;
            }
        }
        if(fail_b) break;
        if(n_tips == 1) {
            if(tip_end != (uint32_t)-1 && n_pending == 0 && x->S.n == 0) {
                kv_push(uint32_t, x->S, tip_end);
                break;
            }
            fail_b = 1;
            break;
        }

        if (i < nv || x->S.n == 0) {
            fail_b = 1;
            break;
        }
    } while (x->S.n > 1 || n_pending);

    if(!fail_b) {//there is a bubble
        cnt = 1; (*r_w_c) = x->a[x->S.a[0]].c; (*r_w_m) = x->a[x->S.a[0]].m; 
        if(!check_bubble_only) {
            if(is_pop) {
                cnt = ulg_bub_pop_backtrack(ug, v0, x);
            } else {
                cnt = ulg_bub_pop_cut_aux(uidx, ug, v0, x, max_ext, max_ext_hifi, b, ub);
            }
        }
    }
    for (i = 0; i < x->b.n; ++i) { // clear the states of visited vertices
        // if(v0 == 119) {
        //     fprintf(stderr, "-[M::%s::(v0>>1)->%u::(v0&1)->%u] v[%u]>>1::%u, v[%u]&1::%u, cnt::%u, is_pop::%u\n", 
        //         __func__, v0>>1, v0&1, i, x->b.a[i]>>1, i, x->b.a[i]&1, cnt, is_pop);
        // }
		t = &x->a[x->b.a[i]];
		t->s = t->c = t->d = t->m = t->nc = t->np = 0;
	}
    if(!cnt) (*r_w_c) = (*r_w_m) = (uint32_t)-1;
    return cnt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq 0x48(%rbp), %rax
movq 0x40(%rbp), %rax
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
movq 0x30(%rbp), %rax
movq (%rax), %rax
movl %eax, -0x44(%rbp)
movq 0x48(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq 0x40(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0x0, -0x8c(%rbp)
movl $0x0, -0x90(%rbp)
movl $0x0, -0x94(%rbp)
movl $0xffffffff, -0x98(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0xac(%rbp)
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x1c(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
movl (%rax,%rcx,8), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x34a24b
movq -0x40(%rbp), %rdi
movl -0x1c(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x311ba0
cmpl $0x2, %eax
jae 0x34a258
movq $0x0, -0x8(%rbp)
jmp 0x34ae77
movq -0x30(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x38(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl -0x1c(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x10(%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl -0x1c(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x14(%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl -0x1c(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0xc(%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl -0x1c(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x4(%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl -0x1c(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x34a372
movq -0x30(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x34a331
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0xe0(%rbp)
jmp 0x34a33f
movl $0x2, %eax
movq %rax, -0xe0(%rbp)
jmp 0x34a33f
movq -0xe0(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x1c(%rbp), %edx
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rsi
movq 0x8(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x8(%rsi)
movl %edx, (%rax,%rcx,4)
jmp 0x34a395
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $-0x1, %rsi
movq %rsi, 0x8(%rdx)
movl -0x4(%rax,%rcx,4), %eax
movl %eax, -0x74(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl -0x74(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0xa0(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl -0x74(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0xa4(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl -0x74(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0xa8(%rbp)
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x74(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x84(%rbp)
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x40(%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, -0xc0(%rbp)
movq -0x40(%rbp), %rdi
movl -0x74(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x311ba0
movl %eax, -0x80(%rbp)
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x84(%rbp), %eax
jae 0x34abb8
movq -0xc0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x34a48f
jmp 0x34abaa
movq -0xc0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x78(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movl -0x78(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movl -0x74(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0x34a4d0
xorl %eax, %eax
movl %eax, -0xe4(%rbp)
jmp 0x34a4ea
movq -0xc0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, -0xe4(%rbp)
movl -0xe4(%rbp), %eax
movl %eax, -0x9c(%rbp)
movl -0x78(%rbp), %eax
shrl %eax
movl -0x1c(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
jne 0x34a513
movl $0x1, -0x90(%rbp)
jmp 0x34abb8
jmp 0x34a515
movq -0x30(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x58(%rcx), %rax
jne 0x34a587
movq -0x30(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x34a546
movq -0x30(%rbp), %rax
movq 0x58(%rax), %rax
shlq %rax
movq %rax, -0xf0(%rbp)
jmp 0x34a554
movl $0x2, %eax
movq %rax, -0xf0(%rbp)
jmp 0x34a554
movq -0xf0(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x30(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x58(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x40(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x74(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movl -0x7c(%rbp), %ecx
addq %rcx, %rax
movl %eax, %edx
movq -0x30(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x30(%rbp), %rsi
movq 0x50(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x50(%rsi)
movl %edx, (%rax,%rcx,4)
movl -0xa0(%rbp), %eax
addl -0x9c(%rbp), %eax
movl %eax, %eax
cmpq -0x28(%rbp), %rax
jbe 0x34a5e3
movl $0x1, -0x90(%rbp)
jmp 0x34abb8
movq -0x40(%rbp), %rdi
movl -0x78(%rbp), %esi
xorl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x311ba0
movl %eax, -0x88(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x10(%rbp), %rdi
movl -0x78(%rbp), %eax
shrl %eax
movl %eax, %eax
movl %eax, %esi
callq 0x37be90
movq %rax, -0x68(%rbp)
cmpl $0x0, 0x18(%rbp)
jne 0x34a802
cmpl $0x1, -0x80(%rbp)
jbe 0x34a6fa
movq 0x30(%rbp), %rax
movq (%rax), %rax
movl %eax, -0x44(%rbp)
movq 0x38(%rbp), %rax
movq $0x0, (%rax)
movq -0xc0(%rbp), %rax
movl -0x7c(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xc8(%rbp)
movq -0x10(%rbp), %rdi
movq -0xc8(%rbp), %rsi
movq 0x30(%rbp), %rdx
movq 0x38(%rbp), %rcx
movl 0x28(%rbp), %eax
movl %eax, %r8d
leaq -0x50(%rbp), %r9
leaq -0x58(%rbp), %rax
movq %rax, (%rsp)
callq 0x348390
movl -0x44(%rbp), %eax
movl %eax, %ecx
movq 0x30(%rbp), %rax
movq %rcx, (%rax)
movq 0x38(%rbp), %rax
movq $0x0, (%rax)
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x34a6f8
cmpq $0x0, -0x50(%rbp)
jne 0x34a6b9
movq $0xa, -0x70(%rbp)
jmp 0x34a6e4
cmpq $0x0, -0x58(%rbp)
je 0x34a6da
movq -0x58(%rbp), %rax
subq -0x50(%rbp), %rax
imulq $0xa, %rax, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x58(%rbp)
movq %rax, -0x70(%rbp)
jmp 0x34a6e2
movq $0x0, -0x70(%rbp)
jmp 0x34a6e4
movq -0x70(%rbp), %rax
cmpq -0x60(%rbp), %rax
jbe 0x34a6f6
movq -0x70(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x34a6f8
jmp 0x34a6fa
cmpl $0x1, -0x88(%rbp)
jbe 0x34a800
movq 0x30(%rbp), %rax
movq (%rax), %rax
movl %eax, -0x44(%rbp)
movq 0x38(%rbp), %rax
movq $0x0, (%rax)
movq -0x40(%rbp), %rdi
movl -0x78(%rbp), %esi
xorl $0x1, %esi
movl -0x74(%rbp), %edx
xorl $0x1, %edx
callq 0x37bdd0
movq %rax, -0xd0(%rbp)
cmpq $0x0, -0xd0(%rbp)
je 0x34a744
jmp 0x34a763
leaq 0x4e836(%rip), %rdi     # 0x398f81
leaq 0x4ba67(%rip), %rsi     # 0x3961b9
movl $0x2708, %edx           # imm = 0x2708
leaq 0x4e826(%rip), %rcx     # 0x398f84
callq 0x2130
movq -0x10(%rbp), %rdi
movq -0xd0(%rbp), %rsi
movq 0x30(%rbp), %rdx
movq 0x38(%rbp), %rcx
movl 0x28(%rbp), %eax
movl %eax, %r8d
leaq -0x50(%rbp), %r9
leaq -0x58(%rbp), %rax
movq %rax, (%rsp)
callq 0x348390
movl -0x44(%rbp), %eax
movl %eax, %ecx
movq 0x30(%rbp), %rax
movq %rcx, (%rax)
movq 0x38(%rbp), %rax
movq $0x0, (%rax)
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x34a7fe
cmpq $0x0, -0x50(%rbp)
jne 0x34a7bf
movq $0xa, -0x70(%rbp)
jmp 0x34a7ea
cmpq $0x0, -0x58(%rbp)
je 0x34a7e0
movq -0x58(%rbp), %rax
subq -0x50(%rbp), %rax
imulq $0xa, %rax, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x58(%rbp)
movq %rax, -0x70(%rbp)
jmp 0x34a7e8
movq $0x0, -0x70(%rbp)
jmp 0x34a7ea
movq -0x70(%rbp), %rax
cmpq -0x60(%rbp), %rax
jbe 0x34a7fc
movq -0x70(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x34a7fe
jmp 0x34a800
jmp 0x34a802
movq -0xd8(%rbp), %rax
movl 0x18(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x34a949
jmp 0x34a81a
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x40(%rcx), %rax
jne 0x34a88c
movq -0x30(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x34a84b
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rax
shlq %rax
movq %rax, -0xf8(%rbp)
jmp 0x34a859
movl $0x2, %eax
movq %rax, -0xf8(%rbp)
jmp 0x34a859
movq -0xf8(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x40(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x48(%rax)
movl -0x78(%rbp), %edx
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x30(%rbp), %rsi
movq 0x38(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x38(%rsi)
movl %edx, (%rax,%rcx,4)
movl -0x74(%rbp), %ecx
movq -0xd8(%rbp), %rax
movl %ecx, (%rax)
movq -0xd8(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0x18(%rax)
movl -0xa0(%rbp), %ecx
addl -0x9c(%rbp), %ecx
movq -0xd8(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0xa4(%rbp), %eax
addq -0x60(%rbp), %rax
movl %eax, %ecx
movq -0xd8(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0xa8(%rbp), %eax
addq -0x68(%rbp), %rax
movl %eax, %ecx
movq -0xd8(%rbp), %rax
movl %ecx, 0xc(%rax)
movl -0x88(%rbp), %edx
movq -0xd8(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, 0x18(%rax)
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x34aa82
movl $0x0, -0xb4(%rbp)
movl -0xa4(%rbp), %eax
addq -0x60(%rbp), %rax
movq -0xd8(%rbp), %rcx
movl 0x8(%rcx), %ecx
cmpq %rcx, %rax
jae 0x34a97b
movl $0x1, -0xb4(%rbp)
jmp 0x34aa11
movl -0xa4(%rbp), %eax
addq -0x60(%rbp), %rax
movq -0xd8(%rbp), %rcx
movl 0x8(%rcx), %ecx
cmpq %rcx, %rax
jne 0x34a9b9
movl -0xa8(%rbp), %eax
addq -0x68(%rbp), %rax
movq -0xd8(%rbp), %rcx
movl 0xc(%rcx), %ecx
cmpq %rcx, %rax
jbe 0x34a9b9
movl $0x1, -0xb4(%rbp)
jmp 0x34aa0f
movl -0xa4(%rbp), %eax
addq -0x60(%rbp), %rax
movq -0xd8(%rbp), %rcx
movl 0x8(%rcx), %ecx
cmpq %rcx, %rax
jne 0x34aa0d
movl -0xa8(%rbp), %eax
addq -0x68(%rbp), %rax
movq -0xd8(%rbp), %rcx
movl 0xc(%rcx), %ecx
cmpq %rcx, %rax
jne 0x34aa0d
movl -0xa0(%rbp), %eax
addl -0x9c(%rbp), %eax
movq -0xd8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jbe 0x34aa0d
movl $0x1, -0xb4(%rbp)
jmp 0x34aa0f
jmp 0x34aa11
cmpl $0x0, -0xb4(%rbp)
je 0x34aa52
movl -0x74(%rbp), %ecx
movq -0xd8(%rbp), %rax
movl %ecx, (%rax)
movl -0xa4(%rbp), %eax
addq -0x60(%rbp), %rax
movl %eax, %ecx
movq -0xd8(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0xa8(%rbp), %eax
addq -0x68(%rbp), %rax
movl %eax, %ecx
movq -0xd8(%rbp), %rax
movl %ecx, 0xc(%rax)
movl -0xa0(%rbp), %eax
addl -0x9c(%rbp), %eax
movq -0xd8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jae 0x34aa80
movl -0xa0(%rbp), %ecx
addl -0x9c(%rbp), %ecx
movq -0xd8(%rbp), %rax
movl %ecx, 0x4(%rax)
jmp 0x34aa82
movq -0xd8(%rbp), %rcx
movl 0x18(%rcx), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addl $-0x1, %eax
movl 0x18(%rcx), %edx
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl $0x80000000, %edx       # imm = 0x80000000
orl %eax, %edx
movl %edx, 0x18(%rcx)
cmpl $0x0, %eax
jne 0x34aba8
movq -0x40(%rbp), %rdi
movl -0x78(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0x311ba0
movl %eax, -0xb0(%rbp)
cmpl $0x0, -0xb0(%rbp)
jbe 0x34ab6c
jmp 0x34aad7
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x34ab49
movq -0x30(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x34ab08
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x100(%rbp)
jmp 0x34ab16
movl $0x2, %eax
movq %rax, -0x100(%rbp)
jmp 0x34ab16
movq -0x100(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x78(%rbp), %edx
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rsi
movq 0x8(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x8(%rsi)
movl %edx, (%rax,%rcx,4)
jmp 0x34ab99
cmpl $0x0, -0x94(%rbp)
je 0x34ab81
movl $0x1, -0x90(%rbp)
jmp 0x34abb8
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
movl -0x78(%rbp), %eax
movl %eax, -0x98(%rbp)
movl -0xac(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x34abaa
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x34a45f
cmpl $0x0, -0x90(%rbp)
je 0x34abc6
jmp 0x34acf7
cmpl $0x1, -0x94(%rbp)
jne 0x34aca2
cmpl $-0x1, -0x98(%rbp)
je 0x34ac96
cmpl $0x0, -0xac(%rbp)
jne 0x34ac96
movq -0x30(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x34ac96
jmp 0x34abfe
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x34ac70
movq -0x30(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x34ac2f
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x108(%rbp)
jmp 0x34ac3d
movl $0x2, %eax
movq %rax, -0x108(%rbp)
jmp 0x34ac3d
movq -0x108(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rsi
shlq $0x2, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x98(%rbp), %edx
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x30(%rbp), %rsi
movq 0x8(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x8(%rsi)
movl %edx, (%rax,%rcx,4)
jmp 0x34acf7
movl $0x1, -0x90(%rbp)
jmp 0x34acf7
movl -0x7c(%rbp), %eax
cmpl -0x84(%rbp), %eax
jb 0x34acb8
movq -0x30(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x34acc4
movl $0x1, -0x90(%rbp)
jmp 0x34acf7
jmp 0x34acc6
movq -0x30(%rbp), %rcx
movb $0x1, %al
cmpq $0x1, 0x8(%rcx)
movb %al, -0x109(%rbp)
ja 0x34ace9
cmpl $0x0, -0xac(%rbp)
setne %al
movb %al, -0x109(%rbp)
movb -0x109(%rbp), %al
testb $0x1, %al
jne 0x34a395
cmpl $0x0, -0x90(%rbp)
jne 0x34adab
movl $0x1, -0x8c(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl (%rcx), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq 0x40(%rbp), %rax
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl (%rcx), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0xc(%rax), %ecx
movq 0x48(%rbp), %rax
movl %ecx, (%rax)
cmpl $0x0, 0x18(%rbp)
jne 0x34ada9
cmpl $0x0, 0x20(%rbp)
je 0x34ad74
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x30(%rbp), %rdx
callq 0x349f70
movl %eax, -0x8c(%rbp)
jmp 0x34ada7
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movq -0x30(%rbp), %rcx
movl -0x34(%rbp), %r8d
movl 0x10(%rbp), %r9d
movq 0x30(%rbp), %r10
movq 0x38(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x349d70
movl %eax, -0x8c(%rbp)
jmp 0x34ada9
jmp 0x34adab
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpq 0x38(%rcx), %rax
jae 0x34ae50
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movq 0x48(%rcx), %rcx
movl -0x7c(%rbp), %edx
movl (%rcx,%rdx,4), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0xd8(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0xd8(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0xd8(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0xd8(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0xd8(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0x18(%rax)
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x34adb2
cmpl $0x0, -0x8c(%rbp)
jne 0x34ae6d
movq 0x48(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq 0x40(%rbp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl -0x8c(%rbp), %eax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw %cs:(%rax,%rax)