// File: /workspace/github_c_makefile_star2_O2/mmayer[P]pcal/src/pcal.c
// Function: display_usage
void display_usage (FILE *fp,       /* destination of usage message */
                    int fullmsg)    /* print complete message? */
{
   FLAG_MSG *pflag;
   PARAM_MSG *ppar;
   char buf[30], *p, flag, *meta;
   int nchars, first, i, indent, n;
   
   sprintf(buf, "%s: %s", W_USAGE, progname);
   nchars = indent = strlen(buf);
   first = TRUE;
   meta = p = NULL;
   fprintf(fp, "\n%s", buf);
   
   /* convert various values to strings for printing (cf. pcallang.h) */
   sprintf(Xtval, "%d", 0);
   sprintf(Ytval, "%d", 0);
   sprintf(Xsval, "%.3f", 1.0);
   sprintf(Ysval, "%.3f", 1.0);
   sprintf(gen_diags_val, "%d", 0);
   
   sprintf(Ncopy, "%d", NCOPY);
   
   /* Display the basic command-line syntax message (by group of flags)... */
   
   for (pflag = flag_msg; (flag = pflag->flag) != '\0'; pflag++) {
      if (flag == '\n') {   /* end of group? */
         if (p) *p = '\0';
         if (meta) {   /* append metavariable name */
            strcat(buf, " ");
            strcat(buf, meta);
         }
         strcat(buf, "]");
         n = strlen(buf);
         if (nchars + n > SCREENWIDTH) {   /* does it fit on line? */
            fprintf(fp, "\n");   /* no - start new one */
            for (nchars = 0; nchars < indent; nchars++) fprintf(fp, " ");
         }
         fprintf(fp, "%s", buf);
         nchars += n;
         first = TRUE;
      }
      else if (flag != ' ') {   /* accumulate flags for group */
         if (first) {
            sprintf(buf, " [");
            p = buf + strlen(buf);
         }
         else *p++ = '|';

         *p++ = '-';
         *p++ = flag;
         meta = pflag->meta;   /* save metavariable name */
         first = FALSE;
      }
   }

   /* After displaying all the possible flag options, we now loop to append a
      display of the various possible formats of the numeric parameter
      descriptions (starting year, starting month, and number of months, in
      various permutations)... */

   for (i = 0; i < PARAM_MSGS; i++) {
      sprintf(buf, " [%s]%s", param_msg[i].desc, i < PARAM_MSGS - 1 ? " |" : "");
      n = strlen(buf);
      if (nchars + n > SCREENWIDTH) {   /* does it fit on line? */
         fprintf(fp, "\n");   /* no - start new one */
         for (nchars = 0; nchars < indent; nchars++) fprintf(fp, " ");
      }
      fprintf(fp, "%s", buf);
      nchars += n;
   }
   
   fprintf(fp, "\n\n");
   if (! fullmsg) {
      fprintf(fp, USAGE_MSG, progname, F_HELP);
      return;
   }
   
   /* Display detailed descriptions of each of the possible command-line
      flags... */

   for (pflag = flag_msg; (flag = pflag->flag) != '\0'; pflag++) {
      if (flag == '\n') {   /* newline?  print and quit */
         fprintf(fp, "\n");
         continue;
      }
      p = buf;   /* copy flag and metavariable to buffer */
      if (flag != ' ') *p++ = '-';
      
      *p++ = flag;
      
      *p = '\0';
      if (pflag->meta) sprintf(p, " %s", pflag->meta);

      fprintf(fp, "\t%-20.20s", buf);
      if (pflag->text) fprintf(fp, "%s", pflag->text);

      /* print default value if specified */
      if (pflag->def) {
         fprintf(fp, " (%s: %s)", W_DEFAULT, pflag->def[0] ? pflag->def : "\"\"" );
      }
      fprintf(fp, "\n");

      /* special case - print color messages after F_OUTLINE_GRAY */
      if (flag == F_OUTLINE_GRAY) {
         fprintf(fp, "\t%20s  (%s: %s)\n", "", W_DEFAULT, color_msg());
      }

   }
   
   /* now print the information about the numeric parameters */
   
   for (ppar = param_msg; ppar->desc; ppar++) {
      fprintf(fp, "\t%-16.16s%s\n", ppar->desc, ppar->text);
   }

   fprintf(fp, "\n");

   return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, 0x1c(%rsp)
movq %rdi, %rbx
leaq 0xf682(%rip), %rsi      # 0x14dea
leaq 0xf682(%rip), %rdx      # 0x14df1
leaq 0x270aa(%rip), %rcx     # 0x2c820
xorl %r12d, %r12d
leaq 0x20(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x52e0
movq %r14, %rdi
callq 0x5100
movq %rax, %r15
leaq 0xf65d(%rip), %rsi      # 0x14df7
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x5200
leaq 0x26f2e(%rip), %rdi     # 0x2c6dc
leaq 0x18ae5(%rip), %r13     # 0x1e29a
movq %r13, %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x52e0
leaq 0x26f20(%rip), %rdi     # 0x2c6e8
movq %r13, %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x52e0
leaq 0x26f19(%rip), %rdi     # 0x2c6f4
leaq 0xf619(%rip), %r14      # 0x14dfb
movsd 0xe81e(%rip), %xmm0     # 0x14008
movq %r14, %rsi
movb $0x1, %al
callq 0x52e0
leaq 0x26f05(%rip), %rdi     # 0x2c700
movq %r14, %rsi
movsd 0xe802(%rip), %xmm0     # 0x14008
movb $0x1, %al
callq 0x52e0
leaq 0x26ebc(%rip), %rdi     # 0x2c6d0
movq %r13, %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x52e0
leaq 0x26ee5(%rip), %rdi     # 0x2c70c
pushq $0x1
popq %r14
movq %r13, %rsi
movl %r14d, %edx
xorl %eax, %eax
callq 0x52e0
testl %r15d, %r15d
movl $0x0, %eax
movq %r15, 0x10(%rsp)
cmovgl %r15d, %eax
movl %eax, 0xc(%rsp)
leaq 0x2351c(%rip), %r13     # 0x28d70
pushq $0x20
popq %rbp
xorl %r15d, %r15d
movl %r14d, %eax
movzbl (%r13), %r14d
cmpl $0xa, %r14d
je 0x58a6
cmpl $0x20, %r14d
je 0x5962
testl %r14d, %r14d
je 0x596b
testl %eax, %eax
je 0x5946
movb $0x0, 0x22(%rsp)
movw $0x5b20, 0x20(%rsp)     # imm = 0x5B20
leaq 0x20(%rsp), %rdi
callq 0x5100
leaq (%rsp,%rax), %r12
addq $0x20, %r12
jmp 0x594e
testq %r12, %r12
leaq 0x20(%rsp), %r14
je 0x58b5
movb $0x0, (%r12)
testq %r15, %r15
je 0x58d4
movq %r14, %rdi
callq 0x5100
movw $0x20, 0x20(%rsp,%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0x52d0
movq %r15, 0x40(%rsp)
movq %r14, %rdi
callq 0x5100
movw $0x5d, 0x20(%rsp,%rax)
movq %r14, %rdi
callq 0x5100
movq %rax, %r14
movq 0x10(%rsp), %rax
addl %r14d, %eax
cmpl $0x4f, %eax
jl 0x592a
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x51b0
movl 0xc(%rsp), %r15d
subl $0x1, %r15d
jb 0x5922
movl %ebp, %edi
movq %rbx, %rsi
callq 0x51b0
jmp 0x5910
addl 0xc(%rsp), %r14d
movl %r14d, %eax
movq %rax, 0x10(%rsp)
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x5160
pushq $0x1
popq %rax
movq 0x40(%rsp), %r15
jmp 0x5962
movb $0x7c, (%r12)
incq %r12
movb $0x2d, (%r12)
movb %r14b, 0x1(%r12)
addq $0x2, %r12
movq 0x8(%r13), %r15
xorl %eax, %eax
addq $0x20, %r13
jmp 0x585d
leaq 0x23fde(%rip), %rbp     # 0x29950
pushq $0x20
popq %r13
xorl %r14d, %r14d
movq 0x10(%rsp), %r15
cmpq $0x3, %r14
je 0x5a13
movq %r14, %rax
shlq $0x4, %rax
movq (%rax,%rbp), %rdx
cmpq $0x2, %r14
leaq 0xf46a(%rip), %rcx      # 0x14e08
leaq 0x18db8(%rip), %rax     # 0x1e75d
cmoveq %rax, %rcx
leaq 0x20(%rsp), %r12
movq %r12, %rdi
leaq 0xf448(%rip), %rsi      # 0x14e00
xorl %eax, %eax
callq 0x52e0
movq %r12, %rdi
callq 0x5100
movq %rax, %r12
addl %r12d, %r15d
cmpl $0x4f, %r15d
jl 0x59fe
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x51b0
movl 0xc(%rsp), %r15d
subl $0x1, %r15d
jb 0x59f6
movl %r13d, %edi
movq %rbx, %rsi
callq 0x51b0
jmp 0x59e3
addl 0xc(%rsp), %r12d
movl %r12d, %r15d
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x5160
incq %r14
jmp 0x597e
leaq 0x1b1f5(%rip), %rdi     # 0x20c0f
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x5300
cmpl $0x0, 0x1c(%rsp)
je 0x5b69
leaq 0x2334e(%rip), %r15     # 0x28d88
pushq $0xa
popq %r13
leaq 0x20(%rsp), %r14
movzbl -0x18(%r15), %r12d
cmpl $0xa, %r12d
je 0x5b21
movq %r14, %rdi
cmpl $0x20, %r12d
je 0x5a6e
testl %r12d, %r12d
je 0x5b35
movb $0x2d, 0x20(%rsp)
leaq 0x21(%rsp), %rdi
movb %r12b, (%rdi)
movb $0x0, 0x1(%rdi)
movq -0x10(%r15), %rdx
testq %rdx, %rdx
je 0x5a8f
incq %rdi
leaq 0xf365(%rip), %rsi      # 0x14ded
xorl %eax, %eax
callq 0x52e0
movq %rbx, %rdi
leaq 0xf3bb(%rip), %rsi      # 0x14e54
movq %r14, %rdx
xorl %eax, %eax
callq 0x5200
movq -0x8(%r15), %rdi
testq %rdi, %rdi
je 0x5ab4
movq %rbx, %rsi
callq 0x5160
movq (%r15), %rax
testq %rax, %rax
je 0x5ae3
cmpb $0x0, (%rax)
leaq 0xf3aa(%rip), %rcx      # 0x14e70
je 0x5acb
movq %rax, %rcx
movq %rbx, %rdi
leaq 0xf389(%rip), %rsi      # 0x14e5e
leaq 0xf38c(%rip), %rdx      # 0x14e68
xorl %eax, %eax
callq 0x5200
movl %r13d, %edi
movq %rbx, %rsi
callq 0x51b0
cmpb $0x47, %r12b
jne 0x5b2c
callq 0x5b93
movq %rbx, %rdi
leaq 0xf370(%rip), %rsi      # 0x14e73
leaq 0x18c53(%rip), %rdx     # 0x1e75d
leaq 0xf357(%rip), %rcx      # 0x14e68
leaq 0x27978(%rip), %r8      # 0x2d490
xorl %eax, %eax
callq 0x5200
jmp 0x5b2c
movl %r13d, %edi
movq %rbx, %rsi
callq 0x51b0
addq $0x20, %r15
jmp 0x5a43
leaq 0xf348(%rip), %r14      # 0x14e84
movq (%rbp), %rdx
testq %rdx, %rdx
je 0x5b5c
movq 0x8(%rbp), %rcx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x5200
addq $0x10, %rbp
jmp 0x5b3c
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x51b0
jmp 0x5b84
leaq 0xf29b(%rip), %rsi      # 0x14e0b
leaq 0x26ca9(%rip), %rdx     # 0x2c820
pushq $0x68
popq %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x5200
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq