// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movl %edx, 0x24(%rsp)
cmpq $0x0, 0x30(%rsp)
je 0x18c469
cmpq $0x0, 0x28(%rsp)
je 0x18c469
cmpl $0x0, 0x24(%rsp)
jne 0x18c4a1
movq 0x4afb30(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x389b99(%rip), %rsi    # 0x516013
leaq 0x3c9843(%rip), %rdx    # 0x555cc4
leaq 0x3c91fb(%rip), %rcx    # 0x555683
leaq 0x3c8fcc(%rip), %r8     # 0x55545b
movl $0x1d9, %r9d            # imm = 0x1D9
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x18c4a3
movq 0x30(%rsp), %rax
movl (%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
leaq 0x3c8fa4(%rip), %rsi    # 0x55545b
movl $0x1da, %edx            # imm = 0x1DA
callq 0xe80f0
movq %rax, 0x18(%rsp)
movq 0x30(%rsp), %rax
movl (%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
movl 0x24(%rsp), %eax
imulq %rax, %rdi
leaq 0x3c8f79(%rip), %rsi    # 0x55545b
movl $0x1da, %edx            # imm = 0x1DA
callq 0xe80f0
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, (%rax)
movq $0x1, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq 0x30(%rsp), %rcx
movl (%rcx), %ecx
cmpq %rcx, %rax
jae 0x18c54c
movq 0x18(%rsp), %rax
movq 0x8(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
movl 0x24(%rsp), %eax
shlq $0x3, %rax
addq %rax, %rdx
movq 0x18(%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x8(%rsp)
jmp 0x18c500
movq 0x18(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x28(%rsp), %rdx
movl 0x24(%rsp), %eax
movl %eax, %ecx
callq 0x18c650
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movsd (%rax), %xmm0
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
movq 0x28(%rsp), %rcx
movl (%rcx), %ecx
addsd (%rax,%rcx,8), %xmm0
movq 0x18(%rsp), %rax
movq (%rax), %rax
addsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movl $0x1, 0x20(%rsp)
movl 0x20(%rsp), %eax
movq 0x30(%rsp), %rcx
cmpl (%rcx), %eax
jae 0x18c610
movsd 0x10(%rsp), %xmm0
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rax
movl 0x20(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm1
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rax
movl 0x20(%rsp), %ecx
movq (%rax,%rcx,8), %rax
movq 0x28(%rsp), %rcx
movl (%rcx), %ecx
addsd (%rax,%rcx,8), %xmm1
movq 0x18(%rsp), %rax
movl 0x20(%rsp), %ecx
movq (%rax,%rcx,8), %rax
addsd (%rax), %xmm1
callq 0xec050
movsd %xmm0, 0x10(%rsp)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x18c5a5
movq 0x18(%rsp), %rax
movq (%rax), %rdi
leaq 0x3c8e3c(%rip), %rsi    # 0x55545b
movl $0x1e8, %edx            # imm = 0x1E8
callq 0xe88c0
movq 0x18(%rsp), %rdi
leaq 0x3c8e26(%rip), %rsi    # 0x55545b
movl $0x1e8, %edx            # imm = 0x1E8
callq 0xe88c0
movsd 0x10(%rsp), %xmm0
addq $0x38, %rsp
retq
nopw (%rax,%rax)