// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/match_iterator_last.c
// Function: gt_match_iterator_last_next
static GtMatchIteratorStatus gt_match_iterator_last_next(GT_UNUSED
                                                         GtMatchIterator *gmpi,
                                                         GT_UNUSED
                                                         GtMatch **match,
                                                         GtError *err)
{
#ifndef _WIN32
  int had_err = 0, rval;
  GtMatchIteratorLast *mil;
  GtStr *tmp = NULL,
        *lastbinary = NULL,
        *matchfilename = NULL;
  gt_assert(gmpi && match);
  gt_error_check(err);
  mil = gt_match_iterator_last_cast(gmpi);

  if (!mil->pvt->queryfilename) {
    GtStr *fn = gt_str_clone(mil->pvt->idxfilename);
    gt_str_append_cstr(fn, ".qry");
    if (!gt_file_exists(gt_str_get(fn))) {
      last_prepare_fasta_seqs(gt_str_get(fn), mil->pvt->es2,
                              mil->pvt->desc_to_seqno, err);
    }
    mil->pvt->queryfilename = gt_str_ref(fn);
    gt_str_delete(fn);
  }

  if (!mil->pvt->matchfile) {
    int fdout;
    pid_t pid;
    gt_assert(mil->pvt->idxfilename
                && gt_str_length(mil->pvt->idxfilename) > 0);

    tmp = gt_str_new();
    lastbinary = gt_str_new();
    matchfilename = gt_str_new();
    had_err = get_run_parameterization(mil, tmp, lastbinary,
                                       gt_str_get(mil->pvt->idxfilename),
                                       gt_str_get(mil->pvt->queryfilename),
                                       err);
    if (!had_err) {
      char *matchfilehash;
      gt_assert(gt_str_length(tmp) > 0);
      matchfilehash = gt_md5_fingerprint(gt_str_get(tmp), gt_str_length(tmp));
      gt_assert(matchfilehash && strlen(matchfilehash) > 0);
      gt_str_append_cstr(matchfilename, mil->pvt->tmpdir);
      gt_str_append_cstr(matchfilename, "/");
      gt_str_append_cstr(matchfilename, matchfilehash);
      gt_str_append_cstr(matchfilename, ".match");
    }

    if (!had_err && !gt_file_exists(gt_str_get(matchfilename))) {
      char **args = NULL;
      args = gt_cstr_split(gt_str_get(tmp), ' ');
      fdout = open(gt_str_get(matchfilename), O_WRONLY | O_CREAT, 0600);
      switch ((pid = fork())) {
        case -1:
               had_err = -1;
               break;
        case 0:
          dup2(fdout, STDOUT_FILENO);
          close(fdout);
          execvp(gt_str_get(lastbinary), args);
        default:
        {
          int status;
          while (-1 == waitpid(pid, &status, 0));
        }
      }
      if (had_err == -1)
        gt_error_set(err, "error forking the LAST process");
      gt_cstr_array_delete(args);
    }
    if (!had_err) {
      mil->pvt->matchfile = gt_file_open(GT_FILE_MODE_UNCOMPRESSED,
                                         gt_str_get(matchfilename), "r", err);
      if (!mil->pvt->matchfile) {
        had_err = -1;
      }
    }
    gt_str_delete(lastbinary);
    gt_str_delete(tmp);

  }
  gt_str_delete(matchfilename);

  if (!had_err) {
    /* result file should now be open */
    gt_assert(mil->pvt->matchfile);
    /* skip all comment lines */
    while (last_parse_comment_line(mil));
    /* parse next match */
    if ((rval = last_parse_match(mil, match, err)) == EOF) {
      *match = NULL;
      return GT_MATCHER_STATUS_END;
    }
  }
  /* return error if required */
  if (had_err) {
    *match = NULL;
    return GT_MATCHER_STATUS_ERROR;
  }
  return GT_MATCHER_STATUS_OK;
#else
  /* XXX */
  gt_error_set(err, "gt_match_iterator_last_next() not implemented");
  return GT_MATCHER_STATUS_ERROR;
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4068, %rsp           # imm = 0x4068
testq %rdi, %rdi
je 0x15f50a
movq %rsi, %rbp
testq %rsi, %rsi
je 0x15f50a
movq %rdx, %r14
movq %rdi, %rbx
testq %rdx, %rdx
je 0x15ed59
movq %r14, %rdi
callq 0xfcc32
testb %al, %al
jne 0x15f51e
callq 0x15ecdb
movq %rax, %rdi
movq %rbx, %rsi
callq 0x15de4d
movq %rax, %r15
movq 0x8(%rax), %rax
cmpq $0x0, 0x48(%rax)
jne 0x15ede1
movq 0x40(%rax), %rdi
callq 0x11b191
movq %rax, %r12
leaq 0x2284bc(%rip), %rsi    # 0x387246
movq %rax, %rdi
callq 0x11acf3
movq %r12, %rdi
callq 0x11b0a1
movq %rax, %rdi
callq 0xff28c
testb %al, %al
jne 0x15edc5
movq %r12, %rdi
callq 0x11b0a1
movq 0x8(%r15), %rcx
movq 0x8(%rcx), %rsi
movq 0x68(%rcx), %rdx
movq %rax, %rdi
movq %r14, %rcx
callq 0x15f644
movq %r12, %rdi
callq 0x11b1f3
movq 0x8(%r15), %rcx
movq %rax, 0x48(%rcx)
movq %r12, %rdi
callq 0x11bdbf
movq 0x8(%r15), %rax
cmpq $0x0, 0x60(%rax)
je 0x15eed1
xorl %edi, %edi
callq 0x11bdbf
movq 0x8(%r15), %rax
movq 0x60(%rax), %rdi
testq %rdi, %rdi
je 0x15f50f
callq 0xfedd0
cmpb $0x23, %al
jne 0x15ee31
movq 0x8(%r15), %rax
movq 0x60(%rax), %rdi
callq 0xfedd0
cmpl $0xa, %eax
jne 0x15ee0d
movq 0x8(%r15), %rax
movq 0x60(%rax), %rdi
testq %rdi, %rdi
jne 0x15ee04
callq 0x4c406
movq 0x8(%r15), %rcx
movq 0x60(%rcx), %rdi
movsbl %al, %esi
callq 0xfee24
movq $-0x1, %rax
movq %rax, 0x48(%rsp)
movq %rax, 0x40(%rsp)
movq %rax, 0x38(%rsp)
movq %rax, 0x30(%rsp)
movq %rax, 0x28(%rsp)
movq %rax, 0x58(%rsp)
movq %rax, 0x50(%rsp)
movb $0x7f, %al
movb %al, 0xf(%rsp)
movb %al, 0xe(%rsp)
movq 0x8(%r15), %rax
cmpq $0x0, 0x60(%rax)
je 0x15f514
testq %r14, %r14
je 0x15ee9d
movq %r14, %rdi
callq 0xfcc32
testb %al, %al
jne 0x15f528
movq 0x8(%r15), %rax
movq 0x58(%rax), %rdi
callq 0x11b132
movq 0x8(%r15), %rax
movq 0x58(%rax), %rdi
movq 0x60(%rax), %rsi
callq 0x11b32c
testl %eax, %eax
je 0x15eff8
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
jne 0x15f4f8
jmp 0x15f134
movq 0x40(%rax), %rdi
testq %rdi, %rdi
je 0x15f519
callq 0x11b0ca
testq %rax, %rax
je 0x15f519
callq 0x11ac6c
movq %rax, %r12
callq 0x11ac6c
movq %rax, %rbx
callq 0x11ac6c
movq %rax, %r13
movq 0x8(%r15), %rax
movq 0x40(%rax), %rdi
callq 0x11b0a1
movq %rax, 0x18(%rsp)
movq 0x8(%r15), %rax
movq 0x48(%rax), %rdi
callq 0x11b0a1
movq %rax, 0x10(%rsp)
testq %r14, %r14
je 0x15ef3d
movq %r14, %rdi
callq 0xfcc32
testb %al, %al
jne 0x15f532
movq %r12, %rdi
callq 0x11b132
movq %rbx, %rdi
callq 0x11b132
leaq 0x228229(%rip), %rdi    # 0x38717d
callq 0x17950
testq %rax, %rax
je 0x15f146
movq %r12, %rdi
movq %rax, %rsi
callq 0x11acf3
leaq 0x22837b(%rip), %rsi    # 0x3872ef
movq %r12, %rdi
callq 0x11acf3
movq %r12, %rdi
callq 0x11b0a1
movq %rax, %rdi
callq 0xff28c
testb %al, %al
jne 0x15f155
movq %r12, %rdi
callq 0x11b0a1
leaq 0x228354(%rip), %rsi    # 0x3872f7
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xfcb67
movq %rbx, %rdi
movq %r12, %rsi
callq 0x11adc1
leaq 0x228370(%rip), %rsi    # 0x387332
movq %r12, %rdi
callq 0x11acf3
movq %r12, %rdi
movq 0x18(%rsp), %rsi
callq 0x11acf3
leaq 0x263142(%rip), %rsi    # 0x3c2120
movq %r12, %rdi
callq 0x11acf3
movq %r12, %rdi
movq 0x10(%rsp), %rsi
callq 0x11acf3
jmp 0x15f4d3
movq 0x8(%r15), %rax
movq 0x58(%rax), %rdi
callq 0x11b0a1
subq $0x8, %rsp
leaq 0x58(%rsp), %r10
leaq 0x16(%rsp), %r11
leaq 0x30(%rsp), %rbx
leaq 0x40(%rsp), %r12
leaq 0x2068(%rsp), %r13
leaq 0x228351(%rip), %rsi    # 0x38737d
leaq 0x50(%rsp), %rdx
leaq 0x68(%rsp), %rcx
leaq 0x48(%rsp), %r8
leaq 0x38(%rsp), %r9
movq %rax, %rdi
movl $0x0, %eax
pushq %r10
pushq %r11
pushq %rbx
pushq %r12
pushq %r13
leaq 0x88(%rsp), %r10
pushq %r10
leaq 0x47(%rsp), %r10
pushq %r10
callq 0x177f0
addq $0x40, %rsp
movq 0x8(%r15), %rcx
cmpl $0xb, %eax
jne 0x15f117
movq 0x68(%rcx), %rdi
leaq 0x60(%rsp), %rsi
callq 0x100add
cmpq $-0x1, %rax
je 0x15f537
movq %rax, %rbx
movq 0x8(%r15), %rax
movq 0x68(%rax), %rdi
leaq 0x2060(%rsp), %rsi
callq 0x100add
cmpq $-0x1, %rax
je 0x15f53c
movq 0x48(%rsp), %rdx
movq 0x40(%rsp), %r9
movq 0x38(%rsp), %r10
movq 0x30(%rsp), %rcx
leaq (%r9,%rcx), %r11
decq %r11
movq 0x28(%rsp), %rcx
leaq (%r10,%rcx), %r14
decq %r14
movb 0xf(%rsp), %cl
xorl %r15d, %r15d
cmpb 0xe(%rsp), %cl
setne %r15b
leaq 0x60(%rsp), %rdi
leaq 0x2060(%rsp), %rsi
movq %rbx, %rcx
movq %rax, %r8
pushq %r15
pushq %r14
pushq %r11
pushq %r10
callq 0x16015f
addq $0x20, %rsp
movq %rax, (%rbp)
xorl %eax, %eax
jmp 0x15f4f8
movq 0x58(%rcx), %rdi
callq 0x11b0a1
leaq 0x22827e(%rip), %rsi    # 0x3873a5
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xfcb67
movq $0x0, (%rbp)
movl $0x1, %eax
jmp 0x15f4f8
leaq 0x2281a3(%rip), %rsi    # 0x3872f0
movq %r12, %rdi
callq 0x11acf3
movq %rbx, 0x20(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x11adc1
movq 0x8(%r15), %rax
xorl %ebx, %ebx
cmpl 0x10(%rax), %ebx
jo 0x15f192
leaq 0x218c96(%rip), %rsi    # 0x377e0d
movq %r12, %rdi
callq 0x11acf3
movq 0x8(%r15), %rax
movl 0x10(%rax), %esi
movq %r12, %rdi
callq 0x11b007
movq 0x8(%r15), %rax
cmpl 0x14(%rax), %ebx
jo 0x15f1b9
leaq 0x218c30(%rip), %rsi    # 0x377dce
movq %r12, %rdi
callq 0x11acf3
movq 0x8(%r15), %rax
movl 0x14(%rax), %esi
movq %r12, %rdi
callq 0x11b007
movq 0x8(%r15), %rax
xorl %ebx, %ebx
cmpl 0x18(%rax), %ebx
jo 0x15f1e2
leaq 0x218c8e(%rip), %rsi    # 0x377e55
movq %r12, %rdi
callq 0x11acf3
movq 0x8(%r15), %rax
movl 0x18(%rax), %esi
movq %r12, %rdi
callq 0x11b007
movq 0x8(%r15), %rax
cmpl 0x1c(%rax), %ebx
jo 0x15f209
leaq 0x22812b(%rip), %rsi    # 0x387319
movq %r12, %rdi
callq 0x11acf3
movq 0x8(%r15), %rax
movl 0x1c(%rax), %esi
movq %r12, %rdi
callq 0x11b007
movq 0x8(%r15), %rax
xorl %ebx, %ebx
cmpl 0x20(%rax), %ebx
jo 0x15f232
leaq 0x228107(%rip), %rsi    # 0x38731e
movq %r12, %rdi
callq 0x11acf3
movq 0x8(%r15), %rax
movl 0x20(%rax), %esi
movq %r12, %rdi
callq 0x11b007
movq 0x8(%r15), %rax
cmpl 0x24(%rax), %ebx
jo 0x15f259
leaq 0x2280e5(%rip), %rsi    # 0x387323
movq %r12, %rdi
callq 0x11acf3
movq 0x8(%r15), %rax
movl 0x24(%rax), %esi
movq %r12, %rdi
callq 0x11b007
movq 0x8(%r15), %rax
xorl %ebx, %ebx
cmpl 0x28(%rax), %ebx
jo 0x15f282
leaq 0x2280c1(%rip), %rsi    # 0x387328
movq %r12, %rdi
callq 0x11acf3
movq 0x8(%r15), %rax
movl 0x28(%rax), %esi
movq %r12, %rdi
callq 0x11b007
movq 0x8(%r15), %rax
cmpl 0x34(%rax), %ebx
jo 0x15f2a9
leaq 0x22809f(%rip), %rsi    # 0x38732d
movq %r12, %rdi
callq 0x11acf3
movq 0x8(%r15), %rax
movl 0x34(%rax), %esi
movq %r12, %rdi
callq 0x11b007
movq 0x8(%r15), %rax
xorl %ebx, %ebx
cmpl 0x2c(%rax), %ebx
jo 0x15f2d2
leaq 0x2189fe(%rip), %rsi    # 0x377cb5
movq %r12, %rdi
callq 0x11acf3
movq 0x8(%r15), %rax
movl 0x2c(%rax), %esi
movq %r12, %rdi
callq 0x11b007
movq 0x8(%r15), %rax
cmpl 0x30(%rax), %ebx
jo 0x15f2f5
leaq 0x21899d(%rip), %rsi    # 0x377c7b
movq %r12, %rdi
callq 0x11acf3
movq 0x8(%r15), %rax
movl 0x30(%rax), %esi
movq %r12, %rdi
callq 0x11b007
leaq 0x228036(%rip), %rsi    # 0x387332
movq %r12, %rdi
callq 0x11acf3
movq %r12, %rdi
movq 0x18(%rsp), %rsi
callq 0x11acf3
leaq 0x262e08(%rip), %rsi    # 0x3c2120
movq %r12, %rdi
callq 0x11acf3
movq %r12, %rdi
movq 0x10(%rsp), %rsi
callq 0x11acf3
movq %r12, %rdi
callq 0x11b0ca
testq %rax, %rax
je 0x15f52d
movq %r12, %rdi
callq 0x11b0a1
movq %rax, %rbx
movq %r12, %rdi
callq 0x11b0ca
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1068d0
testq %rax, %rax
je 0x15f523
movq %rax, %rbx
cmpb $0x0, (%rax)
je 0x15f523
movq 0x8(%r15), %rax
movq 0x38(%rax), %rsi
movq %r13, %rdi
callq 0x11acf3
leaq 0x1ffe1a(%rip), %rsi    # 0x35f1a2
movq %r13, %rdi
callq 0x11acf3
movq %r13, %rdi
movq %rbx, %rsi
callq 0x11acf3
leaq 0x227f2d(%rip), %rsi    # 0x3872cf
movq %r13, %rdi
callq 0x11acf3
movq %r13, %rdi
callq 0x11b0a1
movq %rax, %rdi
callq 0xff28c
testb %al, %al
jne 0x15f462
movq %rbp, 0x18(%rsp)
movq %r12, %rdi
callq 0x11b0a1
movq %rax, %rdi
movl $0x20, %esi
callq 0xe4168
movq %rax, 0x10(%rsp)
movq %r13, %rdi
callq 0x11b0a1
movq %rax, %rdi
movl $0x41, %esi
movl $0x180, %edx            # imm = 0x180
xorl %eax, %eax
callq 0x17d60
movl %eax, %ebp
callq 0x171d0
cmpl $-0x1, %eax
je 0x15f4ae
movl %eax, %ebx
testl %eax, %eax
jne 0x15f43d
movl %ebp, %edi
movl $0x1, %esi
callq 0x17750
movl %ebp, %edi
callq 0x17fc0
movq 0x20(%rsp), %rdi
callq 0x11b0a1
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x175b0
leaq 0x60(%rsp), %rbp
movl %ebx, %edi
movq %rbp, %rsi
xorl %edx, %edx
callq 0x175f0
cmpl $-0x1, %eax
je 0x15f442
movq 0x10(%rsp), %rdi
callq 0xe487c
movq 0x18(%rsp), %rbp
movq %r13, %rdi
callq 0x11b0a1
leaq 0x1fb9e4(%rip), %rdx    # 0x35ae55
xorl %edi, %edi
movq %rax, %rsi
movq %r14, %rcx
callq 0xfead5
movq %rax, %rbx
movq 0x8(%r15), %rax
movq %rbx, 0x60(%rax)
movq 0x20(%rsp), %rdi
callq 0x11bdbf
movq %r12, %rdi
callq 0x11bdbf
movq %r13, %rdi
callq 0x11bdbf
testq %rbx, %rbx
jne 0x15edf3
jmp 0x15f4eb
leaq 0x227d02(%rip), %rsi    # 0x3871b7
movq %r14, %rdi
xorl %eax, %eax
callq 0xfcb67
movq 0x10(%rsp), %rdi
callq 0xe487c
movq 0x18(%rsp), %rbp
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x11bdbf
movq %r12, %rdi
callq 0x11bdbf
movq %r13, %rdi
callq 0x11bdbf
movq $0x0, (%rbp)
movl $0x2, %eax
addq $0x4068, %rsp           # imm = 0x4068
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4c279
callq 0x4c43f
callq 0x4c3cd
callq 0x4c4ea
callq 0x4c2b2
callq 0x4c478
callq 0x4c322
callq 0x4c4b1
callq 0x4c2eb
callq 0x4c394
callq 0x4c35b