// File: /workspace/github_c_makefile_star2_O1/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 0x103ba
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 0x103a5
movl 0x4(%rbx), %eax
movl %r15d, %ecx
xorl %edx, %edx
movzbl (%r14,%rdx), %esi
addl %esi, %eax
incq %rdx
cmpq %rdx, %rcx
jne 0x10393
movl %eax, 0x4(%rbx)
cmpl %ebp, 0x4(%rbx)
jne 0x103ba
movq %r12, %rdi
callq 0x2060
movq $0x0, 0x10(%rbx)
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)
movslq 0x4(%rbx), %r15
movl %r15d, %r12d
incq %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 %r13d, %r13d
xorps %xmm1, %xmm1
cvtsi2sd %r13d, %xmm1
movsd 0xaf4a(%rip), %xmm0     # 0x1b410
divsd %xmm0, %xmm1
callq 0x2160
movsd %xmm0, (%r14)
decq %r13
addq $0x8, %r14
cmpq $-0x100, %r13
jne 0x104b6
testl %r12d, %r12d
js 0x1050e
incq %r12
xorl %r14d, %r14d
leaq 0x1(%r14), %r13
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
callq 0x22b0
movsd %xmm0, (%r15,%r14,8)
movq %r13, %r14
cmpq %r13, %r12
jne 0x104ef
movsd 0x8b22(%rip), %xmm0     # 0x19038
movq %rbx, %rdi
movl $0x1, %esi
callq 0xfcbc
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq