// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/tool.c
// Function: gt_tool_run
int gt_tool_run(GtTool *tool, int argc, const char **argv, GtError *err)
{
  GtOPrval oprval;
  int parsed_args, had_err = 0;
  gt_error_check(err);
  gt_assert(tool);

  /* create tool arguments object */
  if (tool->tool_arguments_new && !tool->arguments)
    tool->arguments = tool->tool_arguments_new();

  /* create option parser object */
  if (tool->tool_option_parser_new && !tool->op)
    tool->op = tool->tool_option_parser_new(tool->arguments);
  else {
    /* make sure defaults are restored when reusing option parsers */
    gt_option_parser_reset(tool->op);
  }

  /* parse options */
  oprval = gt_option_parser_parse(tool->op, &parsed_args, argc, argv,
                                  gt_versionfunc, err);

  switch (oprval) {
    case GT_OPTION_PARSER_OK:
      break;
    case GT_OPTION_PARSER_ERROR:
      had_err = -1;
      break;
    case GT_OPTION_PARSER_REQUESTS_EXIT:
      if (tool->arguments) {
        tool->tool_arguments_delete(tool->arguments);
        tool->arguments = NULL;
      }
      return 0;
  }

  /* check tool arguments */
  if (!had_err && tool->tool_arguments_check) {
    had_err = tool->tool_arguments_check(argc - parsed_args, tool->arguments,
                                         err);
  }

  /* run tool */
  if (!had_err)
    had_err = tool->tool_runner(argc, argv, parsed_args, tool->arguments, err);

  /* return */
  if (had_err)
    return -1;
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r14
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %rbx
testq %rcx, %rcx
je 0xb05cd
movq %r14, %rdi
callq 0x89eb7
testb %al, %al
jne 0xb06cc
testq %rbx, %rbx
je 0xb06a2
movq (%rbx), %rax
testq %rax, %rax
je 0xb05eb
cmpq $0x0, 0x30(%rbx)
jne 0xb05eb
callq *%rax
movq %rax, 0x30(%rbx)
movq 0x10(%rbx), %rax
movq 0x38(%rbx), %rdi
testq %rax, %rax
setne %cl
testq %rdi, %rdi
sete %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0xb0615
movq 0x30(%rbx), %rdi
callq *%rax
movq %rax, %rdi
movq %rax, 0x38(%rbx)
jmp 0xb061e
callq 0x9815c
movq 0x38(%rbx), %rdi
leaq 0x262b(%rip), %r8       # 0xb2c50
leaq 0xc(%rsp), %rsi
movl %ebp, %edx
movq %r15, %rcx
movq %r14, %r9
callq 0x98cb0
pushq $-0x1
popq %r12
cmpl $0x1, %eax
je 0xb0692
cmpl $0x2, %eax
jne 0xb065b
movq 0x30(%rbx), %rdi
xorl %r12d, %r12d
testq %rdi, %rdi
je 0xb0692
callq *0x8(%rbx)
andq $0x0, 0x30(%rbx)
jmp 0xb0692
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0xb0677
movl %ebp, %edi
subl 0xc(%rsp), %edi
movq 0x30(%rbx), %rsi
movq %r14, %rdx
callq *%rax
testl %eax, %eax
jne 0xb0692
movl 0xc(%rsp), %edx
movq 0x30(%rbx), %rcx
movl %ebp, %edi
movq %r15, %rsi
movq %r14, %r8
callq *0x20(%rbx)
xorl %r12d, %r12d
negl %eax
sbbl %r12d, %r12d
movl %r12d, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x3878bf(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x234960(%rip), %rsi    # 0x2e5013
leaq 0x2622e3(%rip), %rdx    # 0x31299d
leaq 0x2621c9(%rip), %rcx    # 0x31288a
leaq 0x262150(%rip), %r8     # 0x312818
pushq $0x43
jmp 0xb06f4
movq 0x387895(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x234936(%rip), %rsi    # 0x2e5013
leaq 0x234adb(%rip), %rdx    # 0x2e51bf
leaq 0x26219f(%rip), %rcx    # 0x31288a
leaq 0x262126(%rip), %r8     # 0x312818
pushq $0x42
popq %r9
xorl %eax, %eax
callq 0x17a50
callq 0x17390