// File: /workspace/github_c_makefile_star2_O3/xiongxu[P]bam2bedGraph2/samtools-0.1.19/bcftools/prob1.c
// Function: bcf_p1_init
bcf_p1aux_t *bcf_p1_init(int n, uint8_t *ploidy)
{
	bcf_p1aux_t *ma;
	int i;
	ma = calloc(1, sizeof(bcf_p1aux_t));
	ma->n1 = -1;
	ma->n = n; ma->M = 2 * n;
	if (ploidy) {
		ma->ploidy = malloc(n);
		memcpy(ma->ploidy, ploidy, n);
		for (i = 0, ma->M = 0; i < n; ++i) ma->M += ploidy[i];
		if (ma->M == 2 * n) {
			free(ma->ploidy);
			ma->ploidy = 0;
		}
	}
	ma->q2p = calloc(256, sizeof(double));
	ma->pdg = calloc(3 * ma->n, sizeof(double));
	ma->phi = calloc(ma->M + 1, sizeof(double));
	ma->phi_indel = calloc(ma->M + 1, sizeof(double));
	ma->phi1 = calloc(ma->M + 1, sizeof(double));
	ma->phi2 = calloc(ma->M + 1, sizeof(double));
	ma->z = calloc(ma->M + 1, sizeof(double));
	ma->zswap = calloc(ma->M + 1, sizeof(double));
	ma->z1 = calloc(ma->M + 1, sizeof(double)); // actually we do not need this large
	ma->z2 = calloc(ma->M + 1, sizeof(double));
	ma->afs = calloc(ma->M + 1, sizeof(double));
	ma->afs1 = calloc(ma->M + 1, sizeof(double));
	ma->lf = calloc(ma->M + 1, sizeof(double));
	for (i = 0; i < 256; ++i)
		ma->q2p[i] = pow(10., -i / 10.);
	for (i = 0; i <= ma->M; ++i) ma->lf[i] = lgamma(i + 1);
	bcf_p1_init_prior(ma, MC_PTYPE_FULL, 1e-3); // the simplest prior
	return ma;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %r15d
movl $0x1, %edi
movl $0xb0, %esi
callq 0x2260
movq %rax, %rbx
movl $0xffffffff, 0x8(%rax)  # imm = 0xFFFFFFFF
movl %r15d, (%rax)
leal (%r15,%r15), %ebp
movl %ebp, 0x4(%rax)
testq %r14, %r14
je 0x107ac
movslq %r15d, %r13
movq %r13, %rdi
callq 0x2360
movq %rax, %r12
movq %rax, 0x10(%rbx)
movq %rax, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x22e0
movl $0x0, 0x4(%rbx)
testl %r15d, %r15d
jle 0x10794
movl %r15d, %eax
xorl %ecx, %ecx
xorl %r13d, %r13d
movzbl (%r14,%rcx), %edx
addl %edx, %r13d
incq %rcx
cmpq %rcx, %rax
jne 0x1077e
movl %r13d, 0x4(%rbx)
jmp 0x10797
xorl %r13d, %r13d
cmpl %ebp, %r13d
jne 0x107af
movq %r12, %rdi
callq 0x2060
movq $0x0, 0x10(%rbx)
movl %ebp, %r13d
movl $0x100, %edi            # imm = 0x100
movl $0x8, %esi
callq 0x2260
movq %rax, %r14
movq %rax, 0x18(%rbx)
leal (%r15,%r15,2), %eax
movslq %eax, %rdi
movl $0x8, %esi
callq 0x2260
movq %rax, 0x20(%rbx)
leal 0x1(%r13), %ebp
movslq %ebp, %r15
movl $0x8, %esi
movq %r15, %rdi
callq 0x2260
movq %rax, 0x28(%rbx)
movl $0x8, %esi
movq %r15, %rdi
callq 0x2260
movq %rax, 0x30(%rbx)
movl $0x8, %esi
movq %r15, %rdi
callq 0x2260
movq %rax, 0x58(%rbx)
movl $0x8, %esi
movq %r15, %rdi
callq 0x2260
movq %rax, 0x60(%rbx)
movl $0x8, %esi
movq %r15, %rdi
callq 0x2260
movq %rax, 0x38(%rbx)
movl $0x8, %esi
movq %r15, %rdi
callq 0x2260
movq %rax, 0x40(%rbx)
movl $0x8, %esi
movq %r15, %rdi
callq 0x2260
movq %rax, 0x48(%rbx)
movl $0x8, %esi
movq %r15, %rdi
callq 0x2260
movq %rax, 0x50(%rbx)
movl $0x8, %esi
movq %r15, %rdi
callq 0x2260
movq %rax, 0x90(%rbx)
movl $0x8, %esi
movq %r15, %rdi
callq 0x2260
movq %rax, 0x98(%rbx)
movl $0x8, %esi
movq %r15, %rdi
callq 0x2260
movq %rax, %r15
movq %rax, 0x70(%rbx)
xorl %r12d, %r12d
xorps %xmm1, %xmm1
cvtsi2sd %r12d, %xmm1
movsd 0xabe8(%rip), %xmm0     # 0x1b4a0
divsd %xmm0, %xmm1
callq 0x2160
movsd %xmm0, (%r14)
decq %r12
addq $0x8, %r14
cmpq $-0x100, %r12
jne 0x108a8
testl %r13d, %r13d
js 0x10901
movl %ebp, %r14d
xorl %r12d, %r12d
leaq 0x1(%r12), %r13
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
callq 0x22b0
movsd %xmm0, (%r15,%r12,8)
movq %r13, %r12
cmpq %r13, %r14
jne 0x108e1
movsd 0x8797(%rip), %xmm0     # 0x190a0
movq %rbx, %rdi
movl $0x1, %esi
callq 0xff84
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq