// File: /workspace/github_c_makefile_star2_O3/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 0x36c43
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
testq %rcx, %rcx
je 0x365b4
movq %r12, %rdi
callq 0x34fea
testb %al, %al
jne 0x36c4d
cmpb $0x0, (%r15)
je 0x36c48
movq %r12, 0x18(%rsp)
cmpb $0x0, 0x28(%r14)
jne 0x365d7
movb $0x1, 0x28(%r14)
movq %r14, %rdi
callq 0x36c57
movq %r15, %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x36d72
leaq 0xab55d(%rip), %rsi     # 0xe1b4b
movq %rbx, %rdi
callq 0x3b7af
movq %r15, %rdi
callq 0xb260
cmpq $-0x3, %rax
je 0x36628
xorl %r12d, %r12d
movq %rbx, %rdi
movl $0x3d, %esi
callq 0x3b9df
incq %r12
movq %r15, %rdi
callq 0xb260
addq $0x3, %rax
cmpq %rax, %r12
jb 0x36607
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3b9df
leaq 0xab514(%rip), %rsi     # 0xe1b50
movq %rbx, %rdi
callq 0x3b7af
leaq 0xab521(%rip), %rsi     # 0xe1b6c
movq %rbx, %rdi
callq 0x3b7af
leaq 0xab522(%rip), %rsi     # 0xe1b7c
movq %rbx, %rdi
callq 0x3b7af
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3b9df
leaq 0xab50c(%rip), %rsi     # 0xe1b82
movq %rbx, %rdi
callq 0x3b7af
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3b9df
leaq 0xb84b6(%rip), %rdi     # 0xeeb48
movq %rbx, %rsi
callq 0x36dd8
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x36d72
leaq 0xab4f7(%rip), %rsi     # 0xe1ba5
movq %rbx, %rdi
callq 0x3b7af
movq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0x3b7af
leaq 0xc1149(%rip), %r12     # 0xf7812
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3b7af
leaq 0xab4ce(%rip), %rdi     # 0xe1ba9
movq %rbx, %rsi
callq 0x36dd8
leaq 0xbb86a(%rip), %rsi     # 0xf1f54
movq %rbx, %rdi
callq 0x3b7af
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3b7af
leaq 0xab4ae(%rip), %rsi     # 0xe1bb2
movq %rbx, %rdi
callq 0x3b7af
movq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0x3b7af
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3b7af
movq 0x18(%r14), %rdi
callq 0x6f310
testq %rax, %rax
je 0x36a03
leaq 0xab479(%rip), %rdi     # 0xe1bb5
movq %rbx, %rsi
callq 0x36dd8
callq 0x3b728
movq %rax, %r13
movq 0x18(%r14), %rdi
callq 0x6f310
testq %rax, %rax
je 0x369fb
xorl %ebp, %ebp
movq 0x18(%r14), %rdi
movq %rbp, %rsi
callq 0x6f037
movq (%rax), %r12
cmpb $0x0, 0x4e(%r12)
jne 0x369e6
movq %rbx, %rdi
leaq 0xcab12(%rip), %rsi     # 0x101297
callq 0x3b7af
movq 0x8(%r12), %rdi
callq 0x3bb5d
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3b7af
movq %rbx, %rdi
leaq 0xab409(%rip), %rsi     # 0xe1bb2
callq 0x3b7af
movl (%r12), %eax
cmpq $0xc, %rax
ja 0x36965
leaq 0xab07d(%rip), %rcx     # 0xe1840
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
leaq 0xab3eb(%rip), %rsi     # 0xe1bc1
callq 0x3b7af
cmpb $0x0, 0x20(%r12)
leaq 0xd3d43(%rip), %rsi     # 0x10a52b
leaq 0xab3dd(%rip), %rax     # 0xe1bcc
cmovneq %rax, %rsi
jmp 0x368f5
movq %rbx, %rdi
leaq 0xab3e0(%rip), %rsi     # 0xe1be2
callq 0x3b7af
movsd 0x20(%r12), %xmm0
ucomisd 0xab0d2(%rip), %xmm0    # 0xe18e8
jne 0x3681e
jnp 0x36956
movq %r13, %rdi
movl $0x6, %esi
callq 0x3ba76
jmp 0x36965
movq %rbx, %rdi
leaq 0xab3a8(%rip), %rsi     # 0xe1be2
callq 0x3b7af
movl 0x20(%r12), %esi
cmpl $-0x1, %esi
je 0x36956
movq %r13, %rdi
callq 0x3bb10
jmp 0x36965
movq %rbx, %rdi
leaq 0xab36c(%rip), %rsi     # 0xe1bd0
jmp 0x368e1
movq %rbx, %rdi
leaq 0xab372(%rip), %rsi     # 0xe1be2
jmp 0x36960
movq %rbx, %rdi
leaq 0xab363(%rip), %rsi     # 0xe1be2
callq 0x3b7af
movq 0x20(%r12), %rsi
cmpq $-0x1, %rsi
je 0x36956
movq %r13, %rdi
callq 0x3b92e
jmp 0x36965
movq %rbx, %rdi
leaq 0xab342(%rip), %rsi     # 0xe1bec
jmp 0x368e1
movq %rbx, %rdi
leaq 0xab32c(%rip), %rsi     # 0xe1be2
callq 0x3b7af
movl 0x20(%r12), %esi
movl %esi, %eax
negl %eax
jo 0x36956
movq %r13, %rdi
callq 0x3bac3
jmp 0x36965
movq %rbx, %rdi
leaq 0xab328(%rip), %rsi     # 0xe1c09
callq 0x3b7af
movq 0x20(%r12), %rsi
testq %rsi, %rsi
je 0x36956
cmpb $0x0, (%rsi)
je 0x36956
movq %r13, %rdi
jmp 0x36960
movq %rbx, %rdi
leaq 0xab2f5(%rip), %rsi     # 0xe1bf9
callq 0x3b7af
cmpq $-0x1, 0x20(%r12)
je 0x36956
movq %r13, %rdi
movl $0x5b, %esi
callq 0x3b9df
movq 0x20(%r12), %rsi
movq %r13, %rdi
callq 0x3b92e
movq %r13, %rdi
leaq 0xb7f4c(%rip), %rsi     # 0xee881
callq 0x3b7af
movq 0x28(%r12), %rsi
movq %r13, %rdi
callq 0x3b92e
movq %r13, %rdi
movl $0x5d, %esi
callq 0x3b9df
jmp 0x36965
movq %r13, %rdi
leaq 0xab278(%rip), %rsi     # 0xe1bd8
callq 0x3b7af
movq %rbx, %rdi
leaq 0xab2a5(%rip), %rsi     # 0xe1c14
callq 0x3b7af
movq 0x10(%r12), %rdi
callq 0x3bb5d
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3b7af
cmpb $0x0, 0x4a(%r12)
jne 0x369cf
movq %r13, %rdi
callq 0x3bb86
testq %rax, %rax
je 0x369cf
movq %rbx, %rdi
leaq 0xab270(%rip), %rsi     # 0xe1c18
callq 0x3b7af
movq %r13, %rdi
callq 0x3bb5d
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3b7af
movq %rbx, %rdi
leaq 0xb8e75(%rip), %rsi     # 0xef83f
callq 0x3b7af
movq %rbx, %rdi
leaq 0xc0e39(%rip), %rsi     # 0xf7812
callq 0x3b7af
movq %r13, %rdi
callq 0x3bbee
incq %rbp
movq 0x18(%r14), %rdi
callq 0x6f310
cmpq %rax, %rbp
jb 0x36760
movq %r13, %rdi
callq 0x3c87b
cmpq $0x0, 0x30(%r14)
je 0x36b5e
movq 0x11a543(%rip), %r13    # 0x150f58
movq (%r13), %rdi
callq 0xb760
movl $0x1, %edi
callq 0xb990
movl %eax, %ebp
leaq 0x10(%rsp), %rdi
callq 0xb840
cmpl $-0x1, %eax
je 0x36c52
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
cmpb $0x67, (%r15)
movq 0x18(%rsp), %r12
jne 0x36a99
cmpb $0x74, 0x1(%r15)
jne 0x36a99
cmpb $0x0, 0x2(%r15)
je 0x36c1b
movq %r12, %rdi
callq 0x35072
movq %rax, %r12
movq %r15, %rdi
movl $0x20, %esi
callq 0x729bc
leaq (%rax,%r15), %r8
leaq 0xab6cd(%rip), %rdx     # 0xe2189
leaq 0x20(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %r12, %rcx
movq 0x18(%rsp), %r12
xorl %eax, %eax
callq 0xba10
movq 0x38(%r14), %rsi
leaq 0x20(%rsp), %rdi
movq %r12, %rdx
callq *0x30(%r14)
movl %eax, %r12d
movq (%r13), %rdi
callq 0xb760
movl 0x10(%rsp), %edi
leaq 0xf(%rsp), %rsi
movl $0x1, %edx
callq 0xb8e0
testq %rax, %rax
jle 0x36b31
leaq 0xf(%rsp), %r13
movsbl 0xf(%rsp), %esi
movq %rbx, %rdi
callq 0x3b9df
movl 0x10(%rsp), %edi
movl $0x1, %edx
movq %r13, %rsi
callq 0xb8e0
testq %rax, %rax
jg 0x36b0e
movl %ebp, %edi
movl $0x1, %esi
callq 0xb5f0
movl %ebp, %edi
callq 0xbcd0
leaq 0xc0cc8(%rip), %rsi     # 0xf7813
movq %rbx, %rdi
callq 0x3b7af
testl %r12d, %r12d
jne 0x36c06
jmp 0x36b6d
leaq 0xc0cae(%rip), %rsi     # 0xf7813
movq %rbx, %rdi
callq 0x3b7af
cmpb $0x1, 0x29(%r14)
jne 0x36bbc
leaq 0xab0ae(%rip), %rdi     # 0xe1c29
movq %rbx, %rsi
callq 0x36dd8
leaq 0xab0b6(%rip), %rsi     # 0xe1c40
movq %rbx, %rdi
callq 0x3b7af
movq %r15, %rdi
movl $0x20, %esi
callq 0x729bc
addq %rax, %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3b7af
leaq 0xc0c5d(%rip), %rsi     # 0xf7811
movq %rbx, %rdi
callq 0x3b7af
leaq 0xab0b5(%rip), %rdi     # 0xe1c78
movq %rbx, %rsi
callq 0x36dd8
leaq 0xab0b5(%rip), %rsi     # 0xe1c87
movq %rbx, %rdi
callq 0x3b7af
movq 0x48(%r14), %rax
testq %rax, %rax
leaq 0xab0af(%rip), %rsi     # 0xe1c97
cmovneq %rax, %rsi
movq %rbx, %rdi
callq 0x3b7af
leaq 0xbaa01(%rip), %rsi     # 0xf15fc
movq %rbx, %rdi
callq 0x3b7af
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x2028, %rsp           # imm = 0x2028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
callq 0x35072
leaq 0xb7ed7(%rip), %rdx     # 0xeeb01
leaq 0x20(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %rax, %rcx
xorl %eax, %eax
callq 0xba10
jmp 0x36ad5
callq 0xcbed
callq 0xcbb4
callq 0xcb66
callq 0xcb9f