// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/ltr/ltr_refseq_match_stream.c
// Function: gt_ltr_refseq_match_stream_next
static int gt_ltr_refseq_match_stream_next(GtNodeStream *ns, GtGenomeNode **gn,
                                           GtError *err)
{
  GtLTRRefseqMatchStream *rms;
  GtGenomeNode *ref_gn;
  int had_err = 0;
  GtUword n_to_check = 0;

  gt_error_check(err);
  rms = gt_ltr_refseq_match_stream_cast(ns);
  if (rms->first_next) {
    while (!(had_err = gt_node_stream_next(rms->in_stream, gn, err)) && *gn) {
      gt_assert(*gn && !had_err);
      ref_gn = gt_genome_node_ref(*gn);
      gt_array_add(rms->nodes, ref_gn);
    }
    if (!had_err)
      had_err = gt_ltr_refseq_match_stream_extract_sequences(rms, &n_to_check,
                                                             err);
    if (n_to_check > 0) {
      if (!had_err)
        had_err = gt_ltr_refseq_match_stream_refseq_match(rms, err);
      if (!had_err) {
        *gn = *(GtGenomeNode**) gt_array_get(rms->nodes, rms->next_index);
        rms->next_index++;
        rms->first_next = false;
        return 0;
      }
    }
  } else {
    if (rms->next_index >= gt_array_size(rms->nodes))
      *gn = NULL;
    else {
      *gn = *(GtGenomeNode**) gt_array_get(rms->nodes, rms->next_index);
      rms->next_index++;
    }
    return 0;
  }

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4058, %rsp           # imm = 0x4058
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, %rbx
testq %rdx, %rdx
je 0x1bcb2e
movq %r13, %rdi
callq 0x89eb7
testb %al, %al
jne 0x1bd18f
callq 0x1bca98
movq %rax, %rdi
movq %rbx, %rsi
callq 0x102c81
movq %rax, %r14
cmpb $0x1, 0x60(%rax)
jne 0x1bcb87
leaq 0x48(%rsp), %rbx
pushq $0x8
popq %r15
movq 0x10(%r14), %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x102a22
testl %eax, %eax
jne 0x1bcbb3
movq (%r12), %rdi
testq %rdi, %rdi
je 0x1bcbc6
callq 0xdccf8
movq %rax, 0x48(%rsp)
movq 0x18(%r14), %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x5851d
jmp 0x1bcb50
movq 0x18(%r14), %rdi
movq 0x58(%r14), %rbx
callq 0x586a4
cmpq %rax, %rbx
jae 0x1bcbba
movq 0x18(%r14), %rdi
movq 0x58(%r14), %rsi
callq 0x581aa
movq (%rax), %rax
movq %rax, (%r12)
incq 0x58(%r14)
jmp 0x1bcbbf
movl %eax, %ebp
jmp 0x1bd130
andq $0x0, (%r12)
xorl %ebp, %ebp
jmp 0x1bd130
testq %r13, %r13
je 0x1bcbdb
movq %r13, %rdi
callq 0x89eb7
testb %al, %al
jne 0x1bd1c7
movq 0x38(%r14), %rdi
leaq 0x176d28(%rip), %rsi    # 0x33390e
movq %r13, %rdx
callq 0x8ce05
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x1bd12d
cmpq $0x0, 0x48(%r14)
je 0x1bcc0e
movq $0x0, 0x18(%rsp)
jmp 0x1bcc30
callq 0x791cd
movq 0x28(%r14), %rsi
movq %rax, %rdi
movq %r13, %rdx
callq 0x7921d
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x1bd12d
movq %r13, 0x8(%rsp)
movq %r12, 0x38(%rsp)
leaq 0x2050(%rsp), %r12
xorl %r13d, %r13d
xorl %r15d, %r15d
xorl %ebp, %ebp
movq %r14, 0x20(%rsp)
movq 0x18(%r14), %rdi
callq 0x586a4
cmpq %rax, %r15
jae 0x1bcec3
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0x581aa
movq (%rax), %rbx
movq %rbx, %rdi
callq 0xdc2f0
testq %rax, %rax
je 0x1bcebb
movq %r15, 0x30(%rsp)
movq %rbx, %rdi
callq 0xdc6f0
movq %rax, 0x40(%rsp)
movq %rax, %rdi
callq 0xdc92e
movq %rax, %r15
movq %rax, %rdi
callq 0xdd14a
movq %rax, %rbx
movq %r15, %rdi
callq 0xdd1f4
movq %rax, 0x50(%rsp)
movq %rdx, 0x58(%rsp)
cmpb $0x1, 0x62(%r14)
jne 0x1bccda
movq %r15, %rdi
leaq 0x1a2f98(%rip), %rsi    # 0x35fc64
callq 0xd9628
testq %rax, %rax
je 0x1bceac
movq %r12, %r14
movq %r15, %rdi
leaq 0x1a2c07(%rip), %rsi    # 0x35f8ee
callq 0xd9628
movq %rax, %r12
movq %rbx, %rdi
callq 0xad1fa
movq 0x50(%rsp), %r9
movq 0x58(%rsp), %r10
testq %r12, %r12
movq %r13, 0x28(%rsp)
je 0x1bcd34
subq $0x8, %rsp
movl $0x2000, %esi           # imm = 0x2000
movq %r14, %r13
movq %r14, %rdi
leaq 0x1a2f4a(%rip), %rdx    # 0x35fc6b
movq %r12, %rcx
movq %rax, %r8
xorl %eax, %eax
pushq %r10
callq 0x17bf0
popq %rcx
popq %rdx
jmp 0x1bcd56
movl $0x2000, %esi           # imm = 0x2000
movq %r14, %r13
movq %r14, %rdi
leaq 0x1a2f28(%rip), %rdx    # 0x35fc6e
movq %rax, %rcx
movq %r9, %r8
movq %r10, %r9
xorl %eax, %eax
callq 0x17bf0
movq %r13, %rdi
pushq $0x20
popq %rsi
pushq $0x2b
popq %rdx
callq 0x6c3a8
movq 0x20(%rsp), %r14
movq 0x20(%r14), %r12
movq %r13, %rdi
callq 0x6c2be
movq %r12, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x8f4bd
cmpq $0x0, 0x48(%r14)
je 0x1bcdfe
callq 0xacb84
movq %rax, %rbx
movq %r15, %rdi
callq 0xda338
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq 0x8(%rsp)
pushq 0x48(%r14)
callq 0x29a8d0
popq %rcx
popq %rdx
movl %eax, %ebp
testl %eax, %eax
movq %r13, %r12
jne 0x1bcdec
movq %rbx, %rdi
callq 0xad1fa
movq %rax, %r15
movq %rbx, %rdi
callq 0xad289
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
pushq $0x32
popq %rcx
movq 0x10(%rsp), %r8
callq 0x8c0bc
movq %rbx, %rdi
callq 0xae103
movq 0x20(%rsp), %r14
jmp 0x1bcea4
movq %rbx, %rdi
callq 0xad1fa
movq %rax, %rdi
leaq 0x1734b5(%rip), %rsi    # 0x3302c5
movq %rsp, %rdx
xorl %eax, %eax
callq 0x177b0
leaq 0x50(%rsp), %r12
movq %r12, %rdi
callq 0xa31ee
leaq 0x1(%rax), %rdi
pushq $0x1
popq %rsi
leaq 0x1a2de0(%rip), %rdx    # 0x35fc15
movl $0x9b, %ecx
callq 0x9334a
movq %rax, %rbx
movq (%rsp), %rsi
movq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0x74d9c
leaq -0x1(%rax), %rcx
movq 0x50(%rsp), %rdx
addq %rcx, %rdx
addq 0x58(%rsp), %rcx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x7239d
movq %r12, %rdi
callq 0xa31ee
movq %r13, %rdi
movq %rbx, %rsi
movq %rax, %rdx
pushq $0x32
popq %rcx
movq 0x10(%rsp), %r8
callq 0x8c0bc
movq %rbx, %rdi
leaq 0x1a2d7e(%rip), %rsi    # 0x35fc15
movl $0xa1, %edx
callq 0x936f9
movq %r13, %r12
movq 0x28(%rsp), %r13
incq %r13
movq 0x30(%rsp), %r15
movq 0x40(%rsp), %rdi
callq 0xdc9f1
incq %r15
jmp 0x1bcc4f
movq 0x10(%rsp), %rdi
callq 0x8da06
testq %r13, %r13
je 0x1bd130
testl %ebp, %ebp
jne 0x1bd130
andq $0x0, (%rsp)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1bcefa
callq 0x89eb7
testb %al, %al
jne 0x1bd1f3
leaq 0x15b41b(%rip), %rdi    # 0x31831c
callq 0x17900
movq 0x30(%r14), %r8
testq %rax, %rax
movq 0x38(%rsp), %r13
je 0x1bcf34
leaq 0x1a2d86(%rip), %rdx    # 0x35fca1
leaq 0x2050(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %rax, %rcx
xorl %eax, %eax
callq 0x17bf0
jmp 0x1bcf52
leaq 0x1a2d69(%rip), %rdx    # 0x35fca4
leaq 0x2050(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %r8, %rcx
xorl %eax, %eax
callq 0x17bf0
leaq 0x13ded4(%rip), %rsi    # 0x2fae2d
leaq 0x2050(%rsp), %rdi
callq 0x171f0
testq %rax, %rax
je 0x1bd11a
movq %rax, %rbx
movq %rbx, %rdi
callq 0x17bb0
cmpl $-0x1, %eax
jne 0x1bcf72
movq %rbx, %rdi
callq 0x17a10
callq 0xbcfce
movq %rax, %r12
movq 0x38(%r14), %rsi
movq %rax, %rdi
callq 0xbd034
movq 0x30(%r14), %rsi
movq %r12, %rdi
callq 0xbd0af
movsd 0x80(%r14), %xmm0
ucomisd 0x12ad58(%rip), %xmm0   # 0x2e7d10
jne 0x1bcfbc
jnp 0x1bcfc4
movq %r12, %rdi
callq 0xbd12c
cmpb $0x1, 0x61(%r14)
jne 0x1bcfda
leaq 0x16a434(%rip), %rsi    # 0x327406
movq %r12, %rdi
callq 0xbd691
movl 0x64(%r14), %esi
movl %esi, %eax
negl %eax
jo 0x1bcfec
movq %r12, %rdi
callq 0xbd1b0
movl 0x68(%r14), %esi
movl %esi, %eax
negl %eax
jo 0x1bcffe
movq %r12, %rdi
callq 0xbd22b
movl 0x6c(%r14), %esi
movl %esi, %eax
negl %eax
jo 0x1bd010
movq %r12, %rdi
callq 0xbd2a6
movl 0x70(%r14), %esi
movl %esi, %eax
negl %eax
jo 0x1bd022
movq %r12, %rdi
callq 0xbd321
movl 0x74(%r14), %esi
movl %esi, %eax
negl %eax
jo 0x1bd034
movq %r12, %rdi
callq 0xbd3d0
movsd 0x90(%r14), %xmm0
ucomisd 0x12accb(%rip), %xmm0   # 0x2e7d10
jne 0x1bd049
jnp 0x1bd079
leaq 0x16a3c1(%rip), %rdx    # 0x327411
leaq 0x50(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movb $0x1, %al
callq 0x17bf0
cmpl $0x2000, %eax           # imm = 0x2000
jae 0x1bd221
leaq 0x50(%rsp), %rsi
movq %r12, %rdi
callq 0xbd691
movl 0x78(%r14), %esi
movl %esi, %eax
negl %eax
jo 0x1bd08b
movq %r12, %rdi
callq 0xbd47f
movsd 0x88(%r14), %xmm0
ucomisd 0x12ac74(%rip), %xmm0   # 0x2e7d10
jne 0x1bd0a0
jnp 0x1bd0a8
movq %r12, %rdi
callq 0xbd4fa
movq 0xa0(%r14), %rcx
testq %rcx, %rcx
je 0x1bd0e4
leaq 0x18e2c8(%rip), %rdx    # 0x34b383
leaq 0x50(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
xorl %eax, %eax
callq 0x17bf0
cmpl $0x2000, %eax           # imm = 0x2000
jae 0x1bd252
leaq 0x50(%rsp), %rsi
movq %r12, %rdi
callq 0xbd691
movq %r12, %rdi
movq 0x8(%rsp), %r12
movq %r12, %rsi
callq 0xfc86f
testq %rax, %rax
je 0x1bd12d
movq %rax, %rbx
movq %rsp, %rsi
movq %rax, %rdi
movq %r12, %rdx
callq 0xfc67d
testl %eax, %eax
je 0x1bd144
leaq 0x1a2bc2(%rip), %rsi    # 0x35fcd7
movq %r12, %rdi
jmp 0x1bd126
leaq 0x1a2bcc(%rip), %rsi    # 0x35fced
movq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x89dbb
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x4058, %rsp           # imm = 0x4058
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsp, %r15
movq (%rsp), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x1bd538
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xfc67d
testl %eax, %eax
je 0x1bd147
cmpl $0x1, %eax
jne 0x1bd12d
movq 0x18(%r14), %rdi
movq 0x58(%r14), %rsi
callq 0x581aa
movq (%rax), %rax
movq %rax, (%r13)
incq 0x58(%r14)
movb $0x0, 0x60(%r14)
jmp 0x1bcbbf
movq 0x27add2(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x127e73(%rip), %rsi    # 0x2e5013
leaq 0x128018(%rip), %rdx    # 0x2e51bf
leaq 0x1a2a47(%rip), %rcx    # 0x35fbf5
leaq 0x1a2a60(%rip), %r8     # 0x35fc15
movl $0x16d, %r9d            # imm = 0x16D
xorl %eax, %eax
callq 0x17a50
callq 0x17390
movq 0x27ad9a(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x127e3b(%rip), %rsi    # 0x2e5013
leaq 0x127fe0(%rip), %rdx    # 0x2e51bf
leaq 0x1a2a51(%rip), %rcx    # 0x35fc37
leaq 0x1a2a28(%rip), %r8     # 0x35fc15
pushq $0x65
popq %r9
jmp 0x1bd1bb
movq 0x27ad6e(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x127e0f(%rip), %rsi    # 0x2e5013
leaq 0x127fb4(%rip), %rdx    # 0x2e51bf
leaq 0x1a2a67(%rip), %rcx    # 0x35fc79
leaq 0x1a29fc(%rip), %r8     # 0x35fc15
movl $0x117, %r9d            # imm = 0x117
jmp 0x1bd1bb
movq 0x27ad40(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x127de1(%rip), %rsi    # 0x2e5013
leaq 0x16a18f(%rip), %rdx    # 0x3273c8
leaq 0x1a2a39(%rip), %rcx    # 0x35fc79
leaq 0x1a29ce(%rip), %r8     # 0x35fc15
movl $0x140, %r9d            # imm = 0x140
jmp 0x1bd1bb
movq 0x27ad0f(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x127db0(%rip), %rsi    # 0x2e5013
leaq 0x16a15e(%rip), %rdx    # 0x3273c8
leaq 0x1a2a08(%rip), %rcx    # 0x35fc79
leaq 0x1a299d(%rip), %r8     # 0x35fc15
movl $0x14a, %r9d            # imm = 0x14A
jmp 0x1bd1bb