// File: /workspace/github_c_makefile_star2_O1/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, %r15
testq %rdi, %rdi
je 0xe6ebf
movq %r15, %rdi
callq 0x101a9a
testb %al, %al
jne 0xe7152
callq 0xd340f
movq %rax, %r14
xorl %ebx, %ebx
testq %rax, %rax
jne 0xe6eff
leaq 0x280665(%rip), %rsi    # 0x36753a
leaq 0x28b713(%rip), %rdx    # 0x3725ef
leaq 0x28452d(%rip), %rcx    # 0x36b410
leaq 0x284449(%rip), %r8     # 0x36b333
movq %r15, %rdi
movl $0xba, %r9d
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %r14, %r14
sete %bpl
movq %r14, %rdi
callq 0xf6be5
movq %rax, %r12
testq %rax, %rax
setne %al
orb %bpl, %al
jne 0xe6f4d
leaq 0x280617(%rip), %rsi    # 0x36753a
leaq 0x284509(%rip), %rdx    # 0x36b433
leaq 0x2844df(%rip), %rcx    # 0x36b410
leaq 0x2843fb(%rip), %r8     # 0x36b333
movq %r15, %rdi
movl $0xbc, %r9d
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
leaq 0x284400(%rip), %rsi    # 0x36b354
leaq 0x28e542(%rip), %rcx    # 0x37549d
movl $0x2e, %edx
movq %r12, %rdi
callq 0xf6d07
movq %r12, %rdi
xorl %esi, %esi
callq 0xf748b
movq %rax, %rbp
testl %ebx, %ebx
setne %al
testq %rbp, %rbp
setne %cl
orb %al, %cl
jne 0xe6fb5
leaq 0x2805af(%rip), %rsi    # 0x36753a
leaq 0x2c2530(%rip), %rdx    # 0x3a94c2
leaq 0x284477(%rip), %rcx    # 0x36b410
leaq 0x284393(%rip), %r8     # 0x36b333
movq %r15, %rdi
movl $0xbf, %r9d
xorl %eax, %eax
callq 0x1019cf
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testl %ebx, %ebx
movq %r14, 0x18(%rsp)
movq %r12, 0x10(%rsp)
jne 0xe7031
leaq 0x284384(%rip), %rsi    # 0x36b354
movq %rbp, %rdi
xorl %edx, %edx
movq %r15, %rcx
callq 0xe7157
testl %eax, %eax
jne 0xe7031
leaq 0x2843f9(%rip), %rsi    # 0x36b3e1
movq %rbp, %rdi
movl $0x2, %edx
movq %r15, %rcx
callq 0xe7157
testl %eax, %eax
jne 0xe7031
leaq 0x284380(%rip), %rsi    # 0x36b383
movq %rbp, %rdi
movl $0x3, %edx
movq %r15, %rcx
callq 0xe7157
testl %eax, %eax
jne 0xe7031
leaq 0x284394(%rip), %rsi    # 0x36b3b2
movq %rbp, %rdi
movl $0x1, %edx
movq %r15, %rcx
callq 0xe7157
movl %eax, %r13d
movl %r13d, (%rsp)
testl %r13d, %r13d
jne 0xe7124
movq %r15, 0x20(%rsp)
leaq 0x7(%rsp), %r13
leaq 0x6(%rsp), %rbx
leaq 0x5(%rsp), %r15
leaq 0x34(%rsp), %r14
xorl %eax, %eax
movq %rbp, 0x8(%rsp)
movl $0xa, %esi
movq %rbp, %rdi
movq %rax, 0x28(%rsp)
movq %rax, %rdx
movl $0x3, %ecx
xorl %r8d, %r8d
callq 0xe6de8
movq %rax, %rbp
movq %rax, %rdi
movq %r13, %rsi
movq %rbx, %rdx
movq %r15, %rcx
movq %r14, %r8
xorl %r9d, %r9d
callq 0xe6b77
testl %eax, %eax
je 0xe709f
movl (%rsp), %r12d
jmp 0xe70f4
cmpl $0x0, (%rsp)
jne 0xe70d3
movq 0x20(%rsp), %rdi
leaq 0x280489(%rip), %rsi    # 0x36753a
leaq 0x2a8914(%rip), %rdx    # 0x38f9cc
leaq 0x284351(%rip), %rcx    # 0x36b410
leaq 0x28426d(%rip), %r8     # 0x36b333
movl $0xdf, %r9d
xorl %eax, %eax
callq 0x1019cf
movq %rbp, %rdi
movq %r13, %rsi
movq %rbx, %rdx
movq %r15, %rcx
movq %r14, %r8
xorl %r9d, %r9d
callq 0xe6b77
testl %eax, %eax
je 0xe70d3
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq %rbp, %rdi
callq 0xe6b9a
movl %r12d, (%rsp)
testl %r12d, %r12d
jne 0xe711f
movq 0x28(%rsp), %rcx
leaq 0x1(%rcx), %rax
cmpq $0x2, %rcx
movq 0x8(%rsp), %rbp
jb 0xe705e
jmp 0xe7124
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
callq 0xee90c
movq 0x10(%rsp), %rdi
callq 0xfaad7
movq 0x18(%rsp), %rdi
callq 0xd335d
movl (%rsp), %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2618c