// File: /workspace/github_c_makefile_star2_O2/mmayer[P]pcal/src/pcal.c
// Function: check_numargs
int check_numargs (void)
{
   /* Validate non-flag (numeric) parameters */
   
   struct tm *p_tm;   /* for getting current month/year */
   time_t tmp;
   int params_ok = TRUE;   /* return value */
   
   switch (nargs) {
   case 0:   /* no arguments - print current month and/or year */
      time(&tmp);
      p_tm = localtime(&tmp);
      init_month = p_tm->tm_mon + 1;
      /* revised to conform to standard Un*x behavior 01/25/00 */
      /* init_year = century() + (p_tm->tm_year % 100); */
      init_year = TM_YEAR + p_tm->tm_year;
      nmonths = 1;
      break;
      
   case 1:   /* one argument - print entire year */
      init_month = JAN;
      init_year = numargs[0];
      nmonths = 12;
      break;
      
   default:   /* two or three arguments - print one or more months */
      init_month = numargs[0];
      init_year = numargs[1];
      nmonths = nargs > 2 ? numargs[2] : 1;
      break;
   }

   if (nmonths < 1) nmonths = 1;   /* ensure at least one month */
      
   /* check range of month and year */
   
   if (init_month < JAN || init_month > DEC) {
      fprintf(stderr, E_ILL_MONTH, progname, init_month, JAN, DEC);
      params_ok = FALSE;
   }
   
   if (init_year >= 0 && init_year < 100) {   /* treat nn as CCnn */
      init_year += century();
   }
   
   if (init_year < MIN_YR || init_year > MAX_YR) {
      fprintf(stderr, E_ILL_YEAR, progname, init_year, MIN_YR, MAX_YR);
      params_ok = FALSE;
   }
   
   return params_ok;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl 0x25de1(%rip), %edx     # 0x2c910
pushq $0x1
popq %rbx
cmpl $0x1, %edx
je 0x6b6f
testl %edx, %edx
jne 0x6b91
movq %rsp, %r14
movq %r14, %rdi
callq 0x5220
movq %r14, %rdi
callq 0x5070
movq %rax, %rdx
movl 0x10(%rax), %ecx
incl %ecx
movl %ecx, 0x26928(%rip)     # 0x2d484
movl $0x76c, %eax            # imm = 0x76C
addl 0x14(%rdx), %eax
movl %eax, 0x2691e(%rip)     # 0x2d488
pushq $0x1
popq %rsi
jmp 0x6bbb
movl $0x1, 0x2690b(%rip)     # 0x2d484
movl 0x25d95(%rip), %eax     # 0x2c914
movl %eax, 0x26903(%rip)     # 0x2d488
movl $0xc, 0x268fd(%rip)     # 0x2d48c
jmp 0x6bc9
movl 0x25d7d(%rip), %ecx     # 0x2c914
movl %ecx, 0x268e7(%rip)     # 0x2d484
movl 0x25d75(%rip), %eax     # 0x2c918
movl 0x25d73(%rip), %esi     # 0x2c91c
cmpl $0x2, %esi
cmovll %ebx, %esi
movl %eax, 0x268d3(%rip)     # 0x2d488
cmpl $0x3, %edx
cmovll %ebx, %esi
movl %esi, 0x268cb(%rip)     # 0x2d48c
leal -0xd(%rcx), %edx
cmpl $-0xd, %edx
jbe 0x6c28
cmpl $0x63, %eax
ja 0x6bdf
callq 0xa0c8
addl 0x268af(%rip), %eax     # 0x2d488
movl %eax, 0x268a9(%rip)     # 0x2d488
leal -0x2710(%rax), %ecx
cmpl $0xffffdfc8, %ecx       # imm = 0xFFFFDFC8
jbe 0x6bf7
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x213fa(%rip), %rcx     # 0x27ff8
movq (%rcx), %rdi
leaq 0xe43c(%rip), %rsi      # 0x15044
leaq 0x25c11(%rip), %rdx     # 0x2c820
xorl %ebx, %ebx
movl %eax, %ecx
movl $0x6d9, %r8d            # imm = 0x6D9
movl $0x270f, %r9d           # imm = 0x270F
xorl %eax, %eax
callq 0x5200
jmp 0x6bed
movq 0x213c9(%rip), %rax     # 0x27ff8
movq (%rax), %rdi
leaq 0xe3e7(%rip), %rsi      # 0x15020
leaq 0x25be0(%rip), %rdx     # 0x2c820
xorl %ebx, %ebx
pushq $0x1
popq %r8
pushq $0xc
popq %r9
xorl %eax, %eax
callq 0x5200
movl 0x26831(%rip), %eax     # 0x2d488
jmp 0x6bc9