// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/core/option.c
// Function: gt_option_parser_manpage
int gt_option_parser_manpage(GtOptionParser *op, const char *toolname,
                             GtStr *outstr, GtError *err)
{
  GtUword i;
  GtOption *option;
  GtStr *default_string;
  int had_err = 0;
  gt_assert(op);
  gt_error_check(err);
  gt_assert(strlen(toolname) > 0);

  /* add common options, if necessary */
  if (!op->common_options_added) {
    op->common_options_added = true;
    add_common_options(op);
  }

  /* title and section */
  print_toolname(toolname, outstr, true);
  gt_str_append_cstr(outstr, "(1)\n");
  for (i = 0; i < strlen(toolname) + 3; i++)
    gt_str_append_char(outstr, '=');
  gt_str_append_char(outstr, '\n');
  gt_str_append_cstr(outstr, ":man source:   GenomeTools\n");
  gt_str_append_cstr(outstr, ":man version:  ");
  gt_str_append_cstr(outstr, GT_VERSION);
  gt_str_append_char(outstr, '\n');
  gt_str_append_cstr(outstr, ":man manual:   GenomeTools Manual\n");
  gt_str_append_char(outstr, '\n');

  /* name */
  print_asciidoc_header("NAME", outstr);
  print_toolname(toolname, outstr, false);
  gt_str_append_cstr(outstr, " - ");
  gt_str_append_cstr(outstr, op->one_liner);
  gt_str_append_cstr(outstr, "\n\n");

  /* synopsis */
  print_asciidoc_header("SYNOPSIS", outstr);
  gt_str_append_cstr(outstr, "*");
  gt_str_append_cstr(outstr, toolname);
  gt_str_append_cstr(outstr, "* ");
  gt_str_append_cstr(outstr, op->synopsis);
  gt_str_append_cstr(outstr, "\n\n");

  /* description */
  if (gt_array_size(op->options)) {
    print_asciidoc_header("DESCRIPTION", outstr);
    default_string = gt_str_new();
    for (i = 0; i < gt_array_size(op->options); i++) {
      option = *(GtOption**) gt_array_get(op->options, i);
      /* skip dev options */
      if (option->is_development_option) continue;
      gt_str_append_cstr(outstr, "*-");
      gt_str_append_cstr(outstr, gt_str_get(option->option_str));
      gt_str_append_cstr(outstr, "* ");
      if (option->option_type == OPTION_BOOL) {
        gt_str_append_cstr(outstr, "['yes|no']");
        gt_str_append_cstr(default_string,
                              option->default_value.b ? "yes" : "no");
      }
      else if (option->option_type == OPTION_CHOICE) {
        gt_str_append_cstr(outstr, "['...']");
        if (!option->default_value.s || !strlen(option->default_value.s))
          gt_str_append_cstr(default_string, "undefined");
        else
          gt_str_append_cstr(default_string, option->default_value.s);
      }
      else if (option->option_type == OPTION_DOUBLE) {
        gt_str_append_cstr(outstr, "['value']");
        if (option->default_value.d == GT_UNDEF_DOUBLE)
          gt_str_append_cstr(default_string, "undefined");
        else
          gt_str_append_double(default_string, option->default_value.d, 6);
      }
      else if (option->option_type == OPTION_FILENAME) {
        gt_str_append_cstr(outstr, "['filename']");
        if (!option->default_value.s || !strlen(option->default_value.s))
          gt_str_append_cstr(default_string, "undefined");
        else
          gt_str_append_cstr(default_string, option->default_value.s);
      }
      else if (option->option_type == OPTION_INT) {
        gt_str_append_cstr(outstr, "['value']");
        if (option->default_value.i == GT_UNDEF_INT)
          gt_str_append_cstr(default_string, "undefined");
        else
          gt_str_append_int(default_string, option->default_value.i);
      }
      else if (option->option_type == OPTION_UINT) {
        gt_str_append_cstr(outstr, "['value']");
        if (option->default_value.ui == GT_UNDEF_UINT)
          gt_str_append_cstr(default_string, "undefined");
        else
          gt_str_append_uint(default_string, option->default_value.ui);
      }
      else if (option->option_type == OPTION_LONG) {
        gt_str_append_cstr(outstr, "['value']");
      }
      else if (option->option_type == OPTION_ULONG) {
        gt_str_append_cstr(outstr, "['value']");
        if (option->default_value.ul == GT_UNDEF_UWORD)
          gt_str_append_cstr(default_string, "undefined");
        else
          gt_str_append_uword(default_string, option->default_value.ul);
      }
      else if (option->option_type == OPTION_RANGE) {
        gt_str_append_cstr(outstr, "['start' 'end']");
        if (option->default_value.r.start == GT_UNDEF_UWORD)
          gt_str_append_cstr(default_string, "undefined");
        else {
          gt_str_append_char(default_string, '[');
          gt_str_append_uword(default_string, option->default_value.r.start);
          gt_str_append_cstr(default_string, "..");
          gt_str_append_uword(default_string, option->default_value.r.end);
          gt_str_append_char(default_string, ']');
        }
      }
      else if (option->option_type == OPTION_STRING) {
        gt_str_append_cstr(outstr, "['string']");
        if (!option->default_value.s || !strlen(option->default_value.s))
          gt_str_append_cstr(default_string, "undefined");
        else
          gt_str_append_cstr(default_string, option->default_value.s);
      }
      gt_str_append_cstr(outstr, "::\n");
      gt_str_append_cstr(outstr, gt_str_get(option->description));
      if (!option->hide_default && gt_str_length(default_string) > 0) {
        gt_str_append_cstr(outstr, " (default: ");
        gt_str_append_cstr(outstr, gt_str_get(default_string));
        gt_str_append_cstr(outstr, ")");
      }
      gt_str_append_cstr(outstr, "\n\n");
      gt_str_reset(default_string);
    }
    gt_str_delete(default_string);
  }

  if (op->comment_func) {
    int old_stdout, out_pipe[2];
#ifndef _WIN32
    int rval;
    GtWord flags;
#endif
    char c,
         prognamebuf[BUFSIZ];

    /* Lua docu scripts print to stdout by themselves, so temporarily
       redirect stdout to a pipe. */
#ifndef _WIN32
    fflush(stdout);
    old_stdout = dup(STDOUT_FILENO);
    if ((rval = pipe(out_pipe)) == -1) {
      perror("pipe");
      exit(EXIT_FAILURE);  /* XXX */
    }

    flags = fcntl(out_pipe[0], F_GETFL);
    flags |= O_NONBLOCK;
    (void) fcntl(out_pipe[0], F_SETFL, flags);

    dup2(out_pipe[1], STDOUT_FILENO);
    close(out_pipe[1]);
#else
    /* XXX */
    fprintf(stderr, "pipe() stuff not implemented\n");
    exit(EXIT_FAILURE);
#endif

    if (!strcmp(toolname, "gt"))
      (void) snprintf(prognamebuf, BUFSIZ, "%s", gt_error_get_progname(err));
    else {
      (void) snprintf(prognamebuf, BUFSIZ, "%s %s",
                      gt_error_get_progname(err),
                      toolname + gt_cstr_length_up_to_char(toolname, ' '));
    }
    had_err = op->comment_func(prognamebuf, op->comment_func_data, err);
    fflush(stdout);

    while (read(out_pipe[0], &c, sizeof (char)) > 0)
      gt_str_append_char(outstr, c);

    dup2(old_stdout, STDOUT_FILENO);
    close(old_stdout);
  }

  gt_str_append_cstr(outstr, "\n");
  if (!had_err) {
    if (op->refer_to_manual) {
      print_asciidoc_header("ADDITIONAL INFORMATION", outstr);
      gt_str_append_cstr(outstr, "For detailed information, please refer to "
                                 "the manual of");
      gt_str_append_cstr(outstr, toolname +
                                 gt_cstr_length_up_to_char(toolname, ' '));
      gt_str_append_cstr(outstr, ".\n\n");
    }
    print_asciidoc_header("REPORTING BUGS", outstr);
    gt_str_append_cstr(outstr, "Report bugs to ");
    gt_str_append_cstr(outstr,
                       op->mail_address ? op->mail_address : GT_MAIL_ADDRESS);
    gt_str_append_cstr(outstr, ".\n");
  }
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2028, %rsp           # imm = 0x2028
testq %rdi, %rdi
je 0x3728c
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
testq %rcx, %rcx
je 0x36c2b
movq %r12, %rdi
callq 0x3566a
testb %al, %al
jne 0x37296
cmpb $0x0, (%r15)
je 0x37291
cmpb $0x0, 0x28(%r14)
jne 0x36c49
movb $0x1, 0x28(%r14)
movq %r14, %rdi
callq 0x372a0
movq %r12, 0x18(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x373d3
leaq 0xaaee6(%rip), %rsi     # 0xe1b4b
movq %rbx, %rdi
callq 0x3c067
movq %r15, %rdi
callq 0xb260
cmpq $-0x3, %rax
je 0x36c9f
xorl %r12d, %r12d
movq %rbx, %rdi
movl $0x3d, %esi
callq 0x3c28d
incq %r12
movq %r15, %rdi
callq 0xb260
addq $0x3, %rax
cmpq %rax, %r12
jb 0x36c7e
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3c28d
leaq 0xaae9d(%rip), %rsi     # 0xe1b50
movq %rbx, %rdi
callq 0x3c067
leaq 0xaaeaa(%rip), %rsi     # 0xe1b6c
movq %rbx, %rdi
callq 0x3c067
leaq 0xaaeab(%rip), %rsi     # 0xe1b7c
movq %rbx, %rdi
callq 0x3c067
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3c28d
leaq 0xaae95(%rip), %rsi     # 0xe1b82
movq %rbx, %rdi
callq 0x3c067
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3c28d
leaq 0xb7e87(%rip), %rdi     # 0xeeb90
movq %rbx, %rsi
callq 0x37439
xorl %r13d, %r13d
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x373d3
leaq 0xaae7d(%rip), %rsi     # 0xe1ba5
movq %rbx, %rdi
callq 0x3c067
movq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0x3c067
leaq 0xc0b65(%rip), %r12     # 0xf78a8
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3c067
leaq 0xaae54(%rip), %rdi     # 0xe1ba9
movq %rbx, %rsi
callq 0x37439
leaq 0xbb240(%rip), %rsi     # 0xf1fa4
movq %rbx, %rdi
callq 0x3c067
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3c067
leaq 0xaae34(%rip), %rsi     # 0xe1bb2
movq %rbx, %rdi
callq 0x3c067
movq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0x3c067
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3c067
movq 0x18(%r14), %rdi
callq 0x6ecda
testq %rax, %rax
je 0x3706d
leaq 0xaadff(%rip), %rdi     # 0xe1bb5
movq %rbx, %rsi
callq 0x37439
callq 0x3bfe0
movq %rax, %r13
movq 0x18(%r14), %rdi
callq 0x6ecda
testq %rax, %rax
je 0x37062
xorl %r12d, %r12d
movq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0x6e9fa
movq (%rax), %rbp
cmpb $0x0, 0x4e(%rbp)
jne 0x3704d
movq %rbx, %rdi
leaq 0xca525(%rip), %rsi     # 0x101323
callq 0x3c067
movq 0x8(%rbp), %rdi
callq 0x3c40b
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3c067
movq %rbx, %rdi
leaq 0xaad91(%rip), %rsi     # 0xe1bb2
callq 0x3c067
movl (%rbp), %eax
cmpq $0xc, %rax
ja 0x36fcf
leaq 0xaaa06(%rip), %rcx     # 0xe1840
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
leaq 0xaad74(%rip), %rsi     # 0xe1bc1
callq 0x3c067
cmpb $0x0, 0x20(%rbp)
leaq 0xd38ae(%rip), %rsi     # 0x10a70b
leaq 0xaad68(%rip), %rax     # 0xe1bcc
cmovneq %rax, %rsi
jmp 0x36f62
movq %rbx, %rdi
leaq 0xaad6b(%rip), %rsi     # 0xe1be2
callq 0x3c067
movsd 0x20(%rbp), %xmm0
ucomisd 0xaaa5f(%rip), %xmm0    # 0xe18e8
jne 0x36e91
jnp 0x36fc0
movq %r13, %rdi
movl $0x6, %esi
callq 0x3c324
jmp 0x36fcf
movq %rbx, %rdi
leaq 0xaad35(%rip), %rsi     # 0xe1be2
callq 0x3c067
movl 0x20(%rbp), %esi
cmpl $-0x1, %esi
je 0x36fc0
movq %r13, %rdi
callq 0x3c3be
jmp 0x36fcf
movq %rbx, %rdi
leaq 0xaacfb(%rip), %rsi     # 0xe1bd0
jmp 0x36f4f
movq %rbx, %rdi
leaq 0xaad01(%rip), %rsi     # 0xe1be2
jmp 0x36fca
movq %rbx, %rdi
leaq 0xaacf2(%rip), %rsi     # 0xe1be2
callq 0x3c067
movq 0x20(%rbp), %rsi
cmpq $-0x1, %rsi
je 0x36fc0
movq %r13, %rdi
callq 0x3c1dc
jmp 0x36fcf
movq %rbx, %rdi
leaq 0xaacd2(%rip), %rsi     # 0xe1bec
jmp 0x36f4f
movq %rbx, %rdi
leaq 0xaacbc(%rip), %rsi     # 0xe1be2
callq 0x3c067
movl 0x20(%rbp), %esi
movl %esi, %eax
negl %eax
jo 0x36fc0
movq %r13, %rdi
callq 0x3c371
jmp 0x36fcf
movq %rbx, %rdi
leaq 0xaacba(%rip), %rsi     # 0xe1c09
callq 0x3c067
movq 0x20(%rbp), %rsi
testq %rsi, %rsi
je 0x36fc0
cmpb $0x0, (%rsi)
je 0x36fc0
movq %r13, %rdi
jmp 0x36fca
movq %rbx, %rdi
leaq 0xaac88(%rip), %rsi     # 0xe1bf9
callq 0x3c067
cmpq $-0x1, 0x20(%rbp)
je 0x36fc0
movq %r13, %rdi
movl $0x5b, %esi
callq 0x3c28d
movq 0x20(%rbp), %rsi
movq %r13, %rdi
callq 0x3c1dc
movq %r13, %rdi
leaq 0xb7929(%rip), %rsi     # 0xee8c9
callq 0x3c067
movq 0x28(%rbp), %rsi
movq %r13, %rdi
callq 0x3c1dc
movq %r13, %rdi
movl $0x5d, %esi
callq 0x3c28d
jmp 0x36fcf
movq %r13, %rdi
leaq 0xaac0e(%rip), %rsi     # 0xe1bd8
callq 0x3c067
movq %rbx, %rdi
leaq 0xaac3b(%rip), %rsi     # 0xe1c14
callq 0x3c067
movq 0x10(%rbp), %rdi
callq 0x3c40b
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3c067
cmpb $0x0, 0x4a(%rbp)
jne 0x37036
movq %r13, %rdi
callq 0x3c434
testq %rax, %rax
je 0x37036
movq %rbx, %rdi
leaq 0xaac09(%rip), %rsi     # 0xe1c18
callq 0x3c067
movq %r13, %rdi
callq 0x3c40b
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3c067
movq %rbx, %rdi
leaq 0xb8859(%rip), %rsi     # 0xef88a
callq 0x3c067
movq %rbx, %rdi
leaq 0xc0868(%rip), %rsi     # 0xf78a8
callq 0x3c067
movq %r13, %rdi
callq 0x3c49c
incq %r12
movq 0x18(%r14), %rdi
callq 0x6ecda
cmpq %rax, %r12
jb 0x36ddb
movq %r13, %rdi
callq 0x3d1eb
xorl %r13d, %r13d
cmpq $0x0, 0x30(%r14)
je 0x371c9
movq 0x119ed9(%rip), %rax    # 0x150f58
movq (%rax), %rdi
callq 0xb760
movl $0x1, %edi
callq 0xb990
movl %eax, %ebp
leaq 0x10(%rsp), %rdi
callq 0xb840
cmpl $-0x1, %eax
je 0x3729b
movl 0x10(%rsp), %edi
movl $0x3, %esi
xorl %eax, %eax
callq 0xba30
orl $0x800, %eax            # imm = 0x800
movslq %eax, %rdx
movl 0x10(%rsp), %edi
movl $0x4, %esi
xorl %eax, %eax
callq 0xba30
movl 0x14(%rsp), %edi
movl $0x1, %esi
callq 0xb5f0
movl 0x14(%rsp), %edi
callq 0xbcd0
leaq 0xc9f9b(%rip), %rsi     # 0x101087
movq %r15, %rdi
callq 0xb890
movl %eax, %r13d
movq 0x18(%rsp), %rdi
callq 0x356f2
movq %rax, %r12
testl %r13d, %r13d
je 0x37137
movq %r15, %rdi
movl $0x20, %esi
callq 0x723d8
leaq (%rax,%r15), %r8
leaq 0xab068(%rip), %rdx     # 0xe2189
leaq 0x20(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %r12, %rcx
xorl %eax, %eax
callq 0xba10
jmp 0x37152
leaq 0xb7a0b(%rip), %rdx     # 0xeeb49
leaq 0x20(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %r12, %rcx
xorl %eax, %eax
callq 0xba10
movq 0x38(%r14), %rsi
leaq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rdx
callq *0x30(%r14)
movl %eax, %r13d
movq 0x119dea(%rip), %rax    # 0x150f58
movq (%rax), %rdi
callq 0xb760
movl 0x10(%rsp), %edi
leaq 0xf(%rsp), %rsi
movl $0x1, %edx
callq 0xb8e0
testq %rax, %rax
jle 0x371b6
leaq 0xf(%rsp), %r12
movsbl 0xf(%rsp), %esi
movq %rbx, %rdi
callq 0x3c28d
movl 0x10(%rsp), %edi
movl $0x1, %edx
movq %r12, %rsi
callq 0xb8e0
testq %rax, %rax
jg 0x37193
movl %ebp, %edi
movl $0x1, %esi
callq 0xb5f0
movl %ebp, %edi
callq 0xbcd0
leaq 0xc06d9(%rip), %rsi     # 0xf78a9
movq %rbx, %rdi
callq 0x3c067
testl %r13d, %r13d
jne 0x37277
cmpb $0x1, 0x29(%r14)
jne 0x37230
leaq 0xaaa3a(%rip), %rdi     # 0xe1c29
movq %rbx, %rsi
callq 0x37439
leaq 0xaaa42(%rip), %rsi     # 0xe1c40
movq %rbx, %rdi
callq 0x3c067
movq %r15, %rdi
movl $0x20, %esi
callq 0x723d8
addq %rax, %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3c067
leaq 0xc067f(%rip), %rsi     # 0xf78a7
movq %rbx, %rdi
callq 0x3c067
leaq 0xaaa41(%rip), %rdi     # 0xe1c78
movq %rbx, %rsi
callq 0x37439
leaq 0xaaa41(%rip), %rsi     # 0xe1c87
movq %rbx, %rdi
callq 0x3c067
movq 0x48(%r14), %rax
testq %rax, %rax
leaq 0xaaa3b(%rip), %rsi     # 0xe1c97
cmovneq %rax, %rsi
movq %rbx, %rdi
callq 0x3c067
leaq 0xba3dd(%rip), %rsi     # 0xf164c
movq %rbx, %rdi
callq 0x3c067
movl %r13d, %eax
addq $0x2028, %rsp           # imm = 0x2028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0xcbed
callq 0xcbb4
callq 0xcb66
callq 0xcb9f