// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/tools/gt_merge.c
// Function: gt_merge_runner
static int gt_merge_runner(int argc, const char **argv, int parsed_args,
                           void *tool_arguments, GtError *err)
{
  MergeArguments *arguments = tool_arguments;
  GtNodeStream *gff3_in_stream,
                *merge_stream,
                *gff3_out_stream;
  GtArray *genome_streams;
  GtUword i;
  int had_err;

  gt_error_check(err);
  gt_assert(arguments);

  /* alloc */
  genome_streams = gt_array_new(sizeof (GtNodeStream*));

  /* XXX: check for multiple specification of '-' */

  /* create an gff3 input stream for each given file */
  if (parsed_args < argc) {
    /* we got files to open */
    for (i = parsed_args; i < argc; i++) {
      gff3_in_stream = gt_gff3_in_stream_new_sorted(argv[i]);
      if (arguments->tidy)
        gt_gff3_in_stream_enable_tidy_mode((GtGFF3InStream*) gff3_in_stream);
      gt_array_add(genome_streams, gff3_in_stream);
    }
   }
   else {
     /* use stdin */
     gff3_in_stream = gt_gff3_in_stream_new_sorted(NULL);
     gt_array_add(genome_streams, gff3_in_stream);
   }

  /* create a merge stream */
  merge_stream = gt_merge_stream_new(genome_streams);
  gt_assert(merge_stream);

  /* create a gff3 output stream */
  gff3_out_stream = gt_gff3_out_stream_new(merge_stream, arguments->outfp);
  if (arguments->retainids)
    gt_gff3_out_stream_retain_id_attributes((GtGFF3OutStream*) gff3_out_stream);

  /* pull the features through the stream and free them afterwards */
  had_err = gt_node_stream_pull(gff3_out_stream, err);

  /* free */
  gt_node_stream_delete(gff3_out_stream);
  gt_node_stream_delete(merge_stream);
  for (i = 0; i < gt_array_size(genome_streams); i++)
    gt_node_stream_delete(*(GtNodeStream**) gt_array_get(genome_streams, i));
  gt_array_delete(genome_streams);

  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, %r15
movl %edx, %ebp
movq %rsi, %r12
movl %edi, %r13d
testq %r8, %r8
je 0xb2d5c
movq %rbx, %rdi
callq 0x101a9a
testb %al, %al
jne 0xb2e86
testq %r15, %r15
je 0xb2e7c
movq %rbx, 0x10(%rsp)
movl $0x8, %edi
callq 0xd46fc
movq %rax, %rbx
cmpl %r13d, %ebp
jge 0xb2dc0
jae 0xb2ddc
movslq %r13d, %r14
movslq %ebp, %rbp
leaq 0x8(%rsp), %r13
movq (%r12,%rbp,8), %rdi
callq 0x14d0a8
movq %rax, 0x8(%rsp)
cmpb $0x1, 0x11(%r15)
jne 0xb2da6
movq %rax, %rdi
callq 0x14cfc0
movl $0x8, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0xd49ce
incq %rbp
cmpq %r14, %rbp
jb 0xb2d89
jmp 0xb2ddc
xorl %edi, %edi
callq 0x14d0a8
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
movl $0x8, %edx
movq %rbx, %rdi
callq 0xd49ce
movq %rbx, %rdi
callq 0x1694c4
testq %rax, %rax
je 0xb2e81
movq %rax, %r12
movq 0x8(%r15), %rsi
movq %rax, %rdi
callq 0x14e310
movq %rax, %r13
cmpb $0x1, 0x10(%r15)
movq 0x10(%rsp), %r14
jne 0xb2e13
movq %r13, %rdi
callq 0x14e38c
movq %r13, %rdi
movq %r14, %rsi
callq 0x16adca
movl %eax, %ebp
movq %r13, %rdi
callq 0x16ac6e
movq %r12, %rdi
callq 0x16ac6e
movq %rbx, %rdi
callq 0xd4a9a
testq %rax, %rax
je 0xb2e63
xorl %r14d, %r14d
movq %rbx, %rdi
movq %r14, %rsi
callq 0xd47ba
movq (%rax), %rdi
callq 0x16ac6e
incq %r14
movq %rbx, %rdi
callq 0xd4a9a
cmpq %rax, %r14
jb 0xb2e40
movq %rbx, %rdi
callq 0xd4ef4
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1c9f0
callq 0x1c9b9
callq 0x1c982
nop