// File: /workspace/github_c_makefile_star2_O0/mmayer[P]pcal/src/readfile.c
// Function: parse_ord
int parse_ord (int ord, int val, char **pword)
{
   int wkd, mon, mm, dd, len, doit, (*pfcn) (int, int, int);
   int val_first, val_last, val_incr, mon_first, mon_last;
   date_str *pdate, date;
   
   if ((wkd = get_weekday(*pword, TRUE)) == NOT_WEEKDAY ||   /* weekday */
       *++pword == NULL ||   /* any word */
       (mon = get_month(*++pword, FALSE, TRUE)) == NOT_MONTH) {   /* month */
      return PARSE_INVLINE;
   }
   
   /* set up loop boundaries for month loop */
   mon_first = mon == ALL_MONTHS || mon == ENTIRE_YEAR ? JAN : mon;
   mon_last  = mon == ALL_MONTHS || mon == ENTIRE_YEAR ? DEC : mon;
   
   pdate = candidate_dates;   /* start of 'candidate_dates[]' array */

   /* special case of "all|odd|even <wildcard> in <month>|all|year" */

   if ((ord == ORD_ALL || ord == ORD_EVEN || ord == ORD_ODD) && IS_WILD(wkd)) {
      pfcn = pdatefcn[wkd - WILD_FIRST];
      doit = ord != ORD_EVEN;
      for (mm = mon_first; mm <= mon_last; mm++) {
         len = LENGTH_OF(mm, curr_year);
         if (mon != ENTIRE_YEAR) doit = ord != ORD_EVEN;
         for (dd = 1; dd <= len; dd++) {
            if ((*pfcn)(mm, dd, curr_year)) {
               if (doit) ADD_DATE(mm, dd, curr_year);
               if (ord != ORD_ALL) doit = ! doit;
            }
         }
      }
   }

   /* special case of "odd|even <weekday> in year" */

   else if ((ord == ORD_EVEN || ord == ORD_ODD) && mon == ENTIRE_YEAR) {
      date.mm = JAN;   /* starting date */
      date.dd = calc_day(ord == ORD_EVEN ? 2 : 1, wkd, JAN);
      date.yy = curr_year;
      do {   /* alternates throughout year */
         ADD_DATE(date.mm, date.dd, date.yy);
         date.dd += 14;
         normalize(&date);
      } while (date.yy == curr_year);
   }
   
   /* special case of "<ordinal>|last <weekday>|<wildcard> in year" */
   
   else if ((ord == ORD_NEGNUM || ord == ORD_POSNUM) && mon == ENTIRE_YEAR) {
      if (calc_year_day(val, wkd, &date)) ADD_DATE(date.mm, date.dd, date.yy);
   }
   
   /* all other combinations of ordinal and day */
   
   else {
      /* set up loop boundaries for "wildcard" ordinals */
      
      val_first = ord == ORD_ALL || ord == ORD_ODD ? 1 : ord == ORD_EVEN ? 2 : val;
      val_last  = ord == ORD_ALL || ord == ORD_ODD ? 5 : ord == ORD_EVEN ? 4 : val;
      val_incr  = ord == ORD_ODD || ord == ORD_EVEN ? 2 : 1;
      
      for (mm = mon_first; mm <= mon_last; mm++) {
         for (val = val_first; val <= val_last; val += val_incr) {
            if ((dd = calc_day(val, wkd, mm)) != 0) ADD_DATE(mm, dd, curr_year);
         }
      }
   }
   
   TERM_DATES;   /* terminate array with null entry */
   return PARSE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movl $0x1, %esi
callq 0xfb80
movl %eax, -0x1c(%rbp)
cmpl $-0x1, %eax
je 0x1152b
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x18(%rbp)
cmpq $0x0, 0x8(%rax)
je 0x1152b
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x18(%rbp)
movq 0x8(%rax), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0xf970
movl %eax, -0x20(%rbp)
cmpl $-0x1, %eax
jne 0x11537
movl $0x2, -0x4(%rbp)
jmp 0x11a71
cmpl $0x0, -0x20(%rbp)
je 0x11543
cmpl $0xd, -0x20(%rbp)
jne 0x1154d
movl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x11553
movl -0x20(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x11565
cmpl $0xd, -0x20(%rbp)
jne 0x1156f
movl $0xc, %eax
movl %eax, -0x6c(%rbp)
jmp 0x11575
movl -0x20(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x4c(%rbp)
leaq 0x2297e(%rip), %rax     # 0x33f00
movq %rax, -0x58(%rbp)
cmpl $0x4, -0x8(%rbp)
je 0x1159c
cmpl $0x3, -0x8(%rbp)
je 0x1159c
cmpl $0x2, -0x8(%rbp)
jne 0x1176d
cmpl $0x7, -0x1c(%rbp)
jl 0x1176d
cmpl $0x11, -0x1c(%rbp)
jg 0x1176d
movl -0x1c(%rbp), %eax
subl $0x7, %eax
movslq %eax, %rcx
leaq 0x1cc00(%rip), %rax     # 0x2e1c0
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
cmpl $0x3, -0x8(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x30(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jg 0x11768
movl -0x24(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x1cb97(%rip), %rax     # 0x2e190
movsbl (%rax,%rcx), %eax
movl %eax, -0x74(%rbp)
xorl %eax, %eax
cmpl $0x2, -0x24(%rbp)
movb %al, -0x6d(%rbp)
jne 0x11667
leaq 0x2204e(%rip), %rax     # 0x33660
movl (%rax), %eax
movl $0x4, %ecx
cltd
idivl %ecx
xorl %eax, %eax
cmpl $0x0, %edx
movb %al, -0x75(%rbp)
jne 0x11661
leaq 0x22033(%rip), %rax     # 0x33660
movl (%rax), %eax
movl $0x64, %ecx
cltd
idivl %ecx
movb $0x1, %al
cmpl $0x0, %edx
movb %al, -0x76(%rbp)
jne 0x1165b
leaq 0x22018(%rip), %rax     # 0x33660
movl (%rax), %eax
movl $0x190, %ecx            # imm = 0x190
cltd
idivl %ecx
cmpl $0x0, %edx
sete %al
movb %al, -0x76(%rbp)
movb -0x76(%rbp), %al
movb %al, -0x75(%rbp)
movb -0x75(%rbp), %al
movb %al, -0x6d(%rbp)
movl -0x74(%rbp), %eax
movb -0x6d(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
movl %eax, -0x2c(%rbp)
cmpl $0xd, -0x20(%rbp)
je 0x1168d
cmpl $0x3, -0x8(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x30(%rbp)
movl $0x1, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jg 0x11758
movq -0x38(%rbp), %rax
movl -0x24(%rbp), %edi
movl -0x28(%rbp), %esi
leaq 0x21faf(%rip), %rcx     # 0x33660
movl (%rcx), %edx
callq *%rax
cmpl $0x0, %eax
je 0x11748
cmpl $0x0, -0x30(%rbp)
je 0x1172f
jmp 0x116c6
leaq 0x2108f(%rip), %rax     # 0x3275c
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x116ff
movq 0x1c91a(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
leaq 0x21f78(%rip), %rax     # 0x33660
movl (%rax), %edx
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %r8d
leaq 0x1388f(%rip), %rsi     # 0x24f87
movb $0x0, %al
callq 0x51b0
movl -0x24(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, (%rax)
movl -0x28(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, 0x4(%rax)
leaq 0x21f47(%rip), %rax     # 0x33660
movl (%rax), %ecx
movq -0x58(%rbp), %rax
movq %rax, %rdx
addq $0xc, %rdx
movq %rdx, -0x58(%rbp)
movl %ecx, 0x8(%rax)
jmp 0x1172f
cmpl $0x4, -0x8(%rbp)
je 0x11746
cmpl $0x0, -0x30(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x30(%rbp)
jmp 0x11748
jmp 0x1174a
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x11694
jmp 0x1175a
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x115dd
jmp 0x11a4a
cmpl $0x3, -0x8(%rbp)
je 0x1177d
cmpl $0x2, -0x8(%rbp)
jne 0x1183f
cmpl $0xd, -0x20(%rbp)
jne 0x1183f
movl $0x1, -0x64(%rbp)
movl -0x8(%rbp), %ecx
movl $0x1, %edi
movl $0x2, %eax
cmpl $0x3, %ecx
cmovel %eax, %edi
movl -0x1c(%rbp), %esi
movl $0x1, %edx
callq 0xbd90
movl %eax, -0x60(%rbp)
leaq 0x21ea8(%rip), %rax     # 0x33660
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
jmp 0x117bf
leaq 0x20f96(%rip), %rax     # 0x3275c
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x117f2
movq 0x1c821(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
movl -0x5c(%rbp), %edx
movl -0x64(%rbp), %ecx
movl -0x60(%rbp), %r8d
leaq 0x1379c(%rip), %rsi     # 0x24f87
movb $0x0, %al
callq 0x51b0
movl -0x64(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, (%rax)
movl -0x60(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x5c(%rbp), %ecx
movq -0x58(%rbp), %rax
movq %rax, %rdx
addq $0xc, %rdx
movq %rdx, -0x58(%rbp)
movl %ecx, 0x8(%rax)
movl -0x60(%rbp), %eax
addl $0xe, %eax
movl %eax, -0x60(%rbp)
leaq -0x64(%rbp), %rdi
callq 0xbb80
movl -0x5c(%rbp), %eax
leaq 0x21e2a(%rip), %rcx     # 0x33660
cmpl (%rcx), %eax
je 0x117bd
jmp 0x11a48
cmpl $-0x1, -0x8(%rbp)
je 0x1184b
cmpl $0x1, -0x8(%rbp)
jne 0x118c9
cmpl $0xd, -0x20(%rbp)
jne 0x118c9
movl -0xc(%rbp), %edi
movl -0x1c(%rbp), %esi
leaq -0x64(%rbp), %rdx
callq 0xc210
cmpl $0x0, %eax
je 0x118c4
jmp 0x11867
leaq 0x20eee(%rip), %rax     # 0x3275c
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x1189a
movq 0x1c779(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
movl -0x5c(%rbp), %edx
movl -0x64(%rbp), %ecx
movl -0x60(%rbp), %r8d
leaq 0x136f4(%rip), %rsi     # 0x24f87
movb $0x0, %al
callq 0x51b0
movl -0x64(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, (%rax)
movl -0x60(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x5c(%rbp), %ecx
movq -0x58(%rbp), %rax
movq %rax, %rdx
addq $0xc, %rdx
movq %rdx, -0x58(%rbp)
movl %ecx, 0x8(%rax)
jmp 0x118c4
jmp 0x11a46
cmpl $0x4, -0x8(%rbp)
je 0x118d5
cmpl $0x2, -0x8(%rbp)
jne 0x118df
movl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x118fb
cmpl $0x3, -0x8(%rbp)
jne 0x118ef
movl $0x2, %eax
movl %eax, -0x80(%rbp)
jmp 0x118f5
movl -0xc(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0x3c(%rbp)
cmpl $0x4, -0x8(%rbp)
je 0x1190d
cmpl $0x2, -0x8(%rbp)
jne 0x1191a
movl $0x5, %eax
movl %eax, -0x84(%rbp)
jmp 0x11942
cmpl $0x3, -0x8(%rbp)
jne 0x1192d
movl $0x4, %eax
movl %eax, -0x88(%rbp)
jmp 0x11936
movl -0xc(%rbp), %eax
movl %eax, -0x88(%rbp)
movl -0x88(%rbp), %eax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %eax
movl %eax, -0x40(%rbp)
movb $0x1, %al
cmpl $0x2, -0x8(%rbp)
movb %al, -0x89(%rbp)
je 0x11966
cmpl $0x3, -0x8(%rbp)
sete %al
movb %al, -0x89(%rbp)
movb -0x89(%rbp), %dl
movl $0x1, %eax
movl $0x2, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x44(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jg 0x11a44
movl -0x3c(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x40(%rbp), %eax
jg 0x11a34
movl -0xc(%rbp), %edi
movl -0x1c(%rbp), %esi
movl -0x24(%rbp), %edx
callq 0xbd90
movl %eax, -0x28(%rbp)
cmpl $0x0, %eax
je 0x11a24
jmp 0x119bb
leaq 0x20d9a(%rip), %rax     # 0x3275c
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x119f4
movq 0x1c625(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
leaq 0x21c83(%rip), %rax     # 0x33660
movl (%rax), %edx
movl -0x24(%rbp), %ecx
movl -0x28(%rbp), %r8d
leaq 0x1359a(%rip), %rsi     # 0x24f87
movb $0x0, %al
callq 0x51b0
movl -0x24(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, (%rax)
movl -0x28(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, 0x4(%rax)
leaq 0x21c52(%rip), %rax     # 0x33660
movl (%rax), %ecx
movq -0x58(%rbp), %rax
movq %rax, %rdx
addq $0xc, %rdx
movq %rdx, -0x58(%rbp)
movl %ecx, 0x8(%rax)
jmp 0x11a24
jmp 0x11a26
movl -0x44(%rbp), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x11997
jmp 0x11a36
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x11985
jmp 0x11a46
jmp 0x11a48
jmp 0x11a4a
movq -0x58(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x58(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x58(%rbp), %rax
movl $0x0, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)