// File: /workspace/github_c_makefile_star2_O2/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 0xe88e
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
testq %rcx, %rcx
je 0xe263
movq %r12, %rdi
callq 0xc103
testb %al, %al
jne 0xe8ea
cmpb $0x0, (%r15)
je 0xe8bc
movq %r12, 0x18(%rsp)
cmpb $0x0, 0x28(%r14)
jne 0xe286
movb $0x1, 0x28(%r14)
movq %r14, %rdi
callq 0xe936
pushq $0x1
popq %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0xea77
leaq 0xbc8b0(%rip), %rsi     # 0xcab4b
movq %rbx, %rdi
callq 0x13dd3
xorl %r12d, %r12d
pushq $0x3d
popq %rbp
movq %r15, %rdi
callq 0xb260
addq $0x3, %rax
cmpq %rax, %r12
jae 0xe2c9
movq %rbx, %rdi
movl %ebp, %esi
callq 0x140b1
incq %r12
jmp 0xe2a9
pushq $0xa
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x140b1
leaq 0xbc873(%rip), %rsi     # 0xcab50
movq %rbx, %rdi
callq 0x13dd3
leaq 0xbc880(%rip), %rsi     # 0xcab6c
movq %rbx, %rdi
callq 0x13dd3
leaq 0xbc881(%rip), %rsi     # 0xcab7c
movq %rbx, %rdi
callq 0x13dd3
movq %rbx, %rdi
movl %ebp, %esi
callq 0x140b1
leaq 0xbc86e(%rip), %rsi     # 0xcab82
movq %rbx, %rdi
callq 0x13dd3
movq %rbx, %rdi
movl %ebp, %esi
callq 0x140b1
leaq 0xc97c3(%rip), %rdi     # 0xd7af0
movq %rbx, %rsi
callq 0xeae1
xorl %ebp, %ebp
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0xea77
leaq 0xbc85a(%rip), %rsi     # 0xcaba5
movq %rbx, %rdi
callq 0x13dd3
movq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0x13dd3
leaq 0xd2862(%rip), %r12     # 0xe0bc8
movq %rbx, %rdi
movq %r12, %rsi
callq 0x13dd3
leaq 0xbc831(%rip), %rdi     # 0xcaba9
movq %rbx, %rsi
callq 0xeae1
leaq 0xccf32(%rip), %rsi     # 0xdb2b9
movq %rbx, %rdi
callq 0x13dd3
movq %rbx, %rdi
movq %r15, %rsi
callq 0x13dd3
leaq 0xbc811(%rip), %rsi     # 0xcabb2
movq %rbx, %rdi
callq 0x13dd3
movq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0x13dd3
movq %rbx, %rdi
movq %r12, %rsi
callq 0x13dd3
movq 0x18(%r14), %rdi
callq 0x4b988
testq %rax, %rax
je 0xe67c
leaq 0xbc7dc(%rip), %rdi     # 0xcabb5
movq %rbx, %rsi
callq 0xeae1
xorl %r13d, %r13d
callq 0x13d5c
movq %rax, %r12
movq 0x18(%r14), %rdi
callq 0x4b988
cmpq %rax, %r13
jae 0xe672
movq 0x18(%r14), %rdi
movq %r13, %rsi
callq 0x4b48e
movq (%rax), %rbp
cmpb $0x0, 0x4e(%rbp)
jne 0xe66a
movq %rbx, %rdi
leaq 0xdc0f2(%rip), %rsi     # 0xea513
callq 0x13dd3
movq 0x8(%rbp), %rdi
callq 0x143d2
movq %rbx, %rdi
movq %rax, %rsi
callq 0x13dd3
movq %rbx, %rdi
leaq 0xbc76e(%rip), %rsi     # 0xcabb2
callq 0x13dd3
movl (%rbp), %eax
cmpq $0xc, %rax
ja 0xe5ec
leaq 0xbc3e3(%rip), %rcx     # 0xca840
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
leaq 0xbc751(%rip), %rsi     # 0xcabc1
callq 0x13dd3
cmpb $0x0, 0x20(%rbp)
leaq 0xe536b(%rip), %rsi     # 0xf37eb
leaq 0xbc745(%rip), %rax     # 0xcabcc
cmovneq %rax, %rsi
jmp 0xe583
movq %rbx, %rdi
leaq 0xbc748(%rip), %rsi     # 0xcabe2
callq 0x13dd3
movsd 0x20(%rbp), %xmm0
ucomisd 0xbc43c(%rip), %xmm0    # 0xca8e8
jne 0xe4b4
jnp 0xe5dd
movq %r12, %rdi
pushq $0x6
popq %rsi
callq 0x141d7
jmp 0xe5ec
movq %rbx, %rdi
leaq 0xbc714(%rip), %rsi     # 0xcabe2
callq 0x13dd3
movl 0x20(%rbp), %esi
cmpl $-0x1, %esi
je 0xe5dd
movq %r12, %rdi
callq 0x14329
jmp 0xe5ec
movq %rbx, %rdi
leaq 0xbc6da(%rip), %rsi     # 0xcabd0
jmp 0xe570
movq %rbx, %rdi
leaq 0xbc6e0(%rip), %rsi     # 0xcabe2
jmp 0xe5e7
movq %rbx, %rdi
leaq 0xbc6d1(%rip), %rsi     # 0xcabe2
callq 0x13dd3
movq 0x20(%rbp), %rsi
cmpq $-0x1, %rsi
je 0xe5dd
movq %r12, %rdi
callq 0x13ffe
jmp 0xe5ec
movq %rbx, %rdi
leaq 0xbc6b1(%rip), %rsi     # 0xcabec
jmp 0xe570
movq %rbx, %rdi
leaq 0xbc69b(%rip), %rsi     # 0xcabe2
callq 0x13dd3
movl 0x20(%rbp), %esi
movl %esi, %eax
negl %eax
jo 0xe5dd
movq %r12, %rdi
callq 0x14280
jmp 0xe5ec
movq %rbx, %rdi
leaq 0xbc699(%rip), %rsi     # 0xcac09
callq 0x13dd3
movq 0x20(%rbp), %rsi
testq %rsi, %rsi
je 0xe5dd
cmpb $0x0, (%rsi)
je 0xe5dd
movq %r12, %rdi
jmp 0xe5e7
movq %rbx, %rdi
leaq 0xbc667(%rip), %rsi     # 0xcabf9
callq 0x13dd3
cmpq $-0x1, 0x20(%rbp)
je 0xe5dd
movq %r12, %rdi
pushq $0x5b
popq %rsi
callq 0x140b1
movq 0x20(%rbp), %rsi
movq %r12, %rdi
callq 0x13ffe
movq %r12, %rdi
leaq 0xc926a(%rip), %rsi     # 0xd7829
callq 0x13dd3
movq 0x28(%rbp), %rsi
movq %r12, %rdi
callq 0x13ffe
movq %r12, %rdi
pushq $0x5d
popq %rsi
callq 0x140b1
jmp 0xe5ec
movq %r12, %rdi
leaq 0xbc5f1(%rip), %rsi     # 0xcabd8
callq 0x13dd3
movq %rbx, %rdi
leaq 0xbc61e(%rip), %rsi     # 0xcac14
callq 0x13dd3
movq 0x10(%rbp), %rdi
callq 0x143d2
movq %rbx, %rdi
movq %rax, %rsi
callq 0x13dd3
cmpb $0x0, 0x4a(%rbp)
jne 0xe653
movq %r12, %rdi
callq 0x14461
testq %rax, %rax
je 0xe653
movq %rbx, %rdi
leaq 0xbc5ec(%rip), %rsi     # 0xcac18
callq 0x13dd3
movq %r12, %rdi
callq 0x143d2
movq %rbx, %rdi
movq %rax, %rsi
callq 0x13dd3
movq %rbx, %rdi
leaq 0xca199(%rip), %rsi     # 0xd87e7
callq 0x13dd3
movq %rbx, %rdi
leaq 0xd256b(%rip), %rsi     # 0xe0bc8
callq 0x13dd3
movq %r12, %rdi
callq 0x1452f
incq %r13
jmp 0xe3ec
movq %r12, %rdi
callq 0x152db
xorl %ebp, %ebp
cmpq $0x0, 0x30(%r14)
je 0xe7a7
movq 0x11f8ba(%rip), %r13    # 0x12df48
movq (%r13), %rdi
callq 0xb760
pushq $0x1
popq %rdi
callq 0xb980
movl %eax, %ebp
leaq 0xc(%rsp), %rdi
callq 0xb830
cmpl $-0x1, %eax
je 0xe922
movl 0xc(%rsp), %edi
pushq $0x3
popq %rsi
xorl %eax, %eax
callq 0xba20
orl $0x800, %eax            # imm = 0x800
movslq %eax, %rdx
movl 0xc(%rsp), %edi
pushq $0x4
popq %rsi
xorl %eax, %eax
callq 0xba20
movl 0x10(%rsp), %edi
pushq $0x1
popq %rsi
callq 0xb5f0
movl 0x10(%rsp), %edi
callq 0xbcc0
cmpb $0x67, (%r15)
movq 0x18(%rsp), %r12
movl %ebp, 0x14(%rsp)
jne 0xe70e
cmpb $0x74, 0x1(%r15)
jne 0xe70e
cmpb $0x0, 0x2(%r15)
je 0xe866
movq %r12, %rdi
callq 0xc24d
movq %rax, %r12
pushq $0x20
popq %rsi
movq %r15, %rdi
callq 0x4fa5d
leaq (%rax,%r15), %r8
leaq 0xbca5a(%rip), %rdx     # 0xcb189
leaq 0x20(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %r12, %rcx
movq 0x18(%rsp), %r12
xorl %eax, %eax
callq 0xba00
movq 0x38(%r14), %rsi
leaq 0x20(%rsp), %rdi
movq %r12, %rdx
callq *0x30(%r14)
movl %eax, %ebp
movq (%r13), %rdi
callq 0xb760
leaq 0xb(%rsp), %r12
pushq $0x1
popq %r13
movl 0xc(%rsp), %edi
movq %r12, %rsi
movq %r13, %rdx
callq 0xb8d0
testq %rax, %rax
jle 0xe78f
movsbl 0xb(%rsp), %esi
movq %rbx, %rdi
callq 0x140b1
jmp 0xe76c
pushq $0x1
popq %rsi
movl 0x14(%rsp), %r12d
movl %r12d, %edi
callq 0xb5f0
movl %r12d, %edi
callq 0xbcc0
leaq 0xd241b(%rip), %rsi     # 0xe0bc9
movq %rbx, %rdi
callq 0x13dd3
testl %ebp, %ebp
jne 0xe852
cmpb $0x1, 0x29(%r14)
jne 0xe80b
leaq 0xbc45d(%rip), %rdi     # 0xcac29
movq %rbx, %rsi
callq 0xeae1
leaq 0xbc465(%rip), %rsi     # 0xcac40
movq %rbx, %rdi
callq 0x13dd3
pushq $0x20
popq %rsi
movq %r15, %rdi
callq 0x4fa5d
addq %rax, %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x13dd3
leaq 0xd23c4(%rip), %rsi     # 0xe0bc7
movq %rbx, %rdi
callq 0x13dd3
leaq 0xbc466(%rip), %rdi     # 0xcac78
movq %rbx, %rsi
callq 0xeae1
leaq 0xbc466(%rip), %rsi     # 0xcac87
movq %rbx, %rdi
callq 0x13dd3
movq 0x48(%r14), %rax
testq %rax, %rax
leaq 0xbc460(%rip), %rsi     # 0xcac97
cmovneq %rax, %rsi
movq %rbx, %rdi
callq 0x13dd3
leaq 0xcbd62(%rip), %rsi     # 0xda5ac
movq %rbx, %rdi
callq 0x13dd3
movl %ebp, %eax
addq $0x2028, %rsp           # imm = 0x2028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
callq 0xc24d
leaq 0xc9234(%rip), %rdx     # 0xd7aa9
leaq 0x20(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %rax, %rcx
xorl %eax, %eax
callq 0xba00
jmp 0xe748
movq 0x11f723(%rip), %rax    # 0x12dfb8
movq (%rax), %rdi
leaq 0xbb7c7(%rip), %rsi     # 0xca066
leaq 0xc96fd(%rip), %rdx     # 0xd7fa3
leaq 0xbc270(%rip), %rcx     # 0xcab1d
leaq 0xbc052(%rip), %r8      # 0xca906
movl $0x21d, %r9d            # imm = 0x21D
jmp 0xe916
movq 0x11f6f5(%rip), %rax    # 0x12dfb8
movq (%rax), %rdi
leaq 0xbb799(%rip), %rsi     # 0xca066
leaq 0xbc262(%rip), %rdx     # 0xcab36
leaq 0xbc242(%rip), %rcx     # 0xcab1d
leaq 0xbc024(%rip), %r8      # 0xca906
movl $0x21f, %r9d            # imm = 0x21F
jmp 0xe916
movq 0x11f6c7(%rip), %rax    # 0x12dfb8
movq (%rax), %rdi
leaq 0xbb76b(%rip), %rsi     # 0xca066
leaq 0xbbd57(%rip), %rdx     # 0xca659
leaq 0xbc214(%rip), %rcx     # 0xcab1d
leaq 0xbbff6(%rip), %r8      # 0xca906
movl $0x21e, %r9d            # imm = 0x21E
xorl %eax, %eax
callq 0xb8c0
callq 0xb300
leaq 0xbc2fb(%rip), %rdi     # 0xcac24
callq 0xb550
pushq $0x1
popq %rdi
callq 0xb7b0