// File: /workspace/github_c_makefile_star2_O1/mmayer[P]pcal/src/readfile.c
// Function: parse_as_non_preproc
int parse_as_non_preproc (char **pword, char *filename)
{
   register char *cp;
   char **ptext;
   int mm, yy;
   int text_type, n, v, match;
   int token;
   
   /*
      Get first field and call date_type() to decode it
   */
   cp = *pword;

   switch (token = date_type(cp, &n, &v)) {

   case DT_YEAR:
      if ((cp = *++pword) != NULL && (yy = atoi(cp)) > 0) {
         if (yy < 100) yy += century();
         curr_year = yy;
         return PARSE_OK;
      }
      if (strcmp(cp, ALL) == 0 || strcmp(cp, "*") == 0) {
         curr_year = ALL_YEARS;
         return PARSE_OK;
      }
      return PARSE_INVLINE;   /* year missing or non-numeric */
      break;

   case DT_OPT:
      if (!get_args(pword, P_OPT, filename, FALSE)) {
         display_usage(stderr, FALSE);
         exit(EXIT_FAILURE);
      }
      return PARSE_OK;
      break;
      
   case DT_INPUT_LANGUAGE:
      pword++;  /* point to 2-letter 'language code' string */
      if (*pword) {
         int i;
         for (i = 0; i < NUM_LANGUAGES; i++) {
            if (ci_strncmp(lang_id[i], *pword, MIN_LANG_LEN) == 0) {
               input_language = i;
               return PARSE_OK;
            }
         }
      }
      return PARSE_INVLINE;
      break;

   case DT_NOTE:
      /* look for optional "/<n>" following keyword */
      n = (cp = strrchr(cp, '/')) ? atoi(++cp) : 0;
      
      if ((mm = get_month(*++pword, TRUE, TRUE)) == NOT_MONTH) return PARSE_INVLINE;
      
      /* if "year all" in effect, wildcard all applicable years */
      if (curr_year == ALL_YEARS) {
         match = FALSE;
         for (curr_year = init_year; curr_year <= final_year; curr_year++) {
            match |= enter_note(mm, pword, n) == PARSE_OK;
         }
         curr_year = ALL_YEARS;   /* reset to wildcard */
         return match ? PARSE_OK : PARSE_NOMATCH;
      } 
      else return enter_note(mm, pword, n);
      break;

   case DT_OTHER:   /* unrecognized token */
      return PARSE_INVLINE;
      break;
      
   case DT_DELETE:   /* fall through to actually delete event entry */
      pword++;
      delete_entry = TRUE;
      
   default:
      /* At this point, we assume that the configuration file line is an event
         specification... */

      /* If the current year is a wildcard ("all" or "*" - see above), enter
         the date for each year covered at least partially by the calendar.
         Note that a "mm/dd/yy" date spec explicitly resets curr_year;
         parse_date() sets the 'curr_year_reset' flag when this happens so
         that we can quit immediately.
      */
      if (curr_year == ALL_YEARS) {
         match = FALSE;
         /* loop over each applicable year */
         for (curr_year = init_year; curr_year <= final_year; curr_year++) {
            match |= process_event_specification(pword, &text_type, &ptext) == PARSE_OK;
            if (curr_year_reset) {   /* quit if year reset */
               return match ? PARSE_OK : PARSE_NOMATCH;
            }
         }
         
         /* restore year to wildcard for next time */
         curr_year = ALL_YEARS;
         delete_entry = FALSE;
         return match ? PARSE_OK : PARSE_NOMATCH;
      }

      match = process_event_specification(pword, &text_type, &ptext);
      delete_entry = FALSE;
      return match;
      
      break;
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %r15
movq %rsp, %rsi
leaq 0x14(%rsp), %rdx
movq %r15, %rdi
callq 0xce0d
incl %eax
cmpl $0xc, %eax
ja 0xbe7d
movl $0x2, %ebp
leaq 0x12e0b(%rip), %rcx     # 0x1ec14
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r15, %rdi
movl $0x2f, %esi
callq 0x5150
testq %rax, %rax
je 0xbfde
incq %rax
movq %rax, %rdi
callq 0x52d0
movl %eax, %r14d
jmp 0xbfe1
xorl %ebp, %ebp
movq %rbx, %rdi
movl $0x10, %esi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x625f
testl %eax, %eax
jne 0xc03a
movq 0x1c192(%rip), %rax     # 0x27ff0
movq (%rax), %rdi
xorl %esi, %esi
callq 0x5be5
movl $0x1, %edi
callq 0x5300
addq $0x8, %rbx
movb $0x1, 0x23137(%rip)     # 0x2efb4
leaq 0x2175c(%rip), %r12     # 0x2d5e0
cmpl $-0x1, (%r12)
je 0xbf29
leaq 0x4(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0xd457
movl %eax, %ebp
jmp 0xbf9d
cmpq $0x0, 0x8(%rbx)
je 0xc03a
leaq 0x200c6(%rip), %r14     # 0x2bf80
xorl %r15d, %r15d
movq 0x8(%rbx), %rsi
movq %r14, %rdi
movl $0x2, %edx
callq 0x9d60
testl %eax, %eax
je 0xc02e
incq %r15
addq $0x14, %r14
cmpq $0x18, %r15
jne 0xbebd
movl $0x2, %ebp
jmp 0xc03a
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0xbfa9
movq %rbx, %rdi
callq 0x52d0
testl %eax, %eax
jle 0xbfa9
movl %eax, %r14d
cmpl $0x63, %eax
jg 0xbf1a
callq 0xa92f
addl %eax, %r14d
leaq 0x216bf(%rip), %rax     # 0x2d5e0
movl %r14d, (%rax)
jmp 0xc038
leaq 0x21568(%rip), %rax     # 0x2d498
movl (%rax), %eax
movl %eax, (%r12)
leaq 0x2169f(%rip), %r13     # 0x2d5dc
movl $0x3, %ebp
cmpl (%r13), %eax
jg 0xbf95
xorl %ecx, %ecx
leaq 0x4(%rsp), %r14
leaq 0x8(%rsp), %r15
movl %ecx, %ebp
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xd457
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
orl %ebp, %ecx
cmpb $0x1, 0x23044(%rip)     # 0x2efb8
je 0xc0a8
movl (%r12), %eax
leal 0x1(%rax), %edx
movl %edx, (%r12)
cmpl (%r13), %eax
jl 0xbf54
xorl %eax, %eax
testl %ecx, %ecx
sete %al
leal (%rax,%rax,2), %ebp
movl $0xffffffff, (%r12)     # imm = 0xFFFFFFFF
movb $0x0, 0x23010(%rip)     # 0x2efb4
jmp 0xc03a
leaq 0x131f1(%rip), %rsi     # 0x1f1a1
movq %rbx, %rdi
callq 0x5200
testl %eax, %eax
je 0xbfcf
leaq 0x12f41(%rip), %rsi     # 0x1ef04
movq %rbx, %rdi
callq 0x5200
testl %eax, %eax
jne 0xc03a
leaq 0x2160a(%rip), %rax     # 0x2d5e0
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0xc038
xorl %r14d, %r14d
movl %r14d, (%rsp)
movq 0x8(%rbx), %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0xc9f2
cmpl $-0x1, %eax
je 0xc03a
movl %eax, %r15d
addq $0x8, %rbx
leaq 0x215d5(%rip), %r12     # 0x2d5e0
cmpl $-0x1, (%r12)
je 0xc04b
movl %r15d, %edi
movq %rbx, %rsi
movl %r14d, %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd3ae
leaq 0x217db(%rip), %rax     # 0x2d810
movl %r15d, (%rax)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x21446(%rip), %rax     # 0x2d498
movl (%rax), %eax
movl %eax, (%r12)
leaq 0x2157d(%rip), %r13     # 0x2d5dc
movl $0x3, %ebp
cmpl (%r13), %eax
jg 0xc09e
xorl %ebp, %ebp
movl %r15d, %edi
movq %rbx, %rsi
movl %r14d, %edx
callq 0xd3ae
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
orl %ecx, %ebp
movl (%r12), %eax
leal 0x1(%rax), %ecx
movl %ecx, (%r12)
cmpl (%r13), %eax
jl 0xc06c
xorl %eax, %eax
testl %ebp, %ebp
sete %al
leal (%rax,%rax,2), %ebp
movl $0xffffffff, (%r12)     # imm = 0xFFFFFFFF
jmp 0xc03a
xorl %eax, %eax
testl %ecx, %ecx
sete %al
leal (%rax,%rax,2), %ebp
jmp 0xc03a