// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/match_iterator_sw.c
// Function: gt_match_iterator_sw_next
static GtMatchIteratorStatus gt_match_iterator_sw_next(GtMatchIterator *mi,
                                                      GT_UNUSED GtMatch **match,
                                                      GT_UNUSED GtError *err)
{
  GtMatchIteratorSW *mis;
  GtSeq *seq_a, *seq_b;
  char *a, *b;
  const char *adesc, *bdesc;
  GtAlignment *ali = NULL;
  GtUword seqlen_a, seqlen_b, seqpos;
  GtRange arng, brng;
  gt_assert(mi && match);

  mis = gt_match_iterator_sw_cast(mi);
  while (true) {
    if (!mis->pvt->firstali)
      mis->pvt->seqno_es2++;
    if (mis->pvt->seqno_es2 == gt_encseq_num_of_sequences(mis->pvt->es2)) {
      mis->pvt->seqno_es1++;
      if (mis->pvt->seqno_es1 == gt_encseq_num_of_sequences(mis->pvt->es1))
        return GT_MATCHER_STATUS_END;
      mis->pvt->seqno_es2 = 0;
    }
    seqlen_a = gt_encseq_seqlength(mis->pvt->es1, mis->pvt->seqno_es1);
    seqlen_b = gt_encseq_seqlength(mis->pvt->es2, mis->pvt->seqno_es2);
    /* XXX: reuse buffers for performance improvement */
    a = gt_malloc(seqlen_a * sizeof (char));
    seqpos = gt_encseq_seqstartpos(mis->pvt->es1, mis->pvt->seqno_es1);
    gt_encseq_extract_decoded(mis->pvt->es1, a, seqpos, seqpos + seqlen_a - 1);
    b = gt_malloc(seqlen_b * sizeof (char));
    seqpos = gt_encseq_seqstartpos(mis->pvt->es2, mis->pvt->seqno_es2);
    gt_encseq_extract_decoded(mis->pvt->es1, b, seqpos, seqpos + seqlen_b - 1);
    seq_a = gt_seq_new(a, seqlen_a, gt_encseq_alphabet(mis->pvt->es1));
    seq_b = gt_seq_new(b, seqlen_b, gt_encseq_alphabet(mis->pvt->es2));
    ali = gt_swalign(seq_a, seq_b, mis->pvt->sf);
    mis->pvt->firstali = false;
    if (ali && gt_alignment_get_length(ali) >= mis->pvt->min_len
          && gt_alignment_eval(ali) <= mis->pvt->max_edist) {
      break;
    }
    gt_alignment_delete(ali);
    gt_seq_delete(seq_a);
    gt_seq_delete(seq_b);
    gt_free(a);
    gt_free(b);
  }
  arng = gt_alignment_get_urange(ali);
  brng = gt_alignment_get_vrange(ali);
  adesc = gt_encseq_description(mis->pvt->es1, &seqlen_a, mis->pvt->seqno_es1);
  bdesc = gt_encseq_description(mis->pvt->es2, &seqlen_b, mis->pvt->seqno_es2);
  *match = gt_match_sw_new("", "",
                           mis->pvt->seqno_es1,
                           mis->pvt->seqno_es2,
                           gt_alignment_get_length(ali),
                           gt_alignment_eval(ali),
                           arng.start, brng.start,
                           arng.end, brng.end,
                           GT_MATCH_DIRECT);
  gt_match_set_seqid1_nt(*match, adesc, seqlen_a);
  gt_match_set_seqid2_nt(*match, bdesc, seqlen_b);
  gt_alignment_delete(ali);
  gt_seq_delete(seq_a);
  gt_seq_delete(seq_b);
  gt_free(a);
  gt_free(b);
  return GT_MATCHER_STATUS_OK;
}

// Assembly:
pushq %rbx
subq $0x130, %rsp            # imm = 0x130
movq %rdi, 0x120(%rsp)
movq %rsi, 0x118(%rsp)
movq %rdx, 0x110(%rsp)
movq $0x0, 0xd0(%rsp)
cmpq $0x0, 0x120(%rsp)
je 0x1ab232
cmpq $0x0, 0x118(%rsp)
jne 0x1ab26a
movq 0x490d67(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x36add0(%rip), %rsi    # 0x516013
leaq 0x3aea4f(%rip), %rdx    # 0x559c99
leaq 0x3aea54(%rip), %rcx    # 0x559ca5
leaq 0x3aea20(%rip), %r8     # 0x559c78
movl $0x3f, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1ab26c
callq 0x1ab1b0
movq %rax, %rdi
movq 0x120(%rsp), %rsi
callq 0x1a79f0
movq %rax, 0x108(%rsp)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
testb $0x1, 0x38(%rax)
jne 0x1ab2b3
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rax)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, 0x70(%rsp)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rdi
callq 0xa9d50
movq %rax, %rcx
movq 0x70(%rsp), %rax
cmpq %rcx, %rax
jne 0x1ab35d
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rax)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, 0x68(%rsp)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
callq 0xa9d50
movq %rax, %rcx
movq 0x68(%rsp), %rax
cmpq %rcx, %rax
jne 0x1ab349
movl $0x1, 0x12c(%rsp)
jmp 0x1ab87b
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq $0x0, 0x20(%rax)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rsi
callq 0xb09f0
movq %rax, 0xc8(%rsp)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rdi
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rsi
callq 0xb09f0
movq %rax, 0xc0(%rsp)
movq 0xc8(%rsp), %rdi
shlq $0x0, %rdi
leaq 0x3ae8ae(%rip), %rsi    # 0x559c78
movl $0x4e, %edx
callq 0xe80f0
movq %rax, 0xf0(%rsp)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rsi
callq 0xb0530
movq %rax, 0xb8(%rsp)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq 0xf0(%rsp), %rsi
movq 0xb8(%rsp), %rdx
movq 0xb8(%rsp), %rcx
addq 0xc8(%rsp), %rcx
subq $0x1, %rcx
callq 0xac570
movq 0xc0(%rsp), %rdi
shlq $0x0, %rdi
leaq 0x3ae823(%rip), %rsi    # 0x559c78
movl $0x51, %edx
callq 0xe80f0
movq %rax, 0xe8(%rsp)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rdi
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rsi
callq 0xb0530
movq %rax, 0xb8(%rsp)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq 0xe8(%rsp), %rsi
movq 0xb8(%rsp), %rdx
movq 0xb8(%rsp), %rcx
addq 0xc0(%rsp), %rcx
subq $0x1, %rcx
callq 0xac570
movq 0xf0(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
callq 0xb0f00
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq %rax, %rdx
callq 0x110410
movq %rax, 0x100(%rsp)
movq 0xe8(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rdi
callq 0xb0f00
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rsi
movq %rax, %rdx
callq 0x110410
movq %rax, 0xf8(%rsp)
movq 0x100(%rsp), %rdi
movq 0xf8(%rsp), %rsi
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdx
callq 0x1eaed0
movq %rax, 0xd0(%rsp)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movb $0x0, 0x38(%rax)
cmpq $0x0, 0xd0(%rsp)
je 0x1ab5e6
movq 0xd0(%rsp), %rdi
callq 0x12a1b0
movq 0x108(%rsp), %rcx
movq 0x8(%rcx), %rcx
cmpq 0x28(%rcx), %rax
jb 0x1ab5e6
movq 0xd0(%rsp), %rdi
callq 0x12a9b0
movq 0x108(%rsp), %rcx
movq 0x8(%rcx), %rcx
cmpq 0x30(%rcx), %rax
ja 0x1ab5e6
jmp 0x1ab644
movq 0xd0(%rsp), %rdi
callq 0x12c3e0
movq 0x100(%rsp), %rdi
callq 0x110820
movq 0xf8(%rsp), %rdi
callq 0x110820
movq 0xf0(%rsp), %rdi
leaq 0x3ae65c(%rip), %rsi    # 0x559c78
movl $0x5f, %edx
callq 0xe88c0
movq 0xe8(%rsp), %rdi
leaq 0x3ae643(%rip), %rsi    # 0x559c78
movl $0x60, %edx
callq 0xe88c0
jmp 0x1ab289
movq 0xd0(%rsp), %rdi
callq 0x12a0f0
movq %rax, 0x88(%rsp)
movq %rdx, 0x90(%rsp)
movq 0x88(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0xd0(%rsp), %rdi
callq 0x12a290
movq %rax, 0x78(%rsp)
movq %rdx, 0x80(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rdx
leaq 0xc8(%rsp), %rsi
callq 0xb1b40
movq %rax, 0xe0(%rsp)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rdi
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rdx
leaq 0xc0(%rsp), %rsi
callq 0xb1b40
movq %rax, 0xd8(%rsp)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x108(%rsp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, 0x38(%rsp)
movq 0xd0(%rsp), %rdi
callq 0x12a1b0
movq %rax, 0x40(%rsp)
movq 0xd0(%rsp), %rdi
callq 0x12a9b0
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %r8
movq %rax, %r9
movq 0xa8(%rsp), %rbx
movq 0x98(%rsp), %r11
movq 0xb0(%rsp), %r10
movq 0xa0(%rsp), %rax
leaq 0x3f1e84(%rip), %rsi    # 0x59d628
xorl %edi, %edi
movq %rsi, %rdi
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movl $0x0, 0x20(%rsp)
callq 0x1abdd0
movq %rax, %rcx
movq 0x118(%rsp), %rax
movq %rcx, (%rax)
movq 0x118(%rsp), %rax
movq (%rax), %rdi
movq 0xe0(%rsp), %rsi
movq 0xc8(%rsp), %rdx
callq 0x1a6ac0
movq 0x118(%rsp), %rax
movq (%rax), %rdi
movq 0xd8(%rsp), %rsi
movq 0xc0(%rsp), %rdx
callq 0x1a6b70
movq 0xd0(%rsp), %rdi
callq 0x12c3e0
movq 0x100(%rsp), %rdi
callq 0x110820
movq 0xf8(%rsp), %rdi
callq 0x110820
movq 0xf0(%rsp), %rdi
leaq 0x3ae42b(%rip), %rsi    # 0x559c78
movl $0x73, %edx
callq 0xe88c0
movq 0xe8(%rsp), %rdi
leaq 0x3ae412(%rip), %rsi    # 0x559c78
movl $0x74, %edx
callq 0xe88c0
movl $0x0, 0x12c(%rsp)
movl 0x12c(%rsp), %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbx
retq
nopl (%rax,%rax)