// File: /workspace/github_cpp_makefile_star2_O2/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 $0x48, %rsp
movq %rsi, %r15
movq 0xc8(%rsp), %rax
movq 0xc0(%rsp), %rcx
movabsq $0x100000000, %rsi      # imm = 0x100000000
pushq $0x2
popq %rdx
testq %rcx, %rcx
je 0xe7a7b
movl (%rcx), %ecx
cmpl $0x3, %ecx
cmovbl %edx, %ecx
jmp 0xe7a7f
leaq -0x1(%rsi), %rcx
movq %rcx, 0x20(%rsp)
movq 0xe0(%rsp), %r14
testq %rax, %rax
movq %rdi, 0x8(%rsp)
je 0xe7aa5
movl (%rax), %eax
cmpl $0x3, %eax
cmovbl %edx, %eax
movq %rax, 0x18(%rsp)
jmp 0xe7aae
movq $0x0, 0x18(%rsp)
movq 0xd0(%rsp), %r12
movq 0x80(%rsp), %rdi
callq 0x13d24
movq 0x8(%rsp), %r8
andq $0x0, (%r8)
leaq 0x20(%r14), %rax
movq %rax, 0x10(%rsp)
leaq -0x10(%r14), %rax
movq %rax, 0x28(%rsp)
xorl %eax, %eax
xorl %ecx, %ecx
cmpq 0xd8(%rsp), %rcx
je 0xe7bf1
imulq $0x18, %rcx, %r8
movq (%r12,%r8), %rdx
movq 0x8(%r12,%r8), %rdi
imulq $0x18, %rdx, %rsi
movq 0x8(%r14,%rsi), %r9
movq %r9, %r10
xorq %rdi, %r10
btrq $0x1f, %r10
testq %r10, %r10
jne 0xe845a
cmpq %r9, %rdi
jne 0xe845a
addq %r12, %r8
leaq (%r14,%rsi), %rdi
movb 0x10(%rdi), %r9b
cmpb %r9b, 0x10(%r8)
jne 0xe845a
leaq 0x1(%rdx), %r9
movq 0x10(%rsp), %r8
leaq (%r8,%rsi), %r10
xorl %r8d, %r8d
cmpq 0xe8(%rsp), %r9
jge 0xe7b83
movq -0x8(%r10), %r11
cmpq (%rdi), %r11
jne 0xe7b83
cmpq 0xf0(%rsp), %r8
jae 0xe7b83
movq (%r10), %r11
andl $0x7fffffff, %r11d      # imm = 0x7FFFFFFF
xorl %ebx, %ebx
cmpq %r15, %r11
setne %bl
addq %rbx, %r8
incq %r9
addq $0x18, %r10
jmp 0xe7b48
addq 0x28(%rsp), %rsi
testq %rdx, %rdx
jle 0xe7bc0
movq -0x8(%rsi), %r9
cmpq (%rdi), %r9
jne 0xe7bc0
cmpq 0xf0(%rsp), %r8
jae 0xe7bc0
movq (%rsi), %r9
andl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
xorl %r10d, %r10d
cmpq %r15, %r9
setne %r10b
addq %r10, %r8
addq $-0x18, %rsi
decq %rdx
jmp 0xe7b88
testq %r8, %r8
sete %dl
cmpq 0xf0(%rsp), %r8
setae %sil
orb %dl, %sil
jne 0xe7be4
addq %r8, %rax
movq 0x8(%rsp), %r8
movq %rax, (%r8)
jmp 0xe7be9
movq 0x8(%rsp), %r8
incq %rcx
jmp 0xe7ae2
cmpq 0x8(%r8), %rax
jbe 0xe7c11
movq %rax, 0x8(%r8)
movq 0x30(%r8), %rdi
imulq $0x18, %rax, %rsi
callq 0x2370
movq 0x8(%rsp), %r8
movq %rax, 0x30(%r8)
leaq 0x10(%r14), %rcx
xorl %eax, %eax
movl $0xffffff, %edx         # imm = 0xFFFFFF
xorl %esi, %esi
movq 0xb8(%rsp), %rdi
cmpq 0xd8(%rsp), %rsi
je 0xe7ea3
imulq $0x18, %rsi, %r8
leaq (%r12,%r8), %rdi
movq (%r12,%r8), %r8
imulq $0x18, %r8, %rbx
leaq (%r14,%rbx), %r9
leaq 0x1(%r8), %r14
movq 0xe8(%rsp), %r11
cmpq %r14, %r11
movq %r14, %r10
cmovgq %r11, %r10
movq 0x10(%rsp), %r11
leaq (%r11,%rbx), %r12
xorl %r11d, %r11d
cmpq 0xe8(%rsp), %r14
jge 0xe7cab
movq -0x8(%r12), %r13
cmpq (%r9), %r13
jne 0xe7ca8
cmpq 0xf0(%rsp), %r11
jae 0xe7ca8
movq (%r12), %r13
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
cmpq %r15, %r13
setne %bpl
addq %rbp, %r11
incq %r14
addq $0x18, %r12
jmp 0xe7c6a
movq %r14, %r10
movq %r8, %r14
sarq $0x3f, %r14
andq %r8, %r14
addq 0x28(%rsp), %rbx
movq %r8, %r12
testq %r12, %r12
jle 0xe7cf7
movq -0x8(%rbx), %r13
cmpq (%r9), %r13
jne 0xe7cf4
cmpq 0xf0(%rsp), %r11
jae 0xe7cf4
movq (%rbx), %r13
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
cmpq %r15, %r13
setne %bpl
addq %rbp, %r11
addq $-0x18, %rbx
decq %r12
jmp 0xe7cbd
movq %r12, %r14
testq %r11, %r11
sete %bl
cmpq 0xf0(%rsp), %r11
setae %r11b
orb %bl, %r11b
jne 0xe7e7e
subq %r14, %r10
cmpq %rdx, %r10
cmovaeq %rdx, %r10
shll $0x8, %r10d
movq %r8, %r11
imulq $0x18, %r11, %rbx
addq 0x10(%rsp), %rbx
incq %r11
cmpq 0xe8(%rsp), %r11
jge 0xe7dcf
movq -0x8(%rbx), %r14
cmpq (%r9), %r14
jne 0xe7dcf
movq (%rbx), %r12
addq $0x18, %rbx
movl %r12d, %r14d
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
cmpq %r15, %r14
je 0xe7d2c
movq 0x8(%rdi), %r14
xorq %r12, %r14
shrq $0x20, %r12
testl %r14d, %r14d
jns 0xe7d7d
movzbl -0x10(%rbx), %ebp
subl %r12d, %ebp
addl $-0x3, %ebp
movl %ebp, %r12d
imulq $0x18, %rax, %r13
incq %rax
movq 0x8(%rsp), %rbp
addq 0x30(%rbp), %r13
movl %r12d, 0xc(%r13)
movq 0x8(%rdi), %r12
shrq $0x20, %r12
movl %r12d, 0x8(%r13)
movzbl 0x10(%rdi), %ebp
orl %r10d, %ebp
movl %ebp, 0x10(%r13)
movq -0x18(%rbx), %rbx
shlq $0x21, %rbx
addq %r14, %r14
movabsq $0x100000000, %rbp      # imm = 0x100000000
andq %rbp, %r14
orq %rbx, %r14
orq %r12, %r14
movq %r14, (%r13)
jmp 0xe7d23
imulq $0x18, %r8, %r11
addq %rcx, %r11
movq 0xd0(%rsp), %r12
testq %r8, %r8
jle 0xe7e86
movq -0x28(%r11), %rbx
cmpq (%r9), %rbx
jne 0xe7e86
decq %r8
movq -0x20(%r11), %r14
addq $-0x18, %r11
movl %r14d, %ebx
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
cmpq %r15, %rbx
je 0xe7dde
movq 0x8(%rdi), %rbx
xorq %r14, %rbx
shrq $0x20, %r14
testl %ebx, %ebx
jns 0xe7e29
movzbl (%r11), %ebp
subl %r14d, %ebp
addl $-0x3, %ebp
movl %ebp, %r14d
imulq $0x18, %rax, %r12
incq %rax
movq 0x8(%rsp), %r13
addq 0x30(%r13), %r12
movl %r14d, 0xc(%r12)
movq 0x8(%rdi), %r14
shrq $0x20, %r14
movl %r14d, 0x8(%r12)
movzbl 0x10(%rdi), %ebp
orl %r10d, %ebp
movl %ebp, 0x10(%r12)
movq -0x8(%r11), %r11
shlq $0x21, %r11
addq %rbx, %rbx
movabsq $0x100000000, %r13      # imm = 0x100000000
andq %r13, %rbx
orq %r11, %rbx
orq %r14, %rbx
movq %rbx, (%r12)
jmp 0xe7dcf
movq 0xd0(%rsp), %r12
incq %rsi
movq 0x8(%rsp), %r8
movq 0xb8(%rsp), %rdi
movq 0xe0(%rsp), %r14
jmp 0xe7c26
cmpq (%r8), %rax
jne 0xe8479
andq $0x0, (%rdi)
movq 0x100(%rsp), %rcx
testq %rcx, %rcx
je 0xe7fe0
movq 0x28(%rcx), %rax
movq (%rax,%r15,8), %r14
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
andq %r14, %rbx
je 0xe7fe0
movq 0x10(%rcx), %r12
shrq $0x20, %r14
cmpq %rbx, 0x8(%rdi)
jae 0xe7f44
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 0xb8(%rsp), %rdi
movq 0x8(%rsp), %r8
movq %rax, 0x10(%rdi)
imulq $0x30, %rbx, %rbx
imulq $0x30, %r14, %rax
leaq (%rax,%r12), %r14
addq $0x28, %r14
xorl %r12d, %r12d
cmpq %r12, %rbx
je 0xe7fc5
movzbl (%r14,%r12), %r13d
testb %r13b, %r13b
js 0xe7fbf
movl -0x14(%r14,%r12), %ebp
movq (%rdi), %rcx
movq 0x10(%rdi), %rax
cmpq 0x8(%rdi), %rcx
jne 0xe7faa
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%rdi)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0xb8(%rsp), %rdi
movq 0x8(%rsp), %r8
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, %r12
jmp 0xe7f57
movq (%rdi), %rax
cmpq $0x2, %rax
jb 0xe7fe0
movq 0x10(%rdi), %rdi
leaq (%rdi,%rax,8), %rsi
callq 0xe177e
movq 0x8(%rsp), %r8
movq 0x30(%r8), %rdi
imulq $0x18, (%r8), %rsi
addq %rdi, %rsi
callq 0xe1068
movq 0xb8(%rsp), %rdx
movq 0x8(%rsp), %rdi
movq (%rdx), %r11
pushq $0x1
popq %r13
xorl %ebp, %ebp
xorl %r14d, %r14d
xorl %r12d, %r12d
movq 0x18(%rsp), %r9
movq 0xf8(%rsp), %r8
movq %r11, 0x10(%rsp)
cmpq (%rdi), %r13
ja 0xe813b
je 0xe8043
movq 0x30(%rdi), %rax
imulq $0x18, %r13, %rcx
imulq $0x18, %rbp, %rsi
movq (%rax,%rsi), %rsi
xorq (%rax,%rcx), %rsi
shrq $0x20, %rsi
je 0xe8051
movq %r13, %rax
subq %rbp, %rax
cmpq %r8, %rax
jae 0xe8056
movq %r13, %rbp
incq %r13
jmp 0xe801e
cmpq %r11, %r12
movq %r11, %rcx
cmovaq %r12, %rcx
imulq $0x18, %rbp, %rbx
cmpq %r11, %r12
jae 0xe8084
movq 0x10(%rdx), %rax
movq 0x30(%rdi), %rsi
movq (%rsi,%rbx), %rsi
shrq $0x20, %rsi
cmpq %rsi, (%rax,%r12,8)
jae 0xe8089
incq %r12
jmp 0xe8064
movq %rcx, %r12
jmp 0xe80e3
jne 0xe80e3
movq (%rdx), %rcx
cmpq 0x8(%rdx), %rcx
jne 0xe80d8
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x8(%rdx)
shlq $0x3, %rsi
movq %rax, %rdi
callq 0x2370
movq 0x10(%rsp), %r11
movq 0xf8(%rsp), %r8
movq 0xb8(%rsp), %rdx
movq 0x18(%rsp), %r9
movq 0x8(%rsp), %rdi
movq %rax, 0x10(%rdx)
movq (%rdx), %rcx
leaq 0x1(%rcx), %rsi
movq %rsi, (%rdx)
movq %r14, (%rax,%rcx,8)
cmpq %r11, %r12
jae 0xe8108
movq 0x10(%rdx), %rax
movq 0x30(%rdi), %rcx
imulq $0x18, %rbp, %rsi
movl 0x4(%rcx,%rsi), %ecx
cmpq %rcx, (%rax,%r12,8)
jne 0xe8108
orq $-0x1, (%rax,%r12,8)
incq %r12
jmp 0xe80e3
imulq $0x18, %r14, %rax
cmpq %r13, %rbp
jae 0xe804e
movq 0x30(%rdi), %rcx
incq %r14
movq 0x10(%rcx,%rbx), %rsi
movq %rsi, 0x10(%rcx,%rax)
movups (%rcx,%rbx), %xmm0
movups %xmm0, (%rcx,%rax)
incq %rbp
addq $0x18, %rax
addq $0x18, %rbx
jmp 0xe810c
movq %r14, (%rdi)
xorl %eax, %eax
xorl %ecx, %ecx
movq 0xe0(%rsp), %r10
movq 0xd0(%rsp), %r8
cmpq %rax, %r11
je 0xe8176
movq 0x10(%rdx), %r11
movq (%r11,%rax,8), %rsi
cmpq $-0x1, %rsi
je 0xe816c
movq %rsi, (%r11,%rcx,8)
incq %rcx
incq %rax
movq 0x10(%rsp), %r11
jmp 0xe8152
testq %rcx, %rcx
je 0xe81ba
subq $0x8, %rsp
movq %r15, %rsi
movq 0xe0(%rsp), %r9
pushq 0xf8(%rsp)
pushq 0xf8(%rsp)
pushq %r10
callq 0xe7417
movq 0x30(%rsp), %r11
movq 0xd8(%rsp), %rdx
movq 0x38(%rsp), %r9
movq 0x28(%rsp), %rdi
addq $0x20, %rsp
testq %r11, %r11
movq 0x20(%rsp), %r8
movq 0xa0(%rsp), %r15
je 0xe81ea
xorl %eax, %eax
cmpq (%rdx), %r11
jae 0xe81e7
movq 0x10(%rdx), %rcx
movq (%rcx,%r11,8), %rsi
movq %rsi, (%rcx,%rax,8)
incq %rax
incq %r11
jmp 0xe81ce
movq %rax, (%rdx)
movq (%rdi), %rsi
movq 0x80(%rsp), %rax
cmpq 0x10(%rax), %rsi
jb 0xe8225
movq 0x80(%rsp), %rbx
movq %rsi, 0x10(%rbx)
movq (%rbx), %rdi
shlq $0x4, %rsi
callq 0x2370
movq 0x18(%rsp), %r9
movq 0x20(%rsp), %r8
movq 0x8(%rsp), %rdi
movq %rax, (%rbx)
leaq (%r8,%r8), %rax
movq %rax, 0x28(%rsp)
leaq -0x1(,%r8,2), %rax
movq %rax, 0x40(%rsp)
pushq $-0x1
popq %rax
pushq $0x1
popq %r10
xorl %ebx, %ebx
movq %rax, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movq (%rdi), %rax
cmpq %rax, %r10
ja 0xe843f
movq 0x30(%rdi), %rax
je 0xe8276
imulq $0x18, %r10, %rcx
movq (%rax,%rcx), %rcx
imulq $0x18, %rbx, %rdx
cmpq (%rax,%rdx), %rcx
je 0xe8437
movq %r10, %rcx
subq %rbx, %rcx
cmpq $0x2, %rcx
movq %r10, 0x10(%rsp)
jb 0xe82b2
imulq $0x18, %rbx, %rdi
addq %rax, %rdi
imulq $0x18, %r10, %rsi
addq %rax, %rsi
callq 0xe1595
movq 0x10(%rsp), %r10
movq 0x18(%rsp), %r9
movq 0x20(%rsp), %r8
movq 0x8(%rsp), %rdi
movq 0x30(%rdi), %rax
imulq $0x18, %rbx, %r14
movq (%rax,%r14), %rcx
shrq $0x21, %rcx
cmpq 0x30(%rsp), %rcx
je 0xe82fa
testq %r15, %r15
je 0xe82d4
movq 0x18(%r15), %rdx
movq (%rdx,%rcx,8), %rdx
jmp 0xe82f0
movq 0xa8(%rsp), %rdx
movq (%rdx), %rdx
movq 0x10(%rdx), %rdx
imulq $0x28, %rcx, %rsi
movl (%rdx,%rsi), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq %rdx, 0x38(%rsp)
movq %rcx, 0x30(%rsp)
movq 0x38(%rsp), %rcx
leal 0x1(%rcx), %r15d
movq %rbx, %r12
shlq $0x4, %r12
orq $0xc, %r12
cmpq %r10, %rbx
jae 0xe842c
movq 0x80(%rsp), %rcx
movq (%rcx), %rbp
movq (%rax,%r14), %rax
shrq $0x21, %rax
movl -0xc(%rbp,%r12), %ecx
movl $0x80000000, %esi       # imm = 0x80000000
andl %esi, %ecx
orl %eax, %ecx
movl %ecx, -0xc(%rbp,%r12)
movq 0x30(%rdi), %rcx
movq (%rcx,%r14), %rcx
shrq %rcx
movl %ecx, %edx
andl %esi, %edx
orl %eax, %edx
movl %edx, -0xc(%rbp,%r12)
movq 0x30(%rdi), %rax
sarl $0x1f, %ecx
andl %r15d, %ecx
addl 0xc(%rax,%r14), %ecx
movl %ecx, -0x8(%rbp,%r12)
movl 0x8(%rax,%r14), %ecx
movl %ecx, -0x4(%rbp,%r12)
movl 0x10(%rax,%r14), %eax
shrl $0x8, %eax
cmpl %eax, %r8d
ja 0xe83ea
cmpl %eax, %r9d
jae 0xe83ea
movq %rbx, %r13
shlq $0x4, %r13
addq %rbp, %r13
movq 0x40(%rsp), %rcx
addq %rcx, %rax
xorl %edx, %edx
divq 0x28(%rsp)
incl %eax
cvtsi2sd %rax, %xmm0
movsd 0xff8bd(%rip), %xmm1    # 0x1e7c68
callq 0x23a0
cvttsd2si %xmm0, %rcx
movl %ecx, (%rbp,%r12)
addq $0xc, %r13
cmpl $0x1000000, %ecx        # imm = 0x1000000
jb 0xe83d4
movl $0xffffff, (%rbp,%r12)  # imm = 0xFFFFFF
movl $0xffffff, %ecx         # imm = 0xFFFFFF
movq 0x8(%rsp), %rdi
movq 0x20(%rsp), %r8
movq 0x18(%rsp), %r9
movq 0x10(%rsp), %r10
jmp 0xe8409
leaq (%r12,%rbp), %r13
cmpq %rax, %r9
setb %cl
cmpq %rax, %r8
seta %al
andb %cl, %al
movzbl %al, %eax
pushq $0x2
popq %rcx
subl %eax, %ecx
movl %ecx, (%rbp,%r12)
shll $0x8, %ecx
movq 0x30(%rdi), %rax
movzbl 0x10(%rax,%r14), %edx
orl %ecx, %edx
movl %edx, (%r13)
incq %rbx
addq $0x18, %r14
addq $0x10, %r12
jmp 0xe830e
movq %r10, %rbx
movq 0xa0(%rsp), %r15
incq %r10
jmp 0xe824e
movq 0x80(%rsp), %rcx
movq %rax, 0x8(%rcx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x104643(%rip), %rdi    # 0x1ecaa4
leaq 0x10468b(%rip), %rsi    # 0x1ecaf3
leaq 0x104712(%rip), %rcx    # 0x1ecb81
movl $0x587, %edx            # imm = 0x587
callq 0x2110
leaq 0x1046f4(%rip), %rdi    # 0x1ecb74
leaq 0x10466c(%rip), %rsi    # 0x1ecaf3
leaq 0x1046f3(%rip), %rcx    # 0x1ecb81
movl $0x5bd, %edx            # imm = 0x5BD
callq 0x2110