// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/rcut.cpp
// Function: update_mc_edges(mc_g_t*, hap_overlaps_list*, kv_u_trans_t*, trans_chain*, double, unsigned int)
void update_mc_edges(mc_g_t *mg, hap_overlaps_list* ha, kv_u_trans_t *ta, trans_chain* t_ch, double f_rate, uint32_t is_sys)
{
	uint32_t v, i, k, qn, tn, qs, qe, ts, te, occ, as, ae, l, offset, l_pos;
	uint64_t hetLen, homLen, oLen;
	mc_interval_t *a = NULL;
	mc_edge_t *ma = NULL;
	asg_t* nsg = mg->ug->g;
	ma_utg_t *u = NULL;
	mc_interval_t *t = NULL;

	kvec_t(mc_interval_t) p; kv_init(p);
	kvec_t(uint32_t) p_idx; kv_init(p_idx);
	if(t_ch)
	{
		kv_push(uint32_t, p_idx, 0);
		for (v = 0; v < nsg->n_seq; v++)
		{
			u = &(mg->ug->u.a[v]);
			for (k = 1, l = 0, offset = 0, l_pos = 0; k <= u->n; ++k) 
			{   
				if (k == u->n || t_ch->ir_het[u->a[k]>>33] != t_ch->ir_het[u->a[l]>>33])
				{
					kv_pushp(mc_interval_t, p, &t);
					t->uID = v;
					t->hs = t_ch->ir_het[u->a[l]>>33];

					t->bS = l_pos;
					t->bE = offset + mg->rg->seq[u->a[k-1]>>33].len - 1;

					t->nS = l;
					t->nE = k - 1;
					l = k;
					l_pos = offset + (uint32_t)u->a[k-1];
				}
				offset += (uint32_t)u->a[k-1];
			}
			kv_push(uint32_t, p_idx, p.n);
		}

		///debug_mc_interval_t(p.a, p.n, p_idx.a, mg->ug, mg->rg, t_ch);
	}

	if(!mg->e)
	{
		CALLOC(mg->e, 1);
		mg->e->n_seq = mg->ug->g->n_seq;
		kv_init(mg->e->idx); kv_init(mg->e->ma); 
	}

	if(ha)
	{
		for (v = 0; v < ha->num; v++)
		{
			for (i = 0; i < ha->x[v].a.n; i++)
			{
				if(ha->x[v].a.a[i].score <= 0) continue;
				if(ha->x[v].a.a[i].xUid == ha->x[v].a.a[i].yUid) continue;
				if(p.n > 0 && p_idx.n > 0)
				{
					/*****************qn*****************/
					qn = ha->x[v].a.a[i].xUid;
					qs = ha->x[v].a.a[i].x_beg_pos;
					qe = ha->x[v].a.a[i].x_end_pos - 1;

					a = p.a + p_idx.a[qn]; 
					occ = p_idx.a[qn+1] - p_idx.a[qn];
					for (k = 0, hetLen = 0, homLen = 0; k < occ; k++)
					{
						as = a[k].bS;
						ae = a[k].bE;
						oLen = ((MIN(qe, ae) >= MAX(qs, as))? MIN(qe, ae) - MAX(qs, as) + 1 : 0);
						if(homLen + hetLen > 0 && oLen == 0) break;
						if(oLen == 0) continue;
						if(a[k].hs == N_HET)
						{
							homLen += oLen;
						} 
						else if(asm_opt.polyploidy <= 2 && (a[k].hs&P_HET))///if(asm_opt.polyploidy <= 2 && (a[k].hs&S_HET))
						{
							homLen += oLen;
						}
						else
						{
							hetLen += oLen;
						}                
					}

					if(hetLen <= ((hetLen + homLen)*f_rate)) continue;
					/*****************qn*****************/


					/*****************tn*****************/
					tn = ha->x[v].a.a[i].yUid;
					ts = ha->x[v].a.a[i].y_beg_pos;
					te = ha->x[v].a.a[i].y_end_pos - 1;

					a = p.a + p_idx.a[tn]; 
					occ = p_idx.a[tn+1] - p_idx.a[tn];
					for (k = 0, hetLen = 0, homLen = 0; k < occ; k++)
					{
						as = a[k].bS;
						ae = a[k].bE;
						oLen = ((MIN(te, ae) >= MAX(ts, as))? MIN(te, ae) - MAX(ts, as) + 1 : 0);
						if(homLen + hetLen > 0 && oLen == 0) break;
						if(oLen == 0) continue;
						if(a[k].hs == N_HET)
						{
							homLen += oLen;
						} 
						else if(asm_opt.polyploidy <= 2 && (a[k].hs&P_HET))///if(asm_opt.polyploidy <= 2 && (a[k].hs&S_HET))
						{
							homLen += oLen;
						}
						else
						{
							hetLen += oLen;
						}                 
					}

					if(hetLen <= ((hetLen + homLen)*f_rate)) continue;
					/*****************tn*****************/
				}
				kv_pushp(mc_edge_t, mg->e->ma, &ma);
				ma->x = (uint64_t)ha->x[v].a.a[i].xUid << 32 | ha->x[v].a.a[i].yUid;
				ma->w = ha->x[v].a.a[i].score;
			}
		}
	}

	if(ta)
	{
		// double sc = get_w_scale(ta);
		// fprintf(stderr, "sc: %f\n", sc);
		for (i = 0; i < ta->n; ++i)
		{
			if(ta->a[i].del) continue;
			if(p.n > 0 && p_idx.n > 0)
			{
				/*****************qn*****************/
				qn = ta->a[i].qn;
				qs = ta->a[i].qs;
				qe = ta->a[i].qe - 1;

				a = p.a + p_idx.a[qn]; 
				occ = p_idx.a[qn+1] - p_idx.a[qn];
				for (k = 0, hetLen = 0, homLen = 0; k < occ; k++)
				{
					as = a[k].bS;
					ae = a[k].bE;
					oLen = ((MIN(qe, ae) >= MAX(qs, as))? MIN(qe, ae) - MAX(qs, as) + 1 : 0);
					if(homLen + hetLen > 0 && oLen == 0) break;
					if(oLen == 0) continue;
					if(a[k].hs == N_HET)
					{
						homLen += oLen;
					} 
					else if(asm_opt.polyploidy <= 2 && (a[k].hs&P_HET))///if(asm_opt.polyploidy <= 2 && (a[k].hs&S_HET))
					{
						homLen += oLen;
					}
					else
					{
						hetLen += oLen;
					}                
				}

				if(hetLen <= ((hetLen + homLen)*f_rate)) continue;
				/*****************qn*****************/

				/*****************tn*****************/
				tn = ta->a[i].tn;
				ts = ta->a[i].ts;
				te = ta->a[i].te - 1;

				a = p.a + p_idx.a[tn]; 
				occ = p_idx.a[tn+1] - p_idx.a[tn];
				for (k = 0, hetLen = 0, homLen = 0; k < occ; k++)
				{
					as = a[k].bS;
					ae = a[k].bE;
					oLen = ((MIN(te, ae) >= MAX(ts, as))? MIN(te, ae) - MAX(ts, as) + 1 : 0);
					if(homLen + hetLen > 0 && oLen == 0) break;
					if(oLen == 0) continue;
					if(a[k].hs == N_HET)
					{
						homLen += oLen;
					} 
					else if(asm_opt.polyploidy <= 2 && (a[k].hs&P_HET))///if(asm_opt.polyploidy <= 2 && (a[k].hs&S_HET))
					{
						homLen += oLen;
					}
					else
					{
						hetLen += oLen;
					}                 
				}

				if(hetLen <= ((hetLen + homLen)*f_rate)) continue;
				/*****************tn*****************/
			}
			kv_pushp(mc_edge_t, mg->e->ma, &ma);
			ma->x = (uint64_t)ta->a[i].qn << 32 | ta->a[i].tn;
			// ma->w = w_cast((ta->a[i].nw*sc));
			ma->w = w_cast((ta->a[i].nw));
		}
	}

	for (i = k = 0; i < mg->e->ma.n; i++)
    {
		if(mg->e->ma.a[i].w == 0) continue;
		mg->e->ma.a[k] = mg->e->ma.a[i];
        k++;
    }
    mg->e->ma.n = k;
	
	radix_sort_mce(mg->e->ma.a, mg->e->ma.a + mg->e->ma.n);
	mc_merge_dup(mg);
	mc_edges_idx(mg->e);
	if(is_sys) mc_edges_symm(mg->e);
	kv_destroy(p); kv_destroy(p_idx);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %r8d, 0x74(%rsp)
movsd %xmm0, 0x58(%rsp)
movq %rdx, 0x78(%rsp)
movq %rsi, %rbx
movq %rcx, 0x68(%rsp)
testq %rcx, %rcx
movq %rdi, 0x10(%rsp)
je 0x168eff
movq 0x18(%rdi), %rax
movq 0x18(%rax), %r14
movl $0x8, %edi
callq 0x2280
movq %rax, 0x20(%rsp)
movl $0x0, (%rax)
movq %r14, 0x50(%rsp)
testl $0x7fffffff, 0x14(%r14) # imm = 0x7FFFFFFF
je 0x168f16
movq %rbx, 0x48(%rsp)
movl $0x1, %r15d
xorl %r11d, %r11d
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movl $0x2, %eax
movq %rax, 0x40(%rsp)
xorl %r9d, %r9d
movq $0x0, 0x18(%rsp)
xorl %r10d, %r10d
movq 0x10(%rsp), %rdi
movq %r15, 0x60(%rsp)
movq 0x18(%rdi), %rax
movq 0x10(%rax), %rcx
leaq (%r11,%r11,4), %rdx
movl 0x10(%rcx,%rdx,8), %eax
testl %eax, %eax
je 0x168e83
leaq (%rcx,%rdx,8), %r8
movl $0x1, %r15d
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %ebx, %ebx
movq %r8, 0x28(%rsp)
movl %ebx, %ebp
cmpl %eax, %r15d
je 0x168da9
movq 0x68(%rsp), %rcx
movq 0x10(%rcx), %rdx
movq 0x18(%r8), %rcx
movl %r15d, %esi
movq (%rcx,%rsi,8), %rsi
shrq $0x21, %rsi
movb (%rdx,%rsi), %sil
movq (%rcx,%rbp,8), %r8
shrq $0x21, %r8
cmpb (%rdx,%r8), %sil
movq 0x28(%rsp), %r8
jne 0x168da9
leal -0x1(%r15), %edx
jmp 0x168e73
movl %ebx, 0x30(%rsp)
cmpq 0x18(%rsp), %r9
movq %r9, %rbx
jne 0x168e00
leaq (%r9,%r9), %rcx
testq %r9, %r9
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x18(%rsp)
leaq (,%rcx,8), %rax
leaq (%rax,%rax,2), %rsi
movq %r10, %rdi
movq %r11, %r14
callq 0x2370
movq 0x28(%rsp), %r8
movq %rbx, %r9
movq %r14, %r11
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movq 0x10(%rsp), %rdi
movq %rax, %r10
movl 0x10(%r8), %eax
leaq (%r9,%r9,2), %rsi
movl %r11d, 0x10(%r10,%rsi,8)
movq 0x68(%rsp), %rcx
movq 0x10(%rcx), %rdx
movq 0x18(%r8), %rcx
movq (%rcx,%rbp,8), %r8
shrq $0x21, %r8
movb (%rdx,%r8), %dl
movb %dl, 0x14(%r10,%rsi,8)
movl %r12d, (%r10,%rsi,8)
movq 0x20(%rdi), %rdx
movq 0x20(%rdx), %r9
leal -0x1(%r15), %edx
movq (%rcx,%rdx,8), %r12
movq %r12, %r8
shrq $0x21, %r8
movl (%r9,%r8,8), %r8d
movq %rbx, %r9
andl %r14d, %r8d
addl %r13d, %r8d
decl %r8d
movl %r8d, 0x4(%r10,%rsi,8)
movq 0x28(%rsp), %r8
movl 0x30(%rsp), %ebx
movl %ebx, 0x8(%r10,%rsi,8)
incq %r9
movl %edx, 0xc(%r10,%rsi,8)
addl %r13d, %r12d
movl %r15d, %ebx
addl (%rcx,%rdx,8), %r13d
incl %r15d
cmpl %eax, %r15d
jbe 0x168d6a
movq 0x60(%rsp), %r15
cmpq 0x40(%rsp), %r15
jne 0x168ec3
leaq (%r15,%r15), %rax
movq %rax, 0x40(%rsp)
leaq (,%r15,8), %rsi
movq 0x20(%rsp), %rdi
movq %r10, %rbx
movq %r11, %r12
movq %r9, %r13
callq 0x2370
movq %r13, %r9
movq %r12, %r11
movq %rbx, %r10
movq 0x10(%rsp), %rdi
jmp 0x168ec8
movq 0x20(%rsp), %rax
movq %rax, 0x20(%rsp)
movl %r9d, (%rax,%r15,4)
incq %r15
incq %r11
movq 0x50(%rsp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %r11
jb 0x168d36
testq %r9, %r9
setne %al
movq %rax, 0x38(%rsp)
movq 0x48(%rsp), %rbx
jmp 0x168f27
xorl %r10d, %r10d
movq $0x0, 0x38(%rsp)
movq $0x0, 0x20(%rsp)
jmp 0x168f27
xorl %r10d, %r10d
movq $0x0, 0x38(%rsp)
movq 0x10(%rsp), %rdi
movq 0x28(%rdi), %r9
testq %r9, %r9
movq %r10, 0x18(%rsp)
jne 0x168f7e
movl $0x1, %edi
movl $0x40, %esi
callq 0x2120
movq 0x18(%rsp), %r10
movq 0x10(%rsp), %rdi
movq %rax, %r9
movq %rax, 0x28(%rdi)
movq 0x18(%rdi), %rax
movq 0x18(%rax), %rax
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl 0x14(%rax), %ecx
movl %ecx, 0x38(%r9)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%r9)
movupd %xmm0, 0x10(%r9)
movupd %xmm0, (%r9)
testq %rbx, %rbx
je 0x16930b
movl 0x8(%rbx), %eax
testl %eax, %eax
je 0x16930b
cmpq $0x0, 0x68(%rsp)
setne %bpl
andb 0x38(%rsp), %bpl
movq (%rbx), %r8
xorl %edx, %edx
movq 0xc82d2(%rip), %xmm3    # 0x231280
movapd 0xc82da(%rip), %xmm4    # 0x231290
movq %rbx, 0x48(%rsp)
movb %bpl, 0xf(%rsp)
leaq (%rdx,%rdx,2), %r12
cmpq $0x0, (%r8,%r12,8)
je 0x1692fd
movq %rdx, 0x80(%rsp)
xorl %ebx, %ebx
xorl %r14d, %r14d
movq %r12, 0x50(%rsp)
movq 0x10(%r8,%r12,8), %rsi
shlq $0x6, %rbx
cmpq $0x0, 0x30(%rsi,%rbx)
jle 0x1692dd
leaq (%rsi,%rbx), %rcx
movl 0x24(%rcx), %r15d
movl 0x28(%rcx), %r11d
cmpl %r11d, %r15d
je 0x1692dd
testb %bpl, %bpl
je 0x169242
movq %r11, 0x40(%rsp)
movq %r8, 0x60(%rsp)
movq %r9, 0x30(%rsp)
movq 0x20(%rsp), %rdi
movl (%rdi,%r15,4), %eax
leal 0x1(%r15), %edx
movl (%rdi,%rdx,4), %r11d
subl %eax, %r11d
jne 0x169044
xorl %r10d, %r10d
xorl %r9d, %r9d
jmp 0x1690cc
movl 0x4(%rcx), %ebp
movl 0x8(%rcx), %r12d
decl %r12d
leaq (%rax,%rax,2), %rax
leaq (%r10,%rax,8), %r13
leaq 0x12c6fb(%rip), %rax    # 0x295758
movl 0x1bc(%rax), %eax
movl %eax, 0x28(%rsp)
xorl %r9d, %r9d
xorl %r10d, %r10d
movl (%r13), %eax
movl 0x4(%r13), %edx
cmpl %edx, %r12d
cmovbl %r12d, %edx
cmpl %eax, %ebp
cmoval %ebp, %eax
subl %eax, %edx
leal 0x1(%rdx), %eax
movl $0x0, %edx
cmovbl %edx, %eax
movq %r9, %rdx
addq %r10, %rdx
setne %dl
testl %eax, %eax
sete %r8b
testb %r8b, %dl
jne 0x1690cc
testq %rax, %rax
je 0x1690c3
movb 0x14(%r13), %dl
testb %dl, %dl
je 0x1690bb
testb $0x2, %dl
je 0x1690c0
cmpl $0x2, 0x28(%rsp)
jg 0x1690c0
addq %rax, %r9
jmp 0x1690c3
addq %rax, %r10
addq $0x18, %r13
decq %r11
jne 0x16906d
movq %r10, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm4, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
addq %r10, %r9
movq %r9, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm4, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
mulsd 0x58(%rsp), %xmm2
ucomisd %xmm1, %xmm2
jae 0x16912a
movq 0x40(%rsp), %rdx
movl (%rdi,%rdx,4), %eax
incl %edx
movl (%rdi,%rdx,4), %r10d
subl %eax, %r10d
jne 0x16914d
xorl %r9d, %r9d
xorl %ecx, %ecx
jmp 0x1691da
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %r10
movq 0x30(%rsp), %r9
movb 0xf(%rsp), %bpl
movq 0x60(%rsp), %r8
movq 0x50(%rsp), %r12
jmp 0x1692dd
movl 0xc(%rcx), %r11d
movl 0x10(%rcx), %ebp
decl %ebp
leaq (%rax,%rax,2), %rax
movq 0x18(%rsp), %rcx
leaq (%rcx,%rax,8), %r12
leaq 0x12c5ee(%rip), %rax    # 0x295758
movl 0x1bc(%rax), %eax
xorl %ecx, %ecx
xorl %r9d, %r9d
movl (%r12), %edx
movl 0x4(%r12), %r8d
cmpl %r8d, %ebp
cmovbl %ebp, %r8d
cmpl %edx, %r11d
cmoval %r11d, %edx
subl %edx, %r8d
leal 0x1(%r8), %r13d
movl $0x0, %edx
cmovbl %edx, %r13d
movq %rcx, %rdx
addq %r9, %rdx
setne %dl
testl %r13d, %r13d
sete %r8b
testb %r8b, %dl
jne 0x1691da
testq %r13, %r13
je 0x1691d1
movb 0x14(%r12), %dl
testb %dl, %dl
je 0x1691c9
testb $0x2, %dl
je 0x1691ce
cmpl $0x2, %eax
jg 0x1691ce
addq %r13, %rcx
jmp 0x1691d1
addq %r13, %r9
addq $0x18, %r12
decq %r10
jne 0x169175
movq %r9, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm4, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
addq %r9, %rcx
movq %rcx, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm4, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
mulsd 0x58(%rsp), %xmm2
ucomisd %xmm1, %xmm2
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %r10
movq 0x30(%rsp), %r9
movb 0xf(%rsp), %bpl
movq 0x60(%rsp), %r8
movq 0x50(%rsp), %r12
movq 0x40(%rsp), %r11
jae 0x1692dd
movq 0x18(%r9), %rax
cmpq 0x20(%r9), %rax
jne 0x1692ab
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x20(%r9)
movq 0x28(%r9), %rdi
shlq $0x4, %rsi
callq 0x2370
movapd 0xc801b(%rip), %xmm4    # 0x231290
movq 0xc8003(%rip), %xmm3    # 0x231280
movq 0x18(%rsp), %r10
movq 0x10(%rsp), %rdi
movq %rax, %rcx
movq 0x28(%rdi), %r9
movq %rax, 0x28(%r9)
movq 0x48(%rsp), %rax
movq (%rax), %r8
movq 0x10(%r8,%r12,8), %rsi
movl 0x24(%rsi,%rbx), %r15d
movl 0x28(%rsi,%rbx), %r11d
jmp 0x1692af
movq 0x28(%r9), %rcx
movq 0x18(%r9), %rax
leaq 0x1(%rax), %rdx
movq %rdx, 0x18(%r9)
shlq $0x4, %rax
shlq $0x20, %r15
movl %r11d, %edx
orq %r15, %rdx
movq %rdx, (%rcx,%rax)
xorps %xmm0, %xmm0
cvtsi2sdq 0x30(%rsi,%rbx), %xmm0
movsd %xmm0, 0x8(%rcx,%rax)
incl %r14d
movq %r14, %rbx
cmpq %r14, (%r8,%r12,8)
ja 0x168fe1
movq 0x48(%rsp), %rbx
movl 0x8(%rbx), %eax
movq 0x80(%rsp), %rdx
incq %rdx
movl %eax, %ecx
cmpq %rcx, %rdx
jb 0x168fc0
movq 0x78(%rsp), %rax
testq %rax, %rax
je 0x16961d
movq (%rax), %r10
testq %r10, %r10
je 0x16961d
cmpq $0x0, 0x68(%rsp)
movq %rax, %rcx
setne %al
movq 0x38(%rsp), %rdx
andb %al, %dl
movq %rdx, 0x38(%rsp)
movq 0x10(%rcx), %rsi
xorl %ebx, %ebx
movq 0xc7f35(%rip), %xmm3    # 0x231280
movapd 0xc7f3d(%rip), %xmm4    # 0x231290
xorl %eax, %eax
xorl %r15d, %r15d
leaq (%rax,%rax,2), %r14
shlq $0x4, %r14
cmpb $0x0, 0x28(%rsi,%r14)
js 0x16960e
cmpb $0x0, 0x38(%rsp)
je 0x16957f
movq %r10, 0x28(%rsp)
movq %r9, 0x30(%rsp)
leaq (%rsi,%r14), %rcx
movl 0x8(%rcx), %edi
movq 0x20(%rsp), %rdx
movl (%rdx,%rdi,4), %eax
incl %edi
movl (%rdx,%rdi,4), %r9d
subl %eax, %r9d
jne 0x1693a5
xorl %r8d, %r8d
xorl %edi, %edi
jmp 0x16942e
movl (%rcx), %r10d
movl 0x4(%rcx), %r11d
decl %r11d
leaq (%rax,%rax,2), %rax
movq 0x18(%rsp), %rdx
leaq (%rdx,%rax,8), %r12
leaq 0x12c395(%rip), %rax    # 0x295758
movl 0x1bc(%rax), %eax
xorl %edi, %edi
xorl %r8d, %r8d
movl (%r12), %ebp
movl 0x4(%r12), %r13d
cmpl %r13d, %r11d
cmovbl %r11d, %r13d
cmpl %ebp, %r10d
cmoval %r10d, %ebp
subl %ebp, %r13d
leal 0x1(%r13), %ebp
cmovbl %ebx, %ebp
movq %rdi, %r13
addq %r8, %r13
setne %r13b
testl %ebp, %ebp
sete %dl
testb %dl, %r13b
jne 0x16942e
testq %rbp, %rbp
je 0x169425
movb 0x14(%r12), %r13b
testb %r13b, %r13b
je 0x16941d
testb $0x2, %r13b
je 0x169422
cmpl $0x2, %eax
jg 0x169422
addq %rbp, %rdi
jmp 0x169425
addq %rbp, %r8
addq $0x18, %r12
decq %r9
jne 0x1693ce
movq %r8, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm4, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
addq %r8, %rdi
movq %rdi, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm4, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
mulsd 0x58(%rsp), %xmm2
ucomisd %xmm1, %xmm2
jae 0x16948e
movl 0x14(%rcx), %edx
movq 0x20(%rsp), %rdi
movl (%rdi,%rdx,4), %eax
incl %edx
movl (%rdi,%rdx,4), %r8d
subl %eax, %r8d
jne 0x1694a2
xorl %edi, %edi
xorl %ecx, %ecx
jmp 0x16952b
movq 0x10(%rsp), %rdi
movq 0x30(%rsp), %r9
movq 0x28(%rsp), %r10
jmp 0x16960e
movl 0xc(%rcx), %r9d
movl 0x10(%rcx), %r10d
decl %r10d
leaq (%rax,%rax,2), %rax
movq 0x18(%rsp), %rcx
leaq (%rcx,%rax,8), %r11
leaq 0x12c297(%rip), %rax    # 0x295758
movl 0x1bc(%rax), %eax
xorl %ecx, %ecx
xorl %edi, %edi
movl (%r11), %edx
movl 0x4(%r11), %r12d
cmpl %r12d, %r10d
cmovbl %r10d, %r12d
cmpl %edx, %r9d
cmoval %r9d, %edx
subl %edx, %r12d
leal 0x1(%r12), %r12d
cmovbl %ebx, %r12d
movq %rcx, %rdx
addq %rdi, %rdx
setne %dl
testl %r12d, %r12d
sete %bpl
testb %bpl, %dl
jne 0x16952b
testq %r12, %r12
je 0x169522
movb 0x14(%r11), %bpl
testb %bpl, %bpl
je 0x16951a
testb $0x2, %bpl
je 0x16951f
cmpl $0x2, %eax
jg 0x16951f
addq %r12, %rcx
jmp 0x169522
addq %r12, %rdi
addq $0x18, %r11
decq %r8
jne 0x1694cb
movq %rdi, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm4, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
addq %rdi, %rcx
movq %rcx, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm4, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
mulsd 0x58(%rsp), %xmm2
ucomisd %xmm1, %xmm2
movq 0x10(%rsp), %rdi
movq 0x30(%rsp), %r9
movq 0x28(%rsp), %r10
jae 0x16960e
movq 0x18(%r9), %rax
cmpq 0x20(%r9), %rax
jne 0x1695d8
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x20(%r9)
movq 0x28(%r9), %rdi
shlq $0x4, %rsi
callq 0x2370
movapd 0xc7cde(%rip), %xmm4    # 0x231290
movq 0xc7cc6(%rip), %xmm3    # 0x231280
movq 0x10(%rsp), %rdi
movq %rax, %rcx
movq 0x28(%rdi), %r9
movq %rax, 0x28(%r9)
movq 0x78(%rsp), %rax
movq (%rax), %r10
movq 0x10(%rax), %rsi
jmp 0x1695dc
movq 0x28(%r9), %rcx
movq 0x18(%r9), %rax
leaq 0x1(%rax), %rdx
movq %rdx, 0x18(%r9)
shlq $0x4, %rax
movl 0x8(%rsi,%r14), %edx
movl 0x14(%rsi,%r14), %r8d
shlq $0x20, %rdx
orq %rdx, %r8
movq %r8, (%rcx,%rax)
movsd 0x20(%rsi,%r14), %xmm0
movsd %xmm0, 0x8(%rcx,%rax)
incl %r15d
movq %r15, %rax
cmpq %r15, %r10
ja 0x169358
xorl %esi, %esi
cmpq $0x0, 0x18(%r9)
je 0x16966d
movl $0x1, %eax
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
movq 0x28(%r9), %rdx
shlq $0x4, %rcx
movsd 0x8(%rdx,%rcx), %xmm1
ucomisd %xmm0, %xmm1
jne 0x169647
jnp 0x169661
addq %rdx, %rcx
movl %esi, %r8d
shlq $0x4, %r8
movupd (%rcx), %xmm1
movupd %xmm1, (%rdx,%r8)
incl %esi
movq 0x28(%rdi), %r9
movl %eax, %ecx
incl %eax
cmpq %rcx, 0x18(%r9)
ja 0x169631
movl %esi, %esi
movq %rsi, 0x18(%r9)
movq 0x28(%r9), %rdi
shlq $0x4, %rsi
addq %rdi, %rsi
callq 0x16695f
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x16710b
movq 0x28(%rbx), %rdi
callq 0x168a9c
cmpl $0x0, 0x74(%rsp)
je 0x1696a7
movq 0x28(%rbx), %rdi
callq 0x168951
movq 0x18(%rsp), %rdi
callq 0x2220
movq 0x20(%rsp), %rdi
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220