// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/phase.c
// Function: phase
static int phase(phaseg_t *g, const char *chr, int vpos, uint64_t *cns, nseq_t *hash)
{
	int i, j, n_seqs = kh_size(hash), n_masked = 0, min_pos;
	khint_t k;
	frag_t **seqs;
	int8_t *path, *sitemask;
	uint64_t *pcnt, *regmask;

	if (vpos == 0) return 0;
	i = clean_seqs(vpos, hash); // i is true if hash has an element with its vpos >= vpos
	min_pos = i? cns[vpos]>>32 : 0x7fffffff;
	if (vpos == 1) {
		printf("PS\t%s\t%d\t%d\n", chr, (int)(cns[0]>>32) + 1, (int)(cns[0]>>32) + 1);
		printf("M0\t%s\t%d\t%d\t%c\t%c\t%d\t0\t0\t0\t0\n//\n", chr, (int)(cns[0]>>32) + 1, (int)(cns[0]>>32) + 1,
			"ACGTX"[cns[0]&3], "ACGTX"[cns[0]>>16&3], g->vpos_shift + 1);
		for (k = 0; k < kh_end(hash); ++k) {
			if (kh_exist(hash, k)) {
				frag_t *f = &kh_val(hash, k);
				if (f->vpos) continue;
				f->flip = 0;
				if (f->seq[0] == 0) f->phased = 0;
				else f->phased = 1, f->phase = f->seq[0] - 1;
			}
		}
		dump_aln(g, min_pos, hash);
		++g->vpos_shift;
		return 1;
	}
	{ // phase
		int **cnt;
		uint64_t *mask;
		printf("PS\t%s\t%d\t%d\n", chr, (int)(cns[0]>>32) + 1, (int)(cns[vpos-1]>>32) + 1);
		sitemask = calloc(vpos, 1);
		cnt = count_all(g->k, vpos, hash);
		path = dynaprog(g->k, vpos, cnt);
		for (i = 0; i < vpos; ++i) free(cnt[i]);
		free(cnt);
		pcnt = fragphase(vpos, path, hash, 0); // do not fix chimeras when masking
		mask = genmask(vpos, pcnt, &n_masked);
		regmask = calloc(n_masked, 8);
		for (i = 0; i < n_masked; ++i) {
			regmask[i] = cns[mask[i]>>32]>>32<<32 | cns[(uint32_t)mask[i]]>>32;
			for (j = mask[i]>>32; j <= (int32_t)mask[i]; ++j)
				sitemask[j] = 1;
		}
		free(mask);
		if (g->flag & FLAG_FIX_CHIMERA) {
			free(pcnt);
			pcnt = fragphase(vpos, path, hash, 1);
		}
	}
	for (i = 0; i < n_masked; ++i)
		printf("FL\t%s\t%d\t%d\n", chr, (int)(regmask[i]>>32) + 1, (int)regmask[i] + 1);
	for (i = 0; i < vpos; ++i) {
		uint64_t x = pcnt[i];
		int8_t c[2];
		c[0] = (cns[i]&0xffff)>>2 == 0? 4 : (cns[i]&3);
		c[1] = (cns[i]>>16&0xffff)>>2 == 0? 4 : (cns[i]>>16&3);
		printf("M%d\t%s\t%d\t%d\t%c\t%c\t%d\t%d\t%d\t%d\t%d\n", sitemask[i]+1, chr, (int)(cns[0]>>32) + 1, (int)(cns[i]>>32) + 1, "ACGTX"[c[path[i]]], "ACGTX"[c[1-path[i]]],
			i + g->vpos_shift + 1, (int)(x&0xffff), (int)(x>>16&0xffff), (int)(x>>32&0xffff), (int)(x>>48&0xffff));
	}
	free(path); free(pcnt); free(regmask); free(sitemask);
	seqs = calloc(n_seqs, sizeof(void*));
	for (k = 0, i = 0; k < kh_end(hash); ++k) 
		if (kh_exist(hash, k) && kh_val(hash, k).vpos < vpos && !kh_val(hash, k).single)
			seqs[i++] = &kh_val(hash, k);
	n_seqs = i;
	ks_introsort_rseq(n_seqs, seqs);
	for (i = 0; i < n_seqs; ++i) {
		frag_t *f = seqs[i];
		printf("EV\t0\t%s\t%d\t40\t%dM\t*\t0\t0\t", chr, f->vpos + 1 + g->vpos_shift, f->vlen);
		for (j = 0; j < f->vlen; ++j) {
			uint32_t c = cns[f->vpos + j];
			if (f->seq[j] == 0) putchar('N');
			else putchar("ACGT"[f->seq[j] == 1? (c&3) : (c>>16&3)]);
		}
		printf("\t*\tYP:i:%d\tYF:i:%d\tYI:i:%d\tYO:i:%d\tYS:i:%d\n", f->phase, f->flip, f->in, f->out, f->beg+1);
	}
	free(seqs);
	printf("//\n");
	fflush(stdout);
	g->vpos_shift += vpos;
	dump_aln(g, min_pos, hash);
	return vpos;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rcx, 0x58(%rsp)
movq %rdx, 0x10(%rsp)
testl %edx, %edx
je 0x1a1b4
movq %rsi, %r12
movq %rdi, 0x30(%rsp)
movslq 0x4(%r8), %rax
movq %rax, 0x78(%rsp)
movl $0x7fffffff, 0x44(%rsp) # imm = 0x7FFFFFFF
cmpl $0x0, (%r8)
movq %r8, 0x20(%rsp)
movq %rsi, 0x60(%rsp)
je 0x1a09a
movb $0x1, %cl
xorl %r15d, %r15d
movl $0x114, %r10d           # imm = 0x114
movl %ecx, 0x8(%rsp)
imulq $0x114, %r15, %rbx      # imm = 0x114
leaq -0x1(%rbx), %rbp
movq 0x10(%r8), %rax
movq %r15, %rdx
shrq $0x4, %rdx
movl (%rax,%rdx,4), %edi
leal (%r15,%r15), %ecx
andl $0x1e, %ecx
movl %edi, %esi
shrl %cl, %esi
testb $0x3, %sil
jne 0x1a057
movq 0x20(%r8), %r9
imulq $0x114, %r15, %r14      # imm = 0x114
movl 0x100(%r9,%r14), %esi
cmpl 0x10(%rsp), %esi
jge 0x1a06e
addq %r9, %r14
movq 0x10c(%r14), %r11
movl %r11d, %r13d
movzwl %r11w, %r10d
andl $0xffff, %r13d          # imm = 0xFFFF
je 0x19fb6
movq %r11, 0x50(%rsp)
leaq (%r9,%rbx), %r12
xorl %r11d, %r11d
cmpb $0x0, (%r12,%r11)
jne 0x19fbb
incq %r11
cmpq %r11, %r10
jne 0x19fa5
jmp 0x19fbe
xorl %r13d, %r13d
jmp 0x19fc8
movl %r11d, %r13d
movq 0x20(%rsp), %r8
movq 0x50(%rsp), %r11
addq %rbp, %r9
testq %r10, %r10
jle 0x19fe3
leaq -0x1(%r10), %r12
cmpb $0x0, (%r9,%r10)
movq %r12, %r10
je 0x19fcb
incl %r12d
jmp 0x19fe6
xorl %r12d, %r12d
subl %r13d, %r12d
jle 0x1a042
testl %r13d, %r13d
je 0x1a014
movl %r13d, %esi
addq %r14, %rsi
movl %r12d, %edx
movq %r14, %rdi
callq 0x34e0
movq 0x20(%rsp), %r8
movl 0x100(%r14), %esi
movq 0x10c(%r14), %r11
addl %r13d, %esi
movl %esi, 0x100(%r14)
movzwl %r12w, %eax
andq $-0x20000, %r11         # imm = 0xFFFE0000
xorl %ecx, %ecx
cmpl $0x1, %eax
sete %cl
shll $0x10, %ecx
orl %eax, %ecx
orq %r11, %rcx
movq %rcx, 0x10c(%r14)
jmp 0x1a04c
btsl %ecx, %edi
movl %edi, (%rax,%rdx,4)
decl 0x4(%r8)
movq 0x60(%rsp), %r12
movl $0x114, %r10d           # imm = 0x114
incq %r15
movl (%r8), %eax
addq %r10, %rbx
addq %r10, %rbp
cmpq %rax, %r15
jb 0x19f3f
jmp 0x1a081
incq %r15
movl (%r8), %eax
xorl %ecx, %ecx
cmpq %rax, %r15
jb 0x19f30
jmp 0x1a088
testb $0x1, 0x8(%rsp)
jne 0x1a09a
movslq 0x10(%rsp), %rax
movq 0x58(%rsp), %rcx
movl 0x4(%rcx,%rax,8), %eax
movl %eax, 0x44(%rsp)
movq 0x58(%rsp), %rax
movl 0x4(%rax), %edx
incl %edx
movq 0x10(%rsp), %rbx
cmpl $0x1, %ebx
jne 0x1a1c6
movq %rax, %r14
leaq 0x28002(%rip), %rdi     # 0x420be
xorl %ebx, %ebx
movq %r12, %rsi
movl %edx, %ecx
xorl %eax, %eax
callq 0x3060
movq (%r14), %rax
movq %rax, %rcx
shrq $0x20, %rcx
incl %ecx
movl %eax, %edx
andl $0x3, %edx
leaq 0x2800a(%rip), %rsi     # 0x420ec
movsbl (%rdx,%rsi), %r8d
shrl $0x10, %eax
andl $0x3, %eax
movsbl (%rax,%rsi), %r9d
movq 0x30(%rsp), %rax
movl 0x14(%rax), %r10d
incl %r10d
subq $0x8, %rsp
leaq 0x27fc2(%rip), %rdi     # 0x420cb
movq %r12, %rsi
movl %ecx, %edx
xorl %eax, %eax
pushq %r10
callq 0x3060
addq $0x10, %rsp
movq 0x20(%rsp), %rdx
movl (%rdx), %esi
testl %esi, %esi
je 0x1a1a0
movl $0x86, %eax
xorl %r8d, %r8d
movq 0x10(%rdx), %rcx
movq %r8, %rdi
shrq $0x4, %rdi
movl (%rcx,%rdi,4), %edi
movl %ebx, %ecx
andb $0x1e, %cl
shrl %cl, %edi
testb $0x3, %dil
jne 0x1a18d
movq 0x20(%rdx), %rcx
cmpl $0x0, -0xc(%rcx,%rax,2)
jne 0x1a18d
movq (%rcx,%rax,2), %rsi
movzbl -0x10c(%rcx,%rax,2), %edi
testq %rdi, %rdi
je 0x1a180
notl %edi
andl $0x1, %edi
shll $0x12, %edi
andq $-0xe0001, %rsi         # imm = 0xFFF1FFFF
addq %rdi, %rsi
addq $0x80000, %rsi          # imm = 0x80000
jmp 0x1a187
andq $-0xa0001, %rsi         # imm = 0xFFF5FFFF
movq %rsi, (%rcx,%rax,2)
movl (%rdx), %esi
incq %r8
movl %esi, %ecx
addq $0x8a, %rax
addl $0x2, %ebx
cmpq %rcx, %r8
jb 0x1a12e
movq 0x30(%rsp), %rbx
movq %rbx, %rdi
movl 0x44(%rsp), %esi
callq 0x1ae00
incl 0x14(%rbx)
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movslq %ebx, %r15
movl -0x4(%rax,%r15,8), %ecx
incl %ecx
leaq 0x27ee7(%rip), %rdi     # 0x420be
movq %r12, %rsi
xorl %eax, %eax
callq 0x3060
movl $0x1, %esi
movq %r15, %rdi
callq 0x3610
movq %rax, 0x68(%rsp)
movq 0x30(%rsp), %rax
movl 0x4(%rax), %r14d
movslq %r14d, %rdi
movl $0x1, %esi
movq %rdi, 0x48(%rsp)
callq 0x3610
movq %rax, %r12
movl $0x8, %esi
movq %r15, 0x70(%rsp)
movq %r15, %rdi
callq 0x3610
movq %rax, %rbp
movl %ebx, %r13d
testl %ebx, %ebx
jle 0x1a256
movl $0x1, %eax
movl %r14d, %ecx
shll %cl, %eax
movslq %eax, %r15
xorl %ebx, %ebx
movl $0x4, %esi
movq %r15, %rdi
callq 0x3610
movq %rax, (%rbp,%rbx,8)
incq %rbx
cmpq %rbx, %r13
jne 0x1a23c
movq %rbp, 0x8(%rsp)
movq %r13, 0x50(%rsp)
movq 0x20(%rsp), %rdx
cmpl $0x0, (%rdx)
je 0x1a465
movl $0x2, %edi
movq 0x48(%rsp), %rax
subq %rax, %rdi
decq %rax
movq %rax, 0x80(%rsp)
xorl %ebx, %ebx
xorl %esi, %esi
movq 0x8(%rsp), %r15
movq 0x10(%rdx), %rcx
movq %rsi, %r8
shrq $0x4, %r8
movl (%rcx,%r8,4), %r8d
leal (%rsi,%rsi), %ecx
shrl %cl, %r8d
testb $0x3, %r8b
jne 0x1a442
movq 0x20(%rdx), %r9
imulq $0x114, %rsi, %rcx      # imm = 0x114
movq 0x10(%rsp), %rax
cmpl %eax, 0x100(%r9,%rcx)
jge 0x1a442
addq %r9, %rcx
movq 0x10c(%rcx), %r11
btl $0x10, %r11d
jb 0x1a442
cmpw $0x1, %r11w
jne 0x1a2fb
orq $0x10000, %r11          # imm = 0x10000
movq %r11, 0x10c(%rcx)
jmp 0x1a442
testl $0xfffe, %r11d          # imm = 0xFFFE
je 0x1a442
movq %rcx, 0x18(%rsp)
addq %rdi, %r9
movl $0x1, %r10d
movq %rdi, 0x38(%rsp)
testl %r14d, %r14d
jle 0x1a388
movq 0x80(%rsp), %rcx
xorl %edi, %edi
cmpq %rcx, %r10
jge 0x1a333
xorl %ebx, %ebx
jmp 0x1a337
movb (%r9,%rdi), %bl
movb %bl, (%r12,%rdi)
incq %rdi
decq %rcx
cmpq %rdi, %r14
jne 0x1a32a
movq 0x48(%rsp), %rax
movb -0x1(%r12,%rax), %al
xorl %ecx, %ecx
testb %al, %al
je 0x1a424
movq %rax, 0x28(%rsp)
movq 0x18(%rsp), %rax
movslq 0x100(%rax), %rbx
leaq (%r15,%r10,8), %r15
movq (%r15,%rbx,8), %rbx
xorl %r15d, %r15d
cmpb $0x1, (%r12,%r15)
adcl $0x0, %ecx
incq %r15
cmpq %r15, %r14
jne 0x1a376
jmp 0x1a3ab
xorl %ecx, %ecx
testb %bl, %bl
je 0x1a42d
movq %rbx, 0x28(%rsp)
movq 0x18(%rsp), %rax
movslq 0x100(%rax), %rbx
leaq (%r15,%r10,8), %r15
movq (%r15,%rbx,8), %rbx
movl %r14d, %ebp
subl %ecx, %ebp
cmpl $0x2, %ebp
jl 0x1a413
xorl %r11d, %r11d
xorl %r15d, %r15d
testl %r14d, %r14d
jle 0x1a3f6
xorl %ebp, %ebp
xorl %r13d, %r13d
movzbl (%r12,%r15), %edx
leal -0x1(%rdx), %edi
xorl %r8d, %r8d
btl %r13d, %r11d
setb %r8b
xorl %eax, %eax
testl %edx, %edx
sete %al
cmovnel %edi, %r8d
addl %eax, %r13d
addl %ebp, %ebp
orl %r8d, %ebp
incq %r15
cmpq %r15, %r14
jne 0x1a3c5
movl %ebp, %r15d
incl (%rbx,%r15,4)
incl %r11d
movl %r11d, %eax
shrl %cl, %eax
testl %eax, %eax
je 0x1a3b8
movq 0x18(%rsp), %rax
movzwl 0x10c(%rax), %r11d
movq 0x8(%rsp), %r15
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rbx
jmp 0x1a42f
xorl %ebx, %ebx
movq 0x38(%rsp), %rdi
jmp 0x1a42f
xorl %ebx, %ebx
incq %r10
movzwl %r11w, %eax
incq %r9
cmpq %rax, %r10
jb 0x1a31b
incq %rsi
movq 0x20(%rsp), %rdx
movl (%rdx), %eax
addq $0x114, %rdi            # imm = 0x114
cmpq %rax, %rsi
jb 0x1a28f
movq 0x30(%rsp), %rax
movl 0x4(%rax), %r14d
movq %r12, %rdi
callq 0x3350
leal -0x1(%r14), %ecx
movl $0x1, %r12d
shll %cl, %r12d
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r14d, %ecx
shll %cl, %r15d
movl $0x4, %esi
movq %r12, %rdi
callq 0x3610
movq %rax, %rbp
movl $0x4, %esi
movq %r12, %rdi
callq 0x3610
movq %rax, 0x38(%rsp)
movl $0x8, %esi
movq 0x70(%rsp), %rdi
callq 0x3610
movq %rax, 0x18(%rsp)
notl %r15d
movq %rbp, 0x48(%rsp)
cmpl $0x0, 0x10(%rsp)
jle 0x1a545
xorl %r13d, %r13d
movq 0x38(%rsp), %rax
movq 0x48(%rsp), %rbx
movq %rax, %rbp
movq 0x8(%rsp), %rax
movq (%rax,%r13,8), %r14
movl $0x1, %esi
movq %r12, %rdi
callq 0x3610
movq 0x18(%rsp), %rcx
movq %rax, (%rcx,%r13,8)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %edx, %edx
movl %ecx, %esi
andl %r15d, %esi
movl %edx, %edi
shrl %edi
movl (%rbx,%rdi,4), %edi
movl (%r14,%rsi,4), %r8d
andl $-0x2, %esi
addl (%r14,%rdx,4), %r8d
movl (%rbx,%rsi,2), %esi
cmpl %esi, %edi
cmovgl %edi, %esi
setle (%rax,%rdx)
addl %r8d, %esi
movl %esi, (%rbp,%rdx,4)
incq %rdx
decl %ecx
cmpq %rdx, %r12
jne 0x1a501
incq %r13
movq %rbx, %rax
movq %rbp, %rbx
cmpq 0x50(%rsp), %r13
jne 0x1a4d8
movl $0x1, %esi
movq 0x70(%rsp), %rdi
callq 0x3610
movq %rax, 0x28(%rsp)
xorl %ecx, %ecx
xorl %eax, %eax
xorl %edx, %edx
movl (%rbp,%rcx,4), %esi
cmpl %edx, %esi
cmovgl %esi, %edx
cmovgl %ecx, %eax
incq %rcx
cmpq %rcx, %r12
jne 0x1a55f
movq 0x10(%rsp), %r14
testl %r14d, %r14d
movq 0x18(%rsp), %r13
jle 0x1a628
movq 0x50(%rsp), %r12
leaq 0x1(%r12), %rcx
xorl %edx, %edx
movq 0x28(%rsp), %rbp
xorl %esi, %esi
xorl %r8d, %r8d
testl %edx, %edx
sete %dil
setne %r8b
movl %eax, %r9d
andl $0x1, %r9d
xorl %r9d, %r8d
movb %r8b, -0x2(%rbp,%rcx)
movq -0x10(%r13,%rcx,8), %r8
movl %eax, %r9d
cmpb $0x0, (%r8,%r9)
je 0x1a5ce
notl %eax
andl %r15d, %eax
movb %dil, %sil
movl %esi, %edx
shrl %eax
decq %rcx
cmpq $0x1, %rcx
ja 0x1a597
xorl %ebx, %ebx
movq 0x8(%rsp), %r15
movq (%r13,%rbx,8), %rdi
callq 0x3350
incq %rbx
cmpq %rbx, %r12
jne 0x1a5e0
movq 0x48(%rsp), %rdi
callq 0x3350
movq 0x38(%rsp), %rdi
callq 0x3350
movq %r13, %rdi
callq 0x3350
testl %r14d, %r14d
jle 0x1a64e
xorl %ebx, %ebx
movq (%r15,%rbx,8), %rdi
callq 0x3350
incq %rbx
cmpq %rbx, %r12
jne 0x1a615
jmp 0x1a64e
movq 0x48(%rsp), %rdi
callq 0x3350
movq 0x38(%rsp), %rdi
callq 0x3350
movq %r13, %rdi
callq 0x3350
movq 0x28(%rsp), %rbp
movq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x3350
xorl %r15d, %r15d
movl %r14d, %edi
movq %rbp, %rsi
movq 0x20(%rsp), %rdx
xorl %ecx, %ecx
callq 0x1b036
movq %rax, %r13
testl %r14d, %r14d
jle 0x1a824
leal -0x1(%r14), %eax
movl %eax, 0x8(%rsp)
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
xorl %edx, %edx
xorl %esi, %esi
xorl %eax, %eax
xorl %r15d, %r15d
xorl %ebx, %ebx
xorl %r14d, %r14d
xorl %ecx, %ecx
movslq %edx, %rdi
movq (%r13,%rdi,8), %r8
movl %r8d, %r9d
movl $0xffff, %r11d          # imm = 0xFFFF
andl %r11d, %r9d
movl %r8d, %edi
shrl $0x10, %edi
movq %r8, %r10
shrq $0x20, %r10
andl %r11d, %r10d
shrq $0x30, %r8
leal (%rdi,%r8), %r11d
leal (%r9,%r10), %ebp
negl %ebp
subl $0x1, %r11d
cmovbl %ebp, %r11d
subl %r10d, %r8d
movl $0x0, %r10d
cmovbl %r10d, %r8d
subl %r9d, %edi
cmovbl %r10d, %edi
addl %r8d, %edi
addl %r11d, %edi
addl %ecx, %edi
movl %edx, %r8d
testl %edi, %edi
jg 0x1a6f5
movl %ebx, %r8d
setle %r9b
testl %ecx, %ecx
cmovel %r8d, %ebx
cmpl 0x8(%rsp), %edx
sete %cl
orb %r9b, %cl
cmpb $0x1, %cl
jne 0x1a767
cmpl $0x3, %esi
jb 0x1a767
cmpl %eax, %r15d
jne 0x1a746
movq %r13, %rbp
leal (%rax,%rax), %r13d
testl %eax, %eax
movl $0x4, %eax
cmovel %eax, %r13d
leal (,%r13,8), %eax
movslq %eax, %rsi
movq %r14, %rdi
callq 0x3720
movq %rax, %r14
movl %r13d, %eax
movq %rbp, %r13
movq %rbx, %rcx
shlq $0x20, %rcx
movslq %r12d, %rdx
orq %rcx, %rdx
movslq %r15d, %rcx
incl %r15d
movq %rdx, (%r14,%rcx,8)
xorl %ecx, %ecx
movl %r12d, %r9d
xorl %r8d, %r8d
jmp 0x1a78e
xorl %r8d, %r8d
movl %edi, %ecx
testl %edi, %edi
jg 0x1a772
xorl %ecx, %ecx
cmpl %esi, %ecx
movl %esi, %r9d
cmovgl %ecx, %r9d
testl %edi, %edi
cmovgl %r9d, %r8d
movl %edx, %r9d
cmpl %esi, %edi
jg 0x1a78b
movl %r12d, %r9d
movl %edx, %r12d
incl %r12d
movl %r12d, %edx
movl %r8d, %esi
cmpl 0x10(%rsp), %r12d
movl %r9d, %r12d
jl 0x1a695
movslq %r15d, %rbx
movl $0x8, %esi
movq %rbx, %rdi
callq 0x3610
testl %ebx, %ebx
setg %bl
movq %rax, 0x18(%rsp)
jle 0x1a83c
movl %r15d, %r9d
xorl %ecx, %ecx
movq 0x58(%rsp), %rdi
movq 0x68(%rsp), %r8
movq 0x28(%rsp), %rbp
movq (%r14,%rcx,8), %rdx
movl %edx, %esi
shrq $0x20, %rdx
movl 0x4(%rdi,%rdx,8), %edx
shlq $0x20, %rdx
movl 0x4(%rdi,%rsi,8), %esi
orq %rdx, %rsi
movq %rsi, (%rax,%rcx,8)
movq (%r14,%rcx,8), %rdx
movq %rdx, %rsi
shrq $0x20, %rsi
cmpl %edx, %esi
jg 0x1a81a
sarq $0x20, %rdx
decq %rdx
movb $0x1, 0x1(%r8,%rdx)
movslq (%r14,%rcx,8), %rsi
incq %rdx
cmpq %rsi, %rdx
jl 0x1a808
incq %rcx
cmpq %r9, %rcx
jne 0x1a7d5
jmp 0x1a843
movl $0x8, %esi
xorl %edi, %edi
callq 0x3610
movq %rax, 0x18(%rsp)
xorl %ebx, %ebx
xorl %r14d, %r14d
jmp 0x1a843
xorl %ebx, %ebx
movq 0x28(%rsp), %rbp
movq %r14, %rdi
callq 0x3350
movq 0x30(%rsp), %rax
testb $0x1, (%rax)
je 0x1a877
movq %r13, %rdi
callq 0x3350
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
movq 0x20(%rsp), %rdx
movl $0x1, %ecx
callq 0x1b036
movq %rax, %r13
testb %bl, %bl
movq 0x18(%rsp), %r12
je 0x1a8b3
movl %r15d, %ebx
leaq 0x27868(%rip), %r14     # 0x420f2
xorl %r15d, %r15d
movq (%r12,%r15,8), %rcx
movq %rcx, %rdx
shrq $0x20, %rdx
incl %edx
incl %ecx
movq %r14, %rdi
movq 0x60(%rsp), %rsi
xorl %eax, %eax
callq 0x3060
incq %r15
cmpq %r15, %rbx
jne 0x1a88d
cmpl $0x0, 0x10(%rsp)
movq 0x30(%rsp), %r10
movq 0x58(%rsp), %rdx
movq 0x68(%rsp), %r14
jle 0x1a9cf
xorl %eax, %eax
movq %r13, 0x8(%rsp)
movq (%r13,%rax,8), %rbx
movq (%rdx,%rax,8), %r8
movl %r8d, %ecx
andb $0x3, %cl
testl $0xfffc, %r8d           # imm = 0xFFFC
movzbl %cl, %ecx
movl $0x4, %esi
cmovel %esi, %ecx
movb %cl, 0x6(%rsp)
movl %r8d, %ecx
shrl $0x10, %ecx
andb $0x3, %cl
testl $0xfffc0000, %r8d       # imm = 0xFFFC0000
movzbl %cl, %ecx
cmovel %esi, %ecx
movb %cl, 0x7(%rsp)
movsbl (%r14,%rax), %esi
incl %esi
movl 0x4(%rdx), %ecx
incl %ecx
shrq $0x20, %r8
incl %r8d
movsbq (%rbp,%rax), %rdx
movsbq 0x6(%rsp,%rdx), %rdi
leaq 0x277b3(%rip), %r11     # 0x420ec
movsbl (%rdi,%r11), %r9d
leaq 0x6(%rsp), %rdi
subq %rdx, %rdi
movsbq 0x1(%rdi), %rdx
movsbl (%rdx,%r11), %r11d
leaq 0x1(%rax), %r13
movl 0x14(%r10), %edx
leal (%rax,%rdx), %ebp
incl %ebp
movl %ebx, %r15d
movl $0xffff, %eax           # imm = 0xFFFF
andl %eax, %r15d
movq %r10, %r14
movl %ebx, %r10d
shrl $0x10, %r10d
movq %rbx, %r12
shrq $0x20, %r12
andl %eax, %r12d
shrq $0x30, %rbx
leaq 0x27778(%rip), %rdi     # 0x420ff
movq 0x60(%rsp), %rdx
xorl %eax, %eax
pushq %rbx
pushq %r12
pushq %r10
pushq %r15
pushq %rbp
movq 0x50(%rsp), %rbp
pushq %r11
callq 0x3060
movq 0x80(%rsp), %rcx
movq 0x88(%rsp), %rdx
movq %r14, %r10
addq $0x30, %rsp
movq %r13, %rax
cmpq %r13, %rcx
movq 0x8(%rsp), %r13
movq 0x68(%rsp), %r14
jne 0x1a8d4
movq %rbp, %rdi
callq 0x3350
movq %r13, %rdi
callq 0x3350
movq 0x18(%rsp), %rdi
callq 0x3350
movq %r14, %rdi
callq 0x3350
movl $0x8, %esi
movq 0x78(%rsp), %rdi
callq 0x3610
movq %rax, %r14
movq 0x20(%rsp), %r10
movl (%r10), %eax
testq %rax, %rax
je 0x1ab72
movq 0x10(%r10), %rdx
movl $0x100, %esi            # imm = 0x100
xorl %edi, %edi
xorl %r8d, %r8d
xorl %ebx, %ebx
movq 0x10(%rsp), %r11
movl %r8d, %ecx
shrl $0x4, %ecx
movl (%rdx,%rcx,4), %r9d
movl %edi, %ecx
andb $0x1e, %cl
shrl %cl, %r9d
testb $0x3, %r9b
jne 0x1aa65
movq 0x20(%r10), %rcx
cmpl %r11d, (%rcx,%rsi)
jge 0x1aa65
testb $0x1, 0xe(%rcx,%rsi)
jne 0x1aa65
addq %rsi, %rcx
addq $-0x100, %rcx
movslq %ebx, %r9
incl %ebx
movq %rcx, (%r14,%r9,8)
incq %r8
addq $0x114, %rsi            # imm = 0x114
addl $0x2, %edi
cmpq %r8, %rax
jne 0x1aa29
movslq %ebx, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x18390
testl %r15d, %r15d
jle 0x1ab7c
movl %ebx, %ebx
leaq 0x2474b(%rip), %rbp     # 0x3f1e2
xorl %r15d, %r15d
movq (%r14,%r15,8), %r12
movl 0x100(%r12), %eax
movq 0x30(%rsp), %rcx
movl 0x14(%rcx), %ecx
leal (%rax,%rcx), %edx
incl %edx
movzwl 0x10c(%r12), %ecx
leaq 0x2765f(%rip), %rdi     # 0x42122
movq 0x60(%rsp), %rsi
xorl %eax, %eax
callq 0x3060
movq 0x10c(%r12), %r8
testw %r8w, %r8w
je 0x1ab2b
xorl %r13d, %r13d
movzbl (%r12,%r13), %ecx
testl %ecx, %ecx
je 0x1ab0d
movslq 0x100(%r12), %rax
addq %r13, %rax
movq 0x58(%rsp), %rdx
movl (%rdx,%rax,8), %eax
cmpl $0x1, %ecx
je 0x1ab04
shrl $0x10, %eax
andl $0x3, %eax
movsbl (%rax,%rbp), %edi
jmp 0x1ab12
movl $0x4e, %edi
callq 0x31e0
incq %r13
movq 0x10c(%r12), %r8
movzwl %r8w, %eax
cmpq %rax, %r13
jb 0x1aae0
movl %r8d, %edx
movl %r8d, %esi
shrl $0x12, %esi
andl $0x1, %esi
shrl $0x11, %edx
andl $0x1, %edx
movq %r8, %rax
shrq $0x20, %rax
movzwl %ax, %ecx
shrq $0x30, %r8
movl 0x104(%r12), %r9d
incl %r9d
leaq 0x275de(%rip), %rdi     # 0x4213b
xorl %eax, %eax
callq 0x3060
incq %r15
cmpq %rbx, %r15
jne 0x1aa9a
jmp 0x1ab7c
xorl %edi, %edi
movq %r14, %rsi
callq 0x18390
movq %r14, %rdi
callq 0x3350
leaq 0x29648(%rip), %rdi     # 0x441d3
callq 0x3150
movq 0x35461(%rip), %rax     # 0x4fff8
movq (%rax), %rdi
callq 0x3800
movq 0x30(%rsp), %rdi
movq 0x10(%rsp), %rax
addl %eax, 0x14(%rdi)
movl 0x44(%rsp), %esi
movq 0x20(%rsp), %rdx
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1ae00