// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/rcut.cpp
// Function: renew_mc_clus_t_adv(mc_clus_t*, unsigned int*, unsigned int)
void renew_mc_clus_t_adv(mc_clus_t *bc, uint32_t *a, uint32_t a_n)
{
	if(!bc) return;
	// fprintf(stderr, "[M::%s] a_n::%u\n", __func__, a_n);
	uint32_t k, i, *ba, bn, m, cocc, iin, /**bub_occ = 0,**/ bbn = 0, bid, bk, bl; 
	uint64_t *p; ma_utg_t *u = NULL; asg64_v *asn = bc->asn;
	kvec_t(double) sc_l; kvec_t(double) sc_r; kvec_t(double) sc_m; kvec_t(uint32_t) tmp;
	kv_init(sc_l); kv_init(sc_r); kv_init(sc_m); kv_init(tmp);
	
	bc->cc.ng.n = bc->cc.nn.n = 0;
	memset(bc->lock, 0, sizeof((*(bc->lock)))*bc->n);///bc->n: number of all nodes
	for (k = 0; k < a_n; k++) bc->lock[a[k]] = 1;///a_n: number of nodes within the cluster

	kv_resize(uint32_t, bc->cc.nn, a_n);
	for (i = bid = bk = 0; i < bc->bub->b_ug->u.n; i++) {
        u = &(bc->bub->b_ug->u.a[i]);
        if(u->n == 0) continue;
		// bub_occ += u->n;
		// fprintf(stderr, "[M::%s] i::%u, u->n::%u\n", __func__, i, (uint32_t)u->n);
        for (k = cocc = 0, iin = bc->cc.nn.n; k < u->n; k++, bid++) {
            get_bubbles(bc->bub, u->a[k]>>33, NULL, NULL, &ba, &bn, NULL);
			kv_pushp(uint64_t, bc->cc.ng, &p); bbn += bn;
			*p = bc->cc.nn.n;///a bubble
			for (m = 0; m < bn; m++) {
				if(!(bc->lock[ba[m]>>1])) continue;///if the node of bubble is not at this cluster
				kv_push(uint32_t, bc->cc.nn, (ba[m]>>1));
				bc->lock[ba[m]>>1] = 2;
            }
			if(asn) {
				for (; bk < asn->n && (asn->a[bk]>>32) < bid; bk++);
				for (; bk < asn->n && (asn->a[bk]>>32) == bid; bk++) {
					if(!(bc->lock[((uint32_t)asn->a[bk])])) continue;///if the node of bubble is not at this cluster
					kv_push(uint32_t, bc->cc.nn, ((uint32_t)asn->a[bk]));
					bc->lock[((uint32_t)asn->a[bk])] = 2;
				}
			}
			
			if(bc->cc.nn.n <= (*p)) {///no node in this bubble
				bc->cc.ng.n--;
				continue;
			}
			*p <<= 32; *p |= (bc->cc.nn.n-((*p)>>32)); cocc++;
        }
		//split the chain if there is multipe bubbles
		if(cocc > 0) {//cocc: # of bubbles in this chain
			for (k = bc->cc.ng.n - cocc; k < bc->cc.ng.n; k++) {
				kv_resize(double, sc_l, clus_n((*bc), k)); 
				kv_resize(double, sc_r, clus_n((*bc), k)); 
				kv_resize(double, sc_m, clus_n((*bc), k)); 
				kv_resize(uint32_t, tmp, clus_n((*bc), k)); 
				// prt_bub(clus_a((*bc), k), clus_n((*bc), k), "-0-"); 
				reorder_bub(bc->mg->e, clus_a((*bc), k), clus_n((*bc), k), bc->lock, 3, 2, 4, 5, 
				sc_l.a, sc_r.a, sc_m.a, tmp.a);
				// prt_bub(clus_a((*bc), k), clus_n((*bc), k), "-1-"); 
			}
			for (k = iin; k < bc->cc.nn.n; k++) bc->lock[bc->cc.nn.a[k]] = 1;//reset
			kv_pushp(uint64_t, bc->cc.ng, &p); *p = (uint64_t)-1; ///cluster
			kv_push(uint32_t, bc->cc.nn, ((uint32_t)-1)); ///split, node id
		}
    }

	if(asn) {
		for (bl = bk, bk = bk + 1; bk <= asn->n; bk++) {
			if(bk == asn->n || (asn->a[bk]>>32) != (asn->a[bl]>>32)) {
				cocc = 0; iin = bc->cc.nn.n;
				kv_pushp(uint64_t, bc->cc.ng, &p); bbn += bn;
            	*p = bc->cc.nn.n;///a bubble
				for (m = bl; m < bk; m++) {
					if(!(bc->lock[((uint32_t)asn->a[m])])) continue;///if the node of bubble is not at this cluster
                    kv_push(uint32_t, bc->cc.nn, ((uint32_t)asn->a[m]));
                    bc->lock[((uint32_t)asn->a[m])] = 2;
				}
				if(bc->cc.nn.n <= (*p)) {///no node in this bubble
					bc->cc.ng.n--; 
					bl = bk;
					continue;
				}
				*p <<= 32; *p |= (bc->cc.nn.n-((*p)>>32)); cocc++;
				if(cocc > 0) {//cocc: # of bubbles in this chain
					for (k = bc->cc.ng.n - cocc; k < bc->cc.ng.n; k++) {
						kv_resize(double, sc_l, clus_n((*bc), k)); 
						kv_resize(double, sc_r, clus_n((*bc), k)); 
						kv_resize(double, sc_m, clus_n((*bc), k)); 
						kv_resize(uint32_t, tmp, clus_n((*bc), k)); 
						// prt_bub(clus_a((*bc), k), clus_n((*bc), k), "-0-"); 
						reorder_bub(bc->mg->e, clus_a((*bc), k), clus_n((*bc), k), bc->lock, 3, 2, 4, 5, 
						sc_l.a, sc_r.a, sc_m.a, tmp.a);
						// prt_bub(clus_a((*bc), k), clus_n((*bc), k), "-1-"); 
					}
					for (k = iin; k < bc->cc.nn.n; k++) bc->lock[bc->cc.nn.a[k]] = 1;//reset
					kv_pushp(uint64_t, bc->cc.ng, &p); *p = (uint64_t)-1; ///cluster
					kv_push(uint32_t, bc->cc.nn, ((uint32_t)-1)); ///split, node id
				}

				bl = bk;
			}
		}
	}
	///need enable it later
	kv_resize(uint32_t, tmp, bc->cc.nn.n);
	kv_resize(uint64_t, bc->cc.ng, bc->cc.ng.n+bc->bub->ug->g->n_seq);
	layout_mc_clus_t(bc->mg->e, bc->cc.nn.a, bc->cc.nn.n, &(bc->sg), tmp.a, bc->cc.ng.a+bc->cc.ng.n, bc->bub->ug, 0.199999, 0.800001, 4);
	
	for (k = 0; k < a_n; k++) bc->lock[a[k]] = 0;
	kv_destroy(sc_l); kv_destroy(sc_r); kv_destroy(sc_m); kv_destroy(tmp);
	// fprintf(stderr, "[M::%s] a_n::%u, bc->cc.nn.n::%u, bc->cc.ng.n::%u, bbn::%u, bub_occ::%u, bc->bub->b_ug->u.n::%u\n", __func__, 
	// a_n, (uint32_t)bc->cc.nn.n, (uint32_t)bc->cc.ng.n, bbn, bub_occ, (uint32_t)bc->bub->b_ug->u.n);
}

// Assembly:
testq %rdi, %rdi
je 0x128467
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %edx, %ebx
movq %rsi, %r13
movq %rdi, %r14
movq 0x70(%rdi), %r15
andq $0x0, (%rdi)
andq $0x0, 0x18(%rdi)
movq 0x48(%rdi), %rdi
movl 0x54(%r14), %edx
xorl %r12d, %r12d
xorl %esi, %esi
callq 0x20e0
movl %ebx, %ebx
cmpq %r12, %rbx
je 0x127964
movq 0x48(%r14), %rax
movl (%r13,%r12,4), %ecx
movb $0x1, (%rax,%rcx)
incq %r12
jmp 0x12794d
movq %r13, 0x78(%rsp)
cmpq %rbx, 0x8(%r14)
jae 0x1279c1
leaq -0x1(%rbx), %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0x8(%r14)
movq 0x10(%r14), %rdi
leaq 0x4(,%rcx,4), %rsi
callq 0x2370
movq %rax, 0x10(%r14)
movq %rbx, 0x70(%rsp)
movq $0x0, 0x30(%rsp)
pushq $0x2
popq %rbx
xorl %ebp, %ebp
movq $0x0, 0x8(%rsp)
movq $0x0, 0x50(%rsp)
xorl %r13d, %r13d
movq $0x0, 0x48(%rsp)
xorl %r12d, %r12d
movq $0x0, 0x40(%rsp)
xorl %eax, %eax
movq $0x0, 0x10(%rsp)
movq $0x0, 0x28(%rsp)
movl %eax, %eax
movq %rax, %rcx
movq 0x30(%r14), %rax
movq 0xc0(%rax), %rax
cmpq %rcx, (%rax)
jbe 0x127f2a
movq 0x10(%rax), %rdx
movq %rcx, 0x88(%rsp)
imulq $0x28, %rcx, %rcx
movl 0x10(%rdx,%rcx), %eax
testl %eax, %eax
je 0x127f1b
movq %r13, 0x18(%rsp)
movq %r12, 0x20(%rsp)
addq %rcx, %rdx
movq (%r14), %rcx
movq %rcx, 0x80(%rsp)
xorl %ecx, %ecx
movl $0x0, 0x38(%rsp)
movq %rdx, 0x60(%rsp)
movl %eax, %eax
cmpq %rax, %rcx
jae 0x127c6e
movq 0x30(%r14), %rdi
movq 0x18(%rdx), %rax
movq %rcx, 0x58(%rsp)
movq (%rax,%rcx,8), %rsi
shrq $0x21, %rsi
subq $0x8, %rsp
xorl %edx, %edx
xorl %ecx, %ecx
leaq 0x70(%rsp), %r8
leaq 0x44(%rsp), %r9
pushq $0x0
callq 0xf6ab5
popq %rax
popq %rcx
movq 0x18(%r14), %r13
movq 0x28(%r14), %rdi
cmpq 0x20(%r14), %r13
jne 0x127ade
leaq (,%r13,2), %rsi
testq %r13, %r13
cmoveq %rbx, %rsi
movq %rsi, 0x20(%r14)
shlq $0x3, %rsi
callq 0x2370
movq %rax, %rdi
movq %rax, 0x28(%r14)
movq 0x18(%r14), %r13
leaq 0x1(%r13), %rax
movq %rax, 0x18(%r14)
movl 0x3c(%rsp), %eax
movq (%r14), %rcx
movq %rdi, 0x90(%rsp)
movq %rcx, (%rdi,%r13,8)
xorl %r12d, %r12d
movl %eax, %ecx
cmpq %rcx, %r12
jae 0x127b73
movq 0x48(%r14), %rcx
movq 0x68(%rsp), %rdx
movl (%rdx,%r12,4), %esi
shrl %esi
cmpb $0x0, (%rcx,%rsi)
je 0x127b6e
movq (%r14), %rdi
movq 0x10(%r14), %rax
cmpq 0x8(%r14), %rdi
jne 0x127b56
leaq (%rdi,%rdi), %rsi
testq %rdi, %rdi
cmoveq %rbx, %rsi
movq %rsi, 0x8(%r14)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r14)
movq 0x68(%rsp), %rdx
movl (%rdx,%r12,4), %esi
movq (%r14), %rdi
movq 0x48(%r14), %rcx
shrl %esi
leaq 0x1(%rdi), %r8
movq %r8, (%r14)
movl %esi, (%rax,%rdi,4)
movl (%rdx,%r12,4), %eax
shrl %eax
movb $0x2, (%rcx,%rax)
movl 0x3c(%rsp), %eax
incq %r12
jmp 0x127afc
testq %r15, %r15
je 0x127c18
movq (%r15), %rax
movl 0x30(%rsp), %r12d
movl %ebp, %ecx
cmpq %rcx, %rax
jbe 0x127bfa
movq 0x10(%r15), %rdx
cmpl %r12d, 0x4(%rdx,%rcx,8)
jae 0x127bfa
incl %ebp
jmp 0x127b84
movq 0x48(%r14), %rsi
movl %edx, %edi
cmpb $0x0, (%rsi,%rdi)
je 0x127bf8
movq (%r14), %rdi
movq 0x10(%r14), %rax
cmpq 0x8(%r14), %rdi
jne 0x127be4
leaq (%rdi,%rdi), %rsi
testq %rdi, %rdi
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r14)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r14)
movq 0x10(%r15), %rcx
movq (%rcx,%rbx,8), %rdx
movq (%r14), %rdi
movq 0x48(%r14), %rsi
leaq 0x1(%rdi), %r8
movq %r8, (%r14)
movl %edx, (%rax,%rdi,4)
movl (%rcx,%rbx,8), %eax
movb $0x2, (%rsi,%rax)
movq (%r15), %rax
incl %ebp
movl %ebp, %ebx
cmpq %rbx, %rax
jbe 0x127c15
movq 0x10(%r15), %rcx
movq (%rcx,%rbx,8), %rdx
movq %rdx, %rsi
shrq $0x20, %rsi
cmpl %r12d, %esi
je 0x127b9a
pushq $0x2
popq %rbx
movq 0x90(%rsp), %rsi
movq (%rsi,%r13,8), %rax
cmpq %rax, (%r14)
jbe 0x127c49
movq %rax, %rcx
shlq $0x20, %rcx
movq %rcx, (%rsi,%r13,8)
movq (%r14), %rdx
movl %eax, %eax
subq %rax, %rdx
orq %rcx, %rdx
movq %rdx, (%rsi,%r13,8)
incl 0x38(%rsp)
jmp 0x127c4d
decq 0x18(%r14)
movq 0x60(%rsp), %rdx
movq 0x58(%rsp), %rcx
incq %rcx
movq 0x30(%rsp), %rax
incl %eax
movq %rax, 0x30(%rsp)
movl 0x10(%rdx), %eax
jmp 0x127a6e
movl 0x38(%rsp), %ecx
testl %ecx, %ecx
je 0x127f11
movq 0x18(%r14), %rax
movl %eax, %ebx
subl %ecx, %ebx
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %r13
movl %ebx, %ebx
cmpq %rbx, %rax
jbe 0x127e72
movq 0x28(%r14), %rax
movq (%rax,%rbx,8), %rdx
movl %edx, %eax
cmpq %rax, 0x50(%rsp)
jae 0x127d05
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x8(,%rcx,8), %rsi
incq %rcx
movq %rcx, 0x50(%rsp)
movq 0x8(%rsp), %rdi
callq 0x2370
movq %rax, 0x8(%rsp)
movq 0x28(%r14), %rax
movq (%rax,%rbx,8), %rdx
movl %edx, %eax
cmpq %rax, 0x48(%rsp)
jae 0x127d65
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x8(,%rcx,8), %rsi
incq %rcx
movq %rcx, 0x48(%rsp)
movq %r13, %rdi
callq 0x2370
movq %rax, %r13
movq 0x28(%r14), %rax
movq (%rax,%rbx,8), %rdx
movl %edx, %eax
cmpq %rax, 0x40(%rsp)
jae 0x127dc5
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x8(,%rcx,8), %rsi
incq %rcx
movq %rcx, 0x40(%rsp)
movq %r12, %rdi
callq 0x2370
movq %rax, %r12
movq 0x28(%r14), %rax
movq (%rax,%rbx,8), %rdx
movl %edx, %eax
cmpq %rax, 0x28(%rsp)
jae 0x127e24
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x4(,%rcx,4), %rsi
incq %rcx
movq %rcx, 0x28(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2370
movq 0x28(%r14), %rcx
movq (%rcx,%rbx,8), %rdx
jmp 0x127e29
movq 0x10(%rsp), %rax
movq 0x40(%r14), %rsi
movq 0x48(%r14), %rcx
movq 0x28(%rsi), %rdi
movq %rdx, %rsi
shrq $0x1e, %rsi
andq $-0x4, %rsi
addq 0x10(%r14), %rsi
pushq $0x3
popq %r8
pushq $0x2
popq %r9
movq %rax, 0x10(%rsp)
pushq %rax
pushq %r12
pushq %r13
pushq 0x20(%rsp)
pushq $0x5
pushq $0x4
callq 0x126f95
addq $0x30, %rsp
incl %ebx
movq 0x18(%r14), %rax
jmp 0x127c8c
pushq $0x2
popq %rbx
movq 0x80(%rsp), %rax
movl %eax, %eax
cmpq %rax, (%r14)
jbe 0x127e97
movq 0x10(%r14), %rcx
movq 0x48(%r14), %rdx
movl (%rcx,%rax,4), %ecx
movb $0x1, (%rdx,%rcx)
incl %eax
jmp 0x127e7d
movq 0x18(%r14), %rcx
movq 0x28(%r14), %rax
cmpq 0x20(%r14), %rcx
jne 0x127ec8
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
cmoveq %rbx, %rsi
movq %rsi, 0x20(%r14)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x28(%r14)
movq 0x18(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x18(%r14)
orq $-0x1, (%rax,%rcx,8)
movq (%r14), %rcx
movq 0x10(%r14), %rax
cmpq 0x8(%r14), %rcx
jne 0x127f04
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
cmoveq %rbx, %rsi
movq %rsi, 0x8(%r14)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r14)
movq (%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%r14)
orl $-0x1, (%rax,%rcx,4)
jmp 0x127f1b
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %r13
movq 0x88(%rsp), %rax
incl %eax
jmp 0x127a12
testq %r15, %r15
je 0x128306
movq %r13, 0x18(%rsp)
movq %r12, 0x20(%rsp)
movq (%r15), %rax
movl %ebp, %r12d
incl %ebp
movl %ebp, %ecx
movl %ecx, %r13d
cmpq %r13, %rax
jb 0x1282fc
movl %ecx, %ebp
je 0x127f6f
movq 0x10(%r15), %rcx
movq (%rcx,%r12,8), %rdx
xorq (%rcx,%r13,8), %rdx
shrq $0x20, %rdx
leal 0x1(%rbp), %ecx
testq %rdx, %rdx
je 0x127f47
movq (%r14), %rax
movq 0x18(%r14), %rbx
movq 0x28(%r14), %rdi
cmpq 0x20(%r14), %rbx
movq %rax, 0x58(%rsp)
jne 0x127fae
leaq (%rbx,%rbx), %rsi
testq %rbx, %rbx
pushq $0x2
popq %rax
cmoveq %rax, %rsi
movq %rsi, 0x20(%r14)
shlq $0x3, %rsi
callq 0x2370
movq %rax, %rdi
movq %rax, 0x28(%r14)
movq (%r14), %rax
movq 0x18(%r14), %rbx
leaq 0x1(%rbx), %rcx
movq %rcx, 0x18(%r14)
movq %rdi, 0x30(%rsp)
movq %rax, (%rdi,%rbx,8)
cmpq %r13, %r12
jae 0x12802b
movq 0x48(%r14), %rcx
movq 0x10(%r15), %rdx
movl (%rdx,%r12,8), %esi
cmpb $0x0, (%rcx,%rsi)
je 0x128026
movq (%r14), %rdi
movq 0x10(%r14), %rax
cmpq 0x8(%r14), %rdi
jne 0x128014
leaq (%rdi,%rdi), %rsi
testq %rdi, %rdi
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%r14)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r14)
movq 0x10(%r15), %rdx
movq (%rdx,%r12,8), %rsi
movq (%r14), %rdi
movq 0x48(%r14), %rcx
leaq 0x1(%rdi), %r8
movq %r8, (%r14)
movl %esi, (%rax,%rdi,4)
movl (%rdx,%r12,8), %eax
movb $0x2, (%rcx,%rax)
incq %r12
jmp 0x127fbf
movq 0x30(%rsp), %rsi
movq (%rsi,%rbx,8), %rax
cmpq %rax, (%r14)
ja 0x128042
decq 0x18(%r14)
jmp 0x127f3d
movq %rax, %rcx
shlq $0x20, %rcx
movq %rcx, (%rsi,%rbx,8)
movq (%r14), %rdx
movl %eax, %eax
subq %rax, %rdx
orq %rcx, %rdx
movq %rdx, (%rsi,%rbx,8)
movq 0x18(%r14), %rax
leal -0x1(%rax), %ebx
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %r13
movl %ebx, %ebx
cmpq %rbx, %rax
jbe 0x128253
movq 0x28(%r14), %rax
movq (%rax,%rbx,8), %rdx
movl %edx, %eax
cmpq %rax, 0x50(%rsp)
jae 0x1280e6
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x8(,%rcx,8), %rsi
incq %rcx
movq %rcx, 0x50(%rsp)
movq 0x8(%rsp), %rdi
callq 0x2370
movq %rax, 0x8(%rsp)
movq 0x28(%r14), %rax
movq (%rax,%rbx,8), %rdx
movl %edx, %eax
cmpq %rax, 0x48(%rsp)
jae 0x128146
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x8(,%rcx,8), %rsi
incq %rcx
movq %rcx, 0x48(%rsp)
movq %r13, %rdi
callq 0x2370
movq %rax, %r13
movq 0x28(%r14), %rax
movq (%rax,%rbx,8), %rdx
movl %edx, %eax
cmpq %rax, 0x40(%rsp)
jae 0x1281a6
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x8(,%rcx,8), %rsi
incq %rcx
movq %rcx, 0x40(%rsp)
movq %r12, %rdi
callq 0x2370
movq %rax, %r12
movq 0x28(%r14), %rax
movq (%rax,%rbx,8), %rdx
movl %edx, %eax
cmpq %rax, 0x28(%rsp)
jae 0x128205
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x4(,%rcx,4), %rsi
incq %rcx
movq %rcx, 0x28(%rsp)
movq 0x10(%rsp), %rdi
callq 0x2370
movq 0x28(%r14), %rcx
movq (%rcx,%rbx,8), %rdx
jmp 0x12820a
movq 0x10(%rsp), %rax
movq 0x40(%r14), %rsi
movq 0x48(%r14), %rcx
movq 0x28(%rsi), %rdi
movq %rdx, %rsi
shrq $0x1e, %rsi
andq $-0x4, %rsi
addq 0x10(%r14), %rsi
pushq $0x3
popq %r8
pushq $0x2
popq %r9
movq %rax, 0x10(%rsp)
pushq %rax
pushq %r12
pushq %r13
pushq 0x20(%rsp)
pushq $0x5
pushq $0x4
callq 0x126f95
addq $0x30, %rsp
incl %ebx
movq 0x18(%r14), %rax
jmp 0x12806d
pushq $0x2
popq %rbx
movq 0x58(%rsp), %rax
movl %eax, %eax
cmpq %rax, (%r14)
jbe 0x128275
movq 0x10(%r14), %rcx
movq 0x48(%r14), %rdx
movl (%rcx,%rax,4), %ecx
movb $0x1, (%rdx,%rcx)
incl %eax
jmp 0x12825b
movq 0x18(%r14), %rcx
movq 0x28(%r14), %rax
cmpq 0x20(%r14), %rcx
jne 0x1282a6
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
cmoveq %rbx, %rsi
movq %rsi, 0x20(%r14)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x28(%r14)
movq 0x18(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x18(%r14)
orq $-0x1, (%rax,%rcx,8)
movq (%r14), %rcx
movq 0x10(%r14), %rax
cmpq 0x8(%r14), %rcx
jne 0x1282e2
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
cmoveq %rbx, %rsi
movq %rsi, 0x8(%r14)
shlq $0x2, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%r14)
movq (%r14), %rcx
movq %r13, 0x18(%rsp)
movq %r12, 0x20(%rsp)
leaq 0x1(%rcx), %rdx
movq %rdx, (%r14)
orl $-0x1, (%rax,%rcx,4)
jmp 0x127f3d
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %r13
movq (%r14), %rax
cmpq %rax, 0x28(%rsp)
movq 0x78(%rsp), %rbx
movq 0x70(%rsp), %r15
movq 0x10(%rsp), %rbp
jae 0x128366
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x4(,%rcx,4), %rsi
movq %rbp, %rdi
callq 0x2370
movq %rax, %rbp
movq 0x18(%r14), %r8
movq 0x30(%r14), %rax
movq 0x10(%rax), %r10
movq 0x18(%r10), %rax
movl 0x14(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %r8, %rcx
movq 0x28(%r14), %rax
cmpq %rcx, 0x20(%r14)
jae 0x1283e8
decq %rcx
movq %rcx, %rdx
shrq %rdx
orq %rcx, %rdx
movq %rdx, %rcx
shrq $0x2, %rcx
orq %rdx, %rcx
movq %rcx, %rdx
shrq $0x4, %rdx
orq %rcx, %rdx
movq %rdx, %rcx
shrq $0x8, %rcx
orq %rdx, %rcx
movq %rcx, %rdx
shrq $0x10, %rdx
orq %rcx, %rdx
leaq 0x1(%rdx), %rcx
movq %rcx, 0x20(%r14)
leaq 0x8(,%rdx,8), %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x28(%r14)
movq 0x18(%r14), %r8
movq 0x30(%r14), %rcx
movq 0x10(%rcx), %r10
movq 0x40(%r14), %rcx
movq 0x28(%rcx), %rdi
movq 0x10(%r14), %rsi
movl (%r14), %edx
leaq 0x78(%r14), %rcx
leaq (%rax,%r8,8), %r9
movsd 0xc6749(%rip), %xmm0    # 0x1eeb50
movsd 0xc6749(%rip), %xmm1    # 0x1eeb58
movq %rbp, %r8
pushq $0x4
pushq %r10
callq 0x13b7a3
popq %rax
popq %rcx
xorl %eax, %eax
cmpq %rax, %r15
je 0x128434
movq 0x48(%r14), %rcx
movl (%rbx,%rax,4), %edx
movb $0x0, (%rcx,%rdx)
incq %rax
jmp 0x12841f
movq 0x8(%rsp), %rdi
callq 0x2220
movq %r13, %rdi
callq 0x2220
movq %r12, %rdi
callq 0x2220
movq %rbp, %rdi
callq 0x2220
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq