// File: /workspace/github_cpp_makefile_star2_O2/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 $0x78, %rsp
movl %r8d, 0x74(%rsp)
movq %rdx, %r9
movq %rsi, %r12
movq %rdi, %r13
pushq $0x2
popq %r15
movq %rcx, 0x60(%rsp)
testq %rcx, %rcx
movq %rdi, 0x48(%rsp)
movsd %xmm0, 0x50(%rsp)
movq %rdx, 0x38(%rsp)
movq %rsi, 0x58(%rsp)
je 0x12467d
pushq $0x1
popq %rax
movq %rax, 0x28(%rsp)
movq 0x18(%r13), %rax
movq 0x18(%rax), %rax
movq %rax, 0x40(%rsp)
pushq $0x8
popq %rdi
movq %r9, %rbx
callq 0x2280
movq %rbx, %r9
movq %rax, %rbp
andl $0x0, (%rax)
xorl %r8d, %r8d
xorl %r11d, %r11d
movq $0x0, 0x8(%rsp)
xorl %r10d, %r10d
movq %r15, 0x20(%rsp)
movq 0x40(%rsp), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rax, %r8
jae 0x12466a
movq %rbp, 0x10(%rsp)
movq 0x18(%r13), %rax
imulq $0x28, %r8, %r15
addq 0x10(%rax), %r15
xorl %r12d, %r12d
pushq $0x1
popq %rax
movl %eax, %ebp
xorl %ebx, %ebx
xorl %edi, %edi
movq 0x8(%rsp), %r9
cmpl 0x10(%r15), %ebp
ja 0x1245ea
movl %r12d, %r14d
je 0x12451e
movq 0x60(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x18(%r15), %rax
movl %ebp, %edx
movq (%rax,%rdx,8), %rdx
shrq $0x21, %rdx
movb (%rcx,%rdx), %dl
movq (%rax,%r14,8), %rsi
shrq $0x21, %rsi
cmpb (%rcx,%rsi), %dl
jne 0x12451e
leal -0x1(%rbp), %ecx
jmp 0x1245e0
cmpq %r9, %r10
jne 0x124578
leaq (%r9,%r9), %r13
testq %r9, %r9
pushq $0x2
popq %rax
cmoveq %rax, %r13
imulq $0x18, %r13, %rsi
movq %rdi, 0x68(%rsp)
movq %r11, %rdi
movl %r12d, 0x18(%rsp)
movq %r8, %r12
movq %rbx, 0x8(%rsp)
movq %r15, %rbx
movq %r10, %r15
callq 0x2370
movq 0x68(%rsp), %rdi
movq %r15, %r10
movq %rbx, %r15
movq 0x8(%rsp), %rbx
movq %r12, %r8
movl 0x18(%rsp), %r12d
movq %rax, %r11
movq %r13, %r9
movq 0x48(%rsp), %r13
imulq $0x18, %r10, %rdx
movl %r8d, 0x10(%r11,%rdx)
movq 0x60(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x18(%r15), %rax
movq (%rax,%r14,8), %rsi
shrq $0x21, %rsi
movb (%rcx,%rsi), %cl
movb %cl, 0x14(%r11,%rdx)
movl %edi, (%r11,%rdx)
movq 0x20(%r13), %rcx
movq 0x20(%rcx), %rsi
leal -0x1(%rbp), %ecx
movq (%rax,%rcx,8), %r14
movq %r14, %rdi
shrq $0x21, %rdi
movl (%rsi,%rdi,8), %esi
movl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
andl %edi, %esi
movq %r14, %rdi
addl %ebx, %esi
decl %esi
movl %esi, 0x4(%r11,%rdx)
movl %r12d, 0x8(%r11,%rdx)
incq %r10
movl %ecx, 0xc(%r11,%rdx)
addl %ebx, %edi
movl %ebp, %r12d
addl (%rax,%rcx,8), %ebx
incl %ebp
jmp 0x1244e0
movq %r9, 0x8(%rsp)
movq 0x20(%rsp), %rax
cmpq %rax, 0x28(%rsp)
jne 0x12463d
leaq (%rax,%rax), %rbx
testq %rax, %rax
pushq $0x2
popq %r15
cmoveq %r15, %rbx
leaq (,%rbx,4), %rsi
movq 0x10(%rsp), %rdi
movq %r11, %r14
movq %r8, %r12
movq %r10, %rbp
callq 0x2370
movq %rbp, %r10
movq %r12, %r8
movq %r14, %r11
movq %rax, %rbp
movq %rbx, 0x20(%rsp)
movq 0x38(%rsp), %r9
jmp 0x12464b
movq 0x10(%rsp), %rbp
movq 0x38(%rsp), %r9
pushq $0x2
popq %r15
movq 0x58(%rsp), %r12
movq 0x28(%rsp), %rax
movl %r10d, (%rbp,%rax,4)
incq %rax
movq %rax, 0x28(%rsp)
incq %r8
jmp 0x1244a8
testq %r10, %r10
setne %al
movq %rax, 0x30(%rsp)
movsd 0x50(%rsp), %xmm3
jmp 0x12468f
movapd %xmm0, %xmm3
xorl %r11d, %r11d
movq $0x0, 0x30(%rsp)
xorl %ebp, %ebp
movq 0x28(%r13), %rax
testq %rax, %rax
movq %r11, 0x8(%rsp)
jne 0x1246e2
pushq $0x1
popq %rdi
pushq $0x40
popq %rsi
movq %r9, %rbx
callq 0x2120
movq %rbx, %r9
movsd 0x50(%rsp), %xmm3
movq 0x8(%rsp), %r11
movq %rax, 0x28(%r13)
movq 0x18(%r13), %rcx
movq 0x18(%rcx), %rdx
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl 0x14(%rdx), %ecx
movl %ecx, 0x38(%rax)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x20(%rax)
movupd %xmm0, 0x10(%rax)
movupd %xmm0, (%rax)
testq %r12, %r12
movq %rbp, 0x10(%rsp)
je 0x124a4f
cmpq $0x0, 0x60(%rsp)
setne %cl
andb 0x30(%rsp), %cl
movb %cl, 0x68(%rsp)
xorl %r9d, %r9d
movq 0xbeb64(%rip), %xmm4    # 0x1e3270
movapd 0xbeb6c(%rip), %xmm5    # 0x1e3280
movl 0x8(%r12), %ecx
cmpq %rcx, %r9
jae 0x124a4a
movq (%r12), %rbx
imulq $0x18, %r9, %r10
xorl %r13d, %r13d
movq %r9, 0x20(%rsp)
movq %r10, 0x40(%rsp)
movl %r13d, %r13d
cmpq %r13, (%rbx,%r10)
jbe 0x124a3d
leaq (%rbx,%r10), %rcx
movq 0x10(%rcx), %rdi
movq %r13, %r14
shlq $0x6, %r14
cmpq $0x0, 0x30(%rdi,%r14)
jle 0x124a35
addq %r14, %rdi
movl 0x24(%rdi), %ecx
movl 0x28(%rdi), %esi
cmpl %esi, %ecx
je 0x124a35
cmpb $0x0, 0x68(%rsp)
je 0x124998
movq %rbx, 0x28(%rsp)
movq %rax, 0x18(%rsp)
movl 0x4(%rdi), %r8d
movl 0x8(%rdi), %r9d
decl %r9d
movl (%rbp,%rcx,4), %edx
imulq $0x18, %rdx, %r10
addq %r11, %r10
incl %ecx
movl (%rbp,%rcx,4), %r11d
subl %edx, %r11d
leaq 0x12efac(%rip), %rax    # 0x253758
movl 0x1bc(%rax), %ecx
imulq $0x18, %r11, %rbp
xorl %ebx, %ebx
xorl %r11d, %r11d
xorl %r12d, %r12d
cmpq %rbx, %rbp
je 0x124829
movl (%r10,%rbx), %edx
movl 0x4(%r10,%rbx), %r15d
cmpl %r15d, %r9d
cmovbl %r9d, %r15d
cmpl %edx, %r8d
cmoval %r8d, %edx
subl %edx, %r15d
leal 0x1(%r15), %r15d
movl $0x0, %eax
cmovbl %eax, %r15d
movq %r12, %rdx
addq %r11, %rdx
setne %dl
testl %r15d, %r15d
sete %al
testb %al, %dl
jne 0x124829
testq %r15, %r15
je 0x124823
movb 0x14(%r10,%rbx), %dl
testb %dl, %dl
je 0x124820
cmpl $0x3, %ecx
setge %al
testb $0x2, %dl
sete %dl
orb %al, %dl
je 0x124820
addq %r15, %r11
jmp 0x124823
addq %r15, %r12
addq $0x18, %rbx
jmp 0x1247be
movq %r11, %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd %xmm5, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
addq %r11, %r12
movq %r12, %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd %xmm5, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
mulsd %xmm3, %xmm2
ucomisd %xmm1, %xmm2
jae 0x12490c
movl 0xc(%rdi), %r8d
movl 0x10(%rdi), %edi
decl %edi
movq 0x10(%rsp), %rbp
movl (%rbp,%rsi,4), %eax
imulq $0x18, %rax, %r9
addq 0x8(%rsp), %r9
leal 0x1(%rsi), %edx
movl (%rbp,%rdx,4), %edx
subl %eax, %edx
imulq $0x18, %rdx, %r11
xorl %ebx, %ebx
xorl %esi, %esi
xorl %r10d, %r10d
movq 0x58(%rsp), %r12
cmpq %rbx, %r11
je 0x124938
movl (%r9,%rbx), %eax
movl 0x4(%r9,%rbx), %edx
cmpl %edx, %edi
cmovbl %edi, %edx
cmpl %eax, %r8d
cmoval %r8d, %eax
subl %eax, %edx
leal 0x1(%rdx), %r15d
movl $0x0, %eax
cmovbl %eax, %r15d
movq %r10, %rax
addq %rsi, %rax
setne %al
testl %r15d, %r15d
sete %dl
testb %dl, %al
jne 0x124938
testq %r15, %r15
je 0x124906
movb 0x14(%r9,%rbx), %dl
testb %dl, %dl
je 0x124903
cmpl $0x3, %ecx
setge %al
testb $0x2, %dl
sete %dl
orb %al, %dl
je 0x124903
addq %r15, %rsi
jmp 0x124906
addq %r15, %r10
addq $0x18, %rbx
jmp 0x1248a0
movq 0x10(%rsp), %rbp
movq 0x8(%rsp), %r11
pushq $0x2
popq %r15
movq 0x18(%rsp), %rax
movq 0x58(%rsp), %r12
movq 0x20(%rsp), %r9
movq 0x40(%rsp), %r10
movq 0x28(%rsp), %rbx
jmp 0x124a35
movq %rsi, %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd %xmm5, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
addq %rsi, %r10
movq %r10, %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd %xmm5, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
mulsd %xmm3, %xmm2
ucomisd %xmm1, %xmm2
movq 0x8(%rsp), %r11
pushq $0x2
popq %r15
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %r9
movq 0x40(%rsp), %r10
movq 0x28(%rsp), %rbx
jae 0x124a35
movq 0x18(%rax), %rcx
cmpq 0x20(%rax), %rcx
jne 0x1249f9
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
cmoveq %r15, %rsi
movq %rsi, 0x20(%rax)
movq 0x28(%rax), %rdi
shlq $0x4, %rsi
callq 0x2370
movq 0x40(%rsp), %r10
movapd 0xbe8b5(%rip), %xmm5    # 0x1e3280
movq 0xbe89d(%rip), %xmm4    # 0x1e3270
movq 0x20(%rsp), %r9
movsd 0x50(%rsp), %xmm3
movq 0x8(%rsp), %r11
movq %rax, %rcx
movq 0x48(%rsp), %rax
movq 0x28(%rax), %rax
movq %rcx, 0x28(%rax)
movq (%r12), %rbx
jmp 0x1249fd
movq 0x28(%rax), %rcx
movq 0x18(%rax), %r8
leaq 0x1(%r8), %rdx
movq %rdx, 0x18(%rax)
shlq $0x4, %r8
movq 0x10(%rbx,%r10), %rdx
movl 0x24(%rdx,%r14), %esi
movl 0x28(%rdx,%r14), %edi
shlq $0x20, %rsi
orq %rsi, %rdi
movq %rdi, (%rcx,%r8)
cvtsi2sdq 0x30(%rdx,%r14), %xmm0
movsd %xmm0, 0x8(%rcx,%r8)
incl %r13d
jmp 0x124737
incq %r9
movq 0x48(%rsp), %r13
jmp 0x124714
movq 0x38(%rsp), %r9
testq %r9, %r9
je 0x124d44
cmpq $0x0, 0x60(%rsp)
setne %cl
movq 0x30(%rsp), %rdx
andb %cl, %dl
movq %rdx, 0x30(%rsp)
movq 0xbe7fb(%rip), %xmm4    # 0x1e3270
movapd 0xbe803(%rip), %xmm5    # 0x1e3280
xorl %r13d, %r13d
movl %r13d, %r13d
cmpq %r13, (%r9)
jbe 0x124d3f
movq 0x10(%r9), %rdx
imulq $0x30, %r13, %r14
cmpb $0x0, 0x28(%rdx,%r14)
js 0x124d37
cmpb $0x0, 0x30(%rsp)
je 0x124ca3
movq %rax, 0x18(%rsp)
leaq (%rdx,%r14), %rsi
movl 0x8(%rsi), %eax
movl (%rsi), %edi
movl 0x4(%rsi), %r8d
decl %r8d
movl (%rbp,%rax,4), %ecx
imulq $0x18, %rcx, %r9
addq %r11, %r9
incl %eax
movl (%rbp,%rax,4), %eax
subl %ecx, %eax
leaq 0x12ec7e(%rip), %rcx    # 0x253758
movl 0x1bc(%rcx), %ecx
imulq $0x18, %rax, %r12
xorl %ebp, %ebp
xorl %r10d, %r10d
xorl %r11d, %r11d
cmpq %rbp, %r12
je 0x124b54
movl (%r9,%rbp), %eax
movl 0x4(%r9,%rbp), %r15d
cmpl %r15d, %r8d
cmovbl %r8d, %r15d
cmpl %eax, %edi
cmoval %edi, %eax
subl %eax, %r15d
leal 0x1(%r15), %r15d
movl $0x0, %eax
cmovbl %eax, %r15d
movq %r11, %rax
addq %r10, %rax
setne %al
testl %r15d, %r15d
sete %bl
testb %bl, %al
jne 0x124b54
testq %r15, %r15
je 0x124b4e
movb 0x14(%r9,%rbp), %al
testb %al, %al
je 0x124b4b
cmpl $0x3, %ecx
setge %bl
testb $0x2, %al
sete %al
orb %bl, %al
je 0x124b4b
addq %r15, %r10
jmp 0x124b4e
addq %r15, %r11
addq $0x18, %rbp
jmp 0x124aec
movq %r10, %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd %xmm5, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
addq %r10, %r11
movq %r11, %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd %xmm5, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
mulsd %xmm3, %xmm2
ucomisd %xmm1, %xmm2
jae 0x124c30
movl 0x14(%rsi), %eax
movl 0xc(%rsi), %edi
movl 0x10(%rsi), %esi
decl %esi
movq 0x10(%rsp), %rbp
movl (%rbp,%rax,4), %r9d
imulq $0x18, %r9, %r8
addq 0x8(%rsp), %r8
incl %eax
movl (%rbp,%rax,4), %eax
subl %r9d, %eax
imulq $0x18, %rax, %r11
xorl %r12d, %r12d
xorl %r9d, %r9d
xorl %r10d, %r10d
cmpq %r12, %r11
je 0x124c4d
movl (%r8,%r12), %eax
movl 0x4(%r8,%r12), %ebx
cmpl %ebx, %esi
cmovbl %esi, %ebx
cmpl %eax, %edi
cmoval %edi, %eax
subl %eax, %ebx
leal 0x1(%rbx), %r15d
movl $0x0, %eax
cmovbl %eax, %r15d
movq %r10, %rax
addq %r9, %rax
setne %al
testl %r15d, %r15d
sete %bl
testb %bl, %al
jne 0x124c4d
testq %r15, %r15
je 0x124c2a
movb 0x14(%r8,%r12), %al
testb %al, %al
je 0x124c27
cmpl $0x3, %ecx
setge %bl
testb $0x2, %al
sete %al
orb %bl, %al
je 0x124c27
addq %r15, %r9
jmp 0x124c2a
addq %r15, %r10
addq $0x18, %r12
jmp 0x124bcb
movq 0x10(%rsp), %rbp
movq 0x8(%rsp), %r11
movq 0x38(%rsp), %r9
pushq $0x2
popq %r15
movq 0x18(%rsp), %rax
jmp 0x124d37
movq %r9, %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd %xmm5, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
addq %r9, %r10
movq %r10, %xmm0
punpckldq %xmm4, %xmm0    # xmm0 = xmm0[0],xmm4[0],xmm0[1],xmm4[1]
subpd %xmm5, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
mulsd %xmm3, %xmm2
ucomisd %xmm1, %xmm2
movq 0x8(%rsp), %r11
movq 0x38(%rsp), %r9
pushq $0x2
popq %r15
movq 0x18(%rsp), %rax
jae 0x124d37
movq 0x18(%rax), %rcx
cmpq 0x20(%rax), %rcx
jne 0x124d00
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
cmoveq %r15, %rsi
movq %rsi, 0x20(%rax)
movq 0x28(%rax), %rdi
shlq $0x4, %rsi
movq %r9, %rbx
callq 0x2370
movapd 0xbe5ac(%rip), %xmm5    # 0x1e3280
movq 0xbe594(%rip), %xmm4    # 0x1e3270
movq %rbx, %r9
movsd 0x50(%rsp), %xmm3
movq 0x8(%rsp), %r11
movq %rax, %rcx
movq 0x48(%rsp), %rax
movq 0x28(%rax), %rax
movq %rcx, 0x28(%rax)
movq 0x10(%rbx), %rdx
jmp 0x124d04
movq 0x28(%rax), %rcx
movq 0x18(%rax), %r8
leaq 0x1(%r8), %rsi
movq %rsi, 0x18(%rax)
shlq $0x4, %r8
movl 0x8(%rdx,%r14), %esi
movl 0x14(%rdx,%r14), %edi
shlq $0x20, %rsi
orq %rsi, %rdi
movq %rdi, (%rcx,%r8)
movsd 0x20(%rdx,%r14), %xmm0
movsd %xmm0, 0x8(%rcx,%r8)
incl %r13d
jmp 0x124a80
movq 0x48(%rsp), %r13
xorl %ecx, %ecx
xorpd %xmm0, %xmm0
xorl %edx, %edx
movl %ecx, %ecx
movl %edx, %esi
cmpq %rcx, 0x18(%rax)
jbe 0x124d8b
movq 0x28(%rax), %rdi
movq %rcx, %r8
shlq $0x4, %r8
movsd 0x8(%rdi,%r8), %xmm1
ucomisd %xmm0, %xmm1
jne 0x124d70
jnp 0x124d87
addq %rdi, %r8
shlq $0x4, %rsi
movupd (%r8), %xmm1
movupd %xmm1, (%rdi,%rsi)
incl %edx
movq 0x28(%r13), %rax
incl %ecx
jmp 0x124d4c
movq %rsi, 0x18(%rax)
movq 0x28(%rax), %rdi
shlq $0x4, %rsi
addq %rdi, %rsi
callq 0x122033
movq %r13, %rdi
callq 0x1226d6
movq 0x28(%r13), %rdi
callq 0x123f79
cmpl $0x0, 0x74(%rsp)
je 0x124dc0
movq 0x28(%r13), %rdi
callq 0x123de4
movq 0x8(%rsp), %rdi
callq 0x2220
movq %rbp, %rdi
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2220