// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/orf_finder_visitor.c
// Function: run_orffinder
static int run_orffinder(GtRegionMapping *rmap,
                         GtFeatureNode *gf,
                         GtUword start,
                         GT_UNUSED GtUword end,
                         unsigned int min,
                         unsigned int max,
                         bool all,
                         GtError *err)
{
  int had_err = 0, i;
  GtUword sum;
  GtCodonIterator* ci = NULL;
  GtTranslator* translator = NULL;
  GtORFIterator* orfi = NULL;
  GtORFIteratorStatus state;
  GtRange orf_rng, tmp_orf_rng[3];
  GtStr *seq = NULL;
  unsigned int orf_frame;

  /* forward strand */
  seq = gt_str_new();
  had_err = gt_extract_feature_sequence(seq,
                                        (GtGenomeNode*) gf,
                                        gt_feature_node_get_type(gf),
                                        false, NULL, NULL, rmap, err);
  if (!had_err) {
    ci = gt_codon_iterator_simple_new(gt_str_get(seq), gt_str_length(seq), err);
    gt_assert(ci);
    translator = gt_translator_new(ci);
    gt_assert(translator);

    orfi = gt_orf_iterator_new(ci, translator);
    gt_assert(orfi);

    for (i = 0; i < 3; i++) {
      tmp_orf_rng[i].start = GT_UNDEF_UWORD;
      tmp_orf_rng[i].end = GT_UNDEF_UWORD;
    }

    while ((state = gt_orf_iterator_next(orfi, &orf_rng, &orf_frame,
                                                err)) == GT_ORF_ITERATOR_OK) {
        if (all) {
          process_orf(orf_rng, orf_frame, GT_STRAND_FORWARD, gf,
                      start, min, max, err);
        } else {
          if (gt_range_length(&orf_rng) >
              gt_range_length(&tmp_orf_rng[orf_frame])) {
            tmp_orf_rng[orf_frame].start = orf_rng.start;
            tmp_orf_rng[orf_frame].end = orf_rng.end;
          }
        }
    }
    if (state == GT_ORF_ITERATOR_ERROR)
      had_err = -1;
  }

  if (!had_err) {
    if (!all) {
      for (i = 0; i < 3; i++) {
        if (tmp_orf_rng[i].start != GT_UNDEF_UWORD) {
          process_orf(tmp_orf_rng[i], (unsigned int) i, GT_STRAND_FORWARD, gf,
                      start, min, max, err);
        }
      }
    }
    gt_codon_iterator_delete(ci);
    gt_translator_delete(translator);
    gt_orf_iterator_delete(orfi);
    orfi = NULL;
    ci = NULL;
    translator = NULL;

    for (i = 0; i < 3; i++) {
      tmp_orf_rng[i].start = GT_UNDEF_UWORD;
      tmp_orf_rng[i].end = GT_UNDEF_UWORD;
    }

    /* reverse strand */
    if (!had_err) {
      GT_UNUSED int rval = 0;
      GtUword length = gt_str_length(seq);
      char *strp = (char*) gt_str_get_mem(seq);
      rval = gt_reverse_complement(strp, gt_str_length(seq), err);
      gt_assert(!rval); /* XXX */
      ci = gt_codon_iterator_simple_new(gt_str_get(seq), gt_str_length(seq),
                                        err);
      gt_assert(ci);
      translator = gt_translator_new(ci);
      gt_assert(translator);
      orfi = gt_orf_iterator_new(ci, translator);
      gt_assert(orfi);

      sum = start + length - 1;

      while ((state = gt_orf_iterator_next(orfi, &orf_rng, &orf_frame,
                                                  err)) == GT_ORF_ITERATOR_OK) {
          if (all) {
            process_orf(orf_rng, orf_frame, GT_STRAND_REVERSE, gf,
                        sum, min, max, err);
          } else {
            if (gt_range_length(&orf_rng) >
                gt_range_length(&tmp_orf_rng[orf_frame])) {
              tmp_orf_rng[orf_frame].start = orf_rng.start;
              tmp_orf_rng[orf_frame].end = orf_rng.end;
            }
          }
      }
      if (state == GT_ORF_ITERATOR_ERROR)
        had_err = -1;
      if (!had_err) {
        if (!all) {
          for (i = 0; i < 3; i++) {
            if (tmp_orf_rng[i].start != GT_UNDEF_UWORD) {
              process_orf(tmp_orf_rng[i], (unsigned int) i, GT_STRAND_REVERSE,
                          gf, sum, min, max, err);
            }
          }
        }
      }
    }
    gt_codon_iterator_delete(ci);
    gt_translator_delete(translator);
    gt_orf_iterator_delete(orfi);
  }
  gt_str_delete(seq);
  return had_err;
}

// Assembly:
subq $0x118, %rsp            # imm = 0x118
movq 0x128(%rsp), %rax
movb 0x120(%rsp), %al
movq %rdi, 0x110(%rsp)
movq %rsi, 0x108(%rsp)
movq %rdx, 0x100(%rsp)
movq %rcx, 0xf8(%rsp)
movl %r8d, 0xf4(%rsp)
movl %r9d, 0xf0(%rsp)
andb $0x1, %al
movb %al, 0xef(%rsp)
movl $0x0, 0xe8(%rsp)
movq $0x0, 0xd0(%rsp)
movq $0x0, 0xc8(%rsp)
movq $0x0, 0xc0(%rsp)
movq $0x0, 0x68(%rsp)
callq 0x11d4a0
movq %rax, 0x68(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x108(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x108(%rsp), %rdi
callq 0x16d430
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rsi
movq %rax, %rdx
movq 0x110(%rsp), %r10
movq 0x128(%rsp), %rax
xorl %ecx, %ecx
xorl %r8d, %r8d
movl %r8d, %r9d
movq %r9, %r8
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x48f4f0
movl %eax, 0xe8(%rsp)
cmpl $0x0, 0xe8(%rsp)
jne 0x1b3454
movq 0x68(%rsp), %rdi
callq 0x11dee0
movq %rax, 0x38(%rsp)
movq 0x68(%rsp), %rdi
callq 0x11dfa0
movq 0x38(%rsp), %rdi
movq %rax, %rsi
movq 0x128(%rsp), %rdx
callq 0xa07e0
movq %rax, 0xd0(%rsp)
cmpq $0x0, 0xd0(%rsp)
jne 0x1b3219
movq 0x488db8(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x362e21(%rip), %rsi    # 0x516013
leaq 0x3928af(%rip), %rdx    # 0x545aa8
leaq 0x3acee0(%rip), %rcx    # 0x5600e0
leaq 0x3ace86(%rip), %r8     # 0x56008d
movl $0xa4, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1b321b
movq 0xd0(%rsp), %rdi
callq 0x124e10
movq %rax, 0xc8(%rsp)
cmpq $0x0, 0xc8(%rsp)
jne 0x1b3273
movq 0x488d5e(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x362dc7(%rip), %rsi    # 0x516013
leaq 0x3acebe(%rip), %rdx    # 0x560111
leaq 0x3ace86(%rip), %rcx    # 0x5600e0
leaq 0x3ace2c(%rip), %r8     # 0x56008d
movl $0xa6, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1b3275
movq 0xd0(%rsp), %rdi
movq 0xc8(%rsp), %rsi
callq 0x1b3cd0
movq %rax, 0xc0(%rsp)
cmpq $0x0, 0xc0(%rsp)
jne 0x1b32d5
movq 0x488cfc(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x362d65(%rip), %rsi    # 0x516013
leaq 0x3ace39(%rip), %rdx    # 0x5600ee
leaq 0x3ace24(%rip), %rcx    # 0x5600e0
leaq 0x3acdca(%rip), %r8     # 0x56008d
movl $0xa9, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1b32d7
movl $0x0, 0xe4(%rsp)
cmpl $0x3, 0xe4(%rsp)
jge 0x1b3336
movslq 0xe4(%rsp), %rcx
leaq 0x70(%rsp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movq $-0x1, (%rax)
movslq 0xe4(%rsp), %rcx
leaq 0x70(%rsp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movq $-0x1, 0x8(%rax)
movl 0xe4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xe4(%rsp)
jmp 0x1b32e2
jmp 0x1b3338
movq 0xc0(%rsp), %rdi
movq 0x128(%rsp), %rcx
leaq 0xa8(%rsp), %rsi
leaq 0x64(%rsp), %rdx
callq 0x1b3db0
movl %eax, 0xbc(%rsp)
cmpl $0x0, %eax
jne 0x1b343d
testb $0x1, 0xef(%rsp)
je 0x1b33c7
movl 0x64(%rsp), %edx
movq 0x108(%rsp), %r8
movq 0x100(%rsp), %r9
movl 0xf4(%rsp), %r11d
movl 0xf0(%rsp), %r10d
movq 0x128(%rsp), %rax
movq 0xa8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
xorl %ecx, %ecx
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x1b39f0
jmp 0x1b3438
leaq 0xa8(%rsp), %rdi
callq 0x107320
movq %rax, 0x30(%rsp)
movl 0x64(%rsp), %eax
leaq 0x70(%rsp), %rdi
shlq $0x4, %rax
addq %rax, %rdi
callq 0x107320
movq %rax, %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
jbe 0x1b3436
movq 0xa8(%rsp), %rcx
movl 0x64(%rsp), %eax
movl %eax, %edx
leaq 0x70(%rsp), %rax
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq 0xb0(%rsp), %rcx
movl 0x64(%rsp), %eax
movl %eax, %edx
leaq 0x70(%rsp), %rax
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
jmp 0x1b3438
jmp 0x1b3338
cmpl $-0x2, 0xbc(%rsp)
jne 0x1b3452
movl $0xffffffff, 0xe8(%rsp) # imm = 0xFFFFFFFF
jmp 0x1b3454
cmpl $0x0, 0xe8(%rsp)
jne 0x1b39cb
testb $0x1, 0xef(%rsp)
jne 0x1b351c
movl $0x0, 0xe4(%rsp)
cmpl $0x3, 0xe4(%rsp)
jge 0x1b351a
movslq 0xe4(%rsp), %rcx
leaq 0x70(%rsp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $-0x1, (%rax)
je 0x1b3502
movslq 0xe4(%rsp), %rax
leaq 0x70(%rsp), %rcx
shlq $0x4, %rax
addq %rax, %rcx
movl 0xe4(%rsp), %edx
movq 0x108(%rsp), %r8
movq 0x100(%rsp), %r9
movl 0xf4(%rsp), %r11d
movl 0xf0(%rsp), %r10d
movq 0x128(%rsp), %rax
movq (%rcx), %rdi
movq 0x8(%rcx), %rsi
xorl %ecx, %ecx
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x1b39f0
jmp 0x1b3504
movl 0xe4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xe4(%rsp)
jmp 0x1b347b
jmp 0x1b351c
movq 0xd0(%rsp), %rdi
callq 0x9f800
movq 0xc8(%rsp), %rdi
callq 0x125770
movq 0xc0(%rsp), %rdi
callq 0x1b3f30
movq $0x0, 0xc0(%rsp)
movq $0x0, 0xd0(%rsp)
movq $0x0, 0xc8(%rsp)
movl $0x0, 0xe4(%rsp)
cmpl $0x3, 0xe4(%rsp)
jge 0x1b35c6
movslq 0xe4(%rsp), %rcx
leaq 0x70(%rsp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movq $-0x1, (%rax)
movslq 0xe4(%rsp), %rcx
leaq 0x70(%rsp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movq $-0x1, 0x8(%rax)
movl 0xe4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xe4(%rsp)
jmp 0x1b3572
cmpl $0x0, 0xe8(%rsp)
jne 0x1b39a4
movl $0x0, 0x60(%rsp)
movq 0x68(%rsp), %rdi
callq 0x11dfa0
movq %rax, 0x58(%rsp)
movq 0x68(%rsp), %rdi
callq 0x11df50
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x68(%rsp), %rdi
callq 0x11dfa0
movq 0x28(%rsp), %rdi
movq %rax, %rsi
movq 0x128(%rsp), %rdx
callq 0x1cb4f0
movl %eax, 0x60(%rsp)
cmpl $0x0, 0x60(%rsp)
je 0x1b3666
movq 0x48896b(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3629d4(%rip), %rsi    # 0x516013
leaq 0x380c46(%rip), %rdx    # 0x53428c
leaq 0x3aca93(%rip), %rcx    # 0x5600e0
leaq 0x3aca39(%rip), %r8     # 0x56008d
movl $0xdc, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1b3668
movq 0x68(%rsp), %rdi
callq 0x11dee0
movq %rax, 0x20(%rsp)
movq 0x68(%rsp), %rdi
callq 0x11dfa0
movq 0x20(%rsp), %rdi
movq %rax, %rsi
movq 0x128(%rsp), %rdx
callq 0xa07e0
movq %rax, 0xd0(%rsp)
cmpq $0x0, 0xd0(%rsp)
jne 0x1b36e1
movq 0x4888f0(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x362959(%rip), %rsi    # 0x516013
leaq 0x3923e7(%rip), %rdx    # 0x545aa8
leaq 0x3aca18(%rip), %rcx    # 0x5600e0
leaq 0x3ac9be(%rip), %r8     # 0x56008d
movl $0xdf, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1b36e3
movq 0xd0(%rsp), %rdi
callq 0x124e10
movq %rax, 0xc8(%rsp)
cmpq $0x0, 0xc8(%rsp)
jne 0x1b373b
movq 0x488896(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3628ff(%rip), %rsi    # 0x516013
leaq 0x3ac9f6(%rip), %rdx    # 0x560111
leaq 0x3ac9be(%rip), %rcx    # 0x5600e0
leaq 0x3ac964(%rip), %r8     # 0x56008d
movl $0xe1, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1b373d
movq 0xd0(%rsp), %rdi
movq 0xc8(%rsp), %rsi
callq 0x1b3cd0
movq %rax, 0xc0(%rsp)
cmpq $0x0, 0xc0(%rsp)
jne 0x1b379d
movq 0x488834(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x36289d(%rip), %rsi    # 0x516013
leaq 0x3ac971(%rip), %rdx    # 0x5600ee
leaq 0x3ac95c(%rip), %rcx    # 0x5600e0
leaq 0x3ac902(%rip), %r8     # 0x56008d
movl $0xe3, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1b379f
movq 0x100(%rsp), %rax
addq 0x58(%rsp), %rax
subq $0x1, %rax
movq %rax, 0xd8(%rsp)
movq 0xc0(%rsp), %rdi
movq 0x128(%rsp), %rcx
leaq 0xa8(%rsp), %rsi
leaq 0x64(%rsp), %rdx
callq 0x1b3db0
movl %eax, 0xbc(%rsp)
cmpl $0x0, %eax
jne 0x1b38c0
testb $0x1, 0xef(%rsp)
je 0x1b384a
movl 0x64(%rsp), %edx
movq 0x108(%rsp), %r8
movq 0xd8(%rsp), %r9
movl 0xf4(%rsp), %r11d
movl 0xf0(%rsp), %r10d
movq 0x128(%rsp), %rax
movq 0xa8(%rsp), %rdi
movq 0xb0(%rsp), %rsi
movl $0x1, %ecx
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x1b39f0
jmp 0x1b38bb
leaq 0xa8(%rsp), %rdi
callq 0x107320
movq %rax, 0x18(%rsp)
movl 0x64(%rsp), %eax
leaq 0x70(%rsp), %rdi
shlq $0x4, %rax
addq %rax, %rdi
callq 0x107320
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jbe 0x1b38b9
movq 0xa8(%rsp), %rcx
movl 0x64(%rsp), %eax
movl %eax, %edx
leaq 0x70(%rsp), %rax
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq 0xb0(%rsp), %rcx
movl 0x64(%rsp), %eax
movl %eax, %edx
leaq 0x70(%rsp), %rax
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
jmp 0x1b38bb
jmp 0x1b37b8
cmpl $-0x2, 0xbc(%rsp)
jne 0x1b38d5
movl $0xffffffff, 0xe8(%rsp) # imm = 0xFFFFFFFF
cmpl $0x0, 0xe8(%rsp)
jne 0x1b39a2
testb $0x1, 0xef(%rsp)
jne 0x1b39a0
movl $0x0, 0xe4(%rsp)
cmpl $0x3, 0xe4(%rsp)
jge 0x1b399e
movslq 0xe4(%rsp), %rcx
leaq 0x70(%rsp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $-0x1, (%rax)
je 0x1b3986
movslq 0xe4(%rsp), %rax
leaq 0x70(%rsp), %rcx
shlq $0x4, %rax
addq %rax, %rcx
movl 0xe4(%rsp), %edx
movq 0x108(%rsp), %r8
movq 0xd8(%rsp), %r9
movl 0xf4(%rsp), %r11d
movl 0xf0(%rsp), %r10d
movq 0x128(%rsp), %rax
movq (%rcx), %rdi
movq 0x8(%rcx), %rsi
movl $0x1, %ecx
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x1b39f0
jmp 0x1b3988
movl 0xe4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xe4(%rsp)
jmp 0x1b38fc
jmp 0x1b39a0
jmp 0x1b39a2
jmp 0x1b39a4
movq 0xd0(%rsp), %rdi
callq 0x9f800
movq 0xc8(%rsp), %rdi
callq 0x125770
movq 0xc0(%rsp), %rdi
callq 0x1b3f30
movq 0x68(%rsp), %rdi
callq 0x11f560
movl 0xe8(%rsp), %eax
addq $0x118, %rsp            # imm = 0x118
retq
nopw %cs:(%rax,%rax)