// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/codon_iterator_encseq.c
// Function: gt_codon_iterator_encseq_unit_test
int gt_codon_iterator_encseq_unit_test(GtError *err)
{
  int had_err = 0,
      i, j;
  const char *testseq    = "gctgatcgactgaacatagctagcacggccgcgcgatcgtacgatg",
             *testseq_rc = "catcgtacgatcgcgcggccgtgctagctatgttcagtcgatcagc",
             *testseq_rv = "gtagcatgctagcgcgccggcacgatcgatacaagtcagctagtcg",
             *testseq_cm = "cgactagctgacttgtatcgatcgtgccggcgcgctagcatgctac";
  GtEncseq *encseq;
  GtEncseqBuilder *eb;
  GtCodonIterator *ci;
  GtAlphabet *alpha;
  char n1, n2, n3;
  unsigned int frame;
  gt_error_check(err);

  alpha = gt_alphabet_new_dna();
  gt_ensure(alpha != NULL);
  eb = gt_encseq_builder_new(alpha);
  gt_ensure(eb != NULL);
  gt_encseq_builder_add_cstr(eb, testseq, strlen(testseq), "foo");
  encseq = gt_encseq_builder_build(eb, NULL);
  gt_ensure(encseq != NULL);

  if (!had_err) {
    /* forward tests */
    had_err = gt_codon_iterator_encseq_single_test(encseq, testseq, testseq,
                                                   GT_READMODE_FORWARD, err);
  }

  if (!had_err) {
    /* complement tests */
    had_err = gt_codon_iterator_encseq_single_test(encseq, testseq, testseq_cm,
                                                   GT_READMODE_COMPL, err);
  }

  if (!had_err) {
    /* revcompl tests */
    had_err = gt_codon_iterator_encseq_single_test(encseq, testseq, testseq_rc,
                                                   GT_READMODE_REVCOMPL, err);
  }

  if (!had_err) {
    /* reverse tests */
    had_err = gt_codon_iterator_encseq_single_test(encseq, testseq, testseq_rv,
                                                   GT_READMODE_REVERSE, err);
  }

  /* lengths < 3 */
  for (j = 0; !had_err && j < 3; j++) {
    ci = gt_codon_iterator_encseq_new_with_readmode(encseq, 10, j,
                                                    GT_READMODE_REVCOMPL, NULL);
    i = 10;
    while (!(gt_codon_iterator_next(ci, &n1, &n2, &n3, &frame, NULL))) {
      gt_ensure(false);
    }
    gt_ensure(i == 10);
    gt_codon_iterator_delete(ci);
  }

  gt_encseq_delete(encseq);
  gt_encseq_builder_delete(eb);
  gt_alphabet_delete(alpha);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %r14
testq %rdi, %rdi
je 0x6a66d
movq %r14, %rdi
callq 0x89eb7
testb %al, %al
jne 0x6a8e3
callq 0x56967
movq %rax, %r15
xorl %ebx, %ebx
testq %rax, %rax
jne 0x6a6ab
leaq 0x293d6f(%rip), %rsi    # 0x2fe3f2
leaq 0x29ec69(%rip), %rdx    # 0x3092f3
leaq 0x297bc6(%rip), %rcx    # 0x302257
leaq 0x297ae2(%rip), %r8     # 0x30217a
movq %r14, %rdi
movl $0xba, %r9d
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %rbx
testq %r15, %r15
sete %bpl
movq %r15, %rdi
callq 0x7d613
movq %rax, %r12
testq %rax, %rax
setne %al
orb %bpl, %al
jne 0x6a6f7
pushq $-0x1
popq %rbx
leaq 0x293d20(%rip), %rsi    # 0x2fe3f2
leaq 0x297ba1(%rip), %rdx    # 0x30227a
leaq 0x297b77(%rip), %rcx    # 0x302257
leaq 0x297a93(%rip), %r8     # 0x30217a
movq %r14, %rdi
movl $0xbc, %r9d
xorl %eax, %eax
callq 0x89dbb
leaq 0x297a9d(%rip), %rsi    # 0x30219b
leaq 0x2a1e28(%rip), %rcx    # 0x30c52d
pushq $0x2e
popq %rdx
movq %r12, %rdi
callq 0x7d964
movq %r12, %rdi
xorl %esi, %esi
callq 0x7e427
movq %rax, %rdi
testl %ebx, %ebx
setne %al
testq %rdi, %rdi
setne %cl
orb %al, %cl
movq %rdi, 0x8(%rsp)
movq %r15, 0x18(%rsp)
movq %r12, 0x10(%rsp)
je 0x6a77d
pushq $-0x1
popq %r13
testl %ebx, %ebx
jne 0x6a7b2
leaq 0x297a51(%rip), %rsi    # 0x30219b
movq %rdi, %rbx
xorl %edx, %edx
movq %r14, %rcx
callq 0x6a91b
testl %eax, %eax
jne 0x6a778
leaq 0x297ac6(%rip), %rsi    # 0x302228
pushq $0x2
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
callq 0x6a91b
testl %eax, %eax
je 0x6a89f
movq %rbx, %rdi
jmp 0x6a7b2
leaq 0x293c6e(%rip), %rsi    # 0x2fe3f2
leaq 0x2d5b27(%rip), %rdx    # 0x3402b2
leaq 0x297ac5(%rip), %rcx    # 0x302257
leaq 0x2979e1(%rip), %r8     # 0x30217a
movq %r14, %rdi
movl $0xbf, %r9d
xorl %eax, %eax
callq 0x89dbb
movq 0x8(%rsp), %rdi
pushq $-0x1
popq %r13
movq %r14, 0x28(%rsp)
xorl %edx, %edx
leaq 0x5(%rsp), %r12
leaq 0x34(%rsp), %rbp
pushq $-0x1
popq %r14
testl %r13d, %r13d
jne 0x6a874
cmpq $0x2, %rdx
ja 0x6a874
xorl %r13d, %r13d
pushq $0xa
popq %rsi
movq %rdx, 0x20(%rsp)
pushq $0x3
popq %rcx
xorl %r8d, %r8d
callq 0x6a53f
movq %rax, %rbx
movb $0x1, %r15b
movq %rbx, %rdi
leaq 0x7(%rsp), %rsi
leaq 0x6(%rsp), %rdx
movq %r12, %rcx
movq %rbp, %r8
xorl %r9d, %r9d
callq 0x6a1c8
testl %eax, %eax
jne 0x6a85a
movl %r14d, %r13d
testb $0x1, %r15b
movl $0x0, %r15d
je 0x6a7f6
xorl %r15d, %r15d
movq 0x28(%rsp), %rdi
leaq 0x293bbf(%rip), %rsi    # 0x2fe3f2
leaq 0x2bc1b2(%rip), %rdx    # 0x3269ec
leaq 0x297a16(%rip), %rcx    # 0x302257
leaq 0x297932(%rip), %r8     # 0x30217a
movl $0xdf, %r9d
xorl %eax, %eax
callq 0x89dbb
movl %r14d, %r13d
jmp 0x6a7f6
movq %rbx, %rdi
callq 0x6a21c
movq 0x20(%rsp), %rdx
incq %rdx
movq 0x8(%rsp), %rdi
jmp 0x6a7c7
callq 0x735fd
movq 0x10(%rsp), %rdi
callq 0x81ac8
movq 0x18(%rsp), %rdi
callq 0x568b5
movl %r13d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x297924(%rip), %rsi    # 0x3021ca
pushq $0x3
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
callq 0x6a91b
testl %eax, %eax
movq %rbx, %rdi
jne 0x6a7b2
leaq 0x297933(%rip), %rsi    # 0x3021f9
pushq $0x1
popq %rdx
movq 0x8(%rsp), %rdi
movq %r14, %rcx
callq 0x6a91b
movq 0x8(%rsp), %rdi
movl %eax, %r13d
jmp 0x6a7b2
movq 0x3cd67e(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x27a71f(%rip), %rsi    # 0x2e5013
leaq 0x27a8c4(%rip), %rdx    # 0x2e51bf
leaq 0x297955(%rip), %rcx    # 0x302257
leaq 0x297871(%rip), %r8     # 0x30217a
movl $0xb7, %r9d
xorl %eax, %eax
callq 0x17a50
callq 0x17390