// File: /workspace/github_cpp_makefile_star2_O3/statgen[P]statgen/lib/samtools-0.1.7a-hybrid/bam_maqcns.c
// Function: bam_maqcns_glfgen
glf1_t *bam_maqcns_glfgen(int _n, const bam_pileup1_t *pl, uint8_t ref_base, bam_maqcns_t *bm)
{
	glf_call_aux_t *b;
	int i, j, k, w[8], c, n;
	glf1_t *g = (glf1_t*)calloc(1, sizeof(glf1_t));
	float p[16], min_p = 1e30;
	uint64_t rms;

	g->ref_base = ref_base;
	if (_n == 0) return g;

	// construct aux array
	if (bm->aux->max < _n) {
		bm->aux->max = _n;
		kroundup32(bm->aux->max);
		bm->aux->info = (uint32_t*)realloc(bm->aux->info, 4 * bm->aux->max);
	}
	for (i = n = 0; i < _n; ++i) {
		const bam_pileup1_t *p = pl + i;
		uint32_t q, x = 0, qq;
		if (p->is_del || (p->b->core.flag&BAM_FUNMAP)) continue;
		q = (uint32_t)bam1_qual(p->b)[p->qpos];
		x |= (uint32_t)bam1_strand(p->b) << 18 | q << 8 | p->b->core.qual;
		if (p->b->core.qual < q) q = p->b->core.qual;
		x |= q << 24;
		qq = bam1_seqi(bam1_seq(p->b), p->qpos);
		q = bam_nt16_nt4_table[qq? qq : ref_base];
		if (!p->is_del && q < 4) x |= 1 << 21 | q << 16;
		bm->aux->info[n++] = x;
	}
	ks_introsort(uint32_t, n, bm->aux->info);
	// generate esum and fsum
	b = (glf_call_aux_t*)calloc(1, sizeof(glf_call_aux_t));
	for (k = 0; k != 8; ++k) w[k] = 0;
	rms = 0;
	for (j = n - 1; j >= 0; --j) { // calculate esum and fsum
		uint32_t info = bm->aux->info[j];
		int tmp;
		if (info>>24 < 4 && (info>>8&0x3f) != 0) info = 4<<24 | (info&0xffffff);
		k = info>>16&7;
		if (info>>24 > 0) {
			b->esum[k&3] += bm->fk[w[k]] * (info>>24);
			b->fsum[k&3] += bm->fk[w[k]];
			if (w[k] < 0xff) ++w[k];
			++b->c[k&3];
		}
		tmp = (int)(info&0xff) < bm->cap_mapQ? (int)(info&0xff) : bm->cap_mapQ;
		rms += tmp * tmp;
	}
	b->rms_mapQ = (uint8_t)(sqrt((double)rms / n) + .499);
	// rescale ->c[]
	for (j = c = 0; j != 4; ++j) c += b->c[j];
	if (c > 255) {
		for (j = 0; j != 4; ++j) b->c[j] = (int)(254.0 * b->c[j] / c + 0.5);
		for (j = c = 0; j != 4; ++j) c += b->c[j];
	}
	if (!bm->is_soap) {
		// generate likelihood
		for (j = 0; j != 4; ++j) {
			// homozygous
			float tmp1, tmp3;
			int tmp2, bar_e;
			for (k = 0, tmp1 = tmp3 = 0.0, tmp2 = 0; k != 4; ++k) {
				if (j == k) continue;
				tmp1 += b->esum[k]; tmp2 += b->c[k]; tmp3 += b->fsum[k];
			}
			if (tmp2) {
				bar_e = (int)(tmp1 / tmp3 + 0.5);
				if (bar_e < 4) bar_e = 4; // should not happen
				if (bar_e > 63) bar_e = 63;
				p[j<<2|j] = tmp1 + bm->coef[bar_e<<16|c<<8|tmp2];
			} else p[j<<2|j] = 0.0; // all the bases are j
			// heterozygous
			for (k = j + 1; k < 4; ++k) {
				for (i = 0, tmp2 = 0, tmp1 = tmp3 = 0.0; i != 4; ++i) {
					if (i == j || i == k) continue;
					tmp1 += b->esum[i]; tmp2 += b->c[i]; tmp3 += b->fsum[i];
				}
				if (tmp2) {
					bar_e = (int)(tmp1 / tmp3 + 0.5);
					if (bar_e < 4) bar_e = 4;
					if (bar_e > 63) bar_e = 63;
					p[j<<2|k] = p[k<<2|j] = -4.343 * bm->lhet[b->c[j]<<8|b->c[k]] + tmp1 + bm->coef[bar_e<<16|c<<8|tmp2];
				} else p[j<<2|k] = p[k<<2|j] = -4.343 * bm->lhet[b->c[j]<<8|b->c[k]]; // all the bases are either j or k
			}
			//
			for (k = 0; k != 4; ++k)
				if (p[j<<2|k] < 0.0) p[j<<2|k] = 0.0;
		}

		{ // fix p[k<<2|k]
			float max1, max2, min1, min2;
			int max_k, min_k;
			max_k = min_k = -1;
			max1 = max2 = -1.0; min1 = min2 = 1e30;
			for (k = 0; k < 4; ++k) {
				if (b->esum[k] > max1) {
					max2 = max1; max1 = b->esum[k]; max_k = k;
				} else if (b->esum[k] > max2) max2 = b->esum[k];
			}
			for (k = 0; k < 4; ++k) {
				if (p[k<<2|k] < min1) {
					min2 = min1; min1 = p[k<<2|k]; min_k = k;
				} else if (p[k<<2|k] < min2) min2 = p[k<<2|k];
			}
			if (max1 > max2 && (min_k != max_k || min1 + 1.0 > min2))
				p[max_k<<2|max_k] = min1 > 1.0? min1 - 1.0 : 0.0;
		}
	} else { // apply the SOAP model
		// generate likelihood
		for (j = 0; j != 4; ++j) {
			float tmp;
			// homozygous
			for (k = 0, tmp = 0.0; k != 4; ++k)
				if (j != k) tmp += b->esum[k];
			p[j<<2|j] = tmp;
			// heterozygous
			for (k = j + 1; k < 4; ++k) {
				for (i = 0, tmp = 0.0; i != 4; ++i)
					if (i != j && i != k) tmp += b->esum[i];
				p[j<<2|k] = p[k<<2|j] = -4.343 * bm->lhet[b->c[j]<<8|b->c[k]] + tmp;
			}
		}
	}

	// convert necessary information to glf1_t
	g->ref_base = ref_base; g->max_mapQ = b->rms_mapQ;
	g->depth = n > 16777215? 16777215 : n;
	for (j = 0; j != 4; ++j)
		for (k = j; k < 4; ++k)
			if (p[j<<2|k] < min_p) min_p = p[j<<2|k];
	g->min_lk = min_p > 255.0? 255 : (int)(min_p + 0.5);
	for (j = c = 0; j != 4; ++j)
		for (k = j; k < 4; ++k)
			g->lk[c++] = p[j<<2|k]-min_p > 255.0? 255 : (int)(p[j<<2|k]-min_p + 0.5);

	free(b);
	return g;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, %r15
movl %edx, %ebp
movq %rsi, %r14
movl %edi, %r12d
movl $0x1, %edi
movl $0x10, %esi
callq 0x3530
movl %ebp, %ecx
andb $0xf, %cl
movq %rax, 0x8(%rsp)
movb %cl, (%rax)
testl %r12d, %r12d
je 0x7cfc
movq 0x38(%r15), %rdx
cmpl %r12d, (%rdx)
movb %cl, 0x7(%rsp)
jge 0x7513
leal -0x1(%r12), %eax
movl %eax, %ecx
sarl %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x8, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x10, %ecx
orl %eax, %ecx
leal 0x1(%rcx), %eax
movl %eax, (%rdx)
movq 0x8(%rdx), %rdi
leal 0x4(,%rcx,4), %eax
movslq %eax, %rsi
callq 0x3610
movq 0x38(%r15), %rdx
movq %rax, 0x8(%rdx)
testl %r12d, %r12d
jle 0x7632
movzbl %bpl, %eax
movl %r12d, %ecx
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
xorl %edi, %edi
leaq 0x26e2c(%rip), %r8      # 0x2e360
xorl %r9d, %r9d
xorl %ebp, %ebp
testb $0x1, 0x14(%r14,%r9)
jne 0x7623
movq (%r14,%r9), %r10
movq 0x8(%r10), %rcx
movq %rcx, %r12
shrq $0x20, %r12
testb $0x4, %r12b
jne 0x7623
movq %rcx, %r13
shrq $0x30, %r13
shlq $0x2, %r13
addq 0x30(%r10), %r13
movl %ecx, %r11d
shrl $0x18, %r11d
addq %r13, %r11
movl 0x10(%r10), %r10d
movl %r10d, %r13d
incl %r13d
shrl $0x1f, %r13d
addl %r13d, %r10d
incl %r10d
sarl %r10d
movslq %r10d, %r10
addq %r11, %r10
movslq 0x8(%r14,%r9), %r13
movzbl (%r13,%r10), %ebx
andl $0x10, %r12d
shll $0xe, %r12d
movl %ebx, %r10d
shll $0x8, %r10d
orl %r12d, %r10d
shrl $0x10, %ecx
movzbl %cl, %r12d
cmpl %ebx, %r12d
cmovbl %r12d, %ebx
shll $0x18, %ebx
orl %r10d, %ebx
movl %r13d, %ecx
shrl $0x1f, %ecx
addl %r13d, %ecx
movl %ecx, %r10d
sarl %r10d
movslq %r10d, %r10
movzbl (%r10,%r11), %r10d
andl $0x3e, %ecx
subl %ecx, %r13d
shll $0x2, %r13d
movb $0x4, %cl
subb %r13b, %cl
shrl %cl, %r10d
andl $0xf, %r10d
cmovel %eax, %r10d
movzbl (%r10,%r8), %ecx
movl %ecx, %r10d
shll $0x10, %r10d
addl $0x200000, %r10d        # imm = 0x200000
cmpl $0x4, %ecx
cmovael %edi, %r10d
orl %ebx, %r10d
orl %r12d, %r10d
movq 0x8(%rdx), %rcx
movslq %ebp, %r11
incl %ebp
movl %r10d, (%rcx,%r11,4)
addq $0x18, %r9
cmpq %r9, %rsi
jne 0x7539
jmp 0x7634
xorl %ebp, %ebp
movslq %ebp, %r12
movq 0x8(%rdx), %rsi
movq %r12, %rdi
callq 0x69e2
movl $0x1, %edi
movl $0x34, %esi
callq 0x3530
movq %rax, %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x60(%rsp)
xorpd %xmm1, %xmm1
xorps %xmm0, %xmm0
testl %r12d, %r12d
jle 0x7772
movq 0x38(%r15), %rax
movq 0x8(%rax), %rax
movl 0xc(%r15), %ecx
movl %ebp, %edx
incq %rdx
xorl %esi, %esi
movl $0x4000000, %edi        # imm = 0x4000000
movl -0x8(%rax,%rdx,4), %r9d
movl %r9d, %r8d
andl $0xffffff, %r8d         # imm = 0xFFFFFF
orl %edi, %r8d
testl $0x3f00, %r9d           # imm = 0x3F00
cmovel %r9d, %r8d
cmpl %edi, %r9d
cmovael %r9d, %r8d
cmpl $0x1000000, %r8d        # imm = 0x1000000
jb 0x7732
movl %r8d, %ebx
shrl $0x18, %ebx
movl %r8d, %r9d
shrl $0x10, %r9d
movl %r9d, %r10d
andl $0x7, %r10d
movq 0x20(%r15), %r12
movslq 0x50(%rsp,%r10,4), %r11
andl $0x3, %r9d
movsd (%r12,%r11,8), %xmm0
xorps %xmm2, %xmm2
cvtsi2sd %ebx, %xmm2
xorps %xmm3, %xmm3
cvtss2sd (%r14,%r9,4), %xmm3
mulsd %xmm0, %xmm2
addsd %xmm3, %xmm2
cvtsd2ss %xmm2, %xmm2
movss %xmm2, (%r14,%r9,4)
xorps %xmm2, %xmm2
cvtss2sd 0x10(%r14,%r9,4), %xmm2
addsd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsd2ss %xmm2, %xmm0
movss %xmm0, 0x10(%r14,%r9,4)
cmpq $0xfe, %r11
jg 0x772d
incl %r11d
movl %r11d, 0x50(%rsp,%r10,4)
incl 0x20(%r14,%r9,4)
movzbl %r8b, %r8d
cmpl %ecx, %r8d
cmovgel %ecx, %r8d
imull %r8d, %r8d
addq %r8, %rsi
decq %rdx
cmpq $0x1, %rdx
ja 0x768a
movq %rsi, %xmm2
punpckldq 0x1bcf2(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x1bcfa(%rip), %xmm2    # 0x23460
movapd %xmm2, %xmm0
unpckhpd %xmm2, %xmm0            # xmm0 = xmm0[1],xmm2[1]
addsd %xmm2, %xmm0
xorps %xmm2, %xmm2
cvtsi2sd %ebp, %xmm2
divsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0x7789
sqrtsd %xmm0, %xmm0
jmp 0x778e
callq 0x3660
addsd 0x1bd6a(%rip), %xmm0    # 0x23500
cvttsd2si %xmm0, %eax
movzbl %al, %eax
movl %eax, 0x30(%r14)
movdqu 0x20(%r14), %xmm0
pshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
paddd %xmm0, %xmm1
pshufd $0x55, %xmm1, %xmm0     # xmm0 = xmm1[1,1,1,1]
paddd %xmm1, %xmm0
movd %xmm0, %eax
cmpl $0x100, %eax            # imm = 0x100
jl 0x784f
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
movupd 0x20(%r14), %xmm1
xorpd %xmm2, %xmm2
movapd %xmm1, %xmm3
unpckhps %xmm2, %xmm3            # xmm3 = xmm3[2],xmm2[2],xmm3[3],xmm2[3]
movapd 0x1bc94(%rip), %xmm4    # 0x23480
orpd %xmm4, %xmm3
subpd %xmm4, %xmm3
unpcklps %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
orpd %xmm4, %xmm1
subpd %xmm4, %xmm1
movapd 0x1bc89(%rip), %xmm2    # 0x23490
mulpd %xmm2, %xmm1
mulpd %xmm2, %xmm3
divpd %xmm0, %xmm3
divpd %xmm0, %xmm1
movapd 0x1bc81(%rip), %xmm0    # 0x234a0
addpd %xmm0, %xmm1
addpd %xmm0, %xmm3
cvttpd2dq %xmm3, %xmm0
cvttpd2dq %xmm1, %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movupd %xmm1, 0x20(%r14)
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
paddd %xmm1, %xmm0
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
paddd %xmm0, %xmm1
movd %xmm1, %eax
cmpl $0x0, 0x10(%r15)
je 0x7935
movl $0x1, %eax
xorl %ecx, %ecx
movsd 0x1bc7f(%rip), %xmm0    # 0x234e8
pxor %xmm1, %xmm1
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x787a
addss (%r14,%rdx,4), %xmm1
incq %rdx
cmpq $0x4, %rdx
jne 0x786f
leal (,%rcx,4), %edx
orl %ecx, %edx
movslq %edx, %rdx
movss %xmm1, 0x10(%rsp,%rdx,4)
cmpq $0x2, %rcx
ja 0x7920
leaq (,%rcx,4), %rdx
movq 0x30(%r15), %rsi
movl 0x20(%r14,%rcx,4), %edi
shll $0x8, %edi
movq %rax, %r8
xorps %xmm1, %xmm1
xorl %r9d, %r9d
cmpq %r9, %rcx
sete %r10b
cmpq %r9, %r8
sete %r11b
orb %r10b, %r11b
jne 0x78d5
addss (%r14,%r9,4), %xmm1
incq %r9
cmpq $0x4, %r9
jne 0x78bc
movl 0x20(%r14,%r8,4), %r9d
orl %edi, %r9d
cvtss2sd %xmm1, %xmm1
movsd (%rsi,%r9,8), %xmm2
mulsd %xmm0, %xmm2
addsd %xmm1, %xmm2
xorps %xmm1, %xmm1
cvtsd2ss %xmm2, %xmm1
leaq (%rcx,%r8,4), %r9
movss %xmm1, 0x10(%rsp,%r9,4)
movq %r8, %r9
orq %rdx, %r9
movss %xmm1, 0x10(%rsp,%r9,4)
incq %r8
cmpq $0x4, %r8
jne 0x78b6
incq %rcx
incq %rax
cmpq $0x4, %rcx
jne 0x7869
jmp 0x7c03
shll $0x8, %eax
movl $0x1, %ecx
xorl %edx, %edx
movsd 0x1bba1(%rip), %xmm0    # 0x234e8
movsd 0x1bba9(%rip), %xmm1    # 0x234f8
movl $0x4, %esi
movl $0x3f, %edi
xorpd %xmm2, %xmm2
xorl %r9d, %r9d
xorl %r8d, %r8d
xorpd %xmm3, %xmm3
xorpd %xmm4, %xmm4
cmpq %r9, %rdx
je 0x7982
addss (%r14,%r9,4), %xmm4
addl 0x20(%r14,%r9,4), %r8d
addss 0x10(%r14,%r9,4), %xmm3
incq %r9
cmpq $0x4, %r9
jne 0x796b
testl %r8d, %r8d
je 0x79db
xorps %xmm5, %xmm5
cvtss2sd %xmm4, %xmm5
divss %xmm3, %xmm4
xorps %xmm3, %xmm3
cvtss2sd %xmm4, %xmm3
addsd %xmm1, %xmm3
cvttsd2si %xmm3, %r9d
cmpl $0x5, %r9d
cmovll %esi, %r9d
cmpl $0x3f, %r9d
cmovgel %edi, %r9d
movq 0x28(%r15), %r10
shll $0x10, %r9d
orl %eax, %r8d
orl %r9d, %r8d
movslq %r8d, %r8
addsd (%r10,%r8,8), %xmm5
xorps %xmm3, %xmm3
cvtsd2ss %xmm5, %xmm3
jmp 0x79de
xorps %xmm3, %xmm3
leal (,%rdx,4), %r8d
orl %edx, %r8d
movslq %r8d, %r8
movss %xmm3, 0x10(%rsp,%r8,4)
leaq (,%rdx,4), %r8
cmpq $0x3, %rdx
jae 0x7af7
movq %rcx, %r9
xorps %xmm4, %xmm4
xorl %r11d, %r11d
xorl %r10d, %r10d
xorps %xmm3, %xmm3
cmpq %r11, %rdx
sete %bl
cmpq %r11, %r9
sete %r12b
orb %bl, %r12b
jne 0x7a38
addss (%r14,%r11,4), %xmm3
addl 0x20(%r14,%r11,4), %r10d
addss 0x10(%r14,%r11,4), %xmm4
incq %r11
cmpq $0x4, %r11
jne 0x7a14
testl %r10d, %r10d
je 0x7aad
movaps %xmm3, %xmm5
divss %xmm4, %xmm5
xorps %xmm4, %xmm4
cvtss2sd %xmm5, %xmm4
addsd %xmm1, %xmm4
cvttsd2si %xmm4, %r11d
cmpl $0x5, %r11d
cmovll %esi, %r11d
cmpl $0x3f, %r11d
cmovgel %edi, %r11d
movq 0x28(%r15), %rbx
movq 0x30(%r15), %r12
movl 0x20(%r14,%rdx,4), %r13d
shll $0x8, %r13d
orl 0x20(%r14,%r9,4), %r13d
xorps %xmm4, %xmm4
cvtss2sd %xmm3, %xmm4
movsd (%r12,%r13,8), %xmm3
mulsd %xmm0, %xmm3
addsd %xmm4, %xmm3
shll $0x10, %r11d
orl %eax, %r10d
orl %r11d, %r10d
movslq %r10d, %r10
addsd (%rbx,%r10,8), %xmm3
jmp 0x7ac9
movq 0x30(%r15), %r10
movl 0x20(%r14,%rdx,4), %r11d
shll $0x8, %r11d
orl 0x20(%r14,%r9,4), %r11d
movsd (%r10,%r11,8), %xmm3
mulsd %xmm0, %xmm3
cvtsd2ss %xmm3, %xmm3
movq %r9, %r10
shlq $0x4, %r10
leaq (%r10,%rdx,4), %r10
movss %xmm3, 0x10(%rsp,%r10)
leaq (%r9,%r8), %r10
movss %xmm3, 0x10(%rsp,%r10,4)
incq %r9
cmpq $0x4, %r9
jne 0x7a08
incq %rdx
xorl %r9d, %r9d
movl %r9d, %r10d
orl %r8d, %r10d
movslq %r10d, %r10
ucomiss 0x10(%rsp,%r10,4), %xmm2
jbe 0x7b17
movl $0x0, 0x10(%rsp,%r10,4)
incl %r9d
cmpl $0x4, %r9d
jne 0x7afd
incq %rcx
cmpq $0x4, %rdx
jne 0x795d
movss 0x1b9e3(%rip), %xmm0    # 0x23518
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
movaps %xmm0, %xmm1
movaps %xmm1, %xmm2
movss (%r14,%rcx,4), %xmm3
ucomiss %xmm1, %xmm3
jbe 0x7b57
movaps %xmm3, %xmm1
movaps %xmm2, %xmm0
movl %ecx, %eax
jmp 0x7b62
movaps %xmm2, %xmm1
ucomiss %xmm0, %xmm3
jbe 0x7b62
movaps %xmm3, %xmm0
incq %rcx
cmpq $0x4, %rcx
jne 0x7b3f
movss 0x1b9a9(%rip), %xmm2    # 0x2351c
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
leaq 0x10(%rsp), %rdx
xorl %esi, %esi
movaps %xmm2, %xmm3
movaps %xmm3, %xmm4
movss (%rdx), %xmm5
ucomiss %xmm5, %xmm3
jbe 0x7b98
movaps %xmm5, %xmm3
movaps %xmm4, %xmm2
movl %esi, %ecx
jmp 0x7ba3
movaps %xmm4, %xmm3
ucomiss %xmm5, %xmm2
jbe 0x7ba3
movaps %xmm5, %xmm2
incq %rsi
addq $0x14, %rdx
cmpq $0x4, %rsi
jne 0x7b82
ucomiss %xmm0, %xmm1
jbe 0x7c03
cmpl %eax, %ecx
jne 0x7bd5
xorps %xmm0, %xmm0
cvtss2sd %xmm3, %xmm0
addsd 0x1b908(%rip), %xmm0    # 0x234d0
xorps %xmm1, %xmm1
cvtss2sd %xmm2, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x7c03
movss 0x1b93b(%rip), %xmm0    # 0x23518
addss %xmm3, %xmm0
movss 0x1b937(%rip), %xmm1    # 0x23520
cmpltss %xmm3, %xmm1
andps %xmm0, %xmm1
leal (,%rax,4), %ecx
orl %eax, %ecx
movslq %ecx, %rax
movss %xmm1, 0x10(%rsp,%rax,4)
movq 0x8(%rsp), %rcx
movb 0x7(%rsp), %al
movb %al, (%rcx)
movb 0x30(%r14), %al
movb %al, 0x1(%rcx)
movl $0xffffff, %ecx         # imm = 0xFFFFFF
cmpl %ecx, %ebp
cmovll %ebp, %ecx
shll $0x8, %ecx
movss 0x1b8f2(%rip), %xmm0    # 0x2351c
leaq 0x10(%rsp), %rax
xorl %edx, %edx
movq $-0x4, %rsi
movaps %xmm0, %xmm1
movss 0x10(%rax,%rsi,4), %xmm0
minss %xmm1, %xmm0
incq %rsi
movq %rdx, %rdi
addq %rsi, %rdi
jne 0x7c38
incq %rdx
addq $0x14, %rax
cmpq $0x4, %rdx
jne 0x7c31
xorps %xmm1, %xmm1
cvtss2sd %xmm0, %xmm1
addsd 0x1b88c(%rip), %xmm1    # 0x234f8
cvttsd2si %xmm1, %edx
movl $0xff, %eax
andl %eax, %edx
ucomiss 0x1b8a6(%rip), %xmm0    # 0x23524
cmoval %eax, %edx
orl %ecx, %edx
movq 0x8(%rsp), %rcx
movl %edx, 0xc(%rcx)
addq $0x2, %rcx
leaq 0x10(%rsp), %rdx
xorl %esi, %esi
movss 0x1b886(%rip), %xmm1    # 0x23524
movsd 0x1b852(%rip), %xmm2    # 0x234f8
xorl %edi, %edi
movslq %edi, %rdi
leaq (%rcx,%rdi), %r9
xorl %r8d, %r8d
movss (%rdx,%r8,4), %xmm3
subss %xmm0, %xmm3
ucomiss %xmm1, %xmm3
cvtss2sd %xmm3, %xmm3
addsd %xmm2, %xmm3
cvttsd2si %xmm3, %r10d
cmoval %eax, %r10d
movb %r10b, (%r9,%r8)
leaq (%rsi,%r8), %r10
incq %r10
incq %r8
cmpq $0x4, %r10
jne 0x7cb2
incq %rsi
addq %r8, %rdi
addq $0x14, %rdx
cmpq $0x4, %rsi
jne 0x7ca8
movq %r14, %rdi
callq 0x32c0
movq 0x8(%rsp), %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq