// File: /workspace/github_c_makefile_star2_O1/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 0x159736
movq %rbx, %rdi
callq 0x101a9a
testb %al, %al
jne 0x159bb5
movq %rbx, 0x8(%rsp)
callq 0x30675f
movq %rax, 0x18(%rsp)
callq 0x3066a4
movq %rax, 0x10(%rsp)
callq 0x30681a
movq %rax, %r12
leaq 0x2329fd(%rip), %rsi    # 0x38c15b
movl $0x150, %edi            # imm = 0x150
movl $0x27b, %edx            # imm = 0x27B
callq 0x1092b2
movq %rax, %rbp
xorl %r15d, %r15d
leaq 0x3655b6(%rip), %rax    # 0x4bed30
movq (%rax,%r15,8), %r13
movq %r13, %rdi
callq 0x172f0
movq %rax, %rbx
testq %rax, %rax
je 0x1597af
xorl %r14d, %r14d
movsbl (%r13,%r14), %esi
movq %r12, %rdi
callq 0xd3d89
movzbl %al, %eax
movl %eax, (%rbp,%r14,4)
incq %r14
cmpq %r14, %rbx
jne 0x159791
movq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
movl %ebx, %edx
callq 0x158e30
callq 0x17e30
movsd %xmm0, 0x20(%rsp)
movq %r14, %rdi
movq %rbp, %rsi
movl %ebx, %edx
callq 0x15904e
callq 0x17e30
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
callq 0x10ac6f
testb %al, %al
je 0x15985e
movq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
movl %ebx, %edx
callq 0x158e30
callq 0x17e30
movsd %xmm0, 0x20(%rsp)
movq %r14, %rdi
movq %rbp, %rsi
movl %ebx, %edx
callq 0x15904e
callq 0x17e30
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
callq 0x10ac6f
movb $0x1, %bl
testb %al, %al
jne 0x15988e
xorl %ebx, %ebx
movq 0x8(%rsp), %rdi
leaq 0x20dcf9(%rip), %rsi    # 0x36753a
leaq 0x232fba(%rip), %rdx    # 0x38c802
leaq 0x232f27(%rip), %rcx    # 0x38c776
leaq 0x232905(%rip), %r8     # 0x38c15b
movl $0x28b, %r9d            # imm = 0x28B
jmp 0x159887
xorl %ebx, %ebx
movq 0x8(%rsp), %rdi
leaq 0x20dcce(%rip), %rsi    # 0x36753a
leaq 0x232f14(%rip), %rdx    # 0x38c787
leaq 0x232efc(%rip), %rcx    # 0x38c776
leaq 0x2328da(%rip), %r8     # 0x38c15b
movl $0x286, %r9d            # imm = 0x286
xorl %eax, %eax
callq 0x1019cf
cmpq $0xb, %r15
ja 0x15989f
incq %r15
testb %bl, %bl
jne 0x159773
leaq 0x2328b5(%rip), %rsi    # 0x38c15b
movq %rbp, %rdi
movl $0x28e, %edx            # imm = 0x28E
callq 0x109670
movq %r12, %rdi
callq 0xd335d
testb %bl, %bl
je 0x15991f
movq 0x18(%rsp), %rdi
movq %rdi, %rsi
callq 0x1593c6
xorps %xmm1, %xmm1
callq 0x10ac6f
testb %al, %al
je 0x159923
movq 0x10(%rsp), %rdi
movq %rdi, %rsi
callq 0x1593c6
xorps %xmm1, %xmm1
callq 0x10ac6f
movb $0x1, %bpl
testb %al, %al
jne 0x159953
leaq 0x20dc3f(%rip), %rsi    # 0x36753a
leaq 0x232fbd(%rip), %rdx    # 0x38c8bf
leaq 0x232e6d(%rip), %rcx    # 0x38c776
leaq 0x23284b(%rip), %r8     # 0x38c15b
xorl %ebp, %ebp
movq 0x8(%rsp), %rdi
movl $0x293, %r9d            # imm = 0x293
jmp 0x15994c
xorl %ebp, %ebp
jmp 0x159953
leaq 0x20dc10(%rip), %rsi    # 0x36753a
leaq 0x232f50(%rip), %rdx    # 0x38c881
leaq 0x232e3e(%rip), %rcx    # 0x38c776
leaq 0x23281c(%rip), %r8     # 0x38c15b
xorl %ebp, %ebp
movq 0x8(%rsp), %rdi
movl $0x291, %r9d            # imm = 0x291
xorl %eax, %eax
callq 0x1019cf
movq 0x10(%rsp), %rdi
callq 0x159bba
movq 0x18(%rsp), %rdi
callq 0x159bba
callq 0x3073f1
movq %rax, 0x18(%rsp)
callq 0x30724c
movq %rax, 0x10(%rsp)
callq 0x307596
movq %rax, %r12
leaq 0x2327d1(%rip), %rsi    # 0x38c15b
movl $0x4b0, %edi            # imm = 0x4B0
movl $0x29c, %edx            # imm = 0x29C
callq 0x1092b2
movq %rax, %r13
testb %bpl, %bpl
je 0x159ad6
xorl %r15d, %r15d
leaq 0x3653f1(%rip), %rax    # 0x4beda0
movq (%rax,%r15,8), %rbp
movq %rbp, %rdi
callq 0x172f0
movq %rax, %rbx
testq %rax, %rax
je 0x1599e4
xorl %r14d, %r14d
movsbl (%rbp,%r14), %esi
movq %r12, %rdi
callq 0xd3d89
movzbl %al, %eax
movl %eax, (%r13,%r14,4)
incq %r14
cmpq %r14, %rbx
jne 0x1599c6
movq 0x18(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0x158e30
callq 0x17e30
movsd %xmm0, 0x20(%rsp)
movq %r14, %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0x15904e
callq 0x17e30
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
callq 0x10ac6f
testb %al, %al
je 0x159a94
movq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0x158e30
callq 0x17e30
movsd %xmm0, 0x20(%rsp)
movq %r14, %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0x15904e
callq 0x17e30
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
callq 0x10ac6f
movb $0x1, %bpl
testb %al, %al
jne 0x159ac4
xorl %ebp, %ebp
movq 0x8(%rsp), %rdi
leaq 0x20dac3(%rip), %rsi    # 0x36753a
leaq 0x232d84(%rip), %rdx    # 0x38c802
leaq 0x232cf1(%rip), %rcx    # 0x38c776
leaq 0x2326cf(%rip), %r8     # 0x38c15b
movl $0x2ad, %r9d            # imm = 0x2AD
jmp 0x159abd
xorl %ebp, %ebp
movq 0x8(%rsp), %rdi
leaq 0x20da98(%rip), %rsi    # 0x36753a
leaq 0x232cde(%rip), %rdx    # 0x38c787
leaq 0x232cc6(%rip), %rcx    # 0x38c776
leaq 0x2326a4(%rip), %r8     # 0x38c15b
movl $0x2a8, %r9d            # imm = 0x2A8
xorl %eax, %eax
callq 0x1019cf
cmpq $0xd, %r15
ja 0x159ad6
incq %r15
testb %bpl, %bpl
jne 0x1599a8
leaq 0x23267e(%rip), %rsi    # 0x38c15b
movq %r13, %rdi
movl $0x2b0, %edx            # imm = 0x2B0
callq 0x109670
movq %r12, %rdi
callq 0xd335d
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testb %bpl, %bpl
je 0x159b90
movq 0x18(%rsp), %rdi
movq %rdi, %rsi
callq 0x1593c6
xorps %xmm1, %xmm1
callq 0x10ac6f
testb %al, %al
je 0x159b5d
movq 0x10(%rsp), %rdi
movq %rdi, %rsi
callq 0x1593c6
xorps %xmm1, %xmm1
callq 0x10ac6f
xorl %ebx, %ebx
testb %al, %al
movq 0x8(%rsp), %rdi
jne 0x159b90
leaq 0x20d9fa(%rip), %rsi    # 0x36753a
leaq 0x232d78(%rip), %rdx    # 0x38c8bf
leaq 0x232c28(%rip), %rcx    # 0x38c776
leaq 0x232606(%rip), %r8     # 0x38c15b
movl $0x2b5, %r9d            # imm = 0x2B5
jmp 0x159b84
leaq 0x20d9d6(%rip), %rsi    # 0x36753a
leaq 0x232d16(%rip), %rdx    # 0x38c881
leaq 0x232c04(%rip), %rcx    # 0x38c776
leaq 0x2325e2(%rip), %r8     # 0x38c15b
movq 0x8(%rsp), %rdi
movl $0x2b3, %r9d            # imm = 0x2B3
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x10(%rsp), %rdi
callq 0x159bba
movq 0x18(%rsp), %rdi
callq 0x159bba
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x492d0