// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_plcmd.c
// Function: pileup_func
static int pileup_func(uint32_t tid, uint32_t pos, int n, const bam_pileup1_t *pu, void *data)
{
	pu_data_t *d = (pu_data_t*)data;
	bam_maqindel_ret_t *r = 0;
	int i, j, rb, rms_mapq = -1, *proposed_indels = 0;
	uint64_t rms_aux;
	uint32_t cns = 0;

	// if GLF is required, suppress -c completely
	if (d->format & BAM_PLF_GLF) return glt3_func(tid, pos, n, pu, data);
	// if d->hash is initialized, only output the sites in the hash table
	if (d->hash) {
		khint_t k = kh_get(64, d->hash, (uint64_t)tid<<32|pos);
		if (k == kh_end(d->hash)) return 0;
		proposed_indels = kh_val(d->hash, k);
	}
	// update d->ref if necessary
	if (d->fai && (int)tid != d->tid) {
		free(d->ref);
		d->ref = fai_fetch(d->fai, d->h->target_name[tid], &d->len);
		d->tid = tid;
	}
	rb = (d->ref && (int)pos < d->len)? d->ref[pos] : 'N';
	// when the indel-only mode is asked for, return if no reads mapped with indels
	if (d->format & BAM_PLF_INDEL_ONLY) {
		for (i = 0; i < n; ++i)
			if (pu[i].indel != 0) break;
		if (i == n) return 0;
	}
	// call the consensus and indel
	if (d->format & BAM_PLF_CNS) // call consensus
		cns = bam_maqcns_call(n, pu, d->c);
	if ((d->format & (BAM_PLF_CNS|BAM_PLF_INDEL_ONLY)) && d->ref && pos < d->len) { // call indels
		if (proposed_indels) // the first element gives the size of the array
			r = bam_maqindel(n, pos, d->ido, pu, d->ref, proposed_indels[0], proposed_indels+1);
		else r = bam_maqindel(n, pos, d->ido, pu, d->ref, 0, 0);
	}
	// when only variant sites are asked for, test if the site is a variant
	if ((d->format & BAM_PLF_CNS) && (d->format & BAM_PLF_VAR_ONLY)) {
		if (!(bam_nt16_table[rb] != 15 && cns>>28 != bam_nt16_table[rb])) { // not a SNP
			if (!(r && (r->gt == 2 || strcmp(r->s[r->gt], "*")))) { // not an indel
				if (r) bam_maqindel_ret_destroy(r);
				return 0;
			}
		}
	}
	// print the first 3 columns
	printf("%s\t%d\t%c\t", d->h->target_name[tid], pos + 1, rb);
	// print consensus information if required
	if (d->format & BAM_PLF_CNS) {
		int ref_q, rb4 = bam_nt16_table[rb];
		ref_q = 0;
		if (rb4 != 15 && cns>>28 != 15 && cns>>28 != rb4) { // a SNP
			ref_q = ((cns>>24&0xf) == rb4)? cns>>8&0xff : (cns>>8&0xff) + (cns&0xff);
			if (ref_q > 255) ref_q = 255;
		}
		rms_mapq = cns>>16&0xff;
		printf("%c\t%d\t%d\t%d\t", bam_nt16_rev_table[cns>>28], cns>>8&0xff, ref_q, rms_mapq);
	}
	// print pileup sequences
	printf("%d\t", n);
	rms_aux = 0; // we need to recalculate rms_mapq when -c is not flagged on the command line
	for (i = 0; i < n; ++i) {
		const bam_pileup1_t *p = pu + i;
		int tmp = p->b->core.qual < d->c->cap_mapQ? p->b->core.qual : d->c->cap_mapQ;
		rms_aux += tmp * tmp;
		if (p->is_head) printf("^%c", p->b->core.qual > 93? 126 : p->b->core.qual + 33);
		if (!p->is_del) {
			int c = bam_nt16_rev_table[bam1_seqi(bam1_seq(p->b), p->qpos)];
			if (c == '=' || toupper(c) == toupper(rb)) c = bam1_strand(p->b)? ',' : '.';
			else c = bam1_strand(p->b)? tolower(c) : toupper(c);
			putchar(c);
			if (p->indel > 0) {
				printf("+%d", p->indel);
				for (j = 1; j <= p->indel; ++j) {
					c = bam_nt16_rev_table[bam1_seqi(bam1_seq(p->b), p->qpos + j)];
					putchar(bam1_strand(p->b)? tolower(c) : toupper(c));
				}
			} else if (p->indel < 0) {
				printf("%d", p->indel);
				for (j = 1; j <= -p->indel; ++j) {
					c = (d->ref && (int)pos+j < d->len)? d->ref[pos+j] : 'N';
					putchar(bam1_strand(p->b)? tolower(c) : toupper(c));
				}
			}
		} else putchar('*');
		if (p->is_tail) putchar('$');
	}
	// finalize rms_mapq
	rms_aux = (uint64_t)(sqrt((double)rms_aux / n) + .499);
	if (rms_mapq < 0) rms_mapq = rms_aux;
	putchar('\t');
	// print quality
	for (i = 0; i < n; ++i) {
		const bam_pileup1_t *p = pu + i;
		int c = bam1_qual(p->b)[p->qpos] + 33;
		if (c > 126) c = 126;
		putchar(c);
	}
	if (d->format & BAM_PLF_2ND) { // print 2nd calls and qualities
		const unsigned char *q;
		putchar('\t');
		for (i = 0; i < n; ++i) {
			const bam_pileup1_t *p = pu + i;
			q = bam_aux_get(p->b, "E2");
			putchar(q? q[p->qpos + 1] : 'N');
		}
		putchar('\t');
		for (i = 0; i < n; ++i) {
			const bam_pileup1_t *p = pu + i;
			q = bam_aux_get(p->b, "U2");
			putchar(q? q[p->qpos + 1] : '!');
		}
	}
	// print mapping quality if -s is flagged on the command line
	if (d->format & BAM_PLF_SIMPLE) {
		putchar('\t');
		for (i = 0; i < n; ++i) {
			int c = pu[i].b->core.qual + 33;
			if (c > 126) c = 126;
			putchar(c);
		}
	}
	putchar('\n');
	// print the indel line if r has been calculated. This only happens if:
	// a) -c or -i are flagged, AND b) the reference sequence is available
	if (r) {
		printf("%s\t%d\t*\t", d->h->target_name[tid], pos + 1);
		if (r->gt < 2) printf("%s/%s\t", r->s[r->gt], r->s[r->gt]);
		else printf("%s/%s\t", r->s[0], r->s[1]);
		printf("%d\t%d\t", r->q_cns, r->q_ref);
		printf("%d\t%d\t", rms_mapq, n);
		printf("%s\t%s\t", r->s[0], r->s[1]);
		//printf("%d\t%d\t", r->gl[0], r->gl[1]);
		printf("%d\t%d\t%d\t", r->cnt1, r->cnt2, r->cnt_anti);
		printf("%d\t%d\n", r->cnt_ref, r->cnt_ambi);
		bam_maqindel_ret_destroy(r);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %r15
movq %rdx, 0x10(%rsp)
movl %esi, %r13d
movl %edi, %r12d
testb $0x8, 0x28(%r8)
movq %r8, 0x8(%rsp)
movq %rcx, 0x20(%rsp)
jne 0x9d8a
movq 0x20(%r8), %rdi
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x9e5b
movl (%rdi), %r8d
testl %r8d, %r8d
je 0x9e48
movq %r12, %rax
shlq $0x20, %rax
movl %r13d, %r9d
orq %rax, %r9
movl %r12d, %eax
shrl %eax
movl %r13d, %ecx
shll $0xb, %ecx
xorl %eax, %ecx
xorl %r13d, %ecx
xorl %r10d, %r10d
movl %ecx, %eax
xorl %edx, %edx
divl %r8d
movl %edx, %esi
leal -0x1(%r8), %r11d
movl %ecx, %eax
xorl %edx, %edx
divl %r11d
incl %edx
movq 0x10(%rdi), %rax
movl %esi, %ebx
movl %ebx, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %r11d
leal (%rbx,%rbx), %ecx
andl $0x1e, %ecx
movl %r11d, %ebp
shrl %cl, %ebp
testb $0x2, %bpl
jne 0x9e3d
testb $0x1, %bpl
jne 0x9d73
movq 0x18(%rdi), %r14
movl %ebx, %r15d
cmpq %r9, (%r14,%r15,8)
movq 0x20(%rsp), %r15
je 0x9e3d
addl %edx, %ebx
cmpl %r8d, %ebx
movl %r8d, %ecx
cmovbl %r10d, %ecx
subl %ecx, %ebx
cmpl %esi, %ebx
jne 0x9d39
jmp 0xa8c6
cmpq $0x0, 0x18(%r8)
je 0xa8f7
movq 0x20(%r8), %rdi
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x9f18
movl (%rdi), %r8d
testl %r8d, %r8d
je 0x9f05
movq %r12, %rax
shlq $0x20, %rax
movl %r13d, %r9d
orq %rax, %r9
movl %r12d, %eax
shrl %eax
movl %r13d, %ecx
shll $0xb, %ecx
xorl %eax, %ecx
xorl %r13d, %ecx
xorl %r10d, %r10d
movl %ecx, %eax
xorl %edx, %edx
divl %r8d
movl %edx, %esi
leal -0x1(%r8), %r11d
movl %ecx, %eax
xorl %edx, %edx
divl %r11d
incl %edx
movq 0x10(%rdi), %rax
movl %esi, %ebx
movl %ebx, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %r11d
leal (%rbx,%rbx), %ecx
andl $0x1e, %ecx
movl %r11d, %ebp
shrl %cl, %ebp
testb $0x2, %bpl
jne 0x9efa
testb $0x1, %bpl
jne 0x9e26
movq 0x18(%rdi), %r14
movl %ebx, %r15d
cmpq %r9, (%r14,%r15,8)
movq 0x20(%rsp), %r15
je 0x9efa
addl %edx, %ebx
cmpl %r8d, %ebx
movl %r8d, %ecx
cmovbl %r10d, %ecx
subl %ecx, %ebx
cmpl %esi, %ebx
jne 0x9dec
jmp 0xa8c6
shrl %cl, %r11d
testb $0x3, %r11b
cmovnel %r8d, %ebx
cmpl %r8d, %ebx
je 0xa8c6
movq 0x20(%rdi), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rbx
movq 0x8(%rsp), %r14
cmpq $0x0, 0x18(%r14)
je 0x9e99
cmpl %r12d, 0x2c(%r14)
je 0x9e99
movq 0x40(%r14), %rdi
callq 0x32c0
movq (%r14), %rax
movq 0x18(%r14), %rdi
movq 0x8(%rax), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %rsi
leaq 0x30(%r14), %rdx
callq 0x1b912
movq %rax, 0x40(%r14)
movl %r12d, 0x2c(%r14)
movq 0x40(%r14), %rax
movl $0x4e, 0x1c(%rsp)
testq %rax, %rax
je 0x9ebb
cmpl %r13d, 0x30(%r14)
jle 0x9ebb
movl %r13d, %ecx
movsbl (%rax,%rcx), %eax
movl %eax, 0x1c(%rsp)
movq 0x8(%rsp), %rax
movl 0x28(%rax), %eax
testb $0x4, %al
je 0xa174
movq 0x10(%rsp), %rdx
testl %edx, %edx
jle 0xa049
movl %edx, %edx
leaq 0xc(%r15), %rsi
xorl %ecx, %ecx
cmpl $0x0, (%rsi)
jne 0xa167
incq %rcx
addq $0x18, %rsi
cmpq %rcx, %rdx
jne 0x9ee0
jmp 0xa8c6
shrl %cl, %r11d
testb $0x3, %r11b
cmovnel %r8d, %ebx
cmpl %r8d, %ebx
je 0xa8c6
movq 0x20(%rdi), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rbx
movl $0x1, %edi
movl $0x30, %esi
callq 0x3530
movq %rax, %rbp
movq 0x8(%rsp), %rcx
movq 0x40(%rcx), %rax
cmpl %r12d, 0x2c(%rcx)
jne 0x9f40
movq 0x8(%rsp), %r12
jmp 0x9fae
testq %rax, %rax
movq 0x8(%rsp), %r15
je 0x9f56
movq 0x48(%r15), %rdi
movq %rbp, %rsi
callq 0x1a6bd
movq (%r15), %rax
movq 0x48(%r15), %rdi
movl %r12d, %r14d
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rax
movq (%rcx,%r14,8), %rsi
movl (%rax,%r14,4), %edx
callq 0x1a578
movq 0x40(%r15), %rdi
callq 0x32c0
movq (%r15), %rax
movq 0x18(%r15), %rdi
movq 0x8(%rax), %rax
movq (%rax,%r14,8), %rsi
leaq 0x30(%r15), %rdx
callq 0x1b912
movq %rax, 0x40(%r15)
movl %r12d, 0x2c(%r15)
movl $0x0, 0x34(%r15)
movq %r15, %r12
movq 0x20(%rsp), %r15
movl $0x4e, %ecx
testq %rax, %rax
je 0x9fc7
cmpl %r13d, 0x30(%r12)
jle 0x9fc7
movl %r13d, %ecx
movsbq (%rax,%rcx), %rcx
leaq 0x24c12(%rip), %rax     # 0x2ebe0
movzbl (%rax,%rcx), %edx
movq 0x8(%r12), %rcx
movq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x7482
movq %rax, %r14
movdqu (%rax), %xmm0
movdqu %xmm0, (%rbp)
movb (%rbp), %al
andb $0xf, %al
orb $0x10, %al
movb %al, (%rbp)
movl %r13d, %eax
subl 0x34(%r12), %eax
movl %eax, 0x10(%rbp)
movl %r13d, 0x34(%r12)
movq 0x48(%r12), %rdi
movq %rbp, %rsi
callq 0x1a6bd
cmpl %r13d, 0x30(%r12)
jbe 0xa140
movq 0x10(%r12), %rdx
movq 0x40(%r12), %r8
testq %rbx, %rbx
je 0xa050
movl (%rbx), %r9d
addq $0x4, %rbx
movq %rbx, (%rsp)
movq 0x10(%rsp), %rdi
movl %r13d, %esi
movq %r15, %rcx
jmp 0xa066
xorl %ecx, %ecx
jmp 0xa16c
movq $0x0, (%rsp)
movq 0x10(%rsp), %rdi
movl %r13d, %esi
movq %r15, %rcx
xorl %r9d, %r9d
callq 0x7fcc
movq %rax, %r15
testq %rax, %rax
je 0xa140
movq 0x10(%rsp), %rax
leal (%rax,%rax,2), %ecx
movl 0x34(%r15), %eax
cmpl %eax, %ecx
cmovll %ecx, %eax
movl 0x38(%r15), %edx
cmpl %edx, %eax
cmovgel %edx, %eax
movb $0x20, (%rbp)
movq $0x0, 0x2(%rbp)
movw $0x0, 0xa(%rbp)
movl 0x34(%r15), %edx
subl %eax, %edx
movl $0xff, %esi
cmpl %esi, %edx
cmovgel %esi, %edx
movb %dl, 0x2(%rbp)
movl 0x38(%r15), %edx
subl %eax, %edx
cmpl %esi, %edx
cmovgel %esi, %edx
subl %eax, %ecx
cmpl %esi, %ecx
cmovgel %esi, %ecx
movb %dl, 0x3(%rbp)
movb %cl, 0x4(%rbp)
movl $0x0, 0x10(%rbp)
movq (%r15), %xmm0
pshuflw $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3,4,5,6,7]
cmpl %esi, %eax
cmovgel %esi, %eax
movd %xmm0, 0x14(%rbp)
movb %al, 0xc(%rbp)
movl (%r15), %eax
movl 0x4(%r15), %ecx
movl %eax, %edx
negl %edx
cmovsl %eax, %edx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl %eax, %edx
cmoval %edx, %eax
incl %eax
movl %eax, 0x18(%rbp)
movq 0x20(%r15), %rdi
incq %rdi
callq 0x34b0
movq %rax, 0x20(%rbp)
movq 0x28(%r15), %rdi
incq %rdi
callq 0x34b0
movq %rax, 0x28(%rbp)
movq 0x48(%r12), %rdi
movq %rbp, %rsi
callq 0x1a6bd
movq %r15, %rdi
callq 0x7efa
movq %r14, %rdi
callq 0x32c0
movq 0x20(%rbp), %rdi
callq 0x32c0
movq 0x28(%rbp), %rdi
callq 0x32c0
movq %rbp, %rdi
callq 0x32c0
jmp 0xa8c6
movq 0x10(%rsp), %rdx
cmpl %edx, %ecx
je 0xa8c6
xorl %r14d, %r14d
testb $0x2, %al
movq 0x10(%rsp), %rbp
je 0xa1a1
movq 0x8(%rsp), %r15
movq 0x8(%r15), %rdx
movl %ebp, %edi
movq 0x20(%rsp), %rsi
callq 0x7e89
movl %eax, %r14d
movl 0x28(%r15), %eax
movq 0x20(%rsp), %r15
testb $0x6, %al
je 0xa1de
movq 0x8(%rsp), %rax
movq 0x40(%rax), %r8
testq %r8, %r8
je 0xa1de
cmpl %r13d, 0x30(%rax)
jbe 0xa1de
movq 0x10(%rax), %rdx
testq %rbx, %rbx
je 0xa8d7
movl (%rbx), %r9d
addq $0x4, %rbx
movq %rbx, (%rsp)
movl %ebp, %edi
movl %r13d, %esi
movq %r15, %rcx
jmp 0xa8ea
xorl %edi, %edi
movq 0x8(%rsp), %rax
movl 0x28(%rax), %eax
notl %eax
testb $0x12, %al
jne 0xa239
movslq 0x1c(%rsp), %rax
leaq 0x249e6(%rip), %rcx     # 0x2ebe0
movzbl (%rcx,%rax), %eax
cmpl $0xf, %eax
je 0xa20d
movl %r14d, %ecx
shrl $0x1c, %ecx
cmpl %eax, %ecx
jne 0xa239
testq %rdi, %rdi
je 0xa8c6
movslq 0x30(%rdi), %rax
cmpq $0x2, %rax
movq 0x10(%rsp), %rbp
je 0xa239
movq 0x20(%rdi,%rax,8), %rax
cmpb $0x2a, (%rax)
jne 0xa239
cmpb $0x0, 0x1(%rax)
je 0xa8c1
movq %rdi, 0x48(%rsp)
movq 0x8(%rsp), %rbx
movq (%rbx), %rax
movq 0x8(%rax), %rax
movl %r12d, %ecx
movq %rcx, 0x40(%rsp)
movq (%rax,%rcx,8), %rsi
leal 0x1(%r13), %edx
leaq 0x19a30(%rip), %rdi     # 0x23c91
xorl %r12d, %r12d
movl %edx, 0x38(%rsp)
movl 0x1c(%rsp), %ecx
xorl %eax, %eax
callq 0x3040
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
testb $0x2, 0x28(%rbx)
je 0xa315
movslq 0x1c(%rsp), %rax
leaq 0x2494f(%rip), %rcx     # 0x2ebe0
movzbl (%rcx,%rax), %ecx
movl %r14d, %eax
shrl $0x1c, %eax
cmpl $0xf, %ecx
je 0xa2d8
cmpl $0xf, %eax
je 0xa2d8
cmpl %ecx, %eax
je 0xa2d8
movl %r14d, %edx
shrl $0x18, %edx
andl $0xf, %edx
movl %r14d, %esi
shrl $0x8, %esi
movl $0xff, %edi
andl %edi, %esi
movl %r14d, %r8d
andl %edi, %r8d
xorl %r12d, %r12d
cmpl %ecx, %edx
cmovnel %r8d, %r12d
addl %esi, %r12d
cmpl %edi, %r12d
cmovael %edi, %r12d
movl %r14d, %r8d
shrl $0x10, %r8d
movl $0xff, %ecx
andl %ecx, %r8d
leaq 0x24bf2(%rip), %rdx     # 0x2eee0
movq (%rdx), %rdx
movsbl (%rdx,%rax), %esi
shrl $0x8, %r14d
andl %ecx, %r14d
leaq 0x19998(%rip), %rdi     # 0x23c9b
movl %r14d, %edx
movl %r12d, %ecx
movl %r8d, 0x2c(%rsp)
xorl %eax, %eax
callq 0x3040
leaq 0x19988(%rip), %rdi     # 0x23ca4
movl %ebp, %esi
xorl %eax, %eax
callq 0x3040
xorpd %xmm2, %xmm2
xorpd %xmm0, %xmm0
testl %ebp, %ebp
movq 0x8(%rsp), %r12
jle 0xa5ef
movslq %r13d, %rax
movl %ebp, %ecx
movq %rcx, 0x30(%rsp)
incq %rax
movq %rax, 0x50(%rsp)
xorl %r15d, %r15d
xorl %ebx, %ebx
leaq (%r15,%r15,2), %rax
movq 0x20(%rsp), %rcx
leaq (%rcx,%rax,8), %rbp
movq (%rbp), %rax
movzbl 0xa(%rax), %eax
movq 0x8(%r12), %rcx
movl 0xc(%rcx), %r13d
cmpl %r13d, %eax
cmovll %eax, %r13d
movb 0x14(%rbp), %cl
testb $0x2, %cl
je 0xa39d
leal 0x21(%rax), %esi
cmpl $0x5e, %eax
movl $0x7e, %eax
cmovael %eax, %esi
leaq 0x19915(%rip), %rdi     # 0x23ca8
xorl %eax, %eax
callq 0x3040
movb 0x14(%rbp), %cl
testb $0x1, %cl
jne 0xa437
movq (%rbp), %rax
movq 0x8(%rax), %r12
movq %r12, %rcx
shrq $0x30, %rcx
shlq $0x2, %rcx
addq 0x30(%rax), %rcx
movl %r12d, %eax
shrl $0x18, %eax
addq %rcx, %rax
movl 0x8(%rbp), %edx
movl %edx, %ecx
shrl $0x1f, %ecx
addl %edx, %ecx
movl %ecx, %esi
sarl %esi
movslq %esi, %rsi
movzbl (%rsi,%rax), %eax
andl $0x3e, %ecx
subl %ecx, %edx
shll $0x2, %edx
movb $0x4, %cl
subb %dl, %cl
shrl %cl, %eax
leaq 0x24af0(%rip), %rcx     # 0x2eee0
movq (%rcx), %rcx
andl $0xf, %eax
movsbl (%rcx,%rax), %r14d
cmpl $0x3d, %r14d
je 0xa41c
movl %r14d, %edi
callq 0x3100
movl %eax, 0x3c(%rsp)
movl 0x1c(%rsp), %edi
callq 0x3100
cmpl %eax, 0x3c(%rsp)
jne 0xa446
xorl %eax, %eax
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
testq %rcx, %r12
sete %al
leal 0x2c(,%rax,2), %edi
jmp 0xa466
movl $0x2a, %edi
callq 0x3170
jmp 0xa59b
movabsq $0x1000000000, %rax     # imm = 0x1000000000
movl %r14d, %edi
testq %rax, %r12
jne 0xa45f
callq 0x3100
jmp 0xa464
callq 0x34f0
movl %eax, %edi
movq 0x8(%rsp), %r12
callq 0x3170
movl 0xc(%rbp), %esi
testl %esi, %esi
jle 0xa525
leaq 0x1982a(%rip), %rdi     # 0x23cac
xorl %eax, %eax
callq 0x3040
cmpl $0x0, 0xc(%rbp)
jle 0xa59b
xorl %r14d, %r14d
movq (%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
shrq $0x30, %rdx
shlq $0x2, %rdx
addq 0x30(%rcx), %rdx
movl %eax, %ecx
shrl $0x18, %ecx
addq %rdx, %rcx
movl 0x8(%rbp), %edx
leal (%r14,%rdx), %esi
addl %r14d, %edx
incl %edx
movl %edx, %edi
shrl $0x1f, %edi
addl %edi, %esi
incl %esi
movl %esi, %edi
sarl %edi
movslq %edi, %rdi
movzbl (%rdi,%rcx), %edi
andl $0x3e, %esi
subl %esi, %edx
shll $0x2, %edx
movb $0x4, %cl
subb %dl, %cl
shrl %cl, %edi
leaq 0x249f6(%rip), %rcx     # 0x2eee0
movq (%rcx), %rcx
andl $0xf, %edi
movsbl (%rcx,%rdi), %edi
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
testq %rcx, %rax
jne 0xa50a
callq 0x3100
jmp 0xa50f
callq 0x34f0
movl %eax, %edi
callq 0x3170
incl %r14d
cmpl 0xc(%rbp), %r14d
jl 0xa496
jmp 0xa59b
jns 0xa59b
leaq 0x1bd62(%rip), %rdi     # 0x26290
xorl %eax, %eax
callq 0x3040
cmpl $0x0, 0xc(%rbp)
jns 0xa59b
xorl %r14d, %r14d
movq 0x40(%r12), %rax
movl $0x4e, %edi
testq %rax, %rax
je 0xa565
movq 0x50(%rsp), %rcx
addq %r14, %rcx
movslq 0x30(%r12), %rdx
cmpq %rdx, %rcx
jge 0xa565
movl %ecx, %ecx
movsbl (%rax,%rcx), %edi
movq (%rbp), %rax
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
testq %rcx, 0x8(%rax)
jne 0xa580
callq 0x3100
jmp 0xa585
callq 0x34f0
movl %eax, %edi
callq 0x3170
movslq 0xc(%rbp), %rax
negq %rax
incq %r14
cmpq %rax, %r14
jl 0xa53e
testb $0x4, 0x14(%rbp)
je 0xa5ab
movl $0x24, %edi
callq 0x3170
imull %r13d, %r13d
addq %r13, %rbx
incq %r15
cmpq 0x30(%rsp), %r15
jne 0xa351
movq %rbx, %xmm1
punpckldq 0x18e83(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x18e8b(%rip), %xmm1    # 0x23460
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq 0x10(%rsp), %rbp
movq 0x20(%rsp), %r15
xorpd %xmm2, %xmm2
xorps %xmm1, %xmm1
cvtsi2sd %ebp, %xmm1
divsd %xmm1, %xmm0
ucomisd %xmm2, %xmm0
jb 0xa606
sqrtsd %xmm0, %xmm0
jmp 0xa60b
callq 0x3660
movl 0x2c(%rsp), %edx
addsd 0x18ee9(%rip), %xmm0    # 0x23500
cvttsd2si %xmm0, %r13
movq %r13, %rax
subsd 0x18ea1(%rip), %xmm0    # 0x234c8
sarq $0x3f, %rax
cvttsd2si %xmm0, %rcx
andl %eax, %ecx
orl %ecx, %r13d
testl %edx, %edx
cmovnsl %edx, %r13d
movl $0x9, %edi
callq 0x3170
testl %ebp, %ebp
jle 0xa6ad
movl %ebp, %eax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rbx
xorl %r14d, %r14d
movq (%r15,%r14), %rax
movq 0x8(%rax), %rcx
movq %rcx, %rdx
shrq $0x30, %rdx
shlq $0x2, %rdx
addq 0x30(%rax), %rdx
shrl $0x18, %ecx
movl 0x10(%rax), %eax
movl %eax, %esi
incl %esi
shrl $0x1f, %esi
addl %esi, %eax
incl %eax
sarl %eax
cltq
addq %rcx, %rax
addq %rdx, %rax
movslq 0x8(%r15,%r14), %rcx
movzbl (%rcx,%rax), %eax
cmpb $0x5d, %al
jb 0xa69a
movl $0x5d, %eax
addb $0x21, %al
movzbl %al, %edi
callq 0x3170
addq $0x18, %r14
cmpq %r14, %rbx
jne 0xa656
testb $0x20, 0x28(%r12)
je 0xa789
movl $0x9, %edi
callq 0x3170
testl %ebp, %ebp
jle 0xa77f
movl %ebp, %eax
movq %rax, 0x30(%rsp)
leaq (,%rax,8), %rax
leaq (%rax,%rax,2), %r15
xorl %r12d, %r12d
leaq 0x195c8(%rip), %r14     # 0x23cb0
movq 0x20(%rsp), %rbx
movq (%rbx,%r12), %rdi
movq %r14, %rsi
callq 0x1175c
testq %rax, %rax
je 0xa70a
movslq 0x8(%rbx,%r12), %rcx
movzbl 0x1(%rax,%rcx), %edi
jmp 0xa70f
movl $0x4e, %edi
callq 0x3170
addq $0x18, %r12
cmpq %r12, %r15
jne 0xa6ed
movl $0x9, %edi
callq 0x3170
testl %ebp, %ebp
movq 0x8(%rsp), %r12
jle 0xa789
movq 0x30(%rsp), %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rbx
xorl %r15d, %r15d
leaq 0x1956c(%rip), %r14     # 0x23cb3
movq 0x20(%rsp), %rbp
movq (%rbp,%r15), %rdi
movq %r14, %rsi
callq 0x1175c
testq %rax, %rax
je 0xa76a
movslq 0x8(%rbp,%r15), %rcx
movzbl 0x1(%rax,%rcx), %edi
jmp 0xa76f
movl $0x21, %edi
callq 0x3170
addq $0x18, %r15
cmpq %r15, %rbx
jne 0xa74c
jmp 0xa789
movl $0x9, %edi
callq 0x3170
testb $0x1, 0x28(%r12)
movq 0x20(%rsp), %r15
je 0xa7da
movl $0x9, %edi
callq 0x3170
cmpl $0x0, 0x10(%rsp)
jle 0xa7da
movl 0x10(%rsp), %eax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rbx
xorl %r14d, %r14d
movl $0x5d, %ebp
movq (%r15,%r14), %rax
movzbl 0xa(%rax), %edi
cmpl $0x5d, %edi
cmovael %ebp, %edi
addl $0x21, %edi
callq 0x3170
addq $0x18, %r14
cmpq %r14, %rbx
jne 0xa7bb
movl $0xa, %edi
callq 0x3170
movq 0x48(%rsp), %r15
testq %r15, %r15
je 0xa8c6
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq 0x40(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x194a8(%rip), %rdi     # 0x23cb6
movl 0x38(%rsp), %edx
xorl %eax, %eax
callq 0x3040
movslq 0x30(%r15), %rax
cmpq $0x1, %rax
jg 0xa834
movq 0x20(%r15,%rax,8), %rdx
leaq 0x19490(%rip), %rdi     # 0x23cbf
movq %rdx, %rsi
jmp 0xa843
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
leaq 0x1947c(%rip), %rdi     # 0x23cbf
xorl %eax, %eax
callq 0x3040
movq 0x10(%rsp), %r14
movl 0x3c(%r15), %esi
movl 0x40(%r15), %edx
leaq 0x19443(%rip), %rbx     # 0x23ca1
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3040
movq %rbx, %rdi
movl %r13d, %esi
movl %r14d, %edx
xorl %eax, %eax
callq 0x3040
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
leaq 0x1ba2d(%rip), %rdi     # 0x262b4
xorl %eax, %eax
callq 0x3040
movl 0x8(%r15), %esi
movl 0xc(%r15), %edx
movl 0x10(%r15), %ecx
leaq 0x193fd(%rip), %rdi     # 0x23c9e
xorl %eax, %eax
callq 0x3040
movl 0x14(%r15), %esi
movl 0x18(%r15), %edx
leaq 0x1bb2f(%rip), %rdi     # 0x263e6
xorl %eax, %eax
callq 0x3040
movq %r15, %rdi
callq 0x7efa
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $0x0, (%rsp)
movl %ebp, %edi
movl %r13d, %esi
movq %r15, %rcx
xorl %r9d, %r9d
callq 0x7fcc
movq %rax, %rdi
jmp 0xa1e0
callq 0x3735