// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/anchor.cpp
// Function: minimizers_qgen_input(ha_abufl_s*, unsigned long, char*, long, unsigned long, unsigned long, Candidates_list*, kvec_t_u8_warp*, void*, ha_pt_s*, All_reads*, ul_idx_t const*, kvec_t_u64_warp*, st_mt_t*, unsigned int*, unsigned int*, ha_mzl_t*, unsigned long, ha_mzl_t*, long, unsigned long, unsigned long, kv_u_trans_t*)
void minimizers_qgen_input(ha_abufl_t *ab, uint64_t rid, char* rs, int64_t rl, uint64_t mz_w, uint64_t mz_k, Candidates_list *cl, kvec_t_u8_warp* k_flag, 
void *ha_flt_tab, ha_pt_t *ha_idx, All_reads* rdb, const ul_idx_t *udb, kvec_t_u64_warp* dbg_ct, st_mt_t *sp, uint32_t *high_occ, 
uint32_t *low_occ, ha_mzl_t *in, uint64_t in_n, ha_mzl_t *idx, int64_t idx_n, uint64_t mzl_cutoff, uint64_t chain_cutoff, kv_u_trans_t *kov)
{
	// fprintf(stderr, "+[M::%s]\n", __func__);
	uint64_t i, k, l, max_cnt = UINT32_MAX, min_cnt = 0, n; ha_mzl_t *z, *p, *y; anchor1_t *an;
	int64_t zi, ns, ne; uint8_t rev; k_mer_hit *s;
	if(high_occ) {
		max_cnt = (*high_occ);
		if(max_cnt < 2) max_cnt = 2;
	}
	if(low_occ) {
		min_cnt = (*low_occ);
		if(min_cnt < 2) min_cnt = 2;
	}
	clear_Candidates_list(cl); 

	for (i = 0, ab->n_a = 0; i < in_n; ++i) {
		///z is one of the minimizer
		z = &in[i]; p = &(idx[z->x]); n = 0;
		assert(z->pos == p->pos && z->rid == p->rid && z->span == p->span && z->rev == p->rev);
		for (zi = z->x+1; zi < idx_n && idx[zi].x == p->x && n < mzl_cutoff; zi++) {
			if(idx[zi].rid == rid) continue; n++;
		}
		for (zi = ((int64_t)z->x)-1; zi >= 0 && idx[zi].x == p->x && n < mzl_cutoff; zi--) {
			if(idx[zi].rid == rid) continue; n++;
		}
		if((!n) || (n >= mzl_cutoff)) continue;
		ab->n_a += n;
	}
	// if(rid == 0) {
	// 	fprintf(stderr, "-0-[M::%s] ab->n_a::%lu, in_n::%lu\n", __func__, ab->n_a, in_n);
	// }

	if (ab->n_a > ab->m_a) {
		ab->m_a = ab->n_a;
		REALLOC(ab->a, ab->m_a);
	}

	for (i = 0, k = 0; i < in_n; ++i) {
		///z is one of the minimizer
		z = &in[i]; p = &(idx[z->x]); n = 0; ns = 0; ne = -1;
		for (zi = z->x+1; zi < idx_n && idx[zi].x == p->x && n < mzl_cutoff; zi++) {
			if(idx[zi].rid == rid) continue; n++;
		}
		ne = zi;
		for (zi = ((int64_t)z->x)-1; zi >= 0 && idx[zi].x == p->x && n < mzl_cutoff; zi--) {
			if(idx[zi].rid == rid) continue; n++;
		}
		ns = zi + 1; 
		if((!n) || (n >= mzl_cutoff)) continue;
		n = ne - ns; if(n > ((uint32_t)(0xffffffu))) n = 0xffffffu; n<<=8;

		for (zi = z->x+1; zi < idx_n && idx[zi].x == p->x; zi++) {
			if(idx[zi].rid == rid) continue; 
			y = &(idx[zi]); an = &ab->a[k++];
			rev = z->rev == y->rev? 0 : 1;
			an->other_off = rev?((uint32_t)-1)-1-(y->pos+1-y->span):y->pos;
			an->self_off = z->pos;
			///an->cnt: cnt<<8|span
			an->cnt = ((z->span <= ((uint32_t)(0xffu)))?z->span:((uint32_t)(0xffu))); an->cnt |= n;
			an->srt = (uint64_t)y->rid<<33 | (uint64_t)rev<<32 | an->self_off;
		}
		for (zi = ((int64_t)z->x)-1; zi >= 0 && idx[zi].x == p->x; zi--) {
			if(idx[zi].rid == rid) continue; 
			y = &(idx[zi]); an = &ab->a[k++];
			rev = z->rev == y->rev? 0 : 1;
			an->other_off = rev?((uint32_t)-1)-1-(y->pos+1-y->span):y->pos;
			an->self_off = z->pos;
			///an->cnt: cnt<<8|span
			an->cnt = ((z->span <= ((uint32_t)(0xffu)))?z->span:((uint32_t)(0xffu))); an->cnt |= n;
			an->srt = (uint64_t)y->rid<<33 | (uint64_t)rev<<32 | an->self_off;
		}
	}
	assert(k == ab->n_a);

	uint64_t kn, spn; u_trans_t *ka; 
	kn = spn = 0; ka = NULL; sp->n = 0;
	if(kov) {
		kn = u_trans_n(*kov, rid); ka = u_trans_a(*kov, rid); 
	}
	if(kn > 0) {
		kv_resize(uint64_t, *sp, kn);
		for (k = 0; k < kn; ++k) {
			if(ka[k].del) continue;
			l = ka[k].tn; l <<= 1; l |= ka[k].rev; 
			kv_push(uint64_t, *sp, l);
		}
		if(sp->n > 1) radix_sort_anc64(sp->a, sp->a + sp->n);
	}

	radix_sort_ha_an1(ab->a, ab->a + ab->n_a); kn = 0;
	for (k = 1, l = n = 0, spn = sp->n; k <= ab->n_a; ++k) {
		if (k == ab->n_a || (ab->a[k].srt>>32) != (ab->a[l].srt>>32)) {
			if(k - l >= chain_cutoff) {
				for (; kn < spn && sp->a[kn] < (ab->a[l].srt>>32); kn++);
				if(kn < spn && sp->a[kn] == (ab->a[l].srt>>32)) kv_push(uint64_t, *sp, n);
				for (; kn < spn && sp->a[kn] == (ab->a[l].srt>>32); kn++) sp->a[kn] = (uint64_t)-1;
				for (i = l; i < k; i++) ab->a[n++] = ab->a[i];
			}
			l = k;
		}
	}
	ab->n_a = n;
	for (k = kn = 0; k < spn; k++) {
		if(sp->a[k] == (uint64_t)-1) continue;
		sp->a[kn++] = sp->a[k];
	}
	// sp->n = kn;
	if(kn > 0) gen_pair_chain(ab, rid, sp, kn, in, in_n, idx, idx_n, mzl_cutoff);
	if(spn > 0) {
		for (k = spn, kn = 0; k < sp->n; k++) sp->a[kn++] = sp->a[k];
		sp->n = kn;
	}
	

	// copy over to _cl_
	if (ab->n_a >= (uint64_t)cl->size) {
		cl->size = ab->n_a;
		REALLOC(cl->list, cl->size);
	}

    uint64_t tid = (uint64_t)-1, tl = (uint64_t)-1;
    for (k = 1, l = 0; k <= ab->n_a; ++k) {
        if (k == ab->n_a || ab->a[k].srt != ab->a[l].srt) {
            if (k-l>1) radix_sort_ha_an3(ab->a+l, ab->a+k);
            if((ab->a[l].srt>>33)!=tid) {
                tid = ab->a[l].srt>>33;
                tl = rdb?Get_READ_LENGTH((*rdb), tid):udb->ug->u.a[tid].len;
            } 
            for (i = l; i < k; i++) {
                s = &cl->list[i];
                s->readID = ab->a[i].srt>>33;
                s->strand = (ab->a[i].srt>>32)&1;
                if(!(s->strand)) {
                    s->offset = ab->a[i].other_off;
                } else {
                    s->offset = ((uint32_t)-1)-ab->a[i].other_off;
                    s->offset = tl-s->offset;
                }
                s->self_offset = ab->a[i].self_off;
                if(((ab->a[i].cnt>>8) < max_cnt) && ((ab->a[i].cnt>>8) > min_cnt)){
                    s->cnt = 1;
                } else if((ab->a[i].cnt>>8) <= min_cnt) {
                    s->cnt = 2;
                } else{
                    s->cnt = 1 + (((ab->a[i].cnt>>8) + (max_cnt<<1) - 1)/(max_cnt<<1));
                    s->cnt = pow(s->cnt, 1.1);
                }
                if(s->cnt > ((uint32_t)(0xffffffu))) s->cnt = 0xffffffu;
                s->cnt <<= 8; s->cnt |= (((uint32_t)(0xffu))&(ab->a[i].cnt));
            }
            l = k;
        }
    }
	cl->length = ab->n_a;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r15
movq 0xd8(%rsp), %rax
movq 0xd0(%rsp), %rcx
movabsq $0x100000000, %rdx      # imm = 0x100000000
testq %rcx, %rcx
je 0x12cc75
movl (%rcx), %ecx
cmpl $0x3, %ecx
movl $0x2, %edx
cmovael %ecx, %edx
jmp 0x12cc78
decq %rdx
movq %rdx, 0x28(%rsp)
movq 0x90(%rsp), %rcx
testq %rax, %rax
movq %rdi, 0x8(%rsp)
je 0x12cca3
movl (%rax), %eax
cmpl $0x3, %eax
movl $0x2, %edx
cmovael %eax, %edx
movq %rdx, 0x20(%rsp)
jmp 0x12ccac
movq $0x0, 0x20(%rsp)
movq 0xf8(%rsp), %rbp
movq 0xf0(%rsp), %r13
movq %rcx, %rdi
callq 0x3f1bd
movq 0x8(%rsp), %r11
movq $0x0, (%r11)
cmpq $0x0, 0xe8(%rsp)
je 0x12d138
leaq -0x1(%rbp), %rax
movq %rax, 0x30(%rsp)
leaq 0x20(%r13), %rax
movq %rax, 0x38(%rsp)
leaq -0x10(%r13), %rax
movq %rax, 0x40(%rsp)
xorl %eax, %eax
xorl %ecx, %ecx
leaq (%rcx,%rcx,2), %rdx
movq 0xe0(%rsp), %rsi
movq (%rsi,%rdx,8), %r8
movq 0x8(%rsi,%rdx,8), %rsi
leaq (%r8,%r8,2), %rdi
movq 0x8(%r13,%rdi,8), %r9
movq %r9, %r10
xorq %rsi, %r10
btrq $0x1f, %r10
testq %r10, %r10
jne 0x12d7b5
cmpq %r9, %rsi
jne 0x12d7b5
movq 0xe0(%rsp), %rsi
leaq (%rsi,%rdx,8), %rdx
leaq (,%rdi,8), %r9
addq %r13, %r9
movb 0x10(%r9), %sil
cmpb %sil, 0x10(%rdx)
jne 0x12d7b5
leaq 0x1(%r8), %rsi
cmpq %rbp, %rsi
jge 0x12cdaf
movq (%r9), %r10
movq 0x30(%rsp), %r11
subq %r8, %r11
movq 0x38(%rsp), %rdx
leaq (%rdx,%rdi,8), %rbx
xorl %edx, %edx
cmpq %r10, -0x8(%rbx)
jne 0x12cdb1
cmpq 0x100(%rsp), %rdx
jae 0x12cdb1
movq (%rbx), %r14
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
xorl %r12d, %r12d
cmpq %r15, %r14
setne %r12b
addq %r12, %rdx
addq $0x18, %rbx
decq %r11
jne 0x12cd7d
jmp 0x12cdb1
xorl %edx, %edx
testq %r8, %r8
movq 0x8(%rsp), %r11
jle 0x12cdfb
movq (%r9), %r8
movq 0x40(%rsp), %r9
leaq (%r9,%rdi,8), %rdi
cmpq %r8, -0x8(%rdi)
jne 0x12cdfb
cmpq 0x100(%rsp), %rdx
jae 0x12cdfb
movq (%rdi), %r9
andl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
xorl %r10d, %r10d
cmpq %r15, %r9
setne %r10b
addq %r10, %rdx
decq %rsi
addq $-0x18, %rdi
cmpq $0x1, %rsi
ja 0x12cdc7
testq %rdx, %rdx
sete %sil
cmpq 0x100(%rsp), %rdx
setae %dil
orb %sil, %dil
jne 0x12ce19
addq %rdx, %rax
movq %rax, (%r11)
incq %rcx
cmpq 0xe8(%rsp), %rcx
jne 0x12ccfe
cmpq 0x8(%r11), %rax
jbe 0x12ce4e
movq %rax, 0x8(%r11)
movq 0x30(%r11), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq 0x8(%rsp), %r11
movq %rax, 0x30(%r11)
leaq 0x28(%r13), %rax
movq %rax, 0x48(%rsp)
leaq -0x8(%r13), %rax
movq %rax, 0x50(%rsp)
xorl %esi, %esi
xorl %ecx, %ecx
leaq (%rsi,%rsi,2), %rbx
movq 0xe0(%rsp), %rax
movq (%rax,%rbx,8), %r12
leaq (%r12,%r12,2), %rdi
leaq (,%rdi,8), %rax
addq %r13, %rax
leaq 0x1(%r12), %r8
cmpq %rbp, %r8
movq %rax, 0x18(%rsp)
movq %rdi, 0x10(%rsp)
jge 0x12ceed
movq (%rax), %rax
movq 0x38(%rsp), %rdx
leaq (%rdx,%rdi,8), %r13
movq %r8, %r9
xorl %r14d, %r14d
cmpq %rax, -0x8(%r13)
jne 0x12cee6
cmpq 0x100(%rsp), %r14
jae 0x12cee6
movq (%r13), %rdx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
xorl %ebp, %ebp
cmpq %r15, %rdx
setne %bpl
addq %rbp, %r14
movq 0xf8(%rsp), %rbp
incq %r9
addq $0x18, %r13
cmpq %r9, %rbp
jne 0x12cea9
movq %rbp, %r9
movq 0x18(%rsp), %rax
jmp 0x12cef3
xorl %r14d, %r14d
movq %r8, %r9
testq %r12, %r12
jle 0x12cf50
movq (%rax), %rax
movq 0x40(%rsp), %rdx
movq 0x10(%rsp), %rdi
leaq (%rdx,%rdi,8), %rbp
movq %r12, %r13
cmpq %rax, -0x8(%rbp)
jne 0x12cf46
cmpq 0x100(%rsp), %r14
jae 0x12cf46
decq %r13
movq (%rbp), %rdx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
xorl %edi, %edi
cmpq %r15, %rdx
setne %dil
addq %rdi, %r14
leaq 0x1(%r13), %rdx
addq $-0x18, %rbp
cmpq $0x1, %rdx
ja 0x12cf0c
xorl %r13d, %r13d
movq 0xf8(%rsp), %rbp
jmp 0x12cf53
movq %r12, %r13
testq %r14, %r14
sete %al
cmpq 0x100(%rsp), %r14
setae %dl
orb %al, %dl
jne 0x12d106
movq 0xe0(%rsp), %rax
leaq (%rax,%rbx,8), %r14
subq %r13, %r9
movl $0xffffff, %eax         # imm = 0xFFFFFF
cmpq %rax, %r9
cmovaeq %rax, %r9
shll $0x8, %r9d
cmpq %rbp, %r8
jge 0x12d042
movq 0x18(%rsp), %rax
movq (%rax), %rbx
movq 0x30(%rsp), %r13
subq %r12, %r13
movq 0x48(%rsp), %rax
movq 0x10(%rsp), %rdx
leaq (%rax,%rdx,8), %rbp
cmpq %rbx, -0x10(%rbp)
jne 0x12d042
movq -0x8(%rbp), %rdx
movl %edx, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %r15, %rax
je 0x12d035
movq 0x8(%r14), %rax
xorq %rdx, %rax
shrq $0x20, %rdx
testl %eax, %eax
jns 0x12cfe6
movzbl (%rbp), %edi
subl %edx, %edi
addl $-0x3, %edi
movl %edi, %edx
leaq (%rcx,%rcx,2), %rdi
incq %rcx
shlq $0x3, %rdi
addq 0x30(%r11), %rdi
movl %edx, 0xc(%rdi)
movq 0x8(%r14), %rdx
shrq $0x20, %rdx
movl %edx, 0x8(%rdi)
movzbl 0x10(%r14), %r11d
orl %r9d, %r11d
movl %r11d, 0x10(%rdi)
movq -0x8(%rbp), %r11
shlq $0x21, %r11
addq %rax, %rax
movabsq $0x100000000, %r10      # imm = 0x100000000
andq %r10, %rax
orq %r11, %rax
movq 0x8(%rsp), %r11
orq %rdx, %rax
movq %rax, (%rdi)
addq $0x18, %rbp
decq %r13
jne 0x12cfb2
testq %r12, %r12
jle 0x12d110
movq 0x18(%rsp), %rax
movq (%rax), %r11
movq 0x50(%rsp), %rax
movq 0x10(%rsp), %rdx
leaq (%rax,%rdx,8), %r10
movq 0xf0(%rsp), %r13
movq 0xf8(%rsp), %rbp
cmpq %r11, -0x10(%r10)
jne 0x12d120
movq -0x8(%r10), %rdx
movl %edx, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %r15, %rax
je 0x12d0f3
movq 0x8(%r14), %rax
xorq %rdx, %rax
shrq $0x20, %rdx
testl %eax, %eax
jns 0x12d0a5
movzbl (%r10), %edi
subl %edx, %edi
addl $-0x3, %edi
movl %edi, %edx
leaq (%rcx,%rcx,2), %rdi
incq %rcx
shlq $0x3, %rdi
movq 0x8(%rsp), %rbx
addq 0x30(%rbx), %rdi
movl %edx, 0xc(%rdi)
movq 0x8(%r14), %rdx
shrq $0x20, %rdx
movl %edx, 0x8(%rdi)
movzbl 0x10(%r14), %ebx
orl %r9d, %ebx
movl %ebx, 0x10(%rdi)
movq -0x8(%r10), %rbx
shlq $0x21, %rbx
addq %rax, %rax
movabsq $0x100000000, %r12      # imm = 0x100000000
andq %r12, %rax
orq %rbx, %rax
orq %rdx, %rax
movq %rax, (%rdi)
decq %r8
addq $-0x18, %r10
cmpq $0x1, %r8
ja 0x12d071
jmp 0x12d120
movq 0xf0(%rsp), %r13
jmp 0x12d120
movq 0xf0(%rsp), %r13
movq 0xf8(%rsp), %rbp
incq %rsi
cmpq 0xe8(%rsp), %rsi
movq 0x8(%rsp), %r11
jne 0x12ce64
jmp 0x12d13a
xorl %ecx, %ecx
cmpq (%r11), %rcx
jne 0x12d7d4
movq 0x110(%rsp), %rax
movq 0xc8(%rsp), %rdi
movq $0x0, (%rdi)
testq %rax, %rax
je 0x12d27e
movq 0x28(%rax), %rcx
movq (%rcx,%r15,8), %r14
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
andq %r14, %rbx
je 0x12d27e
movq 0x10(%rax), %r12
shrq $0x20, %r14
cmpq %rbx, 0x8(%rdi)
jae 0x12d1e6
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(%rdi)
movq 0x10(%rdi), %rdi
leaq 0x8(,%rcx,8), %rsi
callq 0x2370
movq 0xc8(%rsp), %rdi
movq 0x8(%rsp), %r11
movq %rax, 0x10(%rdi)
leaq (%r14,%r14,2), %rax
shlq $0x4, %rax
leaq (%rax,%r12), %r14
addq $0x28, %r14
movl $0x2, %r12d
movzbl (%r14), %r13d
testb %r13b, %r13b
js 0x12d25a
movl -0x14(%r14), %ebp
movq (%rdi), %rcx
movq 0x10(%rdi), %rax
cmpq 0x8(%rdi), %rcx
jne 0x12d245
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
cmoveq %r12, %rsi
movq %rsi, 0x8(%rdi)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0xc8(%rsp), %rdi
movq 0x8(%rsp), %r11
movq %rax, 0x10(%rdi)
movq (%rdi), %rcx
addq %rbp, %rbp
shrl $0x6, %r13d
orq %rbp, %r13
leaq 0x1(%rcx), %rdx
movq %rdx, (%rdi)
movq %r13, (%rax,%rcx,8)
addq $0x30, %r14
decq %rbx
jne 0x12d1fc
movq (%rdi), %rax
cmpq $0x2, %rax
jb 0x12d27e
movq 0x10(%rdi), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x126447
movq 0x8(%rsp), %r11
movq (%r11), %rax
movq 0x30(%r11), %rdi
leaq (%rax,%rax,2), %rax
leaq (%rdi,%rax,8), %rsi
callq 0x125ce1
movq 0xc8(%rsp), %rdx
movq 0x8(%rsp), %rdi
movq (%rdx), %r14
movq (%rdi), %rax
testq %rax, %rax
je 0x12d443
movq 0x108(%rsp), %rbx
movl $0x1, %r13d
movq $-0x1, %r12
xorl %ebp, %ebp
xorl %r11d, %r11d
xorl %r8d, %r8d
movq 0x90(%rsp), %r10
cmpq %rax, %r13
je 0x12d2fd
movq 0x30(%rdi), %rax
leaq (,%r13,2), %rcx
addq %r13, %rcx
leaq (%r8,%r8,2), %rsi
movq (%rax,%rsi,8), %rsi
xorq (%rax,%rcx,8), %rsi
shrq $0x20, %rsi
je 0x12d42f
movq %r13, %rax
subq %r8, %rax
cmpq %rbx, %rax
jb 0x12d42c
cmpq %r14, %rbp
jae 0x12d3a2
movq 0x10(%rdx), %rax
movq 0x30(%rdi), %rcx
leaq (%r8,%r8,2), %rsi
movl 0x4(%rcx,%rsi,8), %ecx
cmpq %rcx, (%rax,%rbp,8)
jae 0x12d338
incq %rbp
cmpq %rbp, %r14
jne 0x12d325
jmp 0x12d3d0
jne 0x12d3a2
movq (%rdx), %rcx
cmpq 0x8(%rdx), %rcx
jne 0x12d397
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%rdx)
shlq $0x3, %rsi
movq %rax, %rdi
movq %r11, 0x10(%rsp)
movq %r8, %rbx
callq 0x2370
movq %rbx, %r8
movq 0x10(%rsp), %r11
movq 0x108(%rsp), %rbx
movq 0xc8(%rsp), %rdx
movq 0x90(%rsp), %r10
movq 0x8(%rsp), %rdi
movq %rax, 0x10(%rdx)
movq (%rdx), %rcx
leaq 0x1(%rcx), %rsi
movq %rsi, (%rdx)
movq %r11, (%rax,%rcx,8)
cmpq %r14, %rbp
jae 0x12d3d3
movq 0x10(%rdx), %rax
leaq (%r8,%r8,2), %rcx
shlq $0x3, %rcx
addq 0x30(%rdi), %rcx
movl 0x4(%rcx), %esi
cmpq %rsi, (%rax,%rbp,8)
jne 0x12d3d3
movq $-0x1, (%rax,%rbp,8)
incq %rbp
cmpq %rbp, %r14
jne 0x12d3b7
movq %r14, %rbp
cmpq %r8, %r13
jbe 0x12d42c
leaq (%r8,%r12), %rax
shlq $0x3, %r8
leaq (%r8,%r8,2), %rcx
leaq (,%r11,8), %rdx
leaq (%rdx,%rdx,2), %rdx
xorl %esi, %esi
movq 0x30(%rdi), %r9
movq 0x10(%r9,%rcx), %r8
movq %r8, 0x10(%r9,%rdx)
movupd (%r9,%rcx), %xmm0
movupd %xmm0, (%r9,%rdx)
decq %rsi
addq $0x18, %rcx
addq $0x18, %rdx
cmpq %rsi, %rax
jne 0x12d3f2
subq %rsi, %r11
movq %r13, %r8
movq 0xc8(%rsp), %rdx
jmp 0x12d42f
movq %r13, %r8
incq %r13
movq (%rdi), %rax
decq %r12
cmpq %rax, %r13
jbe 0x12d2d3
jmp 0x12d44e
xorl %r11d, %r11d
movq 0x90(%rsp), %r10
movq %r11, (%rdi)
testq %r14, %r14
je 0x12d502
movq 0x10(%rdx), %rax
xorl %ecx, %ecx
xorl %r8d, %r8d
movq 0xf0(%rsp), %r11
movq 0xf8(%rsp), %rbx
movq (%rax,%r8,8), %rsi
cmpq $-0x1, %rsi
je 0x12d484
movq %rsi, (%rax,%rcx,8)
incq %rcx
incq %r8
cmpq %r8, %r14
jne 0x12d473
testq %rcx, %rcx
je 0x12d4d0
subq $0x8, %rsp
movq %r15, %rsi
movq 0xe8(%rsp), %r8
movq 0xf0(%rsp), %r9
pushq 0x108(%rsp)
pushq %rbx
pushq %r11
callq 0x12c5bb
movq 0xe8(%rsp), %rdx
movq 0xb0(%rsp), %r10
movq 0x28(%rsp), %rdi
addq $0x20, %rsp
cmpq (%rdx), %r14
jae 0x12d4fc
movq 0x10(%rdx), %rax
leaq (%rax,%r14,8), %rcx
xorl %esi, %esi
movq (%rcx,%rsi,8), %r8
leaq 0x1(%rsi), %r9
movq %r8, (%rax,%rsi,8)
leaq (%r14,%rsi), %r8
incq %r8
movq %r9, %rsi
cmpq (%rdx), %r8
jb 0x12d4df
jmp 0x12d4ff
xorl %r9d, %r9d
movq %r9, (%rdx)
movq (%rdi), %rsi
cmpq 0x10(%r10), %rsi
jb 0x12d52e
movq %rsi, 0x10(%r10)
movq (%r10), %rdi
shlq $0x4, %rsi
callq 0x2370
movq 0x90(%rsp), %r10
movq 0x8(%rsp), %rdi
movq %rax, (%r10)
movq (%rdi), %rsi
movq 0x28(%rsp), %r8
movq 0x20(%rsp), %r9
testq %rsi, %rsi
je 0x12d7a0
movq 0xb0(%rsp), %r14
leaq (%r8,%r8), %rax
movq %rax, 0x18(%rsp)
leaq -0x1(,%r8,2), %rax
movq %rax, 0x40(%rsp)
movq 0x30(%rdi), %rax
movl $0x1, %ebp
movq $-0x1, %r15
xorl %ebx, %ebx
movq $-0x1, %r12
cmpq %rsi, %rbp
je 0x12d59a
leaq (,%rbp,2), %rcx
addq %rbp, %rcx
movq (%rax,%rcx,8), %rcx
leaq (%rbx,%rbx,2), %rdx
cmpq (%rax,%rdx,8), %rcx
je 0x12d78f
movq %rbp, %rcx
subq %rbx, %rcx
cmpq $0x2, %rcx
jb 0x12d5dd
leaq (%rbx,%rbx,2), %rcx
leaq (%rax,%rcx,8), %rdi
leaq (,%rbp,2), %rcx
addq %rbp, %rcx
leaq (%rax,%rcx,8), %rsi
callq 0x12621b
movq 0x20(%rsp), %r9
movq 0x90(%rsp), %r10
movq 0x28(%rsp), %r8
movq 0x8(%rsp), %rdi
movq 0x30(%rdi), %rax
leaq (%rbx,%rbx,2), %rcx
movq (%rax,%rcx,8), %rcx
shrq $0x21, %rcx
cmpq %r12, %rcx
je 0x12d61e
testq %r14, %r14
je 0x12d5fd
movq 0x18(%r14), %rdx
movq (%rdx,%rcx,8), %r15
jmp 0x12d61b
movq 0xb8(%rsp), %rdx
movq (%rdx), %rdx
movq 0x10(%rdx), %rdx
leaq (%rcx,%rcx,4), %rsi
movl (%rdx,%rsi,8), %r15d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
movq %rcx, %r12
cmpq %rbx, %rbp
jbe 0x12d78c
movq %r12, 0x30(%rsp)
movq %r15, 0x38(%rsp)
leal 0x1(%r15), %r11d
leaq (,%rbx,8), %rcx
leaq (%rcx,%rcx,2), %r14
movq %rbx, %r15
shlq $0x4, %r15
orq $0xc, %r15
movq %rbp, 0x10(%rsp)
movq (%r10), %r13
movq (%rax,%r14), %rax
shrq $0x21, %rax
movl -0xc(%r13,%r15), %ecx
movl $0x80000000, %esi       # imm = 0x80000000
andl %esi, %ecx
orl %eax, %ecx
movl %ecx, -0xc(%r13,%r15)
movq 0x30(%rdi), %rcx
movq (%rcx,%r14), %rcx
shrq %rcx
movl %ecx, %edx
andl %esi, %edx
orl %eax, %edx
movl %edx, -0xc(%r13,%r15)
movq 0x30(%rdi), %rax
sarl $0x1f, %ecx
andl %r11d, %ecx
addl 0xc(%rax,%r14), %ecx
movl %ecx, -0x8(%r13,%r15)
movl 0x8(%rax,%r14), %ecx
movl %ecx, -0x4(%r13,%r15)
movl 0x10(%rax,%r14), %eax
shrl $0x8, %eax
cmpl %eax, %r8d
ja 0x12d72d
cmpl %eax, %r9d
jae 0x12d72d
movl %r11d, %ebp
movq %rbx, %r12
shlq $0x4, %r12
addq %r13, %r12
movq 0x40(%rsp), %rcx
addq %rcx, %rax
xorl %edx, %edx
divq 0x18(%rsp)
incl %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd 0x108685(%rip), %xmm1   # 0x235d68
callq 0x23a0
cvttsd2si %xmm0, %rcx
movl %ecx, (%r13,%r15)
addq $0xc, %r12
cmpl $0x1000000, %ecx        # imm = 0x1000000
jb 0x12d70c
movl $0xffffff, (%r13,%r15)  # imm = 0xFFFFFF
movl $0xffffff, %ecx         # imm = 0xFFFFFF
movq 0x8(%rsp), %rdi
movq 0x28(%rsp), %r8
movq 0x90(%rsp), %r10
movq 0x20(%rsp), %r9
movl %ebp, %r11d
movq 0x10(%rsp), %rbp
jmp 0x12d74e
leaq (%r15,%r13), %r12
cmpq %rax, %r9
setb %cl
cmpq %rax, %r8
seta %al
andb %cl, %al
movzbl %al, %eax
movl $0x2, %ecx
subl %eax, %ecx
movl %ecx, (%r13,%r15)
shll $0x8, %ecx
movq 0x30(%rdi), %rax
movzbl 0x10(%rax,%r14), %edx
orl %ecx, %edx
movl %edx, (%r12)
incq %rbx
addq $0x18, %r14
addq $0x10, %r15
cmpq %rbx, %rbp
jne 0x12d651
movq %rbp, %rbx
movq 0xb0(%rsp), %r14
movq 0x38(%rsp), %r15
movq 0x30(%rsp), %r12
jmp 0x12d78f
movq %rbp, %rbx
incq %rbp
movq (%rdi), %rsi
cmpq %rsi, %rbp
jbe 0x12d578
jmp 0x12d7a2
xorl %esi, %esi
movq %rsi, 0x8(%r10)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10d3f8(%rip), %rdi    # 0x23abb4
leaq 0x10d440(%rip), %rsi    # 0x23ac03
leaq 0x10d4c7(%rip), %rcx    # 0x23ac91
movl $0x587, %edx            # imm = 0x587
callq 0x2110
leaq 0x10d4a9(%rip), %rdi    # 0x23ac84
leaq 0x10d421(%rip), %rsi    # 0x23ac03
leaq 0x10d4a8(%rip), %rcx    # 0x23ac91
movl $0x5bd, %edx            # imm = 0x5BD
callq 0x2110