// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/extended/hmm.c
// Function: gt_hmm_unit_test
int gt_hmm_unit_test(GtError *err)
{
  /* the last coin string must be the longest */
  static char *coin_tosses[] = { "H", "T", "HH", "HT", "TH", "TT", "HTHT",
                                 "HHHHHTTTTT", "HTTHTHTHHTHTHHHTHTHTHTHTHHHTH",
                                 "HHHHHHHHHHHHHHHHHHHTTTTTTTTTTTTTTT", "HTTHTH",
                                 "HHTHHTTHTTHTHTHTHTHTTTTTTTHHHTTHHHHHHTHT",
                                 "HHTTTHHTTTHHTHTHTTTHTHHHTHTHHHTHTHHHTHHHTH"
                                 "HHTHTHHHHTTTHTTHHHTTTHTTTHHTHTHTHHTHHTHTHH" };
  /* the last dice string must be the longest */
  static char *dice_rolls[] = { "1", "2", "3", "4", "5", "6", "11", "12", "56",
                                "156246", "165565254154", "66614566161",
                                "12345654321551515144561456131641135452134",
                                "66666666666666666666666666666666666666666666",
                                "3151162464466442453113216311641521336251445436"
                                "3165662656666665116645313265124563666463163666"
                                "3162326455236266666625151631222555441666566563"
                                "5643243641315134651463534111264146262533563661"
                                "6366646623252441366166116325256246225526525226"
                                "6435353336233121625364414432335163243633665562"
                                "466662632666612355245242" };
  unsigned int *encoded_seq;
  GtAlphabet *alpha;
  size_t i, j, len, size;
  GtHMM *fair_hmm, *loaded_hmm;
  int had_err = 0;
  gt_error_check(err);

  /* test the GtHMM class with the coin GtHMMs */
  fair_hmm = gt_coin_hmm_fair();
  loaded_hmm = gt_coin_hmm_loaded();
  alpha = gt_coin_hmm_alphabet();
  size = sizeof (coin_tosses) / sizeof (coin_tosses[0]);
  encoded_seq = gt_malloc(sizeof (int) * strlen(coin_tosses[size-1]));

  for (i = 0; i < size && !had_err; i++) {
    len = strlen(coin_tosses[i]);
    for (j = 0; j < len; j++)
      encoded_seq[j] = gt_alphabet_encode(alpha, coin_tosses[i][j]);
    /* XXX: remove exp() calls */
    gt_ensure(
           gt_double_equals_double(exp(gt_hmm_forward(fair_hmm, encoded_seq,
                                                      len)),
                                   exp(gt_hmm_backward(fair_hmm, encoded_seq,
                                                    len))));
    gt_ensure(
           gt_double_equals_double(exp(gt_hmm_forward(loaded_hmm, encoded_seq,
                                                   len)),
                                   exp(gt_hmm_backward(loaded_hmm, encoded_seq,
                                                    len))));
  }

  gt_free(encoded_seq);
  gt_alphabet_delete(alpha);
  gt_ensure(
            gt_double_equals_double(gt_hmm_rmsd(fair_hmm, fair_hmm), 0.0));
  gt_ensure(
            gt_double_equals_double(gt_hmm_rmsd(loaded_hmm, loaded_hmm), 0.0));
  gt_hmm_delete(loaded_hmm);
  gt_hmm_delete(fair_hmm);

  /* test the GtHMM class with the dice GtHMMs */
  fair_hmm = gt_dice_hmm_fair();
  loaded_hmm = gt_dice_hmm_loaded();
  alpha = gt_dice_hmm_alphabet();
  size = sizeof (dice_rolls) / sizeof (dice_rolls[0]);
  encoded_seq = gt_malloc(sizeof (int) * strlen(dice_rolls[size-1]));

  for (i = 0; i < size && !had_err; i++) {
    len = strlen(dice_rolls[i]);
    for (j = 0; j < len; j++) {
      encoded_seq[j] = gt_alphabet_encode(alpha, dice_rolls[i][j]);
    }
    /* XXX: remove exp() calls */
    gt_ensure(
           gt_double_equals_double(exp(gt_hmm_forward(fair_hmm, encoded_seq,
                                                      len)),
                                   exp(gt_hmm_backward(fair_hmm, encoded_seq,
                                                       len))));
    gt_ensure(
           gt_double_equals_double(exp(gt_hmm_forward(loaded_hmm, encoded_seq,
                                                      len)),
                                   exp(gt_hmm_backward(loaded_hmm, encoded_seq,
                                                       len))));
  }

  gt_free(encoded_seq);
  gt_alphabet_delete(alpha);
  gt_ensure(
            gt_double_equals_double(gt_hmm_rmsd(fair_hmm, fair_hmm), 0.0));
  gt_ensure(
            gt_double_equals_double(gt_hmm_rmsd(loaded_hmm, loaded_hmm), 0.0));
  gt_hmm_delete(loaded_hmm);
  gt_hmm_delete(fair_hmm);

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
testq %rdi, %rdi
je 0xedc95
movq %rbx, %rdi
callq 0x89eb7
testb %al, %al
jne 0xee11b
movq %rbx, 0x8(%rsp)
callq 0x2991a7
movq %rax, 0x18(%rsp)
callq 0x2990c8
movq %rax, 0x10(%rsp)
callq 0x299286
movq %rax, %r12
leaq 0x2354e6(%rip), %rsi    # 0x3231a3
movl $0x150, %edi            # imm = 0x150
movl $0x27b, %edx            # imm = 0x27B
callq 0x93160
movq %rax, %rbp
xorl %r15d, %r15d
xorl %r13d, %r13d
cmpq $0xc, %r15
ja 0xede0c
testl %r13d, %r13d
jne 0xede0c
leaq 0x345051(%rip), %rax    # 0x432d40
movq (%rax,%r15,8), %rbx
movq %rbx, %rdi
callq 0x172d0
movq %rax, %r13
xorl %r14d, %r14d
cmpq %r14, %r13
je 0xedd20
movsbl (%rbx,%r14), %esi
movq %r12, %rdi
callq 0x57552
movzbl %al, %eax
movl %eax, (%rbp,%r14,4)
incq %r14
jmp 0xedd01
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
movl %r13d, %edx
callq 0xed1e3
callq 0x17da0
movsd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
movl %r13d, %edx
callq 0xed45f
callq 0x17da0
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
callq 0x955a5
testb %al, %al
je 0xeddd2
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
movl %r13d, %edx
callq 0xed1e3
callq 0x17da0
movsd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
movl %r13d, %edx
callq 0xed45f
callq 0x17da0
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
callq 0x955a5
xorl %r13d, %r13d
testb %al, %al
jne 0xede04
movq 0x8(%rsp), %rdi
leaq 0x21063d(%rip), %rsi    # 0x2fe3f2
leaq 0x235a8e(%rip), %rdx    # 0x32384a
leaq 0x2359fb(%rip), %rcx    # 0x3237be
leaq 0x2353d9(%rip), %r8     # 0x3231a3
movl $0x28b, %r9d            # imm = 0x28B
jmp 0xeddf9
movq 0x8(%rsp), %rdi
leaq 0x210614(%rip), %rsi    # 0x2fe3f2
leaq 0x2359ea(%rip), %rdx    # 0x3237cf
leaq 0x2359d2(%rip), %rcx    # 0x3237be
leaq 0x2353b0(%rip), %r8     # 0x3231a3
movl $0x286, %r9d            # imm = 0x286
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %r13
incq %r15
jmp 0xedcd5
leaq 0x235390(%rip), %rsi    # 0x3231a3
movq %rbp, %rdi
movl $0x28e, %edx            # imm = 0x28E
callq 0x936f9
movq %r12, %rdi
callq 0x568b5
pushq $-0x1
popq %rbx
testl %r13d, %r13d
jne 0xedec2
movq 0x18(%rsp), %rdi
movq %rdi, %rsi
callq 0xed84a
xorps %xmm1, %xmm1
callq 0x955a5
testb %al, %al
je 0xede91
movq 0x10(%rsp), %rdi
movq %rdi, %rsi
callq 0xed84a
xorps %xmm1, %xmm1
callq 0x955a5
xorl %ebx, %ebx
testb %al, %al
jne 0xedec2
leaq 0x210583(%rip), %rsi    # 0x2fe3f2
leaq 0x235a91(%rip), %rdx    # 0x323907
leaq 0x235941(%rip), %rcx    # 0x3237be
leaq 0x23531f(%rip), %r8     # 0x3231a3
movq 0x8(%rsp), %rdi
movl $0x293, %r9d            # imm = 0x293
jmp 0xedeb8
leaq 0x21055a(%rip), %rsi    # 0x2fe3f2
leaq 0x235a2a(%rip), %rdx    # 0x3238c9
leaq 0x235918(%rip), %rcx    # 0x3237be
leaq 0x2352f6(%rip), %r8     # 0x3231a3
movq 0x8(%rsp), %rdi
movl $0x291, %r9d            # imm = 0x291
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %rbx
movq 0x10(%rsp), %rdi
callq 0xee153
movq 0x18(%rsp), %rdi
callq 0xee153
callq 0x29a4e0
movq %rax, 0x18(%rsp)
callq 0x29a318
movq %rax, 0x10(%rsp)
callq 0x29a6a8
movq %rax, %r12
leaq 0x2352aa(%rip), %rsi    # 0x3231a3
movl $0x4b0, %edi            # imm = 0x4B0
movl $0x29c, %edx            # imm = 0x29C
callq 0x93160
movq %rax, %rbp
xorl %r15d, %r15d
cmpq $0xe, %r15
ja 0xee042
testl %ebx, %ebx
jne 0xee042
leaq 0x344e89(%rip), %rax    # 0x432db0
movq (%rax,%r15,8), %rbx
movq %rbx, %rdi
callq 0x172d0
movq %rax, %r13
xorl %r14d, %r14d
cmpq %r14, %r13
je 0xedf58
movsbl (%rbx,%r14), %esi
movq %r12, %rdi
callq 0x57552
movzbl %al, %eax
movl %eax, (%rbp,%r14,4)
incq %r14
jmp 0xedf39
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
movl %r13d, %edx
callq 0xed1e3
callq 0x17da0
movsd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
movl %r13d, %edx
callq 0xed45f
callq 0x17da0
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
callq 0x955a5
testb %al, %al
je 0xee009
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
movl %r13d, %edx
callq 0xed1e3
callq 0x17da0
movsd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
movl %r13d, %edx
callq 0xed45f
callq 0x17da0
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
callq 0x955a5
xorl %ebx, %ebx
testb %al, %al
jne 0xee03a
movq 0x8(%rsp), %rdi
leaq 0x210406(%rip), %rsi    # 0x2fe3f2
leaq 0x235857(%rip), %rdx    # 0x32384a
leaq 0x2357c4(%rip), %rcx    # 0x3237be
leaq 0x2351a2(%rip), %r8     # 0x3231a3
movl $0x2ad, %r9d            # imm = 0x2AD
jmp 0xee030
movq 0x8(%rsp), %rdi
leaq 0x2103dd(%rip), %rsi    # 0x2fe3f2
leaq 0x2357b3(%rip), %rdx    # 0x3237cf
leaq 0x23579b(%rip), %rcx    # 0x3237be
leaq 0x235179(%rip), %r8     # 0x3231a3
movl $0x2a8, %r9d            # imm = 0x2A8
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %rbx
incq %r15
jmp 0xedf0e
leaq 0x23515a(%rip), %rsi    # 0x3231a3
movq %rbp, %rdi
movl $0x2b0, %edx            # imm = 0x2B0
callq 0x936f9
movq %r12, %rdi
callq 0x568b5
pushq $-0x1
popq %rbp
testl %ebx, %ebx
jne 0xee0f4
movq 0x18(%rsp), %rdi
movq %rdi, %rsi
callq 0xed84a
xorps %xmm1, %xmm1
callq 0x955a5
testb %al, %al
je 0xee0c6
movq 0x10(%rsp), %rdi
movq %rdi, %rsi
callq 0xed84a
xorps %xmm1, %xmm1
callq 0x955a5
xorl %ebx, %ebx
testb %al, %al
jne 0xee0f6
leaq 0x21034e(%rip), %rsi    # 0x2fe3f2
leaq 0x23585c(%rip), %rdx    # 0x323907
leaq 0x23570c(%rip), %rcx    # 0x3237be
leaq 0x2350ea(%rip), %r8     # 0x3231a3
movq 0x8(%rsp), %rdi
movl $0x2b5, %r9d            # imm = 0x2B5
jmp 0xee0ed
leaq 0x210325(%rip), %rsi    # 0x2fe3f2
leaq 0x2357f5(%rip), %rdx    # 0x3238c9
leaq 0x2356e3(%rip), %rcx    # 0x3237be
leaq 0x2350c1(%rip), %r8     # 0x3231a3
movq 0x8(%rsp), %rdi
movl $0x2b3, %r9d            # imm = 0x2B3
xorl %eax, %eax
callq 0x89dbb
movl %ebp, %ebx
movq 0x10(%rsp), %rdi
callq 0xee153
movq 0x18(%rsp), %rdi
callq 0xee153
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x349e46(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x1f6ee7(%rip), %rsi    # 0x2e5013
leaq 0x1f708c(%rip), %rdx    # 0x2e51bf
leaq 0x235684(%rip), %rcx    # 0x3237be
leaq 0x235062(%rip), %r8     # 0x3231a3
movl $0x274, %r9d            # imm = 0x274
xorl %eax, %eax
callq 0x17a50
callq 0x17390