// File: /workspace/github_c_makefile_star2_O1/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, 0x14(%rsp)
movq %rdi, %rbx
leaq 0x101e9(%rip), %rsi     # 0x15dea
leaq 0x101e9(%rip), %rdx     # 0x15df1
leaq 0x26c21(%rip), %rcx     # 0x2c830
xorl %ebp, %ebp
leaq 0x20(%rsp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x52f0
movq %r15, %rdi
callq 0x5100
movq %rax, %r14
leaq 0x101c5(%rip), %rsi     # 0x15df7
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x5210
leaq 0x26aa6(%rip), %rdi     # 0x2c6ec
leaq 0x1962d(%rip), %r12     # 0x1f27a
movq %r12, %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x52f0
leaq 0x26a98(%rip), %rdi     # 0x2c6f8
movq %r12, %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x52f0
leaq 0x26a91(%rip), %rdi     # 0x2c704
leaq 0x10181(%rip), %r13     # 0x15dfb
movsd 0xf386(%rip), %xmm0     # 0x15008
movq %r13, %rsi
movb $0x1, %al
callq 0x52f0
leaq 0x26a7d(%rip), %rdi     # 0x2c710
movq %r13, %rsi
movsd 0xf36a(%rip), %xmm0     # 0x15008
movb $0x1, %al
callq 0x52f0
leaq 0x26a34(%rip), %rdi     # 0x2c6e0
movq %r12, %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x52f0
leaq 0x26a5d(%rip), %rdi     # 0x2c71c
movl $0x1, %r13d
movq %r12, %rsi
movl $0x1, %edx
xorl %eax, %eax
callq 0x52f0
leaq 0x230a5(%rip), %r15     # 0x28d80
movq $0x0, 0x18(%rsp)
movq %r14, 0x8(%rsp)
movzbl (%r15), %r12d
cmpl $0xa, %r12d
je 0x5d32
cmpl $0x20, %r12d
je 0x5df0
testl %r12d, %r12d
je 0x5df9
testl %r13d, %r13d
je 0x5db8
movb $0x0, 0x22(%rsp)
movw $0x5b20, 0x20(%rsp)     # imm = 0x5B20
leaq 0x20(%rsp), %rdi
callq 0x5100
leaq (%rsp,%rax), %rbp
addq $0x20, %rbp
jmp 0x5dbf
testq %rbp, %rbp
leaq 0x20(%rsp), %r12
je 0x5d40
movb $0x0, (%rbp)
movq 0x18(%rsp), %r13
testq %r13, %r13
je 0x5d64
movq %r12, %rdi
callq 0x5100
movw $0x20, 0x20(%rsp,%rax)
movq %r12, %rdi
movq %r13, %rsi
callq 0x52e0
movq %r12, %rdi
callq 0x5100
movw $0x5d, 0x20(%rsp,%rax)
movq %r12, %rdi
callq 0x5100
movq %rax, %r13
addl %r14d, %eax
cmpl $0x4f, %eax
jl 0x5ddc
movl $0xa, %edi
movq %rbx, %rsi
callq 0x51c0
movq 0x8(%rsp), %rax
testl %eax, %eax
jle 0x5dd9
movl %eax, %r14d
movl $0x20, %edi
movq %rbx, %rsi
callq 0x51c0
decl %r14d
jne 0x5d9f
movq 0x8(%rsp), %r14
jmp 0x5ddc
movb $0x7c, (%rbp)
incq %rbp
movb $0x2d, (%rbp)
movb %r12b, 0x1(%rbp)
addq $0x2, %rbp
movq 0x8(%r15), %rax
movq %rax, 0x18(%rsp)
xorl %r13d, %r13d
jmp 0x5df0
xorl %r14d, %r14d
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5160
addl %r13d, %r14d
movl $0x1, %r13d
addq $0x20, %r15
jmp 0x5ce9
leaq 0x10000(%rip), %r12     # 0x15e00
leaq 0x20(%rsp), %r15
xorl %ebp, %ebp
movq %rbp, %rax
shlq $0x4, %rax
leaq 0x23b4b(%rip), %rcx     # 0x29960
movq (%rax,%rcx), %rdx
cmpq $0x2, %rbp
leaq 0xffe4(%rip), %rcx      # 0x15e08
leaq 0x19912(%rip), %rax     # 0x1f73d
cmoveq %rax, %rcx
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x52f0
movq %r15, %rdi
callq 0x5100
movq %rax, %r13
addl %r14d, %eax
cmpl $0x4f, %eax
jl 0x5e84
movl $0xa, %edi
movq %rbx, %rsi
callq 0x51c0
movq 0x8(%rsp), %rax
testl %eax, %eax
jle 0x5e81
movl %eax, %r14d
movl $0x20, %edi
movq %rbx, %rsi
callq 0x51c0
decl %r14d
jne 0x5e68
movq 0x8(%rsp), %r14
jmp 0x5e84
xorl %r14d, %r14d
movq %r15, %rdi
movq %rbx, %rsi
callq 0x5160
addl %r13d, %r14d
incq %rbp
cmpq $0x3, %rbp
jne 0x5e07
leaq 0x1bd49(%rip), %rdi     # 0x21bef
movl $0x2, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x5310
cmpl $0x0, 0x14(%rsp)
je 0x6009
leaq 0x22ece(%rip), %r13     # 0x28d98
leaq 0xff83(%rip), %r14      # 0x15e54
leaq 0xff90(%rip), %rbp      # 0x15e68
movzbl -0x18(%r13), %r12d
cmpl $0xa, %r12d
je 0x5fad
movq %r15, %rdi
cmpl $0x20, %r12d
je 0x5f03
testl %r12d, %r12d
je 0x5fc3
movb $0x2d, 0x20(%rsp)
leaq 0x21(%rsp), %rdi
movb %r12b, (%rdi)
movb $0x0, 0x1(%rdi)
movq -0x10(%r13), %rdx
testq %rdx, %rdx
je 0x5f24
incq %rdi
leaq 0xfed0(%rip), %rsi      # 0x15ded
xorl %eax, %eax
callq 0x52f0
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x5210
movq -0x8(%r13), %rdi
testq %rdi, %rdi
je 0x5f45
movq %rbx, %rsi
callq 0x5160
movq (%r13), %rax
testq %rax, %rax
je 0x5f71
cmpb $0x0, (%rax)
leaq 0xff18(%rip), %rcx      # 0x15e70
je 0x5f5d
movq %rax, %rcx
movq %rbx, %rdi
leaq 0xfef7(%rip), %rsi      # 0x15e5e
movq %rbp, %rdx
xorl %eax, %eax
callq 0x5210
movl $0xa, %edi
movq %rbx, %rsi
callq 0x51c0
cmpb $0x47, %r12b
jne 0x5fba
callq 0x6035
movq %rbx, %rdi
leaq 0xfee0(%rip), %rsi      # 0x15e73
leaq 0x197a3(%rip), %rdx     # 0x1f73d
movq %rbp, %rcx
leaq 0x274fc(%rip), %r8      # 0x2d4a0
xorl %eax, %eax
callq 0x5210
jmp 0x5fba
movl $0xa, %edi
movq %rbx, %rsi
callq 0x51c0
addq $0x20, %r13
jmp 0x5ed8
movq 0x23996(%rip), %rdx     # 0x29960
testq %rdx, %rdx
je 0x5ffa
leaq 0x2399a(%rip), %r15     # 0x29970
leaq 0xfea7(%rip), %r14      # 0x15e84
movq -0x8(%r15), %rcx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x5210
movq (%r15), %rdx
addq $0x10, %r15
testq %rdx, %rdx
jne 0x5fdd
movl $0xa, %edi
movq %rbx, %rsi
callq 0x51c0
jmp 0x6026
leaq 0xfdfb(%rip), %rsi      # 0x15e0b
leaq 0x26819(%rip), %rdx     # 0x2c830
movq %rbx, %rdi
movl $0x68, %ecx
xorl %eax, %eax
callq 0x5210
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq