// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Overlaps.cpp
// Function: asg_bub_pop1_primary_trio(asg_t*, ma_ug_t*, unsigned int, unsigned long, buf_t*, unsigned int, unsigned int, unsigned int, unsigned long*, unsigned long*, hap_cov_t*, unsigned int, unsigned int, utg_trans_t*)
uint64_t asg_bub_pop1_primary_trio(asg_t *g, ma_ug_t *utg, uint32_t v0, uint64_t max_dist, buf_t *b, 
uint32_t positive_flag, uint32_t negative_flag, uint32_t is_pop, uint64_t* path_base_len, uint64_t* path_nodes, 
hap_cov_t *cov, uint32_t is_update_chain, uint32_t keep_d, utg_trans_t *o)
{   
	uint32_t i, n_pending = 0, is_first = 1, cur_m, cur_c, cur_np, cur_nc, to_replace, n_tips, tip_end;
	uint64_t n_pop = 0;
    long long cur_weight = -1, max_weight = -1;
	///if this node has been deleted
	if (g->seq[v0>>1].del || g->seq[v0>>1].c == ALTER_LABLE) return 0; // already deleted
	///if ((uint32_t)g->idx[v0] < 2) return 0; // no bubbles
    if(get_real_length(g, v0, NULL)<2) return 0;
	///S saves nodes with all incoming edges visited
	b->S.n = b->T.n = b->b.n = b->e.n = 0;
	///for each node, b->a saves all related information
	b->a[v0].c = b->a[v0].d = b->a[v0].m = b->a[v0].nc = b->a[v0].np = 0;
	///b->S is the nodes with all incoming edges visited
	kv_push(uint32_t, b->S, v0);
    n_tips = 0;
    tip_end = (uint32_t)-1;
    uint32_t non_positive_flag = (uint32_t)-1;
    if(positive_flag == FATHER) non_positive_flag = MOTHER;
    if(positive_flag == MOTHER) non_positive_flag = FATHER;

	do {
		///v is a node that all incoming edges have been visited
		///d is the distance from v0 to v
		uint32_t v = kv_pop(b->S), d = b->a[v].d, c = b->a[v].c, m = b->a[v].m, nc = b->a[v].nc, np = b->a[v].np;
		uint32_t nv = asg_arc_n(g, v);
		asg_arc_t *av = asg_arc_a(g, v);
		///why we have this assert?
		///assert(nv > 0);
		///all out-edges of v
		for (i = 0; i < nv; ++i) { // loop through v's neighbors
			/**
			p->ul: |____________31__________|__________1___________|______________32_____________|
								qn            direction of overlap       length of this node (not overlap length)
												(in the view of query)
			p->v : |___________31___________|__________1___________|
								tn             reverse direction of overlap
											(in the view of target)
			p->ol: overlap length
			**/
            ///if this edge has been deleted
			if (av[i].del) continue;
            
			uint32_t w = av[i].v, l = (uint32_t)av[i].ul; // v->w with length l
			binfo_t *t = &b->a[w];
			///that means there is a circle, directly terminate the whole bubble poping
			///if (w == v0) goto pop_reset;
            if ((w>>1) == (v0>>1)) {
                goto pop_reset;
            }
            /****************************may have bugs********************************/
            ///important when poping at long untig graph
            if(is_first && keep_d) l = 0;
            /****************************may have bugs********************************/

			

			///push the edge
            ///high 32-bit of g->idx[v] is the start point of v's edges
            //so here is the point of this specfic edge
			kv_push(uint32_t, b->e, (g->idx[v]>>32) + i);
			///find a too far path? directly terminate the whole bubble poping
			if (d + l > max_dist) break; // too far

            ///if this node
			if (t->s == 0) { // this vertex has never been visited
				kv_push(uint32_t, b->b, w); // save it for revert
				///t->p is the parent node of 
				///t->s = 1 means w has been visited
				///d is len(v0->v), l is len(v->w), so t->d is len(v0->w)
				t->p = v, t->s = 1, t->d = d + l;
                /****************************may have bugs********************************/
                cur_c = cur_m = cur_np = 0; cur_nc = 1;
                if(utg)
                {
                    cur_c = get_num_trio_flag(utg, w>>1, positive_flag);
                    cur_m = get_num_trio_flag(utg, w>>1, negative_flag);
                    cur_np = 0; 
                    if(non_positive_flag != (uint32_t)-1) 
                    {
                        cur_np = get_num_trio_flag(utg, w>>1, non_positive_flag);
                    }
                    cur_nc = utg->u.a[(w>>1)].n;
                }
                

                t->c = c + cur_c;
                t->m = m + cur_m;
                t->nc = nc + cur_nc;
                t->np = np + cur_np;
                /****************************may have bugs********************************/
				///incoming edges of w
				///t->r = count_out(g, w^1);
                t->r = get_real_length(g, w^1, NULL);
				++n_pending;
			} else { // visited before
                /****************************may have bugs********************************/
                cur_c = cur_m = cur_np = 0; cur_nc = 1;
                if(utg)
                {
                    cur_c = get_num_trio_flag(utg, w>>1, positive_flag);
                    cur_m = get_num_trio_flag(utg, w>>1, negative_flag);
                    cur_np = 0; 
                    if(non_positive_flag != (uint32_t)-1) 
                    {
                        cur_np = get_num_trio_flag(utg, w>>1, non_positive_flag);
                    }
                    cur_nc = utg->u.a[(w>>1)].n;
                }
                ///BUG: select the path with less negative_flag, less non_positive_flag, more positive_flag, more distance
                ///FIXED: select the path with less (negative_flag+non_positive_flag), more positive_flag, more distance
                to_replace = 0;

                /****************************may have bugs********************************/
                cur_weight = (long long)(c + cur_c) - ((long long)(m + cur_m) + (long long)(np + cur_np));
                max_weight = (long long)t->c - ((long long)t->m + (long long)t->np);
                if(cur_weight > max_weight)
                {
                    to_replace = 1;
                }
                else if(cur_weight == max_weight)
                {
                    if(nc + cur_nc > t->nc)
                    {
                        to_replace = 1;
                    }
                    else if(nc + cur_nc == t->nc)
                    {
                        if(d + l > t->d)
                        {
                            to_replace = 1;
                        }
                    }
                }
                /****************************may have bugs********************************/
                if(to_replace)
                {
                    t->p = v;
                    t->m = m + cur_m;
                    t->c = c + cur_c;
                    t->nc = nc + cur_nc;
                    t->np = np + cur_np;
                }
				///c is the weight (is very likely the number of node in this edge) of the parent node
				///select the longest edge (longest meams most reads/longest edge)
                // if (c + 1 > t->c || (c + 1 == t->c && d + l > t->d)) t->p = v;
				// if (c + 1 > t->c) t->c = c + 1;
                /****************************may have bugs********************************/
				///update len(v0->w)
                ///node: t->d is not the length from this node's parent
                ///it is the shortest edge
				if (d + l < t->d) t->d = d + l; // update dist
			}
			///assert(t->r > 0);
			//if all incoming edges of w have visited
			//push it to b->S
			if (--(t->r) == 0) {
                uint32_t x = get_real_length(g, w, NULL);
                /****************************may have bugs for bubble********************************/
                if(x > 0)
                {
                    kv_push(uint32_t, b->S, w);
                }
                else
                {
                    ///at most one tip
                    if(n_tips != 0) {
                        goto pop_reset;
                    }
                    n_tips++;
                    tip_end = w;
                }
                /****************************may have bugs for bubble********************************/
				--n_pending;
			}
		}
        is_first = 0;
        //if found a tip
        /****************************may have bugs for bubble********************************/
        if(n_tips == 1)
        {
            if(tip_end != (uint32_t)-1 && n_pending == 0 && b->S.n == 0)
            {
                kv_push(uint32_t, b->S, tip_end);
                break;
            }
            else
            {
                goto pop_reset;
            }
        }
        /****************************may have bugs for bubble********************************/
		///if i < nv, that means (d + l > max_dist)
		if (i < nv || b->S.n == 0) {
            goto pop_reset;
        }
	} while (b->S.n > 1 || n_pending);


    /****************************may have bugs********************************/
    ///if(keep_d != 0) debug_asg_bub_pop1_primary_trio(g, utg, v0, max_dist, b, positive_flag, negative_flag, 1);
    /****************************may have bugs********************************/
    if(cov && utg) asg_bub_backtrack_primary_cov(utg, v0, b, cov, is_update_chain);
    if(o && utg) asg_bub_collect_ovlp(utg, v0, b, o);
	if(is_pop) asg_bub_backtrack_primary(g, v0, b);
    if(path_base_len || path_nodes) asg_bub_backtrack_primary_length(g, utg, v0, b, path_base_len, path_nodes);

    n_pop = 1;
pop_reset:

    /****************************may have bugs********************************/
    ///if(!n_pop && keep_d != 0) debug_asg_bub_pop1_primary_trio(g, utg, v0, max_dist, b, positive_flag, negative_flag, 0);
    /****************************may have bugs********************************/

	for (i = 0; i < b->b.n; ++i) { // clear the states of visited vertices
		binfo_t *t = &b->a[b->b.a[i]];
		t->s = t->c = t->d = t->m = t->nc = t->np = 0;
	}
	return n_pop;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %r9d, 0x48(%rsp)
movq %rcx, 0x70(%rsp)
movq 0x20(%rdi), %rax
movl %edx, %ebp
shrl %ebp
cmpl $0x0, (%rax,%rbp,8)
js 0xc0366
cmpb $0x1, 0x4(%rax,%rbp,8)
je 0xc0366
movl %edx, %r12d
movq 0x28(%rdi), %rax
movl %edx, %ecx
movq %rcx, 0x98(%rsp)
movq (%rax,%rcx,8), %rax
xorl %r13d, %r13d
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
andq %rax, %rcx
je 0xc0369
movq %r8, %r11
movq %rsi, %r10
movq 0x8(%rdi), %rdx
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
leaq (%rdx,%rax,8), %rax
addq $0xc, %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %edx, %edx
movl (%rax,%rdx), %esi
notl %esi
shrl $0x1f, %esi
addl %esi, %r13d
addq $0x18, %rdx
cmpq %rdx, %rcx
jne 0xc034c
cmpl $0x2, %r13d
jge 0xc037e
xorl %r13d, %r13d
movq %r13, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
movq %rax, 0x50(%r11)
movq %rax, 0x38(%r11)
movq %rax, 0x20(%r11)
movq %rax, 0x8(%r11)
movq (%r11), %rcx
movq 0x98(%rsp), %rsi
leaq (%rsi,%rsi,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rsi, %rdx
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%rcx,%rdx)
movl $0x0, 0x14(%rcx,%rdx)
cmpq %rax, 0x10(%r11)
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rdi, 0x18(%rsp)
je 0xc03d2
movq 0x18(%r11), %rax
xorl %ecx, %ecx
jmp 0xc03fe
movq $0x2, 0x10(%r11)
movq 0x18(%r11), %rdi
movl $0x8, %esi
callq 0x2370
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %r10
movq (%rsp), %r11
movq %rax, 0x18(%r11)
movq 0x8(%r11), %rcx
movl %r12d, (%rax,%rcx,4)
incq %rcx
xorl %eax, %eax
movl 0x48(%rsp), %edx
cmpl $0x1, %edx
sete %al
leal (%rax,%rax,2), %eax
decl %eax
cmpl $0x2, %edx
movl $0x1, %edx
cmovnel %eax, %edx
movl %edx, 0x60(%rsp)
xorl %r13d, %r13d
movb $0x1, %al
movl $0xffffffff, 0x20(%rsp) # imm = 0xFFFFFFFF
xorl %r14d, %r14d
movl %r12d, 0x10(%rsp)
movq %rbp, 0x50(%rsp)
movq (%r11), %rdx
movq 0x18(%r11), %rsi
leaq -0x1(%rcx), %r8
movq %r8, 0x8(%r11)
movl -0x4(%rsi,%rcx,4), %r9d
movq 0x28(%rdi), %rcx
movq (%rcx,%r9,8), %rcx
testl %ecx, %ecx
je 0xc0992
leaq (%r9,%r9,8), %rsi
leaq (%rsi,%rsi,2), %rsi
addq %r9, %rsi
movl 0x4(%rdx,%rsi), %r8d
movl %r8d, 0x8c(%rsp)
movl 0x8(%rdx,%rsi), %r8d
movl %r8d, 0x6c(%rsp)
movl 0xc(%rdx,%rsi), %r8d
movl %r8d, 0x68(%rsp)
movl 0x14(%rdx,%rsi), %r8d
movl %r8d, 0x44(%rsp)
movl 0x10(%rdx,%rsi), %edx
movl %edx, 0x64(%rsp)
movq %rcx, %rdx
shrq $0x20, %rdx
leaq (%rdx,%rdx,2), %r15
shlq $0x3, %r15
addq 0x8(%rdi), %r15
cmpl $0x0, 0x140(%rsp)
setne %dl
andb %al, %dl
movb %dl, 0x17(%rsp)
movl %ecx, %eax
movq %rax, 0xd0(%rsp)
xorl %r8d, %r8d
movl $0x0, 0x24(%rsp)
movq 0x70(%rsp), %r12
movq %r9, 0x58(%rsp)
movq %r15, 0xa0(%rsp)
leaq (%r8,%r8,2), %rax
cmpl $0x0, 0xc(%r15,%rax,8)
js 0xc0975
movl %r14d, 0x4c(%rsp)
leaq (%r15,%rax,8), %rax
movl 0x8(%rax), %edx
movl %edx, %r14d
shrl %r14d
cmpl %ebp, %r14d
je 0xc09e1
xorl %ebp, %ebp
cmpb $0x0, 0x17(%rsp)
jne 0xc0522
movl (%rax), %ebp
leaq (%rdx,%rdx,8), %rax
leaq (%rax,%rax,2), %rbx
addq %rdx, %rbx
addq (%r11), %rbx
movq 0x50(%r11), %rcx
movq 0x60(%r11), %rax
cmpq 0x58(%r11), %rcx
movq %r8, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
jne 0xc0588
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x58(%r11)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x28(%rsp), %r8
movq 0x58(%rsp), %r9
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %r10
movq (%rsp), %r11
movq %rax, 0x60(%r11)
movq 0x50(%r11), %rcx
movq 0x28(%rdi), %rdx
movl 0x4(%rdx,%r9,8), %edx
addl %r8d, %edx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x50(%r11)
movl %edx, (%rax,%rcx,4)
addl 0x8c(%rsp), %ebp
cmpq %r12, %rbp
ja 0xc09b5
movl 0x18(%rbx), %r15d
testl %r15d, %r15d
js 0xc066b
movq 0x38(%r11), %rcx
movq 0x48(%r11), %rax
cmpq 0x40(%r11), %rcx
jne 0xc0605
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x40(%r11)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x28(%rsp), %r8
movq 0x58(%rsp), %r9
movq 0x8(%rsp), %r10
movq (%rsp), %r11
movq %rax, 0x48(%r11)
movq 0x38(%r11), %rcx
movq 0x30(%rsp), %rsi
leaq 0x1(%rcx), %rdx
movq %rdx, 0x38(%r11)
movl %esi, (%rax,%rcx,4)
orb $-0x80, 0x1b(%rbx)
movl %r9d, (%rbx)
movl %ebp, 0x4(%rbx)
testq %r10, %r10
je 0xc06cf
movq %r10, %rdi
movl %r14d, %esi
movl 0x48(%rsp), %edx
movq %r10, %r12
callq 0xbc731
movl %eax, %ebp
movq %r12, %rdi
movl %r14d, %esi
movl 0x110(%rsp), %edx
callq 0xbc731
movl %eax, %r15d
movl 0x60(%rsp), %edx
cmpl $-0x1, %edx
je 0xc06e2
movq %r12, %rdi
movl %r14d, %esi
callq 0xbc731
jmp 0xc06e4
testq %r10, %r10
je 0xc07ab
movq %r10, %rdi
movl %r14d, %esi
movl 0x48(%rsp), %edx
movq %r10, %r12
callq 0xbc731
movq %rax, 0xc8(%rsp)
movq %r12, %rdi
movl %r14d, %esi
movl 0x110(%rsp), %edx
callq 0xbc731
movl %eax, %edi
movl 0x60(%rsp), %edx
cmpl $-0x1, %edx
je 0xc07b8
movq %rdi, 0xc0(%rsp)
movq %r12, %rdi
movl %r14d, %esi
callq 0xbc731
movq 0xc0(%rsp), %rdi
jmp 0xc07ba
xorl %eax, %eax
movl $0x1, %ecx
xorl %ebp, %ebp
xorl %r15d, %r15d
movq 0x18(%rsp), %rdi
jmp 0xc0711
xorl %eax, %eax
movq 0x18(%rsp), %rdi
movq 0x28(%rsp), %r8
movq 0x10(%r12), %rcx
leaq (%r14,%r14,4), %rdx
movl 0x10(%rcx,%rdx,8), %ecx
movq (%rsp), %r11
movq %r12, %r10
movq 0x70(%rsp), %r12
movq 0x58(%rsp), %r9
movq 0x30(%rsp), %rsi
addl 0x6c(%rsp), %ebp
movl %ebp, 0x8(%rbx)
addl 0x68(%rsp), %r15d
movl %r15d, 0xc(%rbx)
addl 0x44(%rsp), %ecx
movl %ecx, 0x14(%rbx)
addl 0x64(%rsp), %eax
movl %eax, 0x10(%rbx)
movq %rsi, %rax
xorq $0x1, %rax
movq 0x28(%rdi), %rcx
movq (%rcx,%rax,8), %rax
movq %rax, %rcx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
andq %rdx, %rcx
movl 0x4c(%rsp), %r14d
je 0xc0798
movq 0x8(%rdi), %rdx
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
leaq (%rdx,%rax,8), %rax
addq $0xc, %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %edx, %edx
xorl %r15d, %r15d
movq 0x50(%rsp), %rbp
movl (%rax,%rdx), %esi
notl %esi
shrl $0x1f, %esi
addl %esi, %r15d
addq $0x18, %rdx
cmpq %rdx, %rcx
jne 0xc0776
orl $0x80000000, %r15d      # imm = 0x80000000
movq 0x30(%rsp), %rsi
jmp 0xc07a3
movl $0x80000000, %r15d      # imm = 0x80000000
movq 0x50(%rsp), %rbp
incl %r14d
jmp 0xc086b
xorl %eax, %eax
movl $0x1, %ecx
xorl %esi, %esi
xorl %edi, %edi
jmp 0xc07db
xorl %eax, %eax
movq 0x10(%r12), %rcx
movl %r14d, %edx
leaq (%rdx,%rdx,4), %rdx
movl 0x10(%rcx,%rdx,8), %ecx
movq (%rsp), %r11
movq 0x58(%rsp), %r9
movq 0xc8(%rsp), %rsi
addl 0x6c(%rsp), %esi
addl 0x68(%rsp), %edi
addl 0x64(%rsp), %eax
movq %rdi, %r10
movq %rsi, %r12
subq %rax, %rsi
subq %rdi, %rsi
movl 0x8(%rbx), %edx
movl 0xc(%rbx), %edi
movl 0x10(%rbx), %r8d
addq %rdi, %r8
subq %r8, %rdx
cmpq %rdx, %rsi
movl 0x4c(%rsp), %r14d
jle 0xc0833
addl 0x44(%rsp), %ecx
movq 0x18(%rsp), %rdi
movq 0x28(%rsp), %r8
movq 0x30(%rsp), %rsi
movl %r9d, (%rbx)
movl %r10d, 0xc(%rbx)
movl %r12d, 0x8(%rbx)
movl %ecx, 0x14(%rbx)
movl %eax, 0x10(%rbx)
jmp 0xc0854
movq 0x18(%rsp), %rdi
movq 0x28(%rsp), %r8
movq 0x30(%rsp), %rsi
jne 0xc0854
addl 0x44(%rsp), %ecx
cmpl 0x14(%rbx), %ecx
ja 0xc0820
jne 0xc0854
cmpl 0x4(%rbx), %ebp
ja 0xc0820
cmpl 0x4(%rbx), %ebp
jae 0xc085c
movl %ebp, 0x4(%rbx)
movq 0x50(%rsp), %rbp
movq 0x70(%rsp), %r12
movq 0x8(%rsp), %r10
leal -0x1(%r15), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl $0x80000000, %r15d      # imm = 0x80000000
orl %eax, %r15d
movl %r15d, 0x18(%rbx)
testl %eax, %eax
je 0xc0893
movq 0xa0(%rsp), %r15
jmp 0xc0975
movq 0x28(%rdi), %rax
movq (%rax,%rsi,8), %rax
movq %rax, %rcx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
andq %rdx, %rcx
movq 0xa0(%rsp), %r15
je 0xc095f
movq 0x8(%rdi), %rdx
shrq $0x20, %rax
leaq (%rax,%rax,2), %rax
leaq (%rdx,%rax,8), %rax
addq $0xc, %rax
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %edx, %edx
xorl %esi, %esi
movl (%rax,%rdx), %r8d
notl %r8d
shrl $0x1f, %r8d
addl %r8d, %esi
addq $0x18, %rdx
cmpq %rdx, %rcx
jne 0xc08d4
testl %esi, %esi
movq 0x28(%rsp), %r8
movq 0x30(%rsp), %rsi
je 0xc095f
movq 0x8(%r11), %rcx
movq 0x18(%r11), %rax
cmpq 0x10(%r11), %rcx
jne 0xc094c
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x10(%r11)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x30(%rsp), %rsi
movq 0x28(%rsp), %r8
movq 0x58(%rsp), %r9
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %r10
movq (%rsp), %r11
movq %rax, 0x18(%r11)
movq 0x8(%r11), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r11)
movl %esi, (%rax,%rcx,4)
movl 0x20(%rsp), %eax
movl %eax, %esi
jmp 0xc096e
cmpl $0x0, 0x24(%rsp)
movl $0x1, 0x24(%rsp)
jne 0xc09e1
decl %r14d
movl %esi, 0x20(%rsp)
incq %r8
cmpq 0xd0(%rsp), %r8
jne 0xc04ec
cmpl $0x1, 0x24(%rsp)
movl 0x10(%rsp), %r12d
je 0xc09c6
movq 0x8(%r11), %rcx
testq %rcx, %rcx
je 0xc09e1
xorl %eax, %eax
cmpq $0x1, %rcx
jne 0xc043f
testl %r14d, %r14d
jne 0xc043f
jmp 0xc0a70
cmpl $0x1, 0x24(%rsp)
movl 0x10(%rsp), %r12d
movl 0x4c(%rsp), %r14d
jne 0xc09de
xorl %r13d, %r13d
movl 0x20(%rsp), %esi
cmpl $-0x1, %esi
je 0xc09e1
testl %r14d, %r14d
jne 0xc09e1
cmpq $0x0, 0x8(%r11)
je 0xc0a2c
xorl %r13d, %r13d
cmpq $0x0, 0x38(%r11)
je 0xc0369
movl $0x1, %eax
xorl %ecx, %ecx
xorps %xmm0, %xmm0
movq (%r11), %rdx
movq 0x48(%r11), %rsi
movl (%rsi,%rcx,4), %ecx
leaq (%rcx,%rcx,8), %rsi
leaq (%rsi,%rsi,2), %rsi
addq %rcx, %rsi
movups %xmm0, 0x4(%rdx,%rsi)
movl $0x0, 0x14(%rdx,%rsi)
andb $0x7f, 0x1b(%rdx,%rsi)
movl %eax, %ecx
incl %eax
cmpq %rcx, 0x38(%r11)
ja 0xc09f6
jmp 0xc0369
cmpq $0x0, 0x10(%r11)
movq 0x18(%r11), %rax
je 0xc0a3b
xorl %ecx, %ecx
jmp 0xc0a65
movq $0x2, 0x10(%r11)
movl $0x8, %esi
movq %rax, %rdi
callq 0x2370
movl 0x20(%rsp), %esi
movq 0x8(%rsp), %r10
movq (%rsp), %r11
movq %rax, 0x18(%r11)
movq 0x8(%r11), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x8(%r11)
movl %esi, (%rax,%rcx,4)
cmpq $0x0, 0x130(%rsp)
sete %al
testq %r10, %r10
sete %cl
orb %al, %cl
jne 0xc1295
cmpl $0x0, 0x138(%rsp)
je 0xc0aa5
movq 0x130(%rsp), %rax
movq 0xa8(%rax), %rbp
jmp 0xc0aa7
xorl %ebp, %ebp
movq 0x38(%r11), %rdx
testq %rdx, %rdx
je 0xc0b24
movq 0x18(%r11), %rcx
movq 0x48(%r11), %rdi
movl (%rcx), %esi
movl %esi, %r8d
shrl %r8d
xorl %r9d, %r9d
xorl %eax, %eax
movl (%rdi,%r9,4), %r10d
shrl %r10d
cmpl %r8d, %r10d
je 0xc0b13
movq 0x8(%rsp), %r11
movq 0x10(%r11), %r11
leaq (%r10,%r10,4), %rbx
movl 0x10(%r11,%rbx,8), %r10d
testq %r10, %r10
je 0xc0b13
leaq (%r11,%rbx,8), %r11
movq 0x18(%r11), %r11
movq 0x130(%rsp), %rbx
movq 0x8(%rbx), %rbx
xorl %r14d, %r14d
movq (%r11,%r14,8), %r15
shrq $0x21, %r15
addl (%rbx,%r15,4), %eax
incq %r14
cmpq %r14, %r10
jne 0xc0aff
incq %r9
movl %r9d, %r10d
cmpq %r10, %rdx
ja 0xc0ac5
movq (%rsp), %r11
jmp 0xc0b2c
movq 0x18(%r11), %rcx
movl (%rcx), %esi
xorl %eax, %eax
movq (%r11), %rdi
xorl %r8d, %r8d
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl %esi, %r11d
movl %r11d, %r9d
leaq (%r9,%r9,8), %r10
leaq (%r10,%r10,2), %r10
addq %r9, %r10
movl (%rdi,%r10), %r9d
cmpl %esi, %r11d
je 0xc0bb5
movl %r11d, %r10d
shrl %r10d
movq 0x8(%rsp), %rbx
movq 0x10(%rbx), %rbx
leaq (%r10,%r10,4), %r14
movl 0x10(%rbx,%r14,8), %r10d
testq %r10, %r10
je 0xc0bb2
leaq (%rbx,%r14,8), %r11
movq 0x18(%r11), %r11
movq 0x130(%rsp), %r14
movq 0x8(%r14), %rbx
movq 0x30(%r14), %r14
movq 0x20(%r14), %r14
xorl %r15d, %r15d
movq (%r11,%r15,8), %r12
shrq $0x21, %r12
subl (%rbx,%r12,4), %eax
movl (%r14,%r12,8), %r12d
andl %edx, %r12d
addl %r12d, %r8d
incq %r15
cmpq %r15, %r10
jne 0xc0b8d
movl 0x10(%rsp), %r12d
jmp 0xc0bb5
movl %r11d, %r9d
movl %r9d, %r11d
cmpl %r12d, %r9d
jne 0xc0b3a
testl %r8d, %r8d
je 0xc0bcd
xorl %edx, %edx
divl %r8d
jmp 0xc0bcf
xorl %eax, %eax
movq (%rsp), %r11
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl %esi, %r8d
leaq (%r8,%r8,8), %r9
leaq (%r9,%r9,2), %r9
addq %r8, %r9
movl (%rdi,%r9), %r8d
cmpl (%rcx), %esi
jne 0xc0bf3
movl %r8d, %esi
jmp 0xc0c56
movl %esi, %r10d
shrl %r10d
movq 0x8(%rsp), %r9
movq 0x10(%r9), %r9
leaq (%r10,%r10,4), %r10
cmpl $0x0, 0x10(%r9,%r10,8)
je 0xc0c56
leaq (%r9,%r10,8), %rsi
movq 0x18(%rsi), %r9
movq 0x130(%rsp), %r11
movq 0x8(%r11), %r10
movq 0x30(%r11), %r11
movq 0x20(%r11), %r11
xorl %ebx, %ebx
movq (%r9,%rbx,8), %r14
shrq $0x21, %r14
movl (%r11,%r14,8), %r15d
andl %edx, %r15d
imull %eax, %r15d
addl %r15d, (%r10,%r14,4)
incq %rbx
movl 0x10(%rsi), %r14d
cmpq %r14, %rbx
jb 0xc0c2c
movl %r8d, %esi
movq (%rsp), %r11
cmpl %r12d, %esi
jne 0xc0bd8
testq %rbp, %rbp
movq 0x8(%rsp), %r10
je 0xc1295
movq 0x18(%r10), %rdi
movq 0x28(%rdi), %r9
movq 0x98(%rsp), %rax
movq (%r9,%rax,8), %rdx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
andq %rdx, %rax
je 0xc10f6
movq 0x8(%rdi), %r8
shrq $0x20, %rdx
shlq $0x3, %rax
leaq (%rax,%rax,2), %rax
leaq (%rdx,%rdx,2), %rdx
leaq (%r8,%rdx,8), %rdx
addq $0xc, %rdx
xorl %esi, %esi
xorl %r10d, %r10d
movl (%rdx,%rsi), %r11d
notl %r11d
shrl $0x1f, %r11d
addl %r11d, %r10d
addq $0x18, %rsi
cmpq %rsi, %rax
jne 0xc0cb0
cmpl $0x2, %r10d
jne 0xc10f6
movl (%rcx), %esi
movq %rsi, %r10
xorq $0x1, %r10
movq (%r9,%r10,8), %r10
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
andq %r10, %r9
je 0xc10f6
shrq $0x20, %r10
shlq $0x3, %r9
leaq (%r9,%r9,2), %r9
leaq (%r10,%r10,2), %r10
leaq (%r8,%r10,8), %r8
addq $0xc, %r8
xorl %r10d, %r10d
xorl %r11d, %r11d
movl (%r8,%r10), %ebx
notl %ebx
shrl $0x1f, %ebx
addl %ebx, %r11d
addq $0x18, %r10
cmpq %r10, %r9
jne 0xc0d0b
cmpl $0x2, %r11d
jne 0xc10f6
xorl %ecx, %ecx
xorl %r8d, %r8d
movq (%rsp), %r11
cmpl $0x0, (%rdx,%rcx)
js 0xc0d4c
movl -0x4(%rdx,%rcx), %r9d
movl %r8d, %r10d
movl %r9d, 0x90(%rsp,%r10,4)
incl %r8d
addq $0x18, %rcx
cmpq %rcx, %rax
jne 0xc0d33
movl 0x90(%rsp), %r13d
movl %r13d, %eax
shrl %eax
shrl %esi
cmpl %esi, %eax
je 0xc10f2
movl 0x94(%rsp), %r14d
movl %r14d, %eax
shrl %eax
cmpl %esi, %eax
je 0xc10f2
xorl %r12d, %r12d
movl $0x1, %ebx
leaq 0x78(%rsp), %r10
leaq 0x80(%rsp), %rax
leaq 0x3c(%rsp), %rcx
leaq 0xb0(%rsp), %r8
leaq 0xa8(%rsp), %r15
xorl %esi, %esi
movl %r13d, %edx
movq %r15, %r9
pushq %r12
pushq %rbx
pushq %r10
pushq %rax
callq 0x1053a7
addq $0x20, %rsp
movq 0x8(%rsp), %r12
movq 0x18(%r12), %rdi
leaq 0x40(%rsp), %rcx
leaq 0xb8(%rsp), %rbx
xorl %esi, %esi
movl %r14d, %edx
movq %rbx, %r8
movq %r15, %r9
xorl %eax, %eax
pushq %rax
movl $0x1, %eax
pushq %rax
leaq 0x88(%rsp), %rax
pushq %rax
leaq 0x98(%rsp), %rax
pushq %rax
callq 0x1053a7
addq $0x20, %rsp
movq -0x8(%rbx), %rax
movq (%rbx), %rcx
addq %rcx, %rax
incq %rax
movq (%rsp), %rcx
movl 0x38(%rcx), %ecx
movq 0x18(%r12), %rdi
cmpq %rcx, %rax
jne 0xc10e9
movl 0x3c(%rsp), %esi
movq 0x28(%rdi), %rcx
movq (%rcx,%rsi,8), %r8
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
andq %r8, %rdx
je 0xc10e9
movq 0x8(%rdi), %rax
shrq $0x20, %r8
shlq $0x3, %rdx
leaq (%rdx,%rdx,2), %rdx
leaq (%r8,%r8,2), %r8
leaq (%rax,%r8,8), %r8
addq $0xc, %r8
xorl %r9d, %r9d
xorl %r10d, %r10d
movl (%r8,%r9), %r11d
notl %r11d
shrl $0x1f, %r11d
addl %r11d, %r10d
addq $0x18, %r9
cmpq %r9, %rdx
jne 0xc0e66
cmpl $0x1, %r10d
jne 0xc10e9
movl 0x40(%rsp), %edx
movq (%rcx,%rdx,8), %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
andq %rdx, %rcx
je 0xc10e9
shrq $0x20, %rdx
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rdx,%rdx,2), %rdx
leaq (%rax,%rdx,8), %rax
addq $0xc, %rax
xorl %edx, %edx
xorl %r8d, %r8d
movl (%rax,%rdx), %r9d
notl %r9d
shrl $0x1f, %r9d
addl %r9d, %r8d
addq $0x18, %rdx
cmpq %rdx, %rcx
jne 0xc0eba
cmpl $0x1, %r8d
jne 0xc10e9
leaq 0x3c(%rsp), %r14
movq %r14, %rdx
callq 0x10534e
movq 0x8(%rsp), %rbx
movq 0x18(%rbx), %rdi
movl 0x4(%r14), %esi
leaq 0x40(%rsp), %rdx
callq 0x10534e
movq (%rsp), %rax
movq 0x18(%rax), %rax
movl (%rax), %eax
movq 0x18(%rbx), %rdi
cmpl %eax, (%r14)
jne 0xc10e9
cmpl %eax, 0x40(%rsp)
jne 0xc10e9
leaq 0x68(%rbp), %r12
movq $0x0, 0xa0(%rbp)
xorl %r14d, %r14d
leaq 0x3c(%rsp), %rcx
leaq 0xb0(%rsp), %r8
leaq 0xa8(%rsp), %r9
xorl %esi, %esi
movl %r13d, %edx
pushq %r12
pushq $0x1
leaq 0x88(%rsp), %rax
pushq %rax
leaq 0x98(%rsp), %rax
pushq %rax
callq 0x1053a7
addq $0x20, %rsp
movq 0xa0(%rbp), %rcx
testq %rcx, %rcx
je 0xc0fdf
movq 0xb0(%rbp), %rax
movl (%rax,%r14,4), %eax
movl %eax, %edx
shrl %edx
movq 0x8(%rsp), %rsi
movq 0x10(%rsi), %rsi
leaq (%rdx,%rdx,4), %rdi
movl 0x10(%rsi,%rdi,8), %edx
testl %edx, %edx
je 0xc0fd7
leaq (%rsi,%rdi,8), %rcx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edi, %edi
addl %esi, %edx
testb $0x1, %al
movq 0x10(%rbp), %r8
movq 0x18(%rcx), %r9
cmoveq %rdi, %rdx
movq (%r9,%rdx,8), %rdx
shrq $0x21, %rdx
orb $0x2, (%r8,%rdx)
incq %rdi
movl 0x10(%rcx), %edx
decl %esi
cmpq %rdx, %rdi
jb 0xc0fa6
movq 0xa0(%rbp), %rcx
incl %r14d
cmpq %r14, %rcx
ja 0xc0f77
leaq 0xd0(%rbp), %r14
movq $0x0, 0x108(%rbp)
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rdi
movl 0x94(%rsp), %edx
xorl %r13d, %r13d
leaq 0xa8(%rsp), %r9
xorl %esi, %esi
leaq 0x40(%rsp), %rcx
leaq 0xb8(%rsp), %r8
pushq %r14
pushq $0x1
leaq 0x88(%rsp), %rax
pushq %rax
leaq 0x98(%rsp), %rax
pushq %rax
callq 0x1053a7
addq $0x20, %rsp
movq 0x108(%rbp), %rcx
testq %rcx, %rcx
je 0xc10ae
movq 0x118(%rbp), %rax
movl (%rax,%r13,4), %eax
movl %eax, %edx
shrl %edx
movq 0x8(%rsp), %rsi
movq 0x10(%rsi), %rsi
leaq (%rdx,%rdx,4), %rdi
movl 0x10(%rsi,%rdi,8), %edx
testl %edx, %edx
je 0xc10a6
leaq (%rsi,%rdi,8), %rcx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edi, %edi
addl %esi, %edx
testb $0x1, %al
movq 0x10(%rbp), %r8
movq 0x18(%rcx), %r9
cmoveq %rdi, %rdx
movq (%r9,%rdx,8), %rdx
shrq $0x21, %rdx
orb $0x2, (%r8,%rdx)
incq %rdi
movl 0x10(%rcx), %edx
decl %esi
cmpq %rdx, %rdi
jb 0xc1075
movq 0x108(%rbp), %rcx
incl %r13d
cmpq %r13, %rcx
ja 0xc1046
movq (%rsp), %rbx
movq 0x18(%rbx), %rax
movl (%rax), %ecx
xorl $0x1, %ecx
movq %r12, %rdi
movq %r14, %rsi
movl 0x10(%rsp), %r12d
movl %r12d, %edx
movq 0x8(%rsp), %r14
movq %r14, %r8
movq 0x130(%rsp), %r9
callq 0xe23b2
movq %r14, %r10
movq %rbx, %r11
jmp 0xc1295
movq (%rsp), %r11
movl 0x10(%rsp), %r12d
movq 0x18(%r11), %rcx
movl (%rcx), %ecx
movq 0x130(%rsp), %rbx
movq %rbx, %rsi
movl %r12d, %edx
callq 0xe20bc
movq 0xa8(%rbx), %rax
cmpq $0x0, 0x50(%rax)
movq (%rsp), %r11
movq 0x8(%rsp), %r10
je 0xc1295
leaq 0x68(%rbp), %r13
xorl %ebx, %ebx
movq 0x60(%rax), %rax
movl (%rax,%rbx,4), %edx
shrl %edx
movq 0x18(%r11), %rax
movl (%rax), %r8d
shrl %r8d
cmpl %r8d, %edx
je 0xc127a
movq 0x18(%r10), %rdi
movq 0x130(%rsp), %r14
movq %r14, %rsi
movq 0x50(%rsp), %rcx
callq 0xe19e1
movq 0x8(%rsp), %r10
movq (%rsp), %r11
movq 0xa8(%r14), %rax
cmpq $0x0, 0xa0(%rax)
je 0xc127a
movq 0x60(%rax), %rax
movl (%rax,%rbx,4), %edi
movq %r13, %rsi
movq %r11, %rdx
movq %r10, %rcx
movq 0x130(%rsp), %r14
movq %r14, %r8
callq 0xe26ac
movq 0x8(%rsp), %r10
movq (%rsp), %r11
movq 0xa8(%r14), %rax
movq 0x60(%rax), %rax
movl (%rax,%rbx,4), %eax
movl %eax, %edx
shrl %edx
movq 0x10(%r10), %rcx
leaq (%rdx,%rdx,4), %rsi
movl 0x10(%rcx,%rsi,8), %edx
testl %edx, %edx
je 0xc127a
leaq (%rcx,%rsi,8), %rcx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edi, %edi
addl %esi, %edx
testb $0x1, %al
movq 0x10(%rbp), %r8
movq 0x18(%rcx), %r9
cmoveq %rdi, %rdx
movq (%r9,%rdx,8), %rdx
shrq $0x21, %rdx
orb $0x2, (%r8,%rdx)
incq %rdi
movl 0x10(%rcx), %edx
decl %esi
cmpq %rdx, %rdi
jb 0xc11d9
movq 0xa0(%rbp), %rdx
testq %rdx, %rdx
je 0xc127a
xorl %eax, %eax
movq 0xb0(%rbp), %rcx
movl (%rcx,%rax,4), %ecx
movl %ecx, %esi
shrl %esi
movq 0x10(%r10), %rdi
leaq (%rsi,%rsi,4), %r8
movl 0x10(%rdi,%r8,8), %esi
testl %esi, %esi
je 0xc1273
leaq (%rdi,%r8,8), %rdx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %r8d, %r8d
addl %edi, %esi
testb $0x1, %cl
movq 0x10(%rbp), %r9
movq 0x18(%rdx), %r10
cmoveq %r8, %rsi
movq (%r10,%rsi,8), %rsi
shrq $0x21, %rsi
orb $0x2, (%r9,%rsi)
incq %r8
movl 0x10(%rdx), %esi
decl %edi
cmpq %rsi, %r8
jb 0xc123c
movq 0xa0(%rbp), %rdx
movq 0x8(%rsp), %r10
incl %eax
cmpq %rax, %rdx
ja 0xc1211
incl %ebx
movq 0x130(%rsp), %rax
movq 0xa8(%rax), %rax
cmpq %rbx, 0x50(%rax)
ja 0xc112c
testq %r10, %r10
sete %al
movq 0x148(%rsp), %rcx
testq %rcx, %rcx
sete %dl
orb %al, %dl
jne 0xc12c4
movq %r10, %rdi
movl %r12d, %esi
movq %r11, %rdx
callq 0x198cb2
movq 0x8(%rsp), %r10
movq (%rsp), %r11
cmpl $0x0, 0x118(%rsp)
movq 0x18(%rsp), %rdi
movq 0x128(%rsp), %rbx
je 0xc12f4
movl %r12d, %esi
movq %r11, %rdx
callq 0xe27f3
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %r10
movq (%rsp), %r11
movl $0x1, %r13d
movq 0x120(%rsp), %r8
movq %r8, %rax
orq %rbx, %rax
je 0xc09e1
movq %r10, %rsi
movl %r12d, %edx
movq %r11, %rcx
movq %rbx, %r9
callq 0xe29e9
movq (%rsp), %r11
jmp 0xc09e1