// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/inter.cpp
// Function: dd_ul_vec_t(ul_idx_t const*, mg_lchain_t*, long, ul_vec_t*, long)
void dd_ul_vec_t(const ul_idx_t *uref, mg_lchain_t *a, int64_t a_n, ul_vec_t *rch, int64_t ulid)
{
	int64_t k, l, ovlp, novlp, tt, rs, re; uint64_t i; uc_block_t *z; mg_lchain_t *p, *c;
	for (l = 0, k = 1; k <= a_n; k++) {
		if(k == a_n || a[k].score != a[l].score) { ///x[k] and x[l] come from the same unitig
			renew_mg_lchains(uref->ug, a + l, k - l, ulid);
			l = k;
		}
	}

	
	for (i = 0; i < rch->bb.n; i++) {
		rch->bb.a[i].pidx = 0xfffffffe;
		rch->bb.a[i].aidx = rch->bb.a[i].pdis = (uint32_t)-1;
	}

	for (k = 0; k < a_n; k++) {
		if(a[k].dist_pre >= 0) {///not a new alignment
			z = &(rch->bb.a[a[k].dist_pre]); 
			assert(z->hid == (a[k].v>>1) && z->rev == (a[k].v&1));
			if((int64_t)z->qs == a[k].qs && (int64_t)z->qe == a[k].qe && (int64_t)z->ts == a[k].rs && (int64_t)z->te == a[k].re) {
				z->pidx = k; z->pchain = 1;
			} else {
				ovlp = novlp = tt = 0;
				ovlp = ((MIN((int64_t)z->qe, a[k].qe) > MAX((int64_t)z->qs, a[k].qs))? (MIN((int64_t)z->qe, a[k].qe)-MAX((int64_t)z->qs, a[k].qs)):0);
				tt += ovlp;
				novlp += (a[k].qe - a[k].qs - ovlp) + (z->qe - z->qs - ovlp);

				ovlp = ((MIN((int64_t)z->te, a[k].re) > MAX((int64_t)z->ts, a[k].rs))? (MIN((int64_t)z->te, a[k].re)-MAX((int64_t)z->ts, a[k].rs)):0);
				tt += ovlp;
				novlp += (a[k].re - a[k].rs - ovlp) + (z->te - z->ts - ovlp);
				if(novlp > 8 || novlp > (tt*0.01)) {
					kv_pushp(uc_block_t, rch->bb, &z); 
					z->hid = (a[k].v>>1); z->rev = (a[k].v&1); 
					z->pchain = 2; z->base = 0; z->el = 1;
					z->qs = a[k].qs; z->qe = a[k].qe;
					z->te = a[k].re; z->ts = a[k].rs;
					z->pidx = k;
					z->aidx = z->pdis = (uint32_t)-1;
				} else {
					z->qs = a[k].qs; z->qe = a[k].qe;
					z->te = a[k].re; z->ts = a[k].rs;
					z->pidx = k; z->pchain = 1;
				}
			}
		} else {
			kv_pushp(uc_block_t, rch->bb, &z); 
			z->hid = (a[k].v>>1); z->rev = (a[k].v&1); 
			z->pchain = 2; z->base = 0; z->el = 1;
			z->qs = a[k].qs; z->qe = a[k].qe;
			z->te = a[k].re; z->ts = a[k].rs;
			z->pidx = k;
			z->aidx = z->pdis = (uint32_t)-1;
		}
	}

	for (i = k = 0; i < rch->bb.n; i++) {
		if(rch->bb.a[i].pidx == 0xfffffffe && (rch->bb.a[i].pchain != 1 || rch->bb.a[i].pchain != 0)) continue;
		rch->bb.a[k++] = rch->bb.a[i];
	}
	rch->bb.n = k;

	radix_sort_uc_block_t_qe_srt(rch->bb.a, rch->bb.a + rch->bb.n);
	for (l = 0, k = 1; k <= (int64_t)rch->bb.n; k++) {
		if(k == (int64_t)rch->bb.n || rch->bb.a[k].qe != rch->bb.a[l].qe) {
			if(k - l > 1) radix_sort_uc_block_t_qs_srt(rch->bb.a+l, rch->bb.a+k);
			for (; l < k; l++) {
				if(rch->bb.a[l].pidx == 0xfffffffe) {
					rch->bb.a[l].pidx = (uint32_t)-1;
				} else {
					a[rch->bb.a[l].pidx].dist_pre = l;
				}
			}
		}
	}

	// for (i = 0; i < rch->bb.n; i++) {
	// 	if(rch->bb.a[i].pidx == 0xfffffffe) {
	// 		rch->bb.a[i].pidx = (uint32_t)-1;
	// 	} else {
	// 		a[rch->bb.a[i].pidx].dist_pre = i;
	// 	}
	// }
	// fprintf(stderr, "\n[M::%s::]\n", __func__);
	for (i = 0, k = -1; i < rch->bb.n; i++) {
		if(rch->bb.a[i].pidx == (uint32_t)-1) continue;
		if(k < 0) k = i;///in case there is only one UL-to-HiFi alignment
		if(a[rch->bb.a[i].pidx].hash_pre == (uint32_t)-1) {
			rch->bb.a[i].pidx = (uint32_t)-1;
			continue;
		}
		c = &(a[rch->bb.a[i].pidx]); p = &(a[a[rch->bb.a[i].pidx].hash_pre]);
		rch->bb.a[i].pidx = a[a[rch->bb.a[i].pidx].hash_pre].dist_pre; 
		rch->bb.a[rch->bb.a[i].pidx].aidx = i;
		tt = g_adjacent_dis_mul(uref->r_ug->rg, NULL, -1, -1, 
			((rch->bb.a[i].hid<<1)|((uint32_t)rch->bb.a[i].rev))^1, 
			((rch->bb.a[rch->bb.a[i].pidx].hid<<1)|((uint32_t)rch->bb.a[rch->bb.a[i].pidx].rev))^1);
		if(tt >= 0) {
			rch->bb.a[i].pdis = tt;
			// get_r_offset(uref->ug, p, NULL, &rs, NULL, NULL);
			// get_r_offset(uref->ug, c, NULL, &re, NULL, NULL);
			// fprintf(stderr, "+i->%lu: dis->%u, record_dis->%ld\n", i, rch->bb.a[i].pdis, re-rs);
		} else {
			rs = p->off + uref->ug->g->seq[p->score>>1].len;
			re = c->off + uref->ug->g->seq[c->score>>1].len;
			if(re >= rs) rch->bb.a[i].pdis = re - rs;
			else rch->bb.a[i].pdis = (uint32_t)-1;
			// fprintf(stderr, "-i->%lu: dis->%u\n", i, rch->bb.a[i].pdis);
		}

		k = i;
		// if(rch->bb.a[i].base || rch->bb.a[i].pchain == 0 || rch->bb.a[i].el == 0) {
		// 	fprintf(stderr, "+++(%lu) base:%u, pchain:%u, el:%u\n", 
		// 	i, rch->bb.a[i].base, rch->bb.a[i].pchain, rch->bb.a[i].el);
		// }
	}

	///make sure if this UL read has been done
	uint32_t sp = (uint32_t)-1, ep = (uint32_t)-1;
	for (l = 0 ; k >= 0; ) {
		// fprintf(stderr, "k->%ld\n", k);
		if(sp == (uint32_t)-1 || rch->bb.a[k].qe <= sp) {
            if(sp != (uint32_t)-1) l += ep - sp;
            sp = rch->bb.a[k].qs; ep = rch->bb.a[k].qe;
        } else {
            sp = MIN(sp, rch->bb.a[k].qs);
        }
		if(rch->bb.a[k].pidx == (uint32_t)-1) k = -1;
		else k = rch->bb.a[k].pidx;
	}

	if(sp != (uint32_t)-1) l += ep - sp;
	if(l == (int64_t)rch->rlen) rch->dd = 1;


	///debug_ssb
	// for (k = 0; (uint32_t)k < rch->bb.n; k++) {
	// 	if(rch->bb.a[k].pidx != (uint32_t)-1) {
	// 		if((rch->bb.a[k].pidx >= 0) && (rch->bb.a[k].pidx < rch->bb.n) && 
	// 					(rch->bb.a[rch->bb.a[k].pidx].aidx == k)) {
	// 			;
	// 		} else {
	// 			fprintf(stderr, "[M::%s::k->%ld] +rch->bb.n::%u\n", __func__, k, (uint32_t)rch->bb.n);
	// 			for (l = 0; (uint32_t)l < rch->bb.n; l++) {
	// 				fprintf(stderr, "[M::%.*s::k->%lu] q::[%u, %u), t::[%u, %u), pidx::%u, aidx::%u\n", 
	// 				(int)Get_NAME_LENGTH(R_INF, rch->bb.a[l].hid), Get_NAME(R_INF, rch->bb.a[l].hid), l, 
	// 				rch->bb.a[l].qs, rch->bb.a[l].qe, rch->bb.a[l].ts, rch->bb.a[l].te, 
	// 				rch->bb.a[l].pidx, rch->bb.a[l].aidx);
	// 			}
	// 			exit(1);
	// 		}
	// 	}

	// 	if(rch->bb.a[k].aidx != (uint32_t)-1) {
	// 		if((rch->bb.a[k].aidx >= 0) && (rch->bb.a[k].aidx < rch->bb.n) && 
	// 					(rch->bb.a[rch->bb.a[k].aidx].pidx == k)) {
	// 			;
	// 		} else {
	// 			fprintf(stderr, "[M::%s::k->%ld] -rch->bb.n::%u\n", __func__, k, (uint32_t)rch->bb.n);
	// 			for (l = 0; (uint32_t)l < rch->bb.n; l++) {
	// 				fprintf(stderr, "[M::%.*s::k->%lu] q::[%u, %u), t::[%u, %u), pidx::%u, aidx::%u\n", 
	// 				(int)Get_NAME_LENGTH(R_INF, rch->bb.a[l].hid), Get_NAME(R_INF, rch->bb.a[l].hid), l, 
	// 				rch->bb.a[l].qs, rch->bb.a[l].qe, rch->bb.a[l].ts, rch->bb.a[l].te, 
	// 				rch->bb.a[l].pidx, rch->bb.a[l].aidx);
	// 			}
	// 			exit(1);
	// 		}
	// 	}
	// }

	// if(ulid == 292) {
	// 	for (i = 0; i < rch->bb.n; i++) {
	// 		fprintf(stderr, "(%lu) qs:%u, qe:%u, ts:%u, te:%u, pidx:%u\n", i, 
	// 		rch->bb.a[i].qs, rch->bb.a[i].qe, rch->bb.a[i].ts, rch->bb.a[i].te, rch->bb.a[i].pidx);
	// 	}
	// }

	// for (i = 0; i < rch->bb.n; i++) {
	// 	if(rch->bb.a[i].pidx == (uint32_t)-1) continue;
	// 	if(rch->bb.a[i].base || rch->bb.a[i].pchain == 0 || rch->bb.a[i].el == 0) {
	// 		fprintf(stderr, "(%lu) base:%u, pchain:%u, el:%u\n", 
	// 		i, rch->bb.a[i].base, rch->bb.a[i].pchain, rch->bb.a[i].el);
	// 	}
	// 	assert((!(rch->bb.a[i].base)) && (rch->bb.a[i].pchain) && (rch->bb.a[i].el));
	// 	assert((!(rch->bb.a[rch->bb.a[i].pidx].base)) && (rch->bb.a[rch->bb.a[i].pidx].pchain) 
	// 														&& (rch->bb.a[rch->bb.a[i].pidx].el));
	// }
	// int64_t exact = 0, inexact = 0; uc_block_t *z;
	// for (k = 0; k < a_n; k++) {
	// 	// fprintf(stderr, "(%ld) a->qs:%d, a->qe:%d, a->rs:%d, a->re:%d\n", k, a[k].qs, a[k].qe, a[k].rs, a[k].re);
	// 	if(a[k].dist_pre < 0) continue;
	// 	z = &(rch->bb.a[a[k].dist_pre]);
	// 	assert(z->hid == (a[k].v>>1) && z->rev == (a[k].v&1));
	// 	if((int64_t)z->qs == a[k].qs && (int64_t)z->qe == a[k].qe && (int64_t)z->ts == a[k].rs && (int64_t)z->te == a[k].re) {
	// 		exact++;
	// 	} else {
	// 		inexact++;
	// 		// fprintf(stderr, "+z->qs:%u, z->qe:%u, z->ts:%u, z->te:%u\n", z->qs, z->qe, z->ts, z->te);
	// 		// fprintf(stderr, "-a->qs:%d, a->qe:%d, a->rs:%d, a->re:%d\n\n", a[k].qs, a[k].qe, a[k].rs, a[k].re);
	// 	}
	// }
	// fprintf(stderr, "[M::%s::exact->%ld, inexact->%ld]\n", __func__, exact, inexact);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, (%rsp)
movq %rsi, %r12
movq %rdi, %r13
movq %rdx, 0x10(%rsp)
testq %rdx, %rdx
jle 0x1d4ec8
movq 0x10(%rsp), %rbx
negq %rbx
leaq 0x44(%r12), %r14
movl $0x1, %r15d
xorl %eax, %eax
movq %rbx, %rcx
addq %r15, %rcx
je 0x1d4e9a
movl (%r14), %ecx
leaq (%rax,%rax,4), %rdx
cmpl 0x1c(%r12,%rdx,8), %ecx
je 0x1d4eb4
movq (%r13), %rdi
leaq (%rax,%rax,4), %rcx
leaq (%r12,%rcx,8), %rsi
movq %r15, %rdx
subq %rax, %rdx
callq 0x1d4967
movq %r15, %rax
leaq (%rbx,%r15), %rcx
incq %rcx
incq %r15
addq $0x28, %r14
cmpq $0x1, %rcx
jne 0x1d4e84
movq (%rsp), %r14
movq 0x20(%r14), %rax
testq %rax, %rax
je 0x1d4ef7
movq 0x30(%r14), %rcx
addq $0x1c, %rcx
movq %rax, %rdx
movq $-0x2, -0x8(%rcx)
movl $0xffffffff, (%rcx)     # imm = 0xFFFFFFFF
addq $0x24, %rcx
decq %rdx
jne 0x1d4ee0
cmpq $0x0, 0x10(%rsp)
movq %r12, 0x28(%rsp)
movq %r13, 0x30(%rsp)
jle 0x1d5196
leaq 0x8(%r12), %r13
xorl %ebp, %ebp
movslq 0x18(%r13), %rcx
testq %rcx, %rcx
js 0x1d4fbd
movq 0x30(%r14), %rax
leaq (%rcx,%rcx,8), %rsi
movl (%r13), %ecx
movl %ecx, %edx
shrl %edx
cmpl %edx, (%rax,%rsi,4)
jne 0x1d5482
leaq (%rax,%rsi,4), %rsi
movl 0x20(%rsi), %edi
movl %ecx, %r8d
andl $0x1, %r8d
btl $0x5, %edi
sbbl $0x0, %r8d
jne 0x1d5482
movl 0x4(%rsi), %r11d
movl 0x8(%rsi), %r10d
movl 0xc(%r13), %r8d
movl %r8d, 0x18(%rsp)
movslq %r8d, %rbx
cmpq %rbx, %r11
jne 0x1d503e
movl 0x10(%r13), %r8d
movl %r8d, 0x8(%rsp)
movslq %r8d, %r15
cmpq %r15, %r10
jne 0x1d504a
movl 0xc(%rsi), %r8d
movslq 0x4(%r13), %r9
cmpq %r9, %r8
jne 0x1d504a
movl 0x10(%rsi), %r8d
movslq 0x8(%r13), %r9
cmpq %r9, %r8
jne 0x1d504a
movl %ebp, 0x14(%rsi)
andb $-0x20, %dil
incb %dil
movb %dil, 0x20(%rsi)
jmp 0x1d5180
movq 0x20(%r14), %rcx
movq 0x30(%r14), %rax
cmpq 0x28(%r14), %rcx
jne 0x1d4ff7
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rdx
movq %rdx, 0x28(%r14)
shlq $0x2, %rdx
leaq (%rdx,%rdx,8), %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x30(%r14)
movq 0x20(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x20(%r14)
leaq (%rcx,%rcx,8), %rcx
movl (%r13), %edx
movl %edx, %esi
shrl %esi
movl %esi, (%rax,%rcx,4)
shlb $0x5, %dl
andb $0x20, %dl
orb $-0x7e, %dl
movb %dl, 0x20(%rax,%rcx,4)
movdqu 0x4(%r13), %xmm0
pshufd $0x4e, %xmm0, %xmm0     # xmm0 = xmm0[2,3,0,1]
movdqu %xmm0, 0x4(%rax,%rcx,4)
movl %ebp, 0x14(%rax,%rcx,4)
movq $-0x1, 0x18(%rax,%rcx,4)
jmp 0x1d5180
movl 0x10(%r13), %r8d
movl %r8d, 0x8(%rsp)
movslq %r8d, %r15
movl %edi, 0x24(%rsp)
cmpq %r15, %r10
cmovlq %r10, %r15
cmpq %rbx, %r11
cmovgq %r11, %rbx
subq %rbx, %r15
jg 0x1d5064
xorl %r15d, %r15d
movl 0xc(%rsi), %r9d
movl 0x10(%rsi), %r14d
movslq 0x8(%r13), %r8
cmpq %r8, %r14
movq %r8, %r12
cmovlq %r14, %r12
movslq 0x4(%r13), %rdi
cmpq %rdi, %r9
movq %rdi, %rbx
cmovgq %r9, %rbx
subq %rbx, %r12
jg 0x1d5090
xorl %r12d, %r12d
addq %r15, %r12
movl 0x8(%rsp), %ebx
movl 0x18(%rsp), %r15d
subl %r15d, %ebx
movslq %ebx, %rbx
subl %r11d, %r10d
addq %rbx, %r10
movl %r8d, %r11d
subl %edi, %r11d
movslq %r11d, %r11
subl %r9d, %r14d
addq %r11, %r14
addq %r10, %r14
subq %r12, %r14
subq %r12, %r14
cmpq $0x8, %r14
jg 0x1d50de
cvtsi2sd %r14, %xmm0
cvtsi2sd %r12, %xmm1
mulsd 0x66158(%rip), %xmm1    # 0x23b230
ucomisd %xmm1, %xmm0
jbe 0x1d515c
movq (%rsp), %r14
movq 0x20(%r14), %rsi
cmpq 0x28(%r14), %rsi
jne 0x1d5120
leaq (%rsi,%rsi), %rcx
testq %rsi, %rsi
movl $0x2, %edx
cmoveq %rdx, %rcx
movq %rcx, 0x28(%r14)
shlq $0x2, %rcx
leaq (%rcx,%rcx,8), %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x30(%r14)
movq 0x20(%r14), %rsi
movl (%r13), %ecx
movl %ecx, %edx
shrl %edx
leaq 0x1(%rsi), %rdi
movq %rdi, 0x20(%r14)
leaq (%rsi,%rsi,8), %rsi
movl %edx, (%rax,%rsi,4)
shlb $0x5, %cl
andb $0x20, %cl
orb $-0x7e, %cl
movb %cl, 0x20(%rax,%rsi,4)
movdqu 0x4(%r13), %xmm0
pshufd $0x4e, %xmm0, %xmm0     # xmm0 = xmm0[2,3,0,1]
movdqu %xmm0, 0x4(%rax,%rsi,4)
movl %ebp, 0x14(%rax,%rsi,4)
movq $-0x1, 0x18(%rax,%rsi,4)
jmp 0x1d5180
movl %r15d, 0x4(%rsi)
movl 0x8(%rsp), %eax
movl %eax, 0x8(%rsi)
movl %r8d, 0x10(%rsi)
movl %edi, 0xc(%rsi)
movl %ebp, 0x14(%rsi)
movl 0x24(%rsp), %eax
andb $-0x20, %al
incb %al
movb %al, 0x20(%rsi)
movq (%rsp), %r14
incq %rbp
addq $0x28, %r13
cmpq %rbp, 0x10(%rsp)
jne 0x1d4f14
movq 0x20(%r14), %rax
testq %rax, %rax
je 0x1d51e8
xorl %edx, %edx
xorl %ecx, %ecx
xorl %esi, %esi
movq 0x30(%r14), %rdi
cmpl $-0x2, 0x14(%rdi,%rdx)
je 0x1d51da
leaq (%rdi,%rdx), %rax
leaq (%rcx,%rcx,8), %r8
incq %rcx
movl 0x20(%rax), %r9d
movl %r9d, 0x20(%rdi,%r8,4)
movdqu (%rax), %xmm0
movupd 0x10(%rax), %xmm1
movupd %xmm1, 0x10(%rdi,%r8,4)
movdqu %xmm0, (%rdi,%r8,4)
movq 0x20(%r14), %rax
incq %rsi
addq $0x24, %rdx
cmpq %rax, %rsi
jb 0x1d51a1
jmp 0x1d51ea
xorl %ecx, %ecx
movq %rcx, 0x20(%r14)
movq 0x30(%r14), %rdi
leaq (%rcx,%rcx,8), %rax
leaq (%rdi,%rax,4), %rsi
callq 0x19f452
movq 0x20(%r14), %r12
testq %r12, %r12
jle 0x1d52bd
movl $0x1, %ebp
xorl %r15d, %r15d
movl $0xfffffffe, %r13d      # imm = 0xFFFFFFFE
cmpq %r12, %rbp
je 0x1d523c
movq 0x30(%r14), %rax
leaq (,%rbp,8), %rcx
addq %rbp, %rcx
movl 0x8(%rax,%rcx,4), %ecx
leaq (%r15,%r15,8), %rdx
cmpl 0x8(%rax,%rdx,4), %ecx
je 0x1d52a9
movq %rbp, %rax
subq %r15, %rax
cmpq $0x2, %rax
jl 0x1d5268
movq 0x30(%r14), %rax
leaq (%r15,%r15,8), %rcx
leaq (%rax,%rcx,4), %rdi
leaq (,%rbp,8), %rcx
addq %rbp, %rcx
leaq (%rax,%rcx,4), %rsi
callq 0x19f70e
cmpq %r15, %rbp
jle 0x1d52a9
movq 0x30(%r14), %rax
leaq (%r15,%r15,8), %rcx
leaq (%rax,%rcx,4), %rax
addq $0x14, %rax
movq 0x28(%rsp), %rdx
movl (%rax), %ecx
cmpq %r13, %rcx
jne 0x1d5291
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0x1d529a
leaq (%rcx,%rcx,4), %rcx
movl %r15d, 0x20(%rdx,%rcx,8)
incq %r15
addq $0x24, %rax
cmpq %r15, %rbp
jne 0x1d5282
movq %rbp, %r15
leaq 0x1(%rbp), %rax
movq 0x20(%r14), %r12
cmpq %r12, %rbp
movq %rax, %rbp
jl 0x1d521a
testq %r12, %r12
je 0x1d545e
movq 0x30(%r14), %rax
movq %rax, 0x18(%rsp)
leaq 0x20(%rax), %rbp
movq $-0x1, %rax
xorl %r15d, %r15d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq 0x28(%rsp), %r13
movl -0xc(%rbp), %ecx
cmpq %rdx, %rcx
je 0x1d53e3
leaq (%rcx,%rcx,4), %rbx
movl 0x24(%r13,%rbx,8), %ecx
cmpq %rdx, %rcx
je 0x1d5375
leaq (%rcx,%rcx,4), %rax
movq %rax, 0x8(%rsp)
movl 0x20(%r13,%rax,8), %eax
movl %eax, -0xc(%rbp)
leaq (%rax,%rax,8), %rax
movq 0x18(%rsp), %rsi
movl %r15d, 0x1c(%rsi,%rax,4)
movq 0x30(%rsp), %r14
movq 0x28(%r14), %rcx
movq 0x20(%rcx), %rdi
movl -0x20(%rbp), %ecx
movl (%rbp), %edx
shrl $0x5, %edx
andl $0x1, %edx
leal (%rdx,%rcx,2), %r8d
xorl $0x1, %r8d
movl (%rsi,%rax,4), %ecx
movl 0x20(%rsi,%rax,4), %eax
shrl $0x5, %eax
andl $0x1, %eax
leal (%rax,%rcx,2), %r9d
xorl $0x1, %r9d
xorl %esi, %esi
movq $-0x1, %rdx
movq $-0x1, %rcx
callq 0x1d4bf8
testq %rax, %rax
js 0x1d5385
movl %eax, -0x8(%rbp)
jmp 0x1d53d7
testq %rax, %rax
cmovsq %r15, %rax
movl $0xffffffff, -0xc(%rbp) # imm = 0xFFFFFFFF
jmp 0x1d53e3
leaq (,%rbx,8), %rcx
addq %r13, %rcx
movq 0x8(%rsp), %rax
leaq (%r13,%rax,8), %rax
movq (%r14), %rdx
movq 0x18(%rdx), %rdx
movq 0x20(%rdx), %rdx
movl 0x1c(%rax), %esi
sarl %esi
movslq %esi, %rsi
movl (%rdx,%rsi,8), %esi
movl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
andl %edi, %esi
addl (%rax), %esi
movl 0x1c(%rcx), %eax
sarl %eax
cltq
movl (%rdx,%rax,8), %eax
andl %edi, %eax
addl (%rcx), %eax
subl %esi, %eax
jge 0x1d53d4
movl $0xffffffff, -0x8(%rbp) # imm = 0xFFFFFFFF
jmp 0x1d53d7
movl %eax, -0x8(%rbp)
movq %r15, %rax
movq (%rsp), %r14
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
incq %r15
addq $0x24, %rbp
cmpq %r15, %r12
jne 0x1d52e7
testq %rax, %rax
js 0x1d545e
movq 0x30(%r14), %rdx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
cmpl $-0x1, %r8d
je 0x1d5436
leaq (%rax,%rax,8), %r9
cmpl %r8d, 0x8(%rdx,%r9,4)
jbe 0x1d5430
leaq (%rdx,%r9,4), %r9
movl 0x4(%r9), %r9d
cmpl %r9d, %r8d
cmovael %r9d, %r8d
jmp 0x1d5443
subl %r8d, %esi
addq %rsi, %rcx
leaq (%rax,%rax,8), %rsi
movl 0x4(%rdx,%rsi,4), %r8d
movl 0x8(%rdx,%rsi,4), %esi
leaq (%rax,%rax,8), %rax
movl 0x14(%rdx,%rax,4), %eax
cmpq %rdi, %rax
jne 0x1d540e
subl %r8d, %esi
xorl %eax, %eax
cmpl $-0x1, %r8d
cmovnel %esi, %eax
jmp 0x1d5462
xorl %ecx, %ecx
xorl %eax, %eax
addq %rax, %rcx
movl 0x18(%r14), %eax
cmpq %rax, %rcx
jne 0x1d5473
movb $0x1, 0x50(%r14)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6dc36(%rip), %rdi     # 0x2430bf
leaq 0x6a7cb(%rip), %rsi     # 0x23fc5b
leaq 0x6dc56(%rip), %rcx     # 0x2430ed
movl $0x3dd7, %edx           # imm = 0x3DD7
callq 0x2110