// File: /workspace/github_cpp_makefile_star2_O1/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 0x126d8f
movl (%rcx), %ecx
cmpl $0x3, %ecx
movl $0x2, %edx
cmovael %ecx, %edx
jmp 0x126d92
decq %rdx
movq %rdx, 0x38(%rsp)
movq 0x90(%rsp), %rcx
testq %rax, %rax
movq %rdi, 0x8(%rsp)
je 0x126dbd
movl (%rax), %eax
cmpl $0x3, %eax
movl $0x2, %edx
cmovael %eax, %edx
movq %rdx, 0x18(%rsp)
jmp 0x126dc6
movq $0x0, 0x18(%rsp)
movq 0x100(%rsp), %rbp
movq %rcx, %rdi
callq 0x3fd1c
movq 0x8(%rsp), %rcx
movq $0x0, (%rcx)
cmpq $0x0, 0xe8(%rsp)
je 0x126f32
movq 0xf8(%rsp), %rax
decq %rax
movq 0xf0(%rsp), %rcx
leaq 0x20(%rcx), %rdx
movq %rdx, 0x10(%rsp)
leaq -0x10(%rcx), %rdx
xorl %esi, %esi
leaq (%rsi,%rsi,2), %rdi
movq 0xe0(%rsp), %rcx
movq (%rcx,%rdi,8), %r10
movq 0x8(%rcx,%rdi,8), %r8
leaq (%r10,%r10,2), %r9
movq 0xf0(%rsp), %rcx
movq 0x8(%rcx,%r9,8), %r11
movq %r11, %rbx
xorq %r8, %rbx
btrq $0x1f, %rbx
testq %rbx, %rbx
jne 0x127904
cmpq %r11, %r8
jne 0x127904
movq 0xe0(%rsp), %rcx
leaq (%rcx,%rdi,8), %rdi
movq 0xf0(%rsp), %rcx
leaq (%rcx,%r9,8), %r11
movb 0x10(%r11), %r8b
cmpb %r8b, 0x10(%rdi)
jne 0x127904
leaq 0x1(%r10), %r8
cmpq 0xf8(%rsp), %r8
jge 0x126ecb
movq (%r11), %rbx
movq %rax, %r14
subq %r10, %r14
movq 0x10(%rsp), %rcx
leaq (%rcx,%r9,8), %r12
xorl %edi, %edi
cmpq %rbx, -0x8(%r12)
jne 0x126ecd
cmpq %rbp, %rdi
jae 0x126ecd
movq (%r12), %r13
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %ecx, %ecx
cmpq %r15, %r13
setne %cl
addq %rcx, %rdi
addq $0x18, %r12
decq %r14
jne 0x126e9e
jmp 0x126ecd
xorl %edi, %edi
testq %r10, %r10
jle 0x126f07
movq (%r11), %r10
leaq (%rdx,%r9,8), %r9
cmpq %r10, -0x8(%r9)
jne 0x126f07
cmpq %rbp, %rdi
jae 0x126f07
movq (%r9), %rcx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
xorl %r11d, %r11d
cmpq %r15, %rcx
setne %r11b
addq %r11, %rdi
decq %r8
addq $-0x18, %r9
cmpq $0x1, %r8
jg 0x126ed9
testq %rdi, %rdi
sete %cl
cmpq %rbp, %rdi
setae %r8b
orb %cl, %r8b
movq 0x8(%rsp), %rcx
jne 0x126f21
addq %rdi, (%rcx)
incq %rsi
cmpq 0xe8(%rsp), %rsi
jne 0x126e13
movq (%rcx), %rax
cmpq 0x8(%rcx), %rax
jbe 0x126f59
movq %rax, 0x8(%rcx)
movq 0x30(%rcx), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq 0x8(%rsp), %rcx
movq %rax, 0x30(%rcx)
cmpq $0x0, 0xe8(%rsp)
je 0x127251
movq 0xf0(%rsp), %rax
leaq 0x20(%rax), %rcx
movq %rcx, 0x28(%rsp)
leaq -0x10(%rax), %rcx
movq %rcx, 0x30(%rsp)
movq 0xf8(%rsp), %r8
leaq -0x1(%r8), %rcx
movq %rcx, 0x48(%rsp)
leaq 0x28(%rax), %rcx
movq %rcx, 0x40(%rsp)
addq $-0x8, %rax
movq %rax, 0x50(%rsp)
xorl %r9d, %r9d
xorl %edi, %edi
leaq (%r9,%r9,2), %r14
movq 0xe0(%rsp), %rax
movq (%rax,%r14,8), %r10
leaq (%r10,%r10,2), %rdx
movq 0xf0(%rsp), %rax
leaq (%rax,%rdx,8), %rax
leaq 0x1(%r10), %rsi
cmpq %r8, %rsi
movq %rdx, 0x10(%rsp)
movq %rax, 0x20(%rsp)
jge 0x12702b
movq (%rax), %rax
movq 0x28(%rsp), %rcx
leaq (%rcx,%rdx,8), %rbx
movq %rsi, %r11
xorl %r12d, %r12d
cmpq %rax, -0x8(%rbx)
jne 0x12701f
cmpq %rbp, %r12
jae 0x12701f
movq (%rbx), %rcx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
xorl %r13d, %r13d
cmpq %r15, %rcx
setne %r13b
addq %r13, %r12
incq %r11
addq $0x18, %rbx
cmpq %r11, %r8
jne 0x126fef
movq %r8, %r11
movq 0x10(%rsp), %rdx
movq 0x20(%rsp), %rax
jmp 0x127031
xorl %r12d, %r12d
movq %rsi, %r11
testq %r10, %r10
jle 0x127083
movq (%rax), %rax
movq 0x30(%rsp), %rcx
leaq (%rcx,%rdx,8), %r13
movq %r10, %rbx
cmpq %rax, -0x8(%r13)
jne 0x127086
cmpq %rbp, %r12
jae 0x127086
decq %rbx
movq (%r13), %rcx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
xorl %ebp, %ebp
cmpq %r15, %rcx
setne %bpl
addq %rbp, %r12
movq 0x100(%rsp), %rbp
leaq 0x1(%rbx), %rcx
addq $-0x18, %r13
cmpq $0x1, %rcx
jg 0x127045
xorl %ebx, %ebx
jmp 0x127086
movq %r10, %rbx
testq %r12, %r12
sete %al
cmpq %rbp, %r12
setae %cl
orb %al, %cl
jne 0x127236
subq %rbx, %r11
movl $0xffffff, %eax         # imm = 0xFFFFFF
cmpq %rax, %r11
cmovaeq %rax, %r11
movq 0xe0(%rsp), %rax
leaq (%rax,%r14,8), %r14
shll $0x8, %r11d
leaq 0x1(%r10), %rax
cmpq %r8, %rax
jge 0x12717e
movq 0x20(%rsp), %rax
movq (%rax), %rbx
movq 0x48(%rsp), %r12
subq %r10, %r12
movq 0x40(%rsp), %rax
movq 0x10(%rsp), %rcx
leaq (%rax,%rcx,8), %r13
cmpq %rbx, -0x10(%r13)
jne 0x12717e
movq -0x8(%r13), %rcx
movl %ecx, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %r15, %rax
je 0x127171
movq 0x8(%r14), %rax
xorq %rcx, %rax
shrq $0x20, %rcx
testl %eax, %eax
jns 0x127119
movzbl (%r13), %ebp
subl %ecx, %ebp
addl $-0x3, %ebp
movl %ebp, %ecx
leaq (%rdi,%rdi,2), %rbp
incq %rdi
shlq $0x3, %rbp
movq 0x8(%rsp), %r8
addq 0x30(%r8), %rbp
movl %ecx, 0xc(%rbp)
movq 0x8(%r14), %rcx
shrq $0x20, %rcx
movl %ecx, 0x8(%rbp)
movzbl 0x10(%r14), %r8d
orl %r11d, %r8d
movl %r8d, 0x10(%rbp)
movq -0x8(%r13), %r8
shlq $0x21, %r8
addq %rax, %rax
movabsq $0x100000000, %rdx      # imm = 0x100000000
andq %rdx, %rax
orq %r8, %rax
orq %rcx, %rax
movq %rax, (%rbp)
movq 0x100(%rsp), %rbp
addq $0x18, %r13
decq %r12
jne 0x1270e4
testq %r10, %r10
jle 0x127236
movq 0x20(%rsp), %rax
movq (%rax), %r8
movq 0x50(%rsp), %rax
movq 0x10(%rsp), %rcx
leaq (%rax,%rcx,8), %rdx
movabsq $0x100000000, %r12      # imm = 0x100000000
cmpq %r8, -0x10(%rdx)
jne 0x127236
movq -0x8(%rdx), %rcx
movl %ecx, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %r15, %rax
je 0x127225
movq 0x8(%r14), %rax
xorq %rcx, %rax
shrq $0x20, %rcx
testl %eax, %eax
jns 0x1271de
movzbl (%rdx), %r10d
subl %ecx, %r10d
addl $-0x3, %r10d
movl %r10d, %ecx
leaq (%rdi,%rdi,2), %r10
incq %rdi
shlq $0x3, %r10
movq 0x8(%rsp), %rbx
addq 0x30(%rbx), %r10
movl %ecx, 0xc(%r10)
movq 0x8(%r14), %rcx
shrq $0x20, %rcx
movl %ecx, 0x8(%r10)
movzbl 0x10(%r14), %ebx
orl %r11d, %ebx
movl %ebx, 0x10(%r10)
movq -0x8(%rdx), %rbx
shlq $0x21, %rbx
addq %rax, %rax
andq %r12, %rax
orq %rbx, %rax
orq %rcx, %rax
movq %rax, (%r10)
decq %rsi
addq $-0x18, %rdx
cmpq $0x1, %rsi
jg 0x1271a7
incq %r9
cmpq 0xe8(%rsp), %r9
movq 0xf8(%rsp), %r8
jne 0x126faa
jmp 0x127253
xorl %edi, %edi
movq 0x8(%rsp), %rsi
cmpq (%rsi), %rdi
jne 0x127923
movq 0x110(%rsp), %rax
movq 0xc8(%rsp), %rdi
movq $0x0, (%rdi)
testq %rax, %rax
je 0x127299
movq 0x28(%rax), %rcx
movq (%rcx,%r15,8), %rcx
movl %ecx, %ebx
shrq $0x20, %rcx
leaq (%rcx,%rcx,2), %r14
shlq $0x4, %r14
addq 0x10(%rax), %r14
jmp 0x12729e
xorl %ebx, %ebx
xorl %r14d, %r14d
testq %rbx, %rbx
je 0x1273a9
cmpq %rbx, 0x8(%rdi)
jae 0x12730c
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), %rsi
movq %rax, 0x10(%rdi)
cmpq $0x1, %rbx
adcq $0x0, %rbx
shlq $0x4, %rbx
leaq (%rbx,%rbx,2), %rbx
xorl %r12d, %r12d
movzbl 0x28(%r14,%r12), %ebp
testb %bpl, %bpl
js 0x127385
movl 0x14(%r14,%r12), %r13d
movq 0x8(%rdi), %rax
cmpq %rax, (%rdi)
jne 0x12736a
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%rdi)
movq 0x10(%rdi), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0xc8(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %rax, 0x10(%rdi)
addq %r13, %r13
shrl $0x6, %ebp
orq %r13, %rbp
movq (%rdi), %rax
movq 0x10(%rdi), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rdi)
movq %rbp, (%rcx,%rax,8)
addq $0x30, %r12
cmpq %r12, %rbx
jne 0x12731f
movq (%rdi), %rax
cmpq $0x2, %rax
jb 0x1273a9
movq 0x10(%rdi), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0x120587
movq 0x8(%rsp), %rsi
movq (%rsi), %rax
movq 0x30(%rsi), %rdi
leaq (%rax,%rax,2), %rax
leaq (%rdi,%rax,8), %rsi
callq 0x11fe18
movq 0xc8(%rsp), %rdx
movq 0x8(%rsp), %r9
movq (%rdx), %r14
movq (%r9), %rax
testq %rax, %rax
je 0x127580
movq 0x108(%rsp), %rbx
movl $0x1, %r12d
movq $-0x1, %r13
xorl %ebp, %ebp
xorl %r8d, %r8d
xorl %edi, %edi
movq 0x90(%rsp), %r10
movq 0x18(%rsp), %r11
cmpq %rax, %r12
je 0x127425
movq 0x30(%r9), %rax
leaq (%r12,%r12,2), %rcx
leaq (%rdi,%rdi,2), %rsi
movq (%rax,%rsi,8), %rsi
xorq (%rax,%rcx,8), %rsi
shrq $0x20, %rsi
je 0x12756c
movq %r12, %rax
subq %rdi, %rax
cmpq %rbx, %rax
jb 0x127569
cmpq %r14, %rbp
jae 0x1274d3
movq %rdi, %rcx
movq 0x10(%rdx), %rdi
movq 0x30(%r9), %rax
movq %rcx, 0x10(%rsp)
leaq (%rcx,%rcx,2), %rcx
movl 0x4(%rax,%rcx,8), %eax
cmpq %rax, (%rdi,%rbp,8)
jae 0x127468
incq %rbp
cmpq %rbp, %r14
jne 0x127455
movq %r14, %rbp
jmp 0x1274ce
jne 0x1274ce
movq 0x8(%rdx), %rax
cmpq %rax, (%rdx)
jne 0x1274bc
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%rdx)
shlq $0x3, %rsi
movq %r8, %rbx
callq 0x2370
movq %rbx, %r8
movq 0x108(%rsp), %rbx
movq 0xc8(%rsp), %rdx
movq 0x18(%rsp), %r11
movq 0x90(%rsp), %r10
movq 0x8(%rsp), %r9
movq %rax, 0x10(%rdx)
movq (%rdx), %rax
movq 0x10(%rdx), %rcx
leaq 0x1(%rax), %rsi
movq %rsi, (%rdx)
movq %r8, (%rcx,%rax,8)
movq 0x10(%rsp), %rdi
cmpq %r14, %rbp
jae 0x127504
movq 0x10(%rdx), %rax
leaq (%rdi,%rdi,2), %rcx
shlq $0x3, %rcx
addq 0x30(%r9), %rcx
movl 0x4(%rcx), %esi
cmpq %rsi, (%rax,%rbp,8)
jne 0x127504
movq $-0x1, (%rax,%rbp,8)
incq %rbp
cmpq %rbp, %r14
jne 0x1274e8
movq %r14, %rbp
cmpq %rdi, %r12
jbe 0x127569
leaq (%rdi,%r13), %rax
shlq $0x3, %rdi
leaq (%rdi,%rdi,2), %rcx
movq %r8, %rbx
leaq (,%r8,8), %rdx
leaq (%rdx,%rdx,2), %rdx
xorl %esi, %esi
movq 0x30(%r9), %rdi
movq 0x10(%rdi,%rcx), %r8
movq %r8, 0x10(%rdi,%rdx)
movupd (%rdi,%rcx), %xmm0
movupd %xmm0, (%rdi,%rdx)
decq %rsi
addq $0x18, %rcx
addq $0x18, %rdx
cmpq %rsi, %rax
jne 0x127526
movq %rbx, %r8
subq %rsi, %r8
movq %r12, %rdi
movq 0xc8(%rsp), %rdx
movq 0x108(%rsp), %rbx
jmp 0x12756c
movq %r12, %rdi
incq %r12
movq (%r9), %rax
decq %r13
cmpq %rax, %r12
jbe 0x127402
jmp 0x127590
xorl %r8d, %r8d
movq 0x90(%rsp), %r10
movq 0x18(%rsp), %r11
movq %r8, (%r9)
testq %r14, %r14
je 0x1275c3
movq 0x10(%rdx), %rax
xorl %ecx, %ecx
xorl %edi, %edi
movq 0x100(%rsp), %rbx
movq (%rax,%rdi,8), %rsi
cmpq $-0x1, %rsi
je 0x1275b9
movq %rsi, (%rax,%rcx,8)
incq %rcx
incq %rdi
cmpq %rdi, %r14
jne 0x1275a8
jmp 0x1275cd
xorl %ecx, %ecx
movq 0x100(%rsp), %rbx
testq %rcx, %rcx
je 0x12761e
subq $0x8, %rsp
movq %r9, %rdi
movq %r15, %rsi
movq 0xe8(%rsp), %r8
movq 0xf0(%rsp), %r9
pushq %rbx
pushq 0x108(%rsp)
pushq 0x108(%rsp)
callq 0x12660b
movq 0xe8(%rsp), %rdx
movq 0x38(%rsp), %r11
movq 0xb0(%rsp), %r10
movq 0x28(%rsp), %r9
addq $0x20, %rsp
testq %r14, %r14
je 0x127655
cmpq (%rdx), %r14
jae 0x12764f
movq 0x10(%rdx), %rax
leaq (%rax,%r14,8), %rcx
xorl %esi, %esi
movq (%rcx,%rsi,8), %rdi
leaq 0x1(%rsi), %r8
movq %rdi, (%rax,%rsi,8)
leaq (%r14,%rsi), %rdi
incq %rdi
movq %r8, %rsi
cmpq (%rdx), %rdi
jb 0x127632
jmp 0x127652
xorl %r8d, %r8d
movq %r8, (%rdx)
movq (%r9), %rsi
cmpq 0x10(%r10), %rsi
jb 0x127683
movq %rsi, 0x10(%r10)
movq (%r10), %rdi
shlq $0x4, %rsi
callq 0x2370
movq 0x18(%rsp), %r11
movq 0x90(%rsp), %r10
movq 0x8(%rsp), %r9
movq %rax, (%r10)
movq (%r9), %rax
testq %rax, %rax
je 0x1278f1
movq 0xb0(%rsp), %rbx
movq 0x38(%rsp), %rsi
leaq (%rsi,%rsi), %rcx
movq %rcx, 0x10(%rsp)
leaq -0x1(,%rsi,2), %rcx
movq %rcx, 0x20(%rsp)
movl $0x1, %r12d
movq $-0x1, %r14
xorl %ebp, %ebp
movl $0x80000000, %edi       # imm = 0x80000000
movq $-0x1, %r15
cmpq %rax, %r12
je 0x1276f3
movq 0x30(%r9), %rax
leaq (%r12,%r12,2), %rcx
movq (%rax,%rcx,8), %rcx
leaq (,%rbp,2), %rdx
addq %rbp, %rdx
cmpq (%rax,%rdx,8), %rcx
je 0x1278e2
movq %r12, %rax
subq %rbp, %rax
cmpq $0x2, %rax
jb 0x12773b
movq 0x30(%r9), %rax
leaq (,%rbp,2), %rcx
addq %rbp, %rcx
leaq (%rax,%rcx,8), %rdi
leaq (%r12,%r12,2), %rcx
leaq (%rax,%rcx,8), %rsi
callq 0x12035b
movl $0x80000000, %edi       # imm = 0x80000000
movq 0x18(%rsp), %r11
movq 0x90(%rsp), %r10
movq 0x38(%rsp), %rsi
movq 0x8(%rsp), %r9
movq 0x30(%r9), %rax
leaq (,%rbp,2), %rcx
addq %rbp, %rcx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
cmpq %r15, %rax
je 0x127787
testq %rbx, %rbx
je 0x127766
movq 0x18(%rbx), %rcx
movq (%rcx,%rax,8), %r14
jmp 0x127784
movq 0xb8(%rsp), %rcx
movq (%rcx), %rcx
movq 0x10(%rcx), %rcx
leaq (%rax,%rax,4), %rdx
movl (%rcx,%rdx,8), %r14d
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movq %rax, %r15
cmpq %rbp, %r12
jbe 0x1278df
movq %r15, 0x28(%rsp)
movq %r14, 0x30(%rsp)
leal 0x1(%r14), %r13d
leaq (,%rbp,8), %rax
leaq (%rax,%rax,2), %r14
movq %rbp, %r15
shlq $0x4, %r15
orq $0xc, %r15
movq (%r10), %rbx
movq 0x30(%r9), %rax
movq (%rax,%r14), %rax
shrq $0x21, %rax
movl -0xc(%rbx,%r15), %ecx
andl %edi, %ecx
orl %eax, %ecx
movl %ecx, -0xc(%rbx,%r15)
movq 0x30(%r9), %rcx
movq (%rcx,%r14), %rcx
shrq %rcx
movl %ecx, %edx
andl %edi, %edx
orl %eax, %edx
movl %edx, -0xc(%rbx,%r15)
movq 0x30(%r9), %rax
sarl $0x1f, %ecx
andl %r13d, %ecx
addl 0xc(%rax,%r14), %ecx
movl %ecx, -0x8(%rbx,%r15)
movq 0x30(%r9), %rax
movl 0x8(%rax,%r14), %ecx
movl %ecx, -0x4(%rbx,%r15)
movl 0x10(%rax,%r14), %ecx
shrl $0x8, %ecx
movl %ecx, %eax
cmpl %ecx, %esi
seta %cl
cmpq %rax, %r11
setb %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x127830
movl $0x1, (%rbx,%r15)
jmp 0x127887
cmpl %eax, %r11d
jae 0x12787f
addq 0x20(%rsp), %rax
xorl %edx, %edx
divq 0x10(%rsp)
incl %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd 0x10231d(%rip), %xmm1   # 0x229b70
callq 0x23a0
movl $0x80000000, %edi       # imm = 0x80000000
movq 0x18(%rsp), %r11
movq 0x90(%rsp), %r10
movq 0x38(%rsp), %rsi
movq 0x8(%rsp), %r9
cvttsd2si %xmm0, %rax
movl %eax, (%rbx,%r15)
jmp 0x127887
movl $0x2, (%rbx,%r15)
cmpl $0x1000000, (%rbx,%r15) # imm = 0x1000000
jb 0x127899
movl $0xffffff, (%rbx,%r15)  # imm = 0xFFFFFF
movl (%rbx,%r15), %eax
shll $0x8, %eax
movl %eax, (%rbx,%r15)
movq 0x30(%r9), %rcx
movzbl 0x10(%rcx,%r14), %ecx
orl %eax, %ecx
movl %ecx, (%rbx,%r15)
incq %rbp
addq $0x18, %r14
addq $0x10, %r15
cmpq %rbp, %r12
jne 0x1277b5
movq %r12, %rbp
movq 0xb0(%rsp), %rbx
movq 0x30(%rsp), %r14
movq 0x28(%rsp), %r15
jmp 0x1278e2
movq %r12, %rbp
incq %r12
movq (%r9), %rax
cmpq %rax, %r12
jbe 0x1276cd
movq %rax, 0x8(%r10)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x107099(%rip), %rdi    # 0x22e9a4
leaq 0x1070e1(%rip), %rsi    # 0x22e9f3
leaq 0x107168(%rip), %rcx    # 0x22ea81
movl $0x587, %edx            # imm = 0x587
callq 0x2110
leaq 0x10714a(%rip), %rdi    # 0x22ea74
leaq 0x1070c2(%rip), %rsi    # 0x22e9f3
leaq 0x107149(%rip), %rcx    # 0x22ea81
movl $0x5bd, %edx            # imm = 0x5BD
callq 0x2110