// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movl $0x0, 0x2c(%rsp)
cmpq $0x0, 0x70(%rsp)
je 0x18d111
movq 0x70(%rsp), %rdi
callq 0xd8a60
testb $0x1, %al
jne 0x18d0d9
jmp 0x18d111
movq 0x4aeec0(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x388f29(%rip), %rsi    # 0x516013
leaq 0x3890ce(%rip), %rdx    # 0x5161bf
leaq 0x3c8959(%rip), %rcx    # 0x555a51
leaq 0x3c835c(%rip), %r8     # 0x55545b
movl $0x274, %r9d            # imm = 0x274
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x18d113
callq 0x48d420
movq %rax, 0x38(%rsp)
callq 0x48d320
movq %rax, 0x30(%rsp)
callq 0x48d520
movq %rax, 0x60(%rsp)
movq $0xd, 0x40(%rsp)
movq 0x40(%rsp), %rcx
subq $0x1, %rcx
leaq 0x4b0886(%rip), %rax    # 0x63d9d0
movq (%rax,%rcx,8), %rdi
callq 0x192b0
movq %rax, %rdi
shlq $0x2, %rdi
leaq 0x3c82fa(%rip), %rsi    # 0x55545b
movl $0x27b, %edx            # imm = 0x27B
callq 0xe80f0
movq %rax, 0x68(%rsp)
movq $0x0, 0x58(%rsp)
movq 0x58(%rsp), %rcx
xorl %eax, %eax
cmpq 0x40(%rsp), %rcx
movb %al, 0x2b(%rsp)
jae 0x18d199
cmpl $0x0, 0x2c(%rsp)
setne %al
xorb $-0x1, %al
movb %al, 0x2b(%rsp)
movb 0x2b(%rsp), %al
testb $0x1, %al
jne 0x18d1a6
jmp 0x18d357
movq 0x58(%rsp), %rcx
leaq 0x4b081e(%rip), %rax    # 0x63d9d0
movq (%rax,%rcx,8), %rdi
callq 0x192b0
movq %rax, 0x48(%rsp)
movq $0x0, 0x50(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x48(%rsp), %rax
jae 0x18d218
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %rcx
leaq 0x4b07ea(%rip), %rax    # 0x63d9d0
movq (%rax,%rcx,8), %rax
movq 0x50(%rsp), %rcx
movsbl (%rax,%rcx), %esi
callq 0x7f6f0
movzbl %al, %edx
movq 0x68(%rsp), %rax
movq 0x50(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x18d1c9
jmp 0x18d21a
cmpl $0x0, 0x2c(%rsp)
jne 0x18d2ab
movq 0x38(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x48(%rsp), %rax
movl %eax, %edx
callq 0x18bfa0
callq 0x19d40
movsd %xmm0, 0x20(%rsp)
movq 0x38(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x48(%rsp), %rax
movl %eax, %edx
callq 0x18c440
callq 0x19d40
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
callq 0xec260
testb $0x1, %al
jne 0x18d2a9
movq 0x70(%rsp), %rdi
leaq 0x3a237b(%rip), %rsi    # 0x52f5fa
leaq 0x3c87dc(%rip), %rdx    # 0x555a62
leaq 0x3c87c4(%rip), %rcx    # 0x555a51
leaq 0x3c81c7(%rip), %r8     # 0x55545b
movl $0x286, %r9d            # imm = 0x286
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
jmp 0x18d2ab
jmp 0x18d2ad
jmp 0x18d2af
cmpl $0x0, 0x2c(%rsp)
jne 0x18d340
movq 0x30(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x48(%rsp), %rax
movl %eax, %edx
callq 0x18bfa0
callq 0x19d40
movsd %xmm0, 0x18(%rsp)
movq 0x30(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x48(%rsp), %rax
movl %eax, %edx
callq 0x18c440
callq 0x19d40
movaps %xmm0, %xmm1
movsd 0x18(%rsp), %xmm0
callq 0xec260
testb $0x1, %al
jne 0x18d33e
movq 0x70(%rsp), %rdi
leaq 0x3a22e6(%rip), %rsi    # 0x52f5fa
leaq 0x3c87c2(%rip), %rdx    # 0x555add
leaq 0x3c872f(%rip), %rcx    # 0x555a51
leaq 0x3c8132(%rip), %r8     # 0x55545b
movl $0x28b, %r9d            # imm = 0x28B
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
jmp 0x18d340
jmp 0x18d342
jmp 0x18d344
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
jmp 0x18d179
movq 0x68(%rsp), %rdi
leaq 0x3c80f8(%rip), %rsi    # 0x55545b
movl $0x28e, %edx            # imm = 0x28E
callq 0xe88c0
movq 0x60(%rsp), %rdi
callq 0x7e3d0
cmpl $0x0, 0x2c(%rsp)
jne 0x18d3d1
movq 0x38(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x18cad0
xorps %xmm1, %xmm1
callq 0xec260
testb $0x1, %al
jne 0x18d3cf
movq 0x70(%rsp), %rdi
leaq 0x3a2255(%rip), %rsi    # 0x52f5fa
leaq 0x3c87b0(%rip), %rdx    # 0x555b5c
leaq 0x3c869e(%rip), %rcx    # 0x555a51
leaq 0x3c80a1(%rip), %r8     # 0x55545b
movl $0x291, %r9d            # imm = 0x291
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
jmp 0x18d3d1
jmp 0x18d3d3
jmp 0x18d3d5
cmpl $0x0, 0x2c(%rsp)
jne 0x18d42f
movq 0x30(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x18cad0
xorps %xmm1, %xmm1
callq 0xec260
testb $0x1, %al
jne 0x18d42d
movq 0x70(%rsp), %rdi
leaq 0x3a21f7(%rip), %rsi    # 0x52f5fa
leaq 0x3c8790(%rip), %rdx    # 0x555b9a
leaq 0x3c8640(%rip), %rcx    # 0x555a51
leaq 0x3c8043(%rip), %r8     # 0x55545b
movl $0x293, %r9d            # imm = 0x293
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
jmp 0x18d42f
jmp 0x18d431
movq 0x30(%rsp), %rdi
callq 0x18d780
movq 0x38(%rsp), %rdi
callq 0x18d780
callq 0x48efd0
movq %rax, 0x38(%rsp)
callq 0x48ede0
movq %rax, 0x30(%rsp)
callq 0x48f1c0
movq %rax, 0x60(%rsp)
movq $0xf, 0x40(%rsp)
movq 0x40(%rsp), %rcx
subq $0x1, %rcx
leaq 0x4b05c4(%rip), %rax    # 0x63da40
movq (%rax,%rcx,8), %rdi
callq 0x192b0
movq %rax, %rdi
shlq $0x2, %rdi
leaq 0x3c7fc8(%rip), %rsi    # 0x55545b
movl $0x29c, %edx            # imm = 0x29C
callq 0xe80f0
movq %rax, 0x68(%rsp)
movq $0x0, 0x58(%rsp)
movq 0x58(%rsp), %rcx
xorl %eax, %eax
cmpq 0x40(%rsp), %rcx
movb %al, 0x17(%rsp)
jae 0x18d4cb
cmpl $0x0, 0x2c(%rsp)
setne %al
xorb $-0x1, %al
movb %al, 0x17(%rsp)
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0x18d4d8
jmp 0x18d687
movq 0x58(%rsp), %rcx
leaq 0x4b055c(%rip), %rax    # 0x63da40
movq (%rax,%rcx,8), %rdi
callq 0x192b0
movq %rax, 0x48(%rsp)
movq $0x0, 0x50(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x48(%rsp), %rax
jae 0x18d54a
movq 0x60(%rsp), %rdi
movq 0x58(%rsp), %rcx
leaq 0x4b0528(%rip), %rax    # 0x63da40
movq (%rax,%rcx,8), %rax
movq 0x50(%rsp), %rcx
movsbl (%rax,%rcx), %esi
callq 0x7f6f0
movzbl %al, %edx
movq 0x68(%rsp), %rax
movq 0x50(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x18d4fb
jmp 0x18d54c
cmpl $0x0, 0x2c(%rsp)
jne 0x18d5dd
movq 0x38(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x48(%rsp), %rax
movl %eax, %edx
callq 0x18bfa0
callq 0x19d40
movsd %xmm0, 0x8(%rsp)
movq 0x38(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x48(%rsp), %rax
movl %eax, %edx
callq 0x18c440
callq 0x19d40
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
callq 0xec260
testb $0x1, %al
jne 0x18d5db
movq 0x70(%rsp), %rdi
leaq 0x3a2049(%rip), %rsi    # 0x52f5fa
leaq 0x3c84aa(%rip), %rdx    # 0x555a62
leaq 0x3c8492(%rip), %rcx    # 0x555a51
leaq 0x3c7e95(%rip), %r8     # 0x55545b
movl $0x2a8, %r9d            # imm = 0x2A8
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
jmp 0x18d5dd
jmp 0x18d5df
jmp 0x18d5e1
cmpl $0x0, 0x2c(%rsp)
jne 0x18d670
movq 0x30(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x48(%rsp), %rax
movl %eax, %edx
callq 0x18bfa0
callq 0x19d40
movsd %xmm0, (%rsp)
movq 0x30(%rsp), %rdi
movq 0x68(%rsp), %rsi
movq 0x48(%rsp), %rax
movl %eax, %edx
callq 0x18c440
callq 0x19d40
movaps %xmm0, %xmm1
movsd (%rsp), %xmm0
callq 0xec260
testb $0x1, %al
jne 0x18d66e
movq 0x70(%rsp), %rdi
leaq 0x3a1fb6(%rip), %rsi    # 0x52f5fa
leaq 0x3c8492(%rip), %rdx    # 0x555add
leaq 0x3c83ff(%rip), %rcx    # 0x555a51
leaq 0x3c7e02(%rip), %r8     # 0x55545b
movl $0x2ad, %r9d            # imm = 0x2AD
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
jmp 0x18d670
jmp 0x18d672
jmp 0x18d674
movq 0x58(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x58(%rsp)
jmp 0x18d4ab
movq 0x68(%rsp), %rdi
leaq 0x3c7dc8(%rip), %rsi    # 0x55545b
movl $0x2b0, %edx            # imm = 0x2B0
callq 0xe88c0
movq 0x60(%rsp), %rdi
callq 0x7e3d0
cmpl $0x0, 0x2c(%rsp)
jne 0x18d701
movq 0x38(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x18cad0
xorps %xmm1, %xmm1
callq 0xec260
testb $0x1, %al
jne 0x18d6ff
movq 0x70(%rsp), %rdi
leaq 0x3a1f25(%rip), %rsi    # 0x52f5fa
leaq 0x3c8480(%rip), %rdx    # 0x555b5c
leaq 0x3c836e(%rip), %rcx    # 0x555a51
leaq 0x3c7d71(%rip), %r8     # 0x55545b
movl $0x2b3, %r9d            # imm = 0x2B3
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
jmp 0x18d701
jmp 0x18d703
jmp 0x18d705
cmpl $0x0, 0x2c(%rsp)
jne 0x18d75f
movq 0x30(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x18cad0
xorps %xmm1, %xmm1
callq 0xec260
testb $0x1, %al
jne 0x18d75d
movq 0x70(%rsp), %rdi
leaq 0x3a1ec7(%rip), %rsi    # 0x52f5fa
leaq 0x3c8460(%rip), %rdx    # 0x555b9a
leaq 0x3c8310(%rip), %rcx    # 0x555a51
leaq 0x3c7d13(%rip), %r8     # 0x55545b
movl $0x2b5, %r9d            # imm = 0x2B5
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
jmp 0x18d75f
jmp 0x18d761
movq 0x30(%rsp), %rdi
callq 0x18d780
movq 0x38(%rsp), %rdi
callq 0x18d780
movl 0x2c(%rsp), %eax
addq $0x78, %rsp
retq
nop