// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/hmm.c
// Function: compute_backward_table
static void compute_backward_table(double **b, const GtHMM *hmm,
                                   const unsigned int *emissions,
                                   GtUword num_of_emissions)
{
  int row, column, next_row;
  double tmp_prob;

  gt_assert(b && hmm && emissions && num_of_emissions);

  /* fill DP table 'b' (hmm->num_of_states * num_of_emissions) */
  for (row = 0; row < hmm->num_of_states; row++) { /* last column */
    b[row][num_of_emissions-1] = 0.0; /* probability = 1.0 */
  }

  for (column = num_of_emissions - 2; column >= 0; column--) { /* other cols */
    gt_assert(emissions[column] < hmm->num_of_symbols);
    for (row = 0; row < hmm->num_of_states; row++) {
      tmp_prob = hmm->transition_prob[row][0] +
                 hmm->emission_prob[0][emissions[column+1]] +
                 b[0][column+1];
      for (next_row = 1; next_row < hmm->num_of_states; next_row++) {
        /* XXX: replace the logsum() call with a tabulated version */
        tmp_prob = gt_logsum(tmp_prob, hmm->transition_prob[row][next_row] +
                             hmm->emission_prob[next_row][emissions[column+1]] +
                             b[next_row][column+1]);
      }
      b[row][column] = tmp_prob;
    }
  }
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
cmpq $0x0, 0x30(%rsp)
je 0x18c688
cmpq $0x0, 0x28(%rsp)
je 0x18c688
cmpq $0x0, 0x20(%rsp)
je 0x18c688
cmpq $0x0, 0x18(%rsp)
jne 0x18c6c0
movq 0x4af911(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x38997a(%rip), %rsi    # 0x516013
leaq 0x3c961f(%rip), %rdx    # 0x555cbf
leaq 0x3c9642(%rip), %rcx    # 0x555ce9
leaq 0x3c8dad(%rip), %r8     # 0x55545b
movl $0x1ba, %r9d            # imm = 0x1BA
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x18c6c2
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
movq 0x28(%rsp), %rcx
cmpl (%rcx), %eax
jae 0x18c703
movq 0x30(%rsp), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x18(%rsp), %rcx
subq $0x1, %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x18c6ca
movq 0x18(%rsp), %rax
subq $0x2, %rax
movl %eax, 0x10(%rsp)
cmpl $0x0, 0x10(%rsp)
jl 0x18c8b5
jmp 0x18c71d
movq 0x20(%rsp), %rax
movslq 0x10(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq 0x28(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jb 0x18c76c
movq 0x4af865(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3898ce(%rip), %rsi    # 0x516013
leaq 0x3c954b(%rip), %rdx    # 0x555c97
leaq 0x3c9596(%rip), %rcx    # 0x555ce9
leaq 0x3c8d01(%rip), %r8     # 0x55545b
movl $0x1c2, %r9d            # imm = 0x1C2
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x18c76e
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
movq 0x28(%rsp), %rcx
cmpl (%rcx), %eax
jae 0x18c8a3
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd (%rax), %xmm0
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movl 0x10(%rsp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movl (%rcx,%rdx,4), %ecx
addsd (%rax,%rcx,8), %xmm0
movq 0x30(%rsp), %rax
movq (%rax), %rax
movl 0x10(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rsp)
movl $0x1, 0xc(%rsp)
movl 0xc(%rsp), %eax
movq 0x28(%rsp), %rcx
cmpl (%rcx), %eax
jae 0x18c876
movsd (%rsp), %xmm0
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0xc(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rax
movslq 0xc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rsp), %rcx
movl 0x10(%rsp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movl (%rcx,%rdx,4), %ecx
addsd (%rax,%rcx,8), %xmm1
movq 0x30(%rsp), %rax
movslq 0xc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x10(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
addsd (%rax,%rcx,8), %xmm1
callq 0xec050
movsd %xmm0, (%rsp)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x18c7e4
movsd (%rsp), %xmm0
movq 0x30(%rsp), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x10(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x18c776
jmp 0x18c8a5
movl 0x10(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x18c710
addq $0x38, %rsp
retq
nopw (%rax,%rax)