// File: /workspace/github_c_makefile_star2_O3/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 0xb10ee
movq %rbx, %rdi
callq 0xfcc32
testb %al, %al
jne 0xb1325
movl %ebp, 0xc(%rsp)
testq %r15, %r15
je 0xb1320
movq (%r15), %rdi
callq 0x11b0a1
leaq 0x2c40f5(%rip), %rsi    # 0x3751ff
movq %rax, %rdi
callq 0x17a40
movb $0x1, %r14b
testl %eax, %eax
movq %r13, 0x10(%rsp)
je 0xb1128
movq $0x0, (%rsp)
jmp 0xb117d
movq 0x8(%r15), %rdi
callq 0x11b0a1
movq %rax, %rdi
callq 0xff28c
testb %al, %al
je 0xb115c
movb 0x3d(%r15), %bpl
movq 0x8(%r15), %rdi
callq 0x11b0a1
cmpb $0x1, %bpl
jne 0xb126d
movq %rax, %rdi
callq 0x11fc3f
movq 0x8(%r15), %rdi
callq 0x11b0a1
movq %rax, %rdi
movq %rbx, %rsi
callq 0x16c0b4
movq %rax, (%rsp)
testq %rax, %rax
je 0xb1260
xorl %ebp, %ebp
callq 0x1245a8
movq %rax, %r13
testq %rax, %rax
setne %al
orb %bpl, %al
andb %r14b, %al
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpb $0x1, %al
jne 0xb1225
movq %r13, %rdi
movq (%rsp), %rsi
movq %rbx, %rdx
callq 0x125824
testq %rax, %rax
je 0xb1225
movq %rax, %rbp
movq 0x30(%r15), %rdi
callq 0x11b0a1
leaq 0x296dc7(%rip), %rsi    # 0x347f8f
movq %rax, %rdi
callq 0x17a40
testl %eax, %eax
je 0xb1232
movq 0x30(%r15), %rdi
callq 0x11b0a1
leaq 0x29fe0b(%rip), %rsi    # 0x350fef
movq %rax, %rdi
callq 0x17a40
testl %eax, %eax
movl 0xc(%rsp), %r14d
je 0xb1294
movq 0x30(%r15), %rdi
callq 0x11b0a1
leaq 0x29452a(%rip), %rsi    # 0x345733
movq %rax, %rdi
callq 0x17a40
testl %eax, %eax
jne 0xb132a
cmpl %r14d, %r12d
jne 0xb129d
xorl %edi, %edi
jmp 0xb12a9
xorl %ebp, %ebp
xorl %r12d, %r12d
xorl %r15d, %r15d
jmp 0xb12e5
movl 0xc(%rsp), %eax
subl %eax, %r12d
cltq
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax,8), %rsi
movl %r12d, %edi
callq 0x145cdf
movq %rax, %r12
cmpb $0x1, 0x3c(%r15)
jne 0xb12c4
movq %r12, %rdi
callq 0x145b36
jmp 0xb12c4
movb $0x1, %bpl
movq $0x0, (%rsp)
jmp 0xb128c
leaq 0x29fe77(%rip), %rsi    # 0x3510eb
movq $0x0, (%rsp)
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xfcb67
movb $0x1, %bpl
xorl %r14d, %r14d
jmp 0xb117f
cmpl %r14d, %r12d
jne 0xb12b0
xorl %edi, %edi
jmp 0xb12bc
movslq %r14d, %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x14cc96
jmp 0xb12c1
movslq %r14d, %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x1266de
movq %rax, %r12
testq %r12, %r12
je 0xb132a
movq %r12, %rdi
movq %rbp, %rsi
callq 0x14422c
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
callq 0x162f5d
movl %eax, %r14d
movq %r15, %rdi
callq 0x162dee
movq %r12, %rdi
callq 0x162dee
movq %rbp, %rdi
callq 0x14070e
movq %r13, %rdi
callq 0x12579f
movq (%rsp), %rdi
callq 0x16bda0
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1cb57
callq 0x1cae5
callq 0x1cb1e
nop