// File: /workspace/github_c_makefile_star2_O1/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, %r13
movl %edx, 0xc(%rsp)
movq %rsi, %r14
movl %edi, %r15d
testq %r8, %r8
je 0xb3450
movq %rbx, %rdi
callq 0x101a9a
testb %al, %al
jne 0xb3679
testq %r13, %r13
je 0xb3674
movq %r14, 0x10(%rsp)
movq (%r13), %rdi
callq 0x120d23
leaq 0x2cb011(%rip), %rsi    # 0x37e47f
movq %rax, %rdi
callq 0x17a40
movb $0x1, %bpl
testl %eax, %eax
movl %r15d, 0x8(%rsp)
je 0xb3487
xorl %r14d, %r14d
jmp 0xb34db
movq 0x8(%r13), %rdi
callq 0x120d23
movq %rax, %rdi
callq 0x10415c
testb %al, %al
je 0xb34bb
movb 0x3d(%r13), %r14b
movq 0x8(%r13), %rdi
callq 0x120d23
cmpb $0x1, %r14b
jne 0xb35c7
movq %rax, %rdi
callq 0x1259fb
movq 0x8(%r13), %rdi
callq 0x120d23
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1742c4
testq %rax, %rax
je 0xb35bf
movq %rax, %r14
xorl %r12d, %r12d
callq 0x12a404
movq %rax, %r15
testq %rax, %rax
setne %al
orb %r12b, %al
andb %bpl, %al
cmpb $0x1, %al
jne 0xb350f
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x12b644
movq %rax, %rbp
testq %rax, %rax
setne %al
jmp 0xb3513
xorl %ebp, %ebp
xorl %eax, %eax
testb %al, %al
je 0xb3573
movq 0x30(%r13), %rdi
callq 0x120d23
leaq 0x29da68(%rip), %rsi    # 0x350f8f
movq %rax, %rdi
callq 0x17a40
testl %eax, %eax
je 0xb3583
movq 0x30(%r13), %rdi
callq 0x120d23
leaq 0x2a6ae7(%rip), %rsi    # 0x35a02a
movq %rax, %rdi
callq 0x17a40
testl %eax, %eax
je 0xb35b1
movq 0x30(%r13), %rdi
callq 0x120d23
leaq 0x29b1d4(%rip), %rsi    # 0x34e733
movq %rax, %rdi
callq 0x17a40
testl %eax, %eax
je 0xb35e8
xorl %r12d, %r12d
jmp 0xb361b
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %r12d, %r12d
xorl %r13d, %r13d
jmp 0xb363b
movl 0xc(%rsp), %eax
movl 0x8(%rsp), %edi
subl %eax, %edi
cltq
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax,8), %rsi
callq 0x14d00b
movq %rax, %r12
cmpb $0x1, 0x3c(%r13)
jne 0xb361b
movq %r12, %rdi
callq 0x14ce62
jmp 0xb361b
movl 0xc(%rsp), %eax
cmpl %eax, 0x8(%rsp)
jne 0xb35f6
xorl %edi, %edi
jmp 0xb3601
movb $0x1, %r12b
xorl %r14d, %r14d
jmp 0xb35e1
leaq 0x2a6b58(%rip), %rsi    # 0x35a126
xorl %r14d, %r14d
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x1019cf
movb $0x1, %r12b
xorl %ebp, %ebp
jmp 0xb34de
movl 0xc(%rsp), %eax
cmpl %eax, 0x8(%rsp)
jne 0xb3608
xorl %edi, %edi
jmp 0xb3613
cltq
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x12c509
jmp 0xb3618
cltq
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x154286
movq %rax, %r12
testq %r12, %r12
je 0xb367e
movq %r12, %rdi
movq %rbp, %rsi
callq 0x14b480
movq %rax, %r13
movq %rax, %rdi
movq %rbx, %rsi
callq 0x16adca
movl %eax, %ebx
movq %r13, %rdi
callq 0x16ac6e
movq %r12, %rdi
callq 0x16ac6e
movq %rbp, %rdi
callq 0x147952
movq %r15, %rdi
callq 0x12b5bf
movq %r14, %rdi
callq 0x173fb0
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1cc8c
callq 0x1cc1a
callq 0x1cc53
nop