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

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

  /* fill DP table 'f' (hmm->num_of_states * num_of_emissions) */
  for (row = 0; row < hmm->num_of_states; row++) { /* first column */
    gt_assert(emissions[0] < hmm->num_of_symbols);
    f[row][0] = hmm->initial_state_prob[row] +
                hmm->emission_prob[row][emissions[0]];
  }

  for (column = 1; column < num_of_emissions; column++) { /* other columns */
    gt_assert(emissions[column] < hmm->num_of_symbols);
    for (row = 0; row < hmm->num_of_states; row++) {
      f[row][column] = hmm->emission_prob[row][emissions[column]];
      tmp_prob = f[0][column-1] + hmm->transition_prob[0][row];
      for (previous_row = 1; previous_row < hmm->num_of_states;
           previous_row++) {
        /* XXX: replace the logsum() call with a tabulated version */
        tmp_prob = gt_logsum(tmp_prob, f[previous_row][column-1] +
                                       hmm->transition_prob[previous_row][row]);
      }
      f[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 0x18c1a8
cmpq $0x0, 0x28(%rsp)
je 0x18c1a8
cmpq $0x0, 0x20(%rsp)
je 0x18c1a8
cmpq $0x0, 0x18(%rsp)
jne 0x18c1e0
movq 0x4afdf1(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x389e5a(%rip), %rsi    # 0x516013
leaq 0x3c9a74(%rip), %rdx    # 0x555c34
leaq 0x3c9a97(%rip), %rcx    # 0x555c5e
leaq 0x3c928d(%rip), %r8     # 0x55545b
movl $0x181, %r9d            # imm = 0x181
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x18c1e2
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
movq 0x28(%rsp), %rcx
cmpl (%rcx), %eax
jae 0x18c29b
jmp 0x18c1fd
movq 0x20(%rsp), %rax
movl (%rax), %eax
movq 0x28(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jb 0x18c246
movq 0x4afd8b(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x389df4(%rip), %rsi    # 0x516013
leaq 0x3c9a4e(%rip), %rdx    # 0x555c74
leaq 0x3c9a31(%rip), %rcx    # 0x555c5e
leaq 0x3c9227(%rip), %r8     # 0x55545b
movl $0x185, %r9d            # imm = 0x185
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x18c248
movq 0x28(%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x14(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rsp), %rcx
movl (%rcx), %ecx
addsd (%rax,%rcx,8), %xmm0
movq 0x30(%rsp), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, (%rax)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x18c1ea
movl $0x1, 0x10(%rsp)
movslq 0x10(%rsp), %rax
cmpq 0x18(%rsp), %rax
jae 0x18c43b
jmp 0x18c2b5
movq 0x20(%rsp), %rax
movslq 0x10(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq 0x28(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jb 0x18c304
movq 0x4afccd(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x389d36(%rip), %rsi    # 0x516013
leaq 0x3c99b3(%rip), %rdx    # 0x555c97
leaq 0x3c9973(%rip), %rcx    # 0x555c5e
leaq 0x3c9169(%rip), %r8     # 0x55545b
movl $0x18b, %r9d            # imm = 0x18B
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x18c306
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
movq 0x28(%rsp), %rcx
cmpl (%rcx), %eax
jae 0x18c429
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x20(%rsp), %rcx
movslq 0x10(%rsp), %rdx
movl (%rcx,%rdx,4), %ecx
movsd (%rax,%rcx,8), %xmm0
movq 0x30(%rsp), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x10(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x30(%rsp), %rax
movq (%rax), %rax
movl 0x10(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movslq 0x14(%rsp), %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 0x18c3f7
movsd (%rsp), %xmm0
movq 0x30(%rsp), %rax
movslq 0xc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movl 0x10(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm1
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movslq 0xc(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x14(%rsp), %rcx
addsd (%rax,%rcx,8), %xmm1
callq 0xec050
movsd %xmm0, (%rsp)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x18c395
movsd (%rsp), %xmm0
movq 0x30(%rsp), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x10(%rsp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x18c30e
jmp 0x18c42b
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x18c2a3
addq $0x38, %rsp
retq