// File: /workspace/github_c_makefile_star2_O3/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 0x151ded
movq %rbx, %rdi
callq 0xfcc32
testb %al, %al
jne 0x1522a8
movq %rbx, 0x8(%rsp)
callq 0x2fca4b
movq %rax, 0x18(%rsp)
callq 0x2fc990
movq %rax, 0x10(%rsp)
callq 0x2fcb06
movq %rax, %r12
leaq 0x230f86(%rip), %rsi    # 0x382d9b
movl $0x150, %edi            # imm = 0x150
movl $0x27b, %edx            # imm = 0x27B
callq 0x104226
movq %rax, %r13
xorl %r15d, %r15d
leaq 0x361eef(%rip), %rax    # 0x4b3d20
movq (%rax,%r15,8), %rbx
movq %rbx, %rdi
callq 0x172f0
movq %rax, %rbp
testq %rax, %rax
je 0x151e65
xorl %r14d, %r14d
movsbl (%rbx,%r14), %esi
movq %r12, %rdi
callq 0xd185d
movzbl %al, %eax
movl %eax, (%r13,%r14,4)
incq %r14
cmpq %r14, %rbp
jne 0x151e48
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x1514af
callq 0x17e30
movsd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x1516ea
callq 0x17e30
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
callq 0x105bb7
testb %al, %al
je 0x151f86
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x1514af
callq 0x17e30
movsd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x1516ea
callq 0x17e30
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
callq 0x105bb7
testb %al, %al
je 0x151faf
leaq 0x1(%r15), %rax
cmpq $0xc, %r15
movq %rax, %r15
jb 0x151e2a
leaq 0x230e94(%rip), %rsi    # 0x382d9b
movq %r13, %rdi
movl $0x28e, %edx            # imm = 0x28E
callq 0x1045eb
movq %r12, %rdi
callq 0xd0e1c
movq 0x18(%rsp), %rdi
movq %rdi, %rsi
callq 0x151a6f
xorps %xmm1, %xmm1
callq 0x105bb7
testb %al, %al
je 0x151ffd
movq 0x10(%rsp), %rdi
movq %rdi, %rsi
callq 0x151a6f
xorps %xmm1, %xmm1
callq 0x105bb7
movb $0x1, %bl
testb %al, %al
movq 0x8(%rsp), %rdi
jne 0x15202d
leaq 0x20c4da(%rip), %rsi    # 0x35e43e
leaq 0x231594(%rip), %rdx    # 0x3834ff
leaq 0x231444(%rip), %rcx    # 0x3833b6
leaq 0x230e22(%rip), %r8     # 0x382d9b
xorl %ebx, %ebx
movl $0x293, %r9d            # imm = 0x293
jmp 0x152026
leaq 0x20c4b1(%rip), %rsi    # 0x35e43e
leaq 0x231433(%rip), %rdx    # 0x3833c7
leaq 0x23141b(%rip), %rcx    # 0x3833b6
leaq 0x230df9(%rip), %r8     # 0x382d9b
movq 0x8(%rsp), %rdi
movl $0x286, %r9d            # imm = 0x286
jmp 0x151fd6
leaq 0x20c488(%rip), %rsi    # 0x35e43e
leaq 0x231485(%rip), %rdx    # 0x383442
leaq 0x2313f2(%rip), %rcx    # 0x3833b6
leaq 0x230dd0(%rip), %r8     # 0x382d9b
movq 0x8(%rsp), %rdi
movl $0x28b, %r9d            # imm = 0x28B
xorl %eax, %eax
callq 0xfcb67
leaq 0x230db7(%rip), %rsi    # 0x382d9b
movq %r13, %rdi
movl $0x28e, %edx            # imm = 0x28E
callq 0x1045eb
movq %r12, %rdi
callq 0xd0e1c
xorl %ebx, %ebx
jmp 0x15202d
leaq 0x20c43a(%rip), %rsi    # 0x35e43e
leaq 0x2314b6(%rip), %rdx    # 0x3834c1
leaq 0x2313a4(%rip), %rcx    # 0x3833b6
leaq 0x230d82(%rip), %r8     # 0x382d9b
xorl %ebx, %ebx
movq 0x8(%rsp), %rdi
movl $0x291, %r9d            # imm = 0x291
xorl %eax, %eax
callq 0xfcb67
movq 0x10(%rsp), %rdi
callq 0x1522ad
movq 0x18(%rsp), %rdi
callq 0x1522ad
callq 0x2fd6ed
movq %rax, 0x18(%rsp)
callq 0x2fd548
movq %rax, 0x10(%rsp)
callq 0x2fd892
movq %rax, %r12
leaq 0x230d37(%rip), %rsi    # 0x382d9b
movl $0x4b0, %edi            # imm = 0x4B0
movl $0x29c, %edx            # imm = 0x29C
callq 0x104226
movq %rax, %r13
testb %bl, %bl
je 0x152232
xorl %r15d, %r15d
leaq 0x361d08(%rip), %rax    # 0x4b3d90
movq (%rax,%r15,8), %rbx
movq %rbx, %rdi
callq 0x172f0
movq %rax, %rbp
testq %rax, %rax
je 0x1520bc
xorl %r14d, %r14d
movsbl (%rbx,%r14), %esi
movq %r12, %rdi
callq 0xd185d
movzbl %al, %eax
movl %eax, (%r13,%r14,4)
incq %r14
cmpq %r14, %rbp
jne 0x15209f
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x1514af
callq 0x17e30
movsd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x1516ea
callq 0x17e30
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
callq 0x105bb7
testb %al, %al
je 0x1521db
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x1514af
callq 0x17e30
movsd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x1516ea
callq 0x17e30
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
callq 0x105bb7
testb %al, %al
je 0x152204
leaq 0x1(%r15), %rax
cmpq $0xe, %r15
movq %rax, %r15
jb 0x152081
leaq 0x230c3d(%rip), %rsi    # 0x382d9b
movq %r13, %rdi
movl $0x2b0, %edx            # imm = 0x2B0
callq 0x1045eb
movq %r12, %rdi
callq 0xd0e1c
movq 0x18(%rsp), %rdi
movq %rdi, %rsi
callq 0x151a6f
xorps %xmm1, %xmm1
callq 0x105bb7
testb %al, %al
je 0x152278
movq 0x10(%rsp), %rdi
movq %rdi, %rsi
callq 0x151a6f
xorps %xmm1, %xmm1
callq 0x105bb7
xorl %ebx, %ebx
testb %al, %al
movq 0x8(%rsp), %rdi
jne 0x152253
leaq 0x20c283(%rip), %rsi    # 0x35e43e
leaq 0x23133d(%rip), %rdx    # 0x3834ff
leaq 0x2311ed(%rip), %rcx    # 0x3833b6
leaq 0x230bcb(%rip), %r8     # 0x382d9b
movl $0x2b5, %r9d            # imm = 0x2B5
jmp 0x15229f
leaq 0x20c25c(%rip), %rsi    # 0x35e43e
leaq 0x2311de(%rip), %rdx    # 0x3833c7
leaq 0x2311c6(%rip), %rcx    # 0x3833b6
leaq 0x230ba4(%rip), %r8     # 0x382d9b
movq 0x8(%rsp), %rdi
movl $0x2a8, %r9d            # imm = 0x2A8
jmp 0x15222b
leaq 0x20c233(%rip), %rsi    # 0x35e43e
leaq 0x231230(%rip), %rdx    # 0x383442
leaq 0x23119d(%rip), %rcx    # 0x3833b6
leaq 0x230b7b(%rip), %r8     # 0x382d9b
movq 0x8(%rsp), %rdi
movl $0x2ad, %r9d            # imm = 0x2AD
xorl %eax, %eax
callq 0xfcb67
leaq 0x230b62(%rip), %rsi    # 0x382d9b
movq %r13, %rdi
movl $0x2b0, %edx            # imm = 0x2B0
callq 0x1045eb
movq %r12, %rdi
callq 0xd0e1c
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq 0x10(%rsp), %rdi
callq 0x1522ad
movq 0x18(%rsp), %rdi
callq 0x1522ad
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x20c1bf(%rip), %rsi    # 0x35e43e
leaq 0x23123b(%rip), %rdx    # 0x3834c1
leaq 0x231129(%rip), %rcx    # 0x3833b6
leaq 0x230b07(%rip), %r8     # 0x382d9b
movq 0x8(%rsp), %rdi
movl $0x2b3, %r9d            # imm = 0x2B3
xorl %eax, %eax
callq 0xfcb67
jmp 0x15224e
callq 0x4845c