// File: /workspace/github_cpp_makefile_star2_O1/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
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, 0x8(%rsp)
testb $0x8, 0x28(%r8)
movq %r8, 0x10(%rsp)
movq %rcx, 0x18(%rsp)
jne 0x9756
movq %rcx, %r13
movq 0x20(%r8), %r8
xorl %eax, %eax
testq %r8, %r8
je 0x9808
movl (%r8), %edi
testl %edi, %edi
je 0x9823
movq %rbp, %r13
movq 0x8(%rsp), %rcx
movq %rcx, %rax
shlq $0x20, %rax
movl %r14d, %r9d
orq %rax, %r9
movl %ecx, %eax
shrl %eax
movl %r14d, %ecx
shll $0xb, %ecx
xorl %eax, %ecx
xorl %r14d, %ecx
xorl %r10d, %r10d
movl %ecx, %eax
xorl %edx, %edx
divl %edi
movl %edx, %esi
leal -0x1(%rdi), %r11d
movl %ecx, %eax
xorl %edx, %edx
divl %r11d
incl %edx
movq 0x10(%r8), %r11
movl %esi, %eax
movl %eax, %ecx
shrl $0x4, %ecx
movl (%r11,%rcx,4), %ebx
leal (%rax,%rax), %ecx
andl $0x1e, %ecx
movl %ebx, %ebp
shrl %cl, %ebp
testb $0x2, %bpl
jne 0x9813
testb $0x1, %bpl
jne 0x973f
movq 0x18(%r8), %r15
movl %eax, %r12d
cmpq %r9, (%r15,%r12,8)
je 0x9813
addl %edx, %eax
cmpl %edi, %eax
movl %edi, %ecx
cmovbl %r10d, %ecx
subl %ecx, %eax
cmpl %esi, %eax
jne 0x970b
movl %edi, %eax
jmp 0x981b
cmpq $0x0, 0x18(%r8)
je 0xa30d
movq 0x20(%r8), %r8
xorl %eax, %eax
testq %r8, %r8
je 0x980c
movl (%r8), %edi
testl %edi, %edi
je 0x98f4
movq %rbp, %r13
movq 0x8(%rsp), %rcx
movq %rcx, %rax
shlq $0x20, %rax
movl %r14d, %r9d
orq %rax, %r9
movl %ecx, %eax
shrl %eax
movl %r14d, %ecx
shll $0xb, %ecx
xorl %eax, %ecx
xorl %r14d, %ecx
xorl %r10d, %r10d
movl %ecx, %eax
xorl %edx, %edx
divl %edi
movl %edx, %esi
leal -0x1(%rdi), %r11d
movl %ecx, %eax
xorl %edx, %edx
divl %r11d
incl %edx
movq 0x10(%r8), %r11
movl %esi, %eax
movl %eax, %ecx
shrl $0x4, %ecx
movl (%r11,%rcx,4), %ebx
leal (%rax,%rax), %ecx
andl $0x1e, %ecx
movl %ebx, %ebp
shrl %cl, %ebp
testb $0x2, %bpl
jne 0x98e9
testb $0x1, %bpl
jne 0x97f1
movq 0x18(%r8), %r15
movl %eax, %r12d
cmpq %r9, (%r15,%r12,8)
je 0x98e9
addl %edx, %eax
cmpl %edi, %eax
movl %edi, %ecx
cmovbl %r10d, %ecx
subl %ecx, %eax
cmpl %esi, %eax
jne 0x97bd
movl %edi, %eax
jmp 0x98f1
xorl %ebx, %ebx
jmp 0x983d
xorl %ebx, %ebx
jmp 0x990e
shrl %cl, %ebx
testb $0x3, %bl
cmovnel %edi, %eax
movq %r13, %rbp
movq 0x18(%rsp), %r13
cmpl %edi, %eax
jne 0x982b
xorl %ebx, %ebx
jmp 0x9835
movq 0x20(%r8), %rcx
movl %eax, %edx
movq (%rcx,%rdx,8), %rbx
cmpl %edi, %eax
je 0xa2d4
movq 0x10(%rsp), %r15
cmpq $0x0, 0x18(%r15)
je 0x9885
movq 0x8(%rsp), %rax
cmpl %eax, 0x2c(%r15)
je 0x9885
movq 0x40(%r15), %rdi
callq 0x32c0
movq (%r15), %rax
movq 0x18(%r15), %rdi
movq 0x8(%rax), %rax
movq 0x8(%rsp), %r12
movl %r12d, %ecx
movq (%rax,%rcx,8), %rsi
leaq 0x30(%r15), %rdx
callq 0x1b053
movq %rax, 0x40(%r15)
movl %r12d, 0x2c(%r15)
movq 0x40(%r15), %rax
movl $0x4e, 0x24(%rsp)
testq %rax, %rax
je 0x98a7
cmpl %r14d, 0x30(%r15)
jle 0x98a7
movl %r14d, %ecx
movsbl (%rax,%rcx), %eax
movl %eax, 0x24(%rsp)
movl %ebp, %eax
movq %rax, 0x28(%rsp)
movl 0x28(%r15), %eax
testb $0x4, %al
je 0x9a63
testl %ebp, %ebp
jle 0x9a59
leaq 0xc(%r13), %rdx
xorl %ecx, %ecx
cmpl $0x0, (%rdx)
jne 0x9a5b
incq %rcx
addq $0x18, %rdx
cmpq %rcx, 0x28(%rsp)
jne 0x98c8
movq 0x28(%rsp), %rcx
jmp 0x9a5b
shrl %cl, %ebx
testb $0x3, %bl
cmovnel %edi, %eax
movq %r13, %rbp
cmpl %edi, %eax
jne 0x98fc
xorl %ebx, %ebx
jmp 0x9906
movq 0x20(%r8), %rcx
movl %eax, %edx
movq (%rcx,%rdx,8), %rbx
cmpl %edi, %eax
je 0xa2d4
movq %rbp, 0x30(%rsp)
movl $0x1, %edi
movl $0x30, %esi
callq 0x3530
movq %rax, %rbp
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %rax
cmpl %eax, 0x2c(%r12)
je 0x99ad
cmpq $0x0, 0x40(%r12)
je 0x994f
andb $0xf, (%rbp)
movq 0x48(%r12), %rdi
movq %rbp, %rsi
callq 0x1a03d
movq (%r12), %rax
movq 0x48(%r12), %rdi
movq 0x8(%rsp), %r13
movl %r13d, %r15d
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rax
movq (%rcx,%r15,8), %rsi
movl (%rax,%r15,4), %edx
callq 0x19ef8
movq 0x40(%r12), %rdi
callq 0x32c0
movq (%r12), %rax
movq 0x18(%r12), %rdi
movq 0x8(%rax), %rax
movq (%rax,%r15,8), %rsi
leaq 0x30(%r12), %rdx
callq 0x1b053
movq %rax, 0x40(%r12)
movl %r13d, 0x2c(%r12)
movl $0x0, 0x34(%r12)
movq 0x40(%r12), %rcx
movl $0x4e, %eax
testq %rcx, %rcx
je 0x99cb
cmpl %r14d, 0x30(%r12)
jle 0x99cb
movl %r14d, %eax
movsbq (%rcx,%rax), %rax
leaq 0x2620e(%rip), %rcx     # 0x2fbe0
movzbl (%rcx,%rax), %edx
movq 0x8(%r12), %rcx
movq 0x30(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x7212
movq %r12, %r15
movq %rax, %r12
movupd (%rax), %xmm0
movupd %xmm0, (%rbp)
movb (%rbp), %al
andb $0xf, %al
orb $0x10, %al
movb %al, (%rbp)
movl %r14d, %eax
subl 0x34(%r15), %eax
movl %eax, 0x10(%rbp)
movl %r14d, 0x34(%r15)
movq 0x48(%r15), %rdi
movq %rbp, %rsi
callq 0x1a03d
cmpl %r14d, 0x30(%r15)
jbe 0x9a51
movq 0x10(%r15), %rdx
movq 0x40(%r15), %r8
testq %rbx, %rbx
je 0xa1ba
movl (%rbx), %r9d
addq $0x4, %rbx
movq %rbx, (%rsp)
movq 0x30(%rsp), %rdi
movl %r14d, %esi
movq 0x18(%rsp), %rcx
jmp 0xa1d2
xorl %r15d, %r15d
jmp 0xa1da
xorl %ecx, %ecx
cmpl %ebp, %ecx
je 0xa2d4
xorl %r12d, %r12d
testb $0x2, %al
je 0x9a80
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdx
movl %ebp, %edi
movq %r13, %rsi
callq 0x7bfd
movl %eax, %r12d
movq 0x10(%rsp), %rax
testb $0x6, 0x28(%rax)
je 0x9abf
movq 0x40(%rax), %r8
testq %r8, %r8
je 0x9abf
cmpl %r14d, 0x30(%rax)
jbe 0x9abf
movq 0x10(%rax), %rdx
testq %rbx, %rbx
je 0xa2e5
movl (%rbx), %r9d
addq $0x4, %rbx
movq %rbx, (%rsp)
movl %ebp, %edi
movl %r14d, %esi
movq %r13, %rcx
jmp 0xa2f8
xorl %ebx, %ebx
movq 0x10(%rsp), %rax
movl 0x28(%rax), %eax
notl %eax
testb $0x12, %al
jne 0x9b1a
movslq 0x24(%rsp), %rax
leaq 0x26105(%rip), %rcx     # 0x2fbe0
movzbl (%rcx,%rax), %eax
cmpl $0xf, %eax
je 0x9aee
movl %r12d, %ecx
shrl $0x1c, %ecx
cmpl %eax, %ecx
jne 0x9b1a
testq %rbx, %rbx
je 0xa2d4
movslq 0x30(%rbx), %rax
cmpq $0x2, %rax
je 0x9b1a
movq 0x20(%rbx,%rax,8), %rdi
leaq 0x1c964(%rip), %rsi     # 0x26471
callq 0x34e0
testl %eax, %eax
je 0xa305
movq %rbx, 0x50(%rsp)
movq 0x10(%rsp), %rbx
movq (%rbx), %rax
movq 0x8(%rax), %rax
movl 0x8(%rsp), %ecx
movq %rcx, 0x48(%rsp)
movq (%rax,%rcx,8), %rsi
leal 0x1(%r14), %edx
leaq 0x1b0f6(%rip), %rdi     # 0x24c39
xorl %r13d, %r13d
movl %edx, 0x40(%rsp)
movl 0x24(%rsp), %ecx
xorl %eax, %eax
callq 0x3040
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testb $0x2, 0x28(%rbx)
je 0x9bf8
movslq 0x24(%rsp), %rax
leaq 0x2606f(%rip), %rcx     # 0x2fbe0
movzbl (%rcx,%rax), %eax
cmpl $0xf, %eax
je 0x9bb7
movl %r12d, %ecx
shrl $0x1c, %ecx
cmpl $0xf, %ecx
je 0x9bb7
cmpl %eax, %ecx
je 0x9bb7
movl %r12d, %ecx
shrl $0x18, %ecx
andl $0xf, %ecx
movl %r12d, %edx
shrl $0x8, %edx
movl $0xff, %esi
andl %esi, %edx
movl %r12d, %edi
andl %esi, %edi
xorl %r13d, %r13d
cmpl %eax, %ecx
cmovnel %edi, %r13d
addl %edx, %r13d
cmpl %esi, %r13d
cmovgel %esi, %r13d
movl %r12d, %r15d
shrl $0x10, %r15d
movl $0xff, %eax
andl %eax, %r15d
leaq 0x26313(%rip), %rcx     # 0x2fee0
movq (%rcx), %rcx
movl %r12d, %edx
shrl $0x1c, %edx
movsbl (%rcx,%rdx), %esi
shrl $0x8, %r12d
andl %eax, %r12d
leaq 0x1b05b(%rip), %rdi     # 0x24c43
movl %r12d, %edx
movl %r13d, %ecx
movl %r15d, %r8d
xorl %eax, %eax
callq 0x3040
leaq 0x1b04d(%rip), %rdi     # 0x24c4c
movl %ebp, %esi
xorl %eax, %eax
callq 0x3040
xorpd %xmm2, %xmm2
xorpd %xmm0, %xmm0
testl %ebp, %ebp
movq 0x10(%rsp), %r12
movq 0x18(%rsp), %r13
jle 0x9edd
movl %r15d, 0x3c(%rsp)
movq %rbp, 0x30(%rsp)
movslq %r14d, %rax
incq %rax
movq %rax, 0x8(%rsp)
xorl %r15d, %r15d
xorl %ebx, %ebx
leaq (%r15,%r15,2), %r14
movq (%r13,%r14,8), %rax
movzbl 0xa(%rax), %eax
movq 0x8(%r12), %rcx
movl 0xc(%rcx), %ebp
cmpl %ebp, %eax
cmovll %eax, %ebp
testb $0x2, 0x14(%r13,%r14,8)
je 0x9c7a
leal 0x21(%rax), %esi
cmpl $0x5e, %eax
movl $0x7e, %eax
cmovael %eax, %esi
leaq 0x1afdd(%rip), %rdi     # 0x24c50
xorl %eax, %eax
callq 0x3040
leaq (%r13,%r14,8), %r13
testb $0x1, 0x14(%r13)
jne 0x9d1c
movq (%r13), %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(%r13), %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 0x2620b(%rip), %rcx     # 0x2fee0
movq (%rcx), %rcx
andl $0xf, %eax
movsbl (%rcx,%rax), %r14d
cmpl $0x3d, %r14d
je 0x9d01
movl %r14d, %edi
callq 0x3100
movl %eax, 0x44(%rsp)
movl 0x24(%rsp), %edi
callq 0x3100
cmpl %eax, 0x44(%rsp)
jne 0x9d2b
xorl %eax, %eax
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
testq %rcx, %r12
sete %al
leal 0x2c(,%rax,2), %edi
jmp 0x9d4b
movl $0x2a, %edi
callq 0x3170
jmp 0x9e84
movabsq $0x1000000000, %rax     # imm = 0x1000000000
movl %r14d, %edi
testq %rax, %r12
jne 0x9d44
callq 0x3100
jmp 0x9d49
callq 0x34f0
movl %eax, %edi
movq 0x10(%rsp), %r12
callq 0x3170
movl 0xc(%r13), %esi
testl %esi, %esi
jle 0x9e0d
leaq 0x1aeec(%rip), %rdi     # 0x24c54
xorl %eax, %eax
callq 0x3040
cmpl $0x0, 0xc(%r13)
jle 0x9e84
xorl %r14d, %r14d
movq (%r13), %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(%r13), %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 0x2610e(%rip), %rcx     # 0x2fee0
movq (%rcx), %rcx
andl $0xf, %edi
movsbl (%rcx,%rdi), %edi
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
testq %rcx, %rax
jne 0x9df2
callq 0x3100
jmp 0x9df7
callq 0x34f0
movl %eax, %edi
callq 0x3170
incl %r14d
cmpl 0xc(%r13), %r14d
jl 0x9d7d
jmp 0x9e84
jns 0x9e84
leaq 0x1d37a(%rip), %rdi     # 0x27190
xorl %eax, %eax
callq 0x3040
cmpl $0x0, 0xc(%r13)
jns 0x9e84
xorl %r14d, %r14d
movq 0x40(%r12), %rax
movl $0x4e, %edi
testq %rax, %rax
je 0x9e4e
movq 0x8(%rsp), %rcx
addq %r14, %rcx
movslq 0x30(%r12), %rdx
cmpq %rdx, %rcx
jge 0x9e4e
movl %ecx, %ecx
movsbl (%rax,%rcx), %edi
movq (%r13), %rax
movabsq $0x1000000000, %rcx     # imm = 0x1000000000
testq %rcx, 0x8(%rax)
jne 0x9e69
callq 0x3100
jmp 0x9e6e
callq 0x34f0
movl %eax, %edi
callq 0x3170
movslq 0xc(%r13), %rax
negq %rax
incq %r14
cmpq %rax, %r14
jl 0x9e27
testb $0x4, 0x14(%r13)
je 0x9e95
movl $0x24, %edi
callq 0x3170
imull %ebp, %ebp
addq %rbp, %rbx
incq %r15
cmpq 0x28(%rsp), %r15
movq 0x18(%rsp), %r13
jne 0x9c3c
movq %rbx, %xmm1
punpckldq 0x1a575(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x1a57d(%rip), %xmm1    # 0x24440
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq 0x30(%rsp), %rbp
movl 0x3c(%rsp), %r15d
xorpd %xmm2, %xmm2
xorps %xmm1, %xmm1
cvtsi2sd %ebp, %xmm1
divsd %xmm1, %xmm0
ucomisd %xmm2, %xmm0
jb 0x9ef4
sqrtsd %xmm0, %xmm0
jmp 0x9ef9
callq 0x3660
addsd 0x1a59f(%rip), %xmm0    # 0x244a0
cvttsd2si %xmm0, %rdx
movq %rdx, %rax
subsd 0x1a557(%rip), %xmm0    # 0x24468
sarq $0x3f, %rax
cvttsd2si %xmm0, %rcx
andl %eax, %ecx
orl %ecx, %edx
testl %r15d, %r15d
cmovnsl %r15d, %edx
movq %rdx, 0x8(%rsp)
movl $0x9, %edi
callq 0x3170
testl %ebp, %ebp
jle 0x9fa8
movq 0x28(%rsp), %rax
leaq (,%rax,8), %rax
leaq (%rax,%rax,2), %rbx
xorl %r14d, %r14d
movq 0x18(%rsp), %rdi
movq (%rdi,%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(%rdi,%r14), %rcx
movzbl (%rcx,%rax), %eax
cmpb $0x5d, %al
jb 0x9f95
movl $0x5d, %eax
addb $0x21, %al
movzbl %al, %edi
callq 0x3170
addq $0x18, %r14
cmpq %r14, %rbx
jne 0x9f4c
testb $0x20, 0x28(%r12)
je 0xa072
movl $0x9, %edi
callq 0x3170
testl %ebp, %ebp
jle 0xa013
movq 0x28(%rsp), %rax
leaq (,%rax,8), %rax
leaq (%rax,%rax,2), %rbx
xorl %r15d, %r15d
leaq 0x1ac7b(%rip), %r14     # 0x24c58
movq 0x18(%rsp), %r13
movq (%r13,%r15), %rdi
movq %r14, %rsi
callq 0x1110a
testq %rax, %rax
je 0xa000
movslq 0x8(%r13,%r15), %rcx
movzbl 0x1(%rax,%rcx), %edi
jmp 0xa005
movl $0x4e, %edi
callq 0x3170
addq $0x18, %r15
cmpq %r15, %rbx
jne 0x9fe2
movl $0x9, %edi
callq 0x3170
testl %ebp, %ebp
jle 0xa072
movq 0x28(%rsp), %rax
leaq (,%rax,8), %rax
leaq (%rax,%rax,2), %rbx
xorl %r15d, %r15d
leaq 0x1ac1f(%rip), %r14     # 0x24c5b
movq 0x18(%rsp), %r13
movq (%r13,%r15), %rdi
movq %r14, %rsi
callq 0x1110a
testq %rax, %rax
je 0xa05f
movslq 0x8(%r13,%r15), %rcx
movzbl 0x1(%rax,%rcx), %edi
jmp 0xa064
movl $0x21, %edi
callq 0x3170
addq $0x18, %r15
cmpq %r15, %rbx
jne 0xa041
movq %rbp, %r15
testb $0x1, 0x28(%r12)
movq 0x18(%rsp), %r12
je 0xa0c5
movl $0x9, %edi
callq 0x3170
testl %r15d, %r15d
jle 0xa0c5
movq 0x28(%rsp), %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rbx
xorl %r14d, %r14d
movl $0x5d, %ebp
movq (%r12,%r14), %rax
movzbl 0xa(%rax), %edi
cmpl $0x5d, %edi
cmovael %ebp, %edi
addl $0x21, %edi
callq 0x3170
addq $0x18, %r14
cmpq %r14, %rbx
jne 0xa0a6
movl $0xa, %edi
callq 0x3170
movq 0x50(%rsp), %rbx
testq %rbx, %rbx
je 0xa2d4
movq %r15, %r14
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq 0x48(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x1ab62(%rip), %rdi     # 0x24c5e
movl 0x40(%rsp), %edx
xorl %eax, %eax
callq 0x3040
movslq 0x30(%rbx), %rax
cmpq $0x1, %rax
jg 0xa122
movq 0x20(%rbx,%rax,8), %rdx
leaq 0x1ab4a(%rip), %rdi     # 0x24c67
movq %rdx, %rsi
jmp 0xa131
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
leaq 0x1ab36(%rip), %rdi     # 0x24c67
xorl %eax, %eax
callq 0x3040
movq 0x8(%rsp), %r12
movl 0x3c(%rbx), %esi
movl 0x40(%rbx), %edx
movq %rbx, %r15
leaq 0x1aafc(%rip), %rbx     # 0x24c49
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3040
movq %rbx, %rdi
movl %r12d, %esi
movl %r14d, %edx
xorl %eax, %eax
callq 0x3040
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
leaq 0x1d03e(%rip), %rdi     # 0x271b4
xorl %eax, %eax
callq 0x3040
movl 0x8(%r15), %esi
movl 0xc(%r15), %edx
movl 0x10(%r15), %ecx
leaq 0x1aab6(%rip), %rdi     # 0x24c46
xorl %eax, %eax
callq 0x3040
movl 0x14(%r15), %esi
movl 0x18(%r15), %edx
leaq 0x1d140(%rip), %rdi     # 0x272e6
xorl %eax, %eax
callq 0x3040
movq %r15, %rdi
callq 0x7c6e
jmp 0xa2d4
movq $0x0, (%rsp)
movq 0x30(%rsp), %rdi
movl %r14d, %esi
movq 0x18(%rsp), %rcx
xorl %r9d, %r9d
callq 0x7d57
movq %rax, %r15
testq %r15, %r15
je 0xa2b2
movq 0x30(%rsp), %rax
leal (%rax,%rax,2), %ecx
movl 0x34(%r15), %eax
movl 0x38(%r15), %edx
cmpl %eax, %ecx
cmovll %ecx, %eax
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
movb %dl, 0x3(%rbp)
subl %eax, %ecx
cmpl %esi, %ecx
cmovgel %esi, %ecx
movb %cl, 0x4(%rbp)
movl $0x0, 0x10(%rbp)
movzwl (%r15), %ecx
movw %cx, 0x14(%rbp)
movzwl 0x4(%r15), %ecx
cmpl %esi, %eax
cmovgel %esi, %eax
movw %cx, 0x16(%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 0x10(%rsp), %rax
movq 0x48(%rax), %rdi
movq %rbp, %rsi
callq 0x1a03d
movq %r15, %rdi
callq 0x7c6e
movq %r12, %rdi
callq 0x32c0
movq 0x20(%rbp), %rdi
callq 0x32c0
movq 0x28(%rbp), %rdi
callq 0x32c0
movq %rbp, %rdi
callq 0x32c0
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 %r14d, %esi
movq %r13, %rcx
xorl %r9d, %r9d
callq 0x7d57
movq %rax, %rbx
jmp 0x9ac1
movq %rbx, %rdi
jmp 0xa1b0
callq 0x3735