// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/hmm.c
// Function: gt_hmm_backward
double gt_hmm_backward(const GtHMM* hmm, const unsigned int *emissions,
                    unsigned int num_of_emissions)
{
  unsigned int i;
  double **b, P;

  gt_assert(hmm && emissions && num_of_emissions);
  gt_array2dim_malloc(b, hmm->num_of_states, num_of_emissions);

  /* XXX: we do not need the full table here, the last column would suffice */
  compute_backward_table(b, hmm, emissions, num_of_emissions);

  /* compute P(x) */
  P = hmm->initial_state_prob[0] + hmm->emission_prob[0][emissions[0]] +
      b[0][0];
  for (i = 1; i < hmm->num_of_states; i++) {
    /* XXX: replace the logsum() call with a tabulated version */
    P = gt_logsum(P, hmm->initial_state_prob[i] +
                     hmm->emission_prob[i][emissions[0]] + b[i][0]);
  }

  gt_array2dim_delete(b);
  return P;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x159261
movq %rsi, %rbx
testq %rsi, %rsi
je 0x159261
movl %edx, %ebp
testl %edx, %edx
je 0x159261
movq %rdi, %r14
movl (%rdi), %edi
shlq $0x3, %rdi
leaq 0x2330d3(%rip), %r12    # 0x38c15b
movq %r12, %rsi
movl $0x1da, %edx            # imm = 0x1DA
callq 0x1092b2
movq %rax, %r15
movl (%r14), %edi
movl %ebp, %r13d
imulq %r13, %rdi
shlq $0x3, %rdi
movq %r12, %rsi
movl $0x1da, %edx            # imm = 0x1DA
callq 0x1092b2
movq %rax, (%r15)
movl (%r14), %eax
cmpq $0x2, %rax
jb 0x1590e1
leaq (,%r13,8), %rcx
movq (%r15), %rdx
addq %rcx, %rdx
movl $0x1, %esi
movq %rdx, (%r15,%rsi,8)
incq %rsi
addq %rcx, %rdx
cmpq %rsi, %rax
jne 0x1590d2
testq %rax, %rax
je 0x1590fd
xorl %ecx, %ecx
movq (%r15,%rcx,8), %rdx
movq $0x0, -0x8(%rdx,%r13,8)
incq %rcx
cmpq %rcx, %rax
jne 0x1590e8
addl $-0x2, %ebp
js 0x1591c2
movl %ebp, %eax
movq %rax, (%rsp)
movl (%rbx,%rax,4), %eax
cmpl 0x4(%r14), %eax
jae 0x15925c
cmpl $0x0, (%r14)
je 0x1591b3
movq (%rsp), %rax
leal 0x1(%rax), %r13d
xorl %ebp, %ebp
movq 0x10(%r14), %rax
movq (%rax,%rbp,8), %rax
movsd (%rax), %xmm0
movq 0x18(%r14), %rax
movq (%rax), %rax
movl (%rbx,%r13,4), %ecx
addsd (%rax,%rcx,8), %xmm0
movq (%r15), %rax
addsd (%rax,%r13,8), %xmm0
cmpl $0x2, (%r14)
jb 0x159197
movl $0x1, %r12d
movq 0x10(%r14), %rax
movq 0x18(%r14), %rcx
movq (%rax,%rbp,8), %rax
movsd (%rax,%r12,8), %xmm1
movq (%rcx,%r12,8), %rax
movl (%rbx,%r13,4), %ecx
addsd (%rax,%rcx,8), %xmm1
movq (%r15,%r12,8), %rax
addsd (%rax,%r13,8), %xmm1
callq 0x10aba0
incq %r12
movl (%r14), %eax
cmpq %rax, %r12
jb 0x15915e
movq (%r15,%rbp,8), %rax
movq (%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
incq %rbp
movl (%r14), %eax
cmpq %rax, %rbp
jb 0x15912d
movq (%rsp), %rax
leal -0x1(%rax), %ebp
testl %eax, %eax
jg 0x159106
movq 0x8(%r14), %rax
movsd (%rax), %xmm0
movq 0x18(%r14), %rax
movq (%rax), %rax
movl (%rbx), %ecx
addsd (%rax,%rcx,8), %xmm0
movq (%r15), %rax
addsd (%rax), %xmm0
cmpl $0x2, (%r14)
jb 0x15921c
movl $0x1, %r12d
movq 0x8(%r14), %rax
movq 0x18(%r14), %rcx
movsd (%rax,%r12,8), %xmm1
movq (%rcx,%r12,8), %rax
movl (%rbx), %ecx
addsd (%rax,%rcx,8), %xmm1
movq (%r15,%r12,8), %rax
addsd (%rax), %xmm1
callq 0x10aba0
incq %r12
movl (%r14), %eax
cmpq %rax, %r12
jb 0x1591eb
movsd %xmm0, (%rsp)
movq (%r15), %rdi
leaq 0x232f30(%rip), %rbx    # 0x38c15b
movq %rbx, %rsi
movl $0x1e8, %edx            # imm = 0x1E8
callq 0x109670
movq %r15, %rdi
movq %rbx, %rsi
movl $0x1e8, %edx            # imm = 0x1E8
callq 0x109670
movsd (%rsp), %xmm0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x49108
callq 0x490cf