// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/tools/gt_mkfeatureindex.c
// Function: gt_mkfeatureindex_runner
static int gt_mkfeatureindex_runner(int argc,
                                    const char **argv,
                                    int parsed_args,
                                    void *tool_arguments,
                                    GtError *err)
{
  GtMkfeatureindexArguments *arguments = tool_arguments;
  GtNodeStream *in_stream = NULL,
              *feature_stream = NULL;
  GtRDB *rdb = NULL;
  GtAnnoDBSchema *adb = NULL;
  GtFeatureIndex *fis = NULL;
  int had_err = 0;

  gt_error_check(err);
  gt_assert(arguments);

#ifdef HAVE_SQLITE
  if (strcmp(gt_str_get(arguments->backend),
             GT_SQLITE_BACKEND_STRING) == 0) {
    if (gt_file_exists(gt_str_get(arguments->filename))) {
      if (arguments->force) {
        gt_xunlink(gt_str_get(arguments->filename));
      } else {
        gt_error_set(err, "file \"%s\" exists already. use option -force to "
                     "overwrite", gt_str_get(arguments->filename));
        had_err = -1;
      }
    }
    if (!had_err) {
      rdb = gt_rdb_sqlite_new(gt_str_get(arguments->filename), err);
      if (!rdb)
        had_err = -1;
    }
  }
#endif
#ifdef HAVE_MYSQL
  if (strcmp(gt_str_get(arguments->backend),
                    GT_MYSQL_BACKEND_STRING) == 0) {
    arguments->pass = gt_get_password("password: ", err);
    rdb = gt_rdb_mysql_new(gt_str_get(arguments->host),
                           arguments->port,
                           gt_str_get(arguments->database),
                           gt_str_get(arguments->user),
                           gt_str_get(arguments->pass),
                           err);
    if (!rdb)
      had_err = -1;
  }
#endif

  adb = gt_anno_db_gfflike_new();
  if (!had_err && !adb)
    had_err = -1;

  if (!had_err) {
    fis = gt_anno_db_schema_get_feature_index(adb, rdb, err);
    if (!fis)
      had_err = -1;
  }

  if (!had_err) {
    if (strcmp(gt_str_get(arguments->input), "gff") == 0)
    {
      in_stream = gt_gff3_in_stream_new_unsorted(argc - parsed_args,
                                                 argv + parsed_args);
      if (arguments->verbose)
        gt_gff3_in_stream_show_progress_bar((GtGFF3InStream*) in_stream);
    } else if (strcmp(gt_str_get(arguments->input), "bed") == 0)
    {
      if (argc - parsed_args == 0)
        in_stream = gt_bed_in_stream_new(NULL);
      else
        in_stream = gt_bed_in_stream_new(argv[parsed_args]);
    } else if (strcmp(gt_str_get(arguments->input), "gtf") == 0)
    {
      if (argc - parsed_args == 0)
        in_stream = gt_gtf_in_stream_new(NULL);
      else
        in_stream = gt_gtf_in_stream_new(argv[parsed_args]);
    }
    gt_assert(in_stream);

    feature_stream = gt_feature_stream_new(in_stream, fis);
    had_err = gt_node_stream_pull(feature_stream, err);
  }
  gt_node_stream_delete(feature_stream);
  gt_node_stream_delete(in_stream);
  gt_feature_index_delete(fis);
  gt_anno_db_schema_delete(adb);
  gt_rdb_delete(rdb);
  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, %r13
movl %edi, %r12d
testq %r8, %r8
je 0x3473f
movq %rbx, %rdi
callq 0x89eb7
testb %al, %al
jne 0x349a1
movl %ebp, 0xc(%rsp)
testq %r15, %r15
je 0x34973
movq (%r15), %rdi
callq 0xad1fa
leaq 0x2e0db4(%rip), %rsi    # 0x31550f
movq %rax, %rdi
callq 0x179e0
movb $0x1, %r14b
testl %eax, %eax
movq %r13, 0x10(%rsp)
je 0x34779
movq $0x0, (%rsp)
jmp 0x347ce
movq 0x8(%r15), %rdi
callq 0xad1fa
movq %rax, %rdi
callq 0x8da98
testb %al, %al
je 0x347ad
movb 0x3d(%r15), %bpl
movq 0x8(%r15), %rdi
callq 0xad1fa
cmpb $0x1, %bpl
jne 0x348bc
movq %rax, %rdi
callq 0xb3704
movq 0x8(%r15), %rdi
callq 0xad1fa
movq %rax, %rdi
movq %rbx, %rsi
callq 0x10d8b0
movq %rax, (%rsp)
testq %rax, %rax
je 0x348af
xorl %ebp, %ebp
callq 0xb9186
movq %rax, %r13
testq %rax, %rax
setne %al
orb %bpl, %al
andb %r14b, %al
pushq $-0x1
popq %r14
cmpb $0x1, %al
jne 0x34874
movq %r13, %rdi
movq (%rsp), %rsi
movq %rbx, %rdx
callq 0xba686
testq %rax, %rax
je 0x34874
movq %rax, %rbp
movq 0x30(%r15), %rdi
callq 0xad1fa
leaq 0x2b3778(%rip), %rsi    # 0x2e7f8f
movq %rax, %rdi
callq 0x179e0
testl %eax, %eax
je 0x34881
movq 0x30(%r15), %rdi
callq 0xad1fa
leaq 0x2bc7cf(%rip), %rsi    # 0x2f1002
movq %rax, %rdi
callq 0x179e0
testl %eax, %eax
movl 0xc(%rsp), %r14d
je 0x348e3
movq 0x30(%r15), %rdi
callq 0xad1fa
leaq 0x2b0edb(%rip), %rsi    # 0x2e5733
movq %rax, %rdi
callq 0x179e0
testl %eax, %eax
jne 0x349cf
cmpl %r14d, %r12d
jne 0x348ec
xorl %edi, %edi
jmp 0x348f8
xorl %ebp, %ebp
xorl %r12d, %r12d
xorl %r15d, %r15d
jmp 0x34938
movl 0xc(%rsp), %eax
subl %eax, %r12d
cltq
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax,8), %rsi
movl %r12d, %edi
callq 0xdeebd
movq %rax, %r12
cmpb $0x1, 0x3c(%r15)
jne 0x34913
movq %r12, %rdi
callq 0xdeb22
jmp 0x34913
movb $0x1, %bpl
movq $0x0, (%rsp)
jmp 0x348db
leaq 0x2bc83b(%rip), %rsi    # 0x2f10fe
movq $0x0, (%rsp)
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x89dbb
movb $0x1, %bpl
xorl %r14d, %r14d
jmp 0x347d0
cmpl %r14d, %r12d
jne 0x348ff
xorl %edi, %edi
jmp 0x3490b
movslq %r14d, %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
callq 0xe7977
jmp 0x34910
movslq %r14d, %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
callq 0xbb771
movq %rax, %r12
testq %r12, %r12
je 0x349cf
movq %r12, %rdi
movq %rbp, %rsi
callq 0xdcac8
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
callq 0x102b93
movl %eax, %r14d
movq %r15, %rdi
callq 0x10297b
movq %r12, %rdi
callq 0x10297b
movq %rbp, %rdi
callq 0xd7777
movq %r13, %rdi
callq 0xba5a3
movq (%rsp), %rdi
callq 0x10d1a6
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4035ee(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b068f(%rip), %rsi    # 0x2e5013
leaq 0x313cc8(%rip), %rdx    # 0x348653
leaq 0x2bc753(%rip), %rcx    # 0x2f10e5
leaq 0x2bc64b(%rip), %r8     # 0x2f0fe4
movl $0xc4, %r9d
jmp 0x349fb
movq 0x4035c0(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b0661(%rip), %rsi    # 0x2e5013
leaq 0x2b0806(%rip), %rdx    # 0x2e51bf
leaq 0x2bc725(%rip), %rcx    # 0x2f10e5
leaq 0x2bc61d(%rip), %r8     # 0x2f0fe4
movl $0xc3, %r9d
jmp 0x349fb
movq 0x403592(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2b0633(%rip), %rsi    # 0x2e5013
leaq 0x2ba9ac(%rip), %rdx    # 0x2ef393
leaq 0x2bc6f7(%rip), %rcx    # 0x2f10e5
leaq 0x2bc5ef(%rip), %r8     # 0x2f0fe4
movl $0x106, %r9d            # imm = 0x106
xorl %eax, %eax
callq 0x17a50
callq 0x17390
nop