// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/hmm.c
// Function: gt_hmm_rmsd
double gt_hmm_rmsd(const GtHMM *hmm_a, const GtHMM* hmm_b)
{
  unsigned int i, j;
  double difference = 0.0, rmsd = 0.0, a_prob, b_prob;
  gt_assert(hmm_a && hmm_b);
  gt_assert(hmm_a->num_of_states == hmm_b->num_of_states);
  gt_assert(hmm_a->num_of_symbols == hmm_b->num_of_symbols);
  gt_assert(gt_hmm_is_valid(hmm_a));
  gt_assert(gt_hmm_is_valid(hmm_b));
  /* add transitions probabilities */
  for (i = 0; i < hmm_a->num_of_states; i++) {
    for (j = 0; j < hmm_a->num_of_states; j++) {
      a_prob = gt_hmm_get_transition_probability(hmm_a,i,j);
      b_prob = gt_hmm_get_transition_probability(hmm_b,i,j);

      if (gt_double_equals_double(a_prob, b_prob))
        difference = 0.0;
      else
        difference = a_prob - b_prob;
      rmsd += difference * difference;
    }
  }
  /* add emission probabilities */
  for (i = 0; i < hmm_a->num_of_states; i++) {
    for (j = 0; j < hmm_a->num_of_symbols; j++) {
      a_prob = gt_hmm_get_emission_probability(hmm_a,i,j);
      b_prob = gt_hmm_get_emission_probability(hmm_b,i,j);

      if (gt_double_equals_double(a_prob, b_prob))
        difference = 0.0;
      else
        difference = a_prob - b_prob;
      rmsd += difference * difference;
    }
  }
  return sqrt(rmsd);
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x18(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
cmpq $0x0, 0x30(%rsp)
je 0x18cb00
cmpq $0x0, 0x28(%rsp)
jne 0x18cb38
movq 0x4af499(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x389502(%rip), %rsi    # 0x516013
leaq 0x3c8b87(%rip), %rdx    # 0x55569f
leaq 0x3c8b8f(%rip), %rcx    # 0x5556ae
leaq 0x3c8935(%rip), %r8     # 0x55545b
movl $0x21b, %r9d            # imm = 0x21B
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x18cb3a
jmp 0x18cb3c
movq 0x30(%rsp), %rax
movl (%rax), %eax
movq 0x28(%rsp), %rcx
cmpl (%rcx), %eax
je 0x18cb84
movq 0x4af44d(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3894b6(%rip), %rsi    # 0x516013
leaq 0x3c8b56(%rip), %rdx    # 0x5556ba
leaq 0x3c8b43(%rip), %rcx    # 0x5556ae
leaq 0x3c88e9(%rip), %r8     # 0x55545b
movl $0x21c, %r9d            # imm = 0x21C
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x18cb86
jmp 0x18cb88
movq 0x30(%rsp), %rax
movl 0x4(%rax), %eax
movq 0x28(%rsp), %rcx
cmpl 0x4(%rcx), %eax
je 0x18cbd2
movq 0x4af3ff(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x389468(%rip), %rsi    # 0x516013
leaq 0x3c8b35(%rip), %rdx    # 0x5556e7
leaq 0x3c8af5(%rip), %rcx    # 0x5556ae
leaq 0x3c889b(%rip), %r8     # 0x55545b
movl $0x21d, %r9d            # imm = 0x21D
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x18cbd4
jmp 0x18cbd6
movq 0x30(%rsp), %rdi
callq 0x18b260
testb $0x1, %al
jne 0x18cc1c
movq 0x4af3b5(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x38941e(%rip), %rsi    # 0x516013
leaq 0x3c8b1a(%rip), %rdx    # 0x555716
leaq 0x3c8aab(%rip), %rcx    # 0x5556ae
leaq 0x3c8851(%rip), %r8     # 0x55545b
movl $0x21e, %r9d            # imm = 0x21E
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x18cc1e
jmp 0x18cc20
movq 0x28(%rsp), %rdi
callq 0x18b260
testb $0x1, %al
jne 0x18cc66
movq 0x4af36b(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3893d4(%rip), %rsi    # 0x516013
leaq 0x3c8ae7(%rip), %rdx    # 0x55572d
leaq 0x3c8a61(%rip), %rcx    # 0x5556ae
leaq 0x3c8807(%rip), %r8     # 0x55545b
movl $0x21f, %r9d            # imm = 0x21F
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x18cc68
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
movq 0x30(%rsp), %rcx
cmpl (%rcx), %eax
jae 0x18cd3d
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
movq 0x30(%rsp), %rcx
cmpl (%rcx), %eax
jae 0x18cd2b
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
movl 0x20(%rsp), %edx
callq 0x18ae10
movsd %xmm0, 0x8(%rsp)
movq 0x28(%rsp), %rdi
movl 0x24(%rsp), %esi
movl 0x20(%rsp), %edx
callq 0x18ae10
movsd %xmm0, (%rsp)
movsd 0x8(%rsp), %xmm0
movsd (%rsp), %xmm1
callq 0xec260
testb $0x1, %al
jne 0x18ccdf
jmp 0x18ccea
xorps %xmm0, %xmm0
movsd %xmm0, 0x18(%rsp)
jmp 0x18ccfb
movsd 0x8(%rsp), %xmm0
subsd (%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x18(%rsp), %xmm0
movsd 0x18(%rsp), %xmm2
movsd 0x10(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x18cc89
jmp 0x18cd2d
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x18cc70
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
movq 0x30(%rsp), %rcx
cmpl (%rcx), %eax
jae 0x18ce13
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
movq 0x30(%rsp), %rcx
cmpl 0x4(%rcx), %eax
jae 0x18ce01
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
movl 0x20(%rsp), %edx
callq 0x18b0e0
movsd %xmm0, 0x8(%rsp)
movq 0x28(%rsp), %rdi
movl 0x24(%rsp), %esi
movl 0x20(%rsp), %edx
callq 0x18b0e0
movsd %xmm0, (%rsp)
movsd 0x8(%rsp), %xmm0
movsd (%rsp), %xmm1
callq 0xec260
testb $0x1, %al
jne 0x18cdb5
jmp 0x18cdc0
xorps %xmm0, %xmm0
movsd %xmm0, 0x18(%rsp)
jmp 0x18cdd1
movsd 0x8(%rsp), %xmm0
subsd (%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x18(%rsp), %xmm0
movsd 0x18(%rsp), %xmm2
movsd 0x10(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x18cd5e
jmp 0x18ce03
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x18cd45
movsd 0x10(%rsp), %xmm0
callq 0x19590
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)