// File: /workspace/github_c_makefile_star2_O3/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 0xe29eb
movq %r14, %rdi
callq 0xfcc32
testb %al, %al
jne 0xe2c94
callq 0xd0ece
movq %rax, %rbx
testq %rax, %rax
je 0xe2a0f
movq %rbx, %rdi
callq 0xf259c
testq %rax, %rax
je 0xe2a4d
movq %rax, %r15
movb $0x1, %r13b
xorl %ebp, %ebp
jmp 0xe2a82
leaq 0x27ba28(%rip), %rsi    # 0x35e43e
leaq 0x28697a(%rip), %rdx    # 0x369397
leaq 0x27f8dc(%rip), %rcx    # 0x362300
leaq 0x27f7f8(%rip), %r8     # 0x362223
xorl %r13d, %r13d
movq %r14, %rdi
movl $0xba, %r9d
xorl %eax, %eax
callq 0xfcb67
xorl %edi, %edi
callq 0xf259c
movq %rax, %r15
movb $0x1, %bpl
jmp 0xe2a82
leaq 0x27b9ea(%rip), %rsi    # 0x35e43e
leaq 0x27f8c8(%rip), %rdx    # 0x362323
leaq 0x27f89e(%rip), %rcx    # 0x362300
leaq 0x27f7ba(%rip), %r8     # 0x362223
xorl %r15d, %r15d
movq %r14, %rdi
movl $0xbc, %r9d
xorl %eax, %eax
callq 0xfcb67
movb $0x1, %bpl
xorl %r13d, %r13d
leaq 0x27f7bb(%rip), %rsi    # 0x362244
leaq 0x2897bd(%rip), %rcx    # 0x36c24d
movl $0x2e, %edx
movq %r15, %rdi
callq 0xf26be
movq %r15, %rdi
xorl %esi, %esi
callq 0xf2e3b
movq %rax, %r12
testq %rax, %rax
setne %al
orb %bpl, %al
je 0xe2c33
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testb %r13b, %r13b
je 0xe2c64
leaq 0x27f776(%rip), %rsi    # 0x362244
movq %r12, %rdi
xorl %edx, %edx
movq %r14, %rcx
callq 0xe2c99
testl %eax, %eax
jne 0xe2c64
leaq 0x27f7e7(%rip), %rsi    # 0x3622d1
movq %r12, %rdi
movl $0x2, %edx
movq %r14, %rcx
callq 0xe2c99
testl %eax, %eax
jne 0xe2c64
leaq 0x27f76a(%rip), %rsi    # 0x362273
movq %r12, %rdi
movl $0x3, %edx
movq %r14, %rcx
callq 0xe2c99
testl %eax, %eax
jne 0xe2c64
leaq 0x27f77a(%rip), %rsi    # 0x3622a2
movq %r12, %rdi
movl $0x1, %edx
movq %r14, %rcx
callq 0xe2c99
testl %eax, %eax
jne 0xe2c64
xorl %eax, %eax
movq %rbx, 0x18(%rsp)
movq %r14, 0x28(%rsp)
movq %r12, 0x20(%rsp)
movl $0xa, %esi
movq %r12, %rdi
movq %rax, 0x30(%rsp)
movq %rax, %rdx
movl $0x3, %ecx
xorl %r8d, %r8d
callq 0xe2914
movq %rax, %r13
movq %rax, %rdi
leaq 0xf(%rsp), %rsi
leaq 0xe(%rsp), %rdx
leaq 0xd(%rsp), %rcx
leaq 0x14(%rsp), %r8
xorl %r9d, %r9d
callq 0xe26a3
movl %eax, %ebx
movl $0x0, %ebp
testl %eax, %eax
jne 0xe2c0d
movl %ebx, 0x10(%rsp)
movq %r14, %rdi
leaq 0x27b895(%rip), %rsi    # 0x35e43e
leaq 0x2a3a3c(%rip), %rdx    # 0x3865ec
leaq 0x27f749(%rip), %rcx    # 0x362300
leaq 0x27f665(%rip), %r8     # 0x362223
movl $0xdf, %r9d
xorl %eax, %eax
callq 0xfcb67
leaq 0xf(%rsp), %rbp
leaq 0xe(%rsp), %rbx
leaq 0xd(%rsp), %r14
leaq 0x14(%rsp), %r12
movq %r13, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movq %r14, %rcx
movq %r12, %r8
xorl %r9d, %r9d
callq 0xe26a3
testl %eax, %eax
je 0xe2bdf
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0x28(%rsp), %r14
movq 0x20(%rsp), %r12
movl 0x10(%rsp), %ebx
movq %r13, %rdi
callq 0xe26c6
testl %ebx, %ebx
je 0xe2c8d
movq 0x30(%rsp), %rcx
leaq 0x1(%rcx), %rax
cmpq $0x2, %rcx
movq 0x18(%rsp), %rbx
jb 0xe2b51
jmp 0xe2c64
leaq 0x27b804(%rip), %rsi    # 0x35e43e
leaq 0x2bd391(%rip), %rdx    # 0x39ffd2
leaq 0x27f6b8(%rip), %rcx    # 0x362300
leaq 0x27f5d4(%rip), %r8     # 0x362223
movq %r14, %rdi
movl $0xbf, %r9d
xorl %eax, %eax
callq 0xfcb67
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %r12, %rdi
callq 0xea375
movq %r15, %rdi
callq 0xf63c5
movq %rbx, %rdi
callq 0xd0e1c
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rsp), %rbx
jmp 0xe2c64
callq 0x25c75