// File: /workspace/github_c_makefile_star2_O0/mmayer[P]pcal/src/readfile.c
// Function: read_datefile
void read_datefile (FILE *fp, char *filename)
{
   static int file_level = 0;
   int if_level = 0;
   int line = 0;
   int extra = 0;
   int pptype, ntokens, save_year, expr, (*pfcn) (char *) = NULL;
   char *ptok = NULL;
   char **pword;
   char msg[STRSIZ], incpath[STRSIZ], save_font;

   /* stack for processing nested "if{n}defs" - required for "elif" */
   struct {
      int state;   /* PROCESSING, AWAITING_TRUE, SKIP_TO_ENDIF */
      int else_ok;   /* is "elif" or "else" legal at this point? */
   } if_state[MAX_IF_NESTING+1];
   
   if (fp == NULL) return;   /* whoops, no date file */
      
   /* Note that there is no functional limit on file nesting.  This is mostly
      to catch infinite loops (e.g., a includes b, b includes a).
   */
   if (++file_level > MAX_FILE_NESTING) {
      ERR(E_FILE_NESTING);
      exit(EXIT_FAILURE);
   }
   
   save_year = curr_year;   /* save current year... */
   save_font = fontstyle[0];   /* ... and font style */
   
   if_state[0].state = PROCESSING;   /* set up initial state */
   if_state[0].else_ok = FALSE;
   
   /* read lines until EOF */
   
   while (get_pcal_line(fp, lbuf, &line)) {
      char suffix;
      
      if (DEBUG(DEBUG_PP)) {
         fprintf(stderr, "%s (%d)", filename, line);
         if (if_state[if_level].state == PROCESSING) fprintf(stderr, ": '%s'", lbuf);
         fprintf(stderr, "\n");
      }
      
      ntokens = loadwords(words, lbuf); /* split line into tokens */
      pword = words;   /* point to the first */
      
      /* get token type and pointers to function and name */
      
      suffix = words[0][strlen(words[0])-1];
      if ((pptype = get_token(*pword++)) != PP_OTHER) {
         pfcn = pp_info[pptype].pfcn;
         ptok = pp_info[pptype].name;
         pptype = pp_info[pptype].code;   /* use type code */
      }
      
      /* Perform symbol value substitution, but bypass it for any 'undef'
        preprocessor commands, otherwise there's no way to 'undef' a symbol
        which also had a value defined with it.
      */
      if (pptype != PP_UNDEF) {
         char **ap, *nap;
         for (ap=words; *ap; ap++) {
            if ((nap = find_sym_val(*ap))) *ap=nap;
         }
      }
      
      switch (pptype) {

      case PP_DEFINE:
         if (if_state[if_level].state == PROCESSING) (void) (*pfcn)(*pword);
         if (ntokens == 3) do_define_sym_val(*pword,pword[1]);
         extra = ntokens > 3;
         break;
         
      case PP_UNDEF:
         if (if_state[if_level].state == PROCESSING) (void) (*pfcn)(*pword);
         extra = ntokens > 2;
         break;
         
      case PP_ELIF:
         if (!if_state[if_level].else_ok) {
            ERR(E_ELIF_ERR);
            break;
         }
         
         /* if a true expression has just been processed, disable processing
            and skip to endif; if no true expression has been found yet and
            the current expression is true, enable processing
         */
         switch (if_state[if_level].state) {
         case PROCESSING:
            if_state[if_level].state = SKIP_TO_ENDIF;
            break;
         case AWAITING_TRUE:
            copy_text(lbuf, pword);   /* reconstruct string */
            if ((expr = (*pfcn)(lbuf)) == EXPR_ERR) {
               ERR(E_EXPR_SYNTAX);
               expr = FALSE;
            }
            if (expr) if_state[if_level].state = PROCESSING;
            break;
         }
         
         extra = FALSE;
         break;
         
      case PP_ELSE:
         if (!if_state[if_level].else_ok) {
            ERR(E_ELSE_ERR);
            break;
         }
         
         /* if a true condition has just been processed, disable processing
            and skip to endif; if no true condition has been found yet, enable
            processing
         */
         switch (if_state[if_level].state) {
         case PROCESSING:
            if_state[if_level].state = SKIP_TO_ENDIF;
            break;
         case AWAITING_TRUE:
            if_state[if_level].state = PROCESSING;
            break;
         }
         
         /* subsequent "elif" or "else" forbidden */
         if_state[if_level].else_ok = FALSE;
         extra = ntokens > 1;
         break;
         
      case PP_ENDIF:
         if (if_level < 1) {
            ERR(E_END_ERR);
            break;
         }
         if_level--;
         extra = ntokens > 1;
         break;
         
      case PP_IFDEF:
      case PP_IFNDEF:
         /* "if{n}def"s nested too deeply? */
         if (++if_level > MAX_IF_NESTING) {
            ERR(E_IF_NESTING);
            exit(EXIT_FAILURE);
            break;
         }
         
         /* if processing enabled at outer level, evaluate expression and
            enable/disable processing for following clause; if not, skip to
            matching endif
         */
         if (if_state[if_level-1].state == PROCESSING) {
            copy_text(lbuf, pword);   /* reconstruct string */
            if ((expr = (*pfcn)(lbuf)) == EXPR_ERR) {
               ERR(E_EXPR_SYNTAX);
               expr = FALSE;
            }
            if_state[if_level].state = expr ? PROCESSING : AWAITING_TRUE;
         } 
         else if_state[if_level].state = SKIP_TO_ENDIF;
         
         if_state[if_level].else_ok = TRUE;
         extra = FALSE;
         break;
         
      case PP_INCLUDE:
         if (if_state[if_level].state == PROCESSING) {
            do_include(mk_path(incpath, filename), *pword, suffix == '?');
         }
         extra = ntokens > 2;
         break;
         
      case PP_OTHER:   
         /* None of the above... Parse this configuration file line as a
            non-preprocessor directive.  This could be an event specification,
            an event deletion specification, a 'year' specification, an 'input
            language' specification, an option specification, or a 'note box'
            text specification.
         */
         if (if_state[if_level].state == PROCESSING) {

            switch (parse_as_non_preproc(words, filename)) {

            case PARSE_INVDATE:
               ERR(E_INV_DATE);
               break;
               
            case PARSE_INVLINE:
               ERR(E_INV_LINE);
               break;
               
            case PARSE_NOMATCH:
               ERR(E_NO_MATCH);
               break;
            }
         }
         extra = FALSE;
         break;
         
      } /* end switch */
      
      if (extra) {   /* extraneous data? */
         sprintf(msg, E_GARBAGE, ptok);
         ERR(msg);
      }
      
   } /* end while */
   
   if (if_level > 0) fprintf(stderr, E_UNT_IFDEF, progname, filename);
   
   file_level--;
   curr_year = save_year;   /* restore saved year and font style */
   fontstyle[0] = save_font;

   return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2d0, %rsp            # imm = 0x2D0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0xd994
jmp 0xe130
movl 0x25ef6(%rip), %eax     # 0x33890
addl $0x1, %eax
movl %eax, 0x25eed(%rip)     # 0x33890
cmpl $0xa, %eax
jle 0xd9e0
movq 0x20649(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
movq -0x10(%rbp), %r8
movl -0x18(%rbp), %r9d
leaq 0x1743f(%rip), %rsi     # 0x24e00
leaq 0x24ee8(%rip), %rdx     # 0x328b0
leaq 0x1744d(%rip), %rcx     # 0x24e1c
movb $0x0, %al
callq 0x51b0
movl $0x1, %edi
callq 0x52b0
leaq 0x25c79(%rip), %rax     # 0x33660
movl (%rax), %eax
movl %eax, -0x28(%rbp)
leaq 0x21273(%rip), %rax     # 0x2ec66
movb (%rax), %al
movb %al, -0x1e1(%rbp)
movl $0x0, -0x290(%rbp)
movl $0x0, -0x28c(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x24f96(%rip), %rsi     # 0x329b0
leaq -0x18(%rbp), %rdx
callq 0xd310
cmpl $0x0, %eax
je 0xe0dd
leaq 0x24d29(%rip), %rax     # 0x3275c
movl (%rax), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0xdaa1
movq 0x205b4(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
movq -0x10(%rbp), %rdx
movl -0x18(%rbp), %ecx
leaq 0x173eb(%rip), %rsi     # 0x24e40
movb $0x0, %al
callq 0x51b0
movslq -0x14(%rbp), %rax
cmpl $0x0, -0x290(%rbp,%rax,8)
jne 0xda89
movq 0x20587(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
leaq 0x173cd(%rip), %rsi     # 0x24e48
leaq 0x24f2e(%rip), %rdx     # 0x329b0
movb $0x0, %al
callq 0x51b0
movq 0x20568(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
leaq 0x1aa8f(%rip), %rsi     # 0x28529
movb $0x0, %al
callq 0x51b0
leaq 0x25108(%rip), %rdi     # 0x32bb0
leaq 0x24f01(%rip), %rsi     # 0x329b0
callq 0xc660
movl %eax, -0x24(%rbp)
leaq 0x250f2(%rip), %rax     # 0x32bb0
movq %rax, -0x48(%rbp)
leaq 0x250e7(%rip), %rax     # 0x32bb0
movq (%rax), %rax
movq %rax, -0x2b0(%rbp)
leaq 0x250d6(%rip), %rax     # 0x32bb0
movq (%rax), %rdi
callq 0x50e0
movq %rax, %rcx
movq -0x2b0(%rbp), %rax
subq $0x1, %rcx
movb (%rax,%rcx), %al
movb %al, -0x291(%rbp)
movq -0x48(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x48(%rbp)
movq (%rax), %rdi
callq 0xe140
movl %eax, -0x20(%rbp)
cmpl $-0x1, %eax
je 0xdb63
movslq -0x20(%rbp), %rcx
leaq 0x20cad(%rip), %rax     # 0x2e7d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, -0x38(%rbp)
movslq -0x20(%rbp), %rcx
leaq 0x20c93(%rip), %rax     # 0x2e7d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movslq -0x20(%rbp), %rcx
leaq 0x20c7a(%rip), %rax     # 0x2e7d0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x20(%rbp)
cmpl $0x7, -0x20(%rbp)
je 0xdbc9
leaq 0x25040(%rip), %rax     # 0x32bb0
movq %rax, -0x2a0(%rbp)
movq -0x2a0(%rbp), %rax
cmpq $0x0, (%rax)
je 0xdbc7
movq -0x2a0(%rbp), %rax
movq (%rax), %rdi
callq 0xe1c0
movq %rax, -0x2a8(%rbp)
cmpq $0x0, %rax
je 0xdbb1
movq -0x2a8(%rbp), %rcx
movq -0x2a0(%rbp), %rax
movq %rcx, (%rax)
jmp 0xdbb3
movq -0x2a0(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x2a0(%rbp)
jmp 0xdb77
jmp 0xdbc9
movl -0x20(%rbp), %eax
incl %eax
movl %eax, %ecx
movq %rcx, -0x2b8(%rbp)
subl $0x8, %eax
ja 0xe08b
movq -0x2b8(%rbp), %rax
leaq 0x17152(%rip), %rcx     # 0x24d40
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movslq -0x14(%rbp), %rax
cmpl $0x0, -0x290(%rbp,%rax,8)
jne 0xdc12
movq -0x38(%rbp), %rax
movq -0x48(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
cmpl $0x3, -0x24(%rbp)
jne 0xdc2c
movq -0x48(%rbp), %rax
movq (%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xe210
cmpl $0x3, -0x24(%rbp)
setg %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
jmp 0xe08b
movslq -0x14(%rbp), %rax
cmpl $0x0, -0x290(%rbp,%rax,8)
jne 0xdc5b
movq -0x38(%rbp), %rax
movq -0x48(%rbp), %rcx
movq (%rcx), %rdi
callq *%rax
cmpl $0x2, -0x24(%rbp)
setg %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
jmp 0xe08b
movslq -0x14(%rbp), %rax
cmpl $0x0, -0x28c(%rbp,%rax,8)
jne 0xdcb0
movq 0x20374(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
movq -0x10(%rbp), %r8
movl -0x18(%rbp), %r9d
leaq 0x1716a(%rip), %rsi     # 0x24e00
leaq 0x24c13(%rip), %rdx     # 0x328b0
leaq 0x171ab(%rip), %rcx     # 0x24e4f
movb $0x0, %al
callq 0x51b0
jmp 0xe08b
movslq -0x14(%rbp), %rax
movl -0x290(%rbp,%rax,8), %eax
movl %eax, -0x2bc(%rbp)
testl %eax, %eax
je 0xdcd4
jmp 0xdcc7
movl -0x2bc(%rbp), %eax
subl $0x1, %eax
je 0xdce5
jmp 0xdd53
movslq -0x14(%rbp), %rax
movl $0x2, -0x290(%rbp,%rax,8)
jmp 0xdd53
movq -0x48(%rbp), %rsi
leaq 0x24cc0(%rip), %rdi     # 0x329b0
callq 0xc8e0
leaq 0x24cb4(%rip), %rdi     # 0x329b0
callq *-0x38(%rbp)
movl %eax, -0x2c(%rbp)
cmpl $-0x1, %eax
jne 0xdd3c
movq 0x202ea(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
movq -0x10(%rbp), %r8
movl -0x18(%rbp), %r9d
leaq 0x170e0(%rip), %rsi     # 0x24e00
leaq 0x24b89(%rip), %rdx     # 0x328b0
leaq 0x17132(%rip), %rcx     # 0x24e60
movb $0x0, %al
callq 0x51b0
movl $0x0, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0xdd51
movslq -0x14(%rbp), %rax
movl $0x0, -0x290(%rbp,%rax,8)
jmp 0xdd53
movl $0x0, -0x1c(%rbp)
jmp 0xe08b
movslq -0x14(%rbp), %rax
cmpl $0x0, -0x28c(%rbp,%rax,8)
jne 0xdda0
movq 0x20284(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
movq -0x10(%rbp), %r8
movl -0x18(%rbp), %r9d
leaq 0x1707a(%rip), %rsi     # 0x24e00
leaq 0x24b23(%rip), %rdx     # 0x328b0
leaq 0x170e7(%rip), %rcx     # 0x24e7b
movb $0x0, %al
callq 0x51b0
jmp 0xe08b
movslq -0x14(%rbp), %rax
movl -0x290(%rbp,%rax,8), %eax
movl %eax, -0x2c0(%rbp)
testl %eax, %eax
je 0xddc4
jmp 0xddb7
movl -0x2c0(%rbp), %eax
subl $0x1, %eax
je 0xddd5
jmp 0xdde4
movslq -0x14(%rbp), %rax
movl $0x2, -0x290(%rbp,%rax,8)
jmp 0xdde4
movslq -0x14(%rbp), %rax
movl $0x0, -0x290(%rbp,%rax,8)
movslq -0x14(%rbp), %rax
movl $0x0, -0x28c(%rbp,%rax,8)
cmpl $0x1, -0x24(%rbp)
setg %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
jmp 0xe08b
cmpl $0x1, -0x14(%rbp)
jge 0xde40
movq 0x201e4(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
movq -0x10(%rbp), %r8
movl -0x18(%rbp), %r9d
leaq 0x16fda(%rip), %rsi     # 0x24e00
leaq 0x24a83(%rip), %rdx     # 0x328b0
leaq 0x17058(%rip), %rcx     # 0x24e8c
movb $0x0, %al
callq 0x51b0
jmp 0xe08b
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x1, -0x24(%rbp)
setg %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
jmp 0xe08b
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x14, %eax
jle 0xdea3
movq 0x20186(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
movq -0x10(%rbp), %r8
movl -0x18(%rbp), %r9d
leaq 0x16f7c(%rip), %rsi     # 0x24e00
leaq 0x24a25(%rip), %rdx     # 0x328b0
leaq 0x1700c(%rip), %rcx     # 0x24e9e
movb $0x0, %al
callq 0x51b0
movl $0x1, %edi
callq 0x52b0
movl -0x14(%rbp), %eax
subl $0x1, %eax
cltq
cmpl $0x0, -0x290(%rbp,%rax,8)
jne 0xdf29
movq -0x48(%rbp), %rsi
leaq 0x24af0(%rip), %rdi     # 0x329b0
callq 0xc8e0
leaq 0x24ae4(%rip), %rdi     # 0x329b0
callq *-0x38(%rbp)
movl %eax, -0x2c(%rbp)
cmpl $-0x1, %eax
jne 0xdf0c
movq 0x2011a(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
movq -0x10(%rbp), %r8
movl -0x18(%rbp), %r9d
leaq 0x16f10(%rip), %rsi     # 0x24e00
leaq 0x249b9(%rip), %rdx     # 0x328b0
leaq 0x16f62(%rip), %rcx     # 0x24e60
movb $0x0, %al
callq 0x51b0
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %edx
movl $0x1, %ecx
xorl %eax, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movslq -0x14(%rbp), %rax
movl %ecx, -0x290(%rbp,%rax,8)
jmp 0xdf38
movslq -0x14(%rbp), %rax
movl $0x2, -0x290(%rbp,%rax,8)
movslq -0x14(%rbp), %rax
movl $0x1, -0x28c(%rbp,%rax,8)
movl $0x0, -0x1c(%rbp)
jmp 0xe08b
movslq -0x14(%rbp), %rax
cmpl $0x0, -0x290(%rbp,%rax,8)
jne 0xdf92
leaq -0x1e0(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xd4d0
movq %rax, %rdi
movq -0x48(%rbp), %rax
movq (%rax), %rsi
movsbl -0x291(%rbp), %eax
cmpl $0x3f, %eax
sete %al
andb $0x1, %al
movzbl %al, %edx
callq 0xe2e0
cmpl $0x2, -0x24(%rbp)
setg %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
jmp 0xe08b
movslq -0x14(%rbp), %rax
cmpl $0x0, -0x290(%rbp,%rax,8)
jne 0xe084
movq -0x10(%rbp), %rsi
leaq 0x24bed(%rip), %rdi     # 0x32bb0
callq 0xe610
movl %eax, %ecx
movl %ecx, -0x2c4(%rbp)
subl $0x1, %eax
je 0xdff4
jmp 0xdfd7
movl -0x2c4(%rbp), %eax
subl $0x2, %eax
je 0xe024
jmp 0xdfe4
movl -0x2c4(%rbp), %eax
subl $0x3, %eax
je 0xe054
jmp 0xe082
movq 0x1fffd(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
movq -0x10(%rbp), %r8
movl -0x18(%rbp), %r9d
leaq 0x16df3(%rip), %rsi     # 0x24e00
leaq 0x2489c(%rip), %rdx     # 0x328b0
leaq 0x16ead(%rip), %rcx     # 0x24ec8
movb $0x0, %al
callq 0x51b0
jmp 0xe082
movq 0x1ffcd(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
movq -0x10(%rbp), %r8
movl -0x18(%rbp), %r9d
leaq 0x16dc3(%rip), %rsi     # 0x24e00
leaq 0x2486c(%rip), %rdx     # 0x328b0
leaq 0x16e8a(%rip), %rcx     # 0x24ed5
movb $0x0, %al
callq 0x51b0
jmp 0xe082
movq 0x1ff9d(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
movq -0x10(%rbp), %r8
movl -0x18(%rbp), %r9d
leaq 0x16d93(%rip), %rsi     # 0x24e00
leaq 0x2483c(%rip), %rdx     # 0x328b0
leaq 0x16e6c(%rip), %rcx     # 0x24ee7
movb $0x0, %al
callq 0x51b0
jmp 0xe084
movl $0x0, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0xe0d8
leaq -0x110(%rbp), %rdi
movq -0x40(%rbp), %rdx
leaq 0x16e5a(%rip), %rsi     # 0x24efd
movb $0x0, %al
callq 0x52a0
movq 0x1ff47(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
leaq -0x110(%rbp), %rcx
movq -0x10(%rbp), %r8
movl -0x18(%rbp), %r9d
leaq 0x16d36(%rip), %rsi     # 0x24e00
leaq 0x247df(%rip), %rdx     # 0x328b0
movb $0x0, %al
callq 0x51b0
jmp 0xda0f
cmpl $0x0, -0x14(%rbp)
jle 0xe106
movq 0x1ff0e(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
movq -0x10(%rbp), %rcx
leaq 0x16e22(%rip), %rsi     # 0x24f1a
leaq 0x247b1(%rip), %rdx     # 0x328b0
movb $0x0, %al
callq 0x51b0
movl 0x25784(%rip), %eax     # 0x33890
addl $-0x1, %eax
movl %eax, 0x2577b(%rip)     # 0x33890
movl -0x28(%rbp), %ecx
leaq 0x25541(%rip), %rax     # 0x33660
movl %ecx, (%rax)
movb -0x1e1(%rbp), %cl
leaq 0x20b38(%rip), %rax     # 0x2ec66
movb %cl, (%rax)
addq $0x2d0, %rsp            # imm = 0x2D0
popq %rbp
retq
nopl (%rax)