// File: /workspace/github_c_makefile_star2_O1/mmayer[P]pcal/src/readfile.c
// Function: do_include
int do_include (char *path, char *name, int noerr)
{
   FILE *fp;
   char *p, incfile[STRSIZ], tmpnam[STRSIZ], sv_tmpnam[STRSIZ];
   int yy, yyfirst, yylast, sv_curr_year;
   
   if (!name) return 0;   /* whoops, no date file */

   /* copy name, stripping "" or <> */
   strcpy(tmpnam, name + (*name == '"' || *name == '<'));
   if ((p = P_LASTCHAR(tmpnam)) && (*p == '"' || *p == '>')) *p = '\0';

   /* save year and unmunged file name */
   sv_curr_year = curr_year;
   strcpy(sv_tmpnam, tmpnam);
   
   /* set up range of years to include: '%y', if present, is normally expanded
      to only the current year - except in "year all" mode where it is
      expanded to every applicable year
   */
   yyfirst = yylast = curr_year;
   if (curr_year == ALL_YEARS) {
      yyfirst = yylast = init_year;
      if ((p = strchr(tmpnam, '%')) != NULL && *(p+1) == 'y') yylast = final_year;
   }

   /*
    * loop over all years to be included
    */
   for (yy = yyfirst; yy <= yylast; yy++) {
      strcpy(tmpnam, sv_tmpnam);   /* restore unmunged name */
      
      /* replace each instance of %y with last two digits of year */
      while ((p = strchr(tmpnam, '%')) != NULL && *(p+1) == 'y') {
         *p++ = (yy / 10) % 10 + '0';
         *p = yy % 10 + '0';
      }
      
      if ((fp = fopen(mk_filespec(incfile, path, tmpnam), "r")) == NULL) {
         if (noerr) continue;   /* silently ignore in include? mode */
         fprintf(stderr, E_FOPEN_ERR, progname, incfile);
         exit(EXIT_FAILURE);
      }
      
      curr_year = yy;   /* avoid infinite recursion */
      read_datefile(fp, incfile);   /* recursive call */
      fclose(fp);
   }

   curr_year = sv_curr_year;   /* restore original value */
   
   return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movl %edx, 0x4(%rsp)
movq %rdi, 0x8(%rsp)
testq %rsi, %rsi
je 0xbd69
movb (%rsi), %al
cmpb $0x22, %al
sete %cl
cmpb $0x3c, %al
sete %al
orb %cl, %al
movzbl %al, %eax
addq %rsi, %rax
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x50a0
cmpb $0x0, (%rbx)
je 0xbc1f
leaq 0x10(%rsp), %rdi
callq 0x5100
addq %rsp, %rax
addq $0xf, %rax
jmp 0xbc21
xorl %eax, %eax
testq %rax, %rax
je 0xbc36
movzbl (%rax), %ecx
cmpl $0x3e, %ecx
je 0xbc33
cmpl $0x22, %ecx
jne 0xbc36
movb $0x0, (%rax)
leaq 0x219a3(%rip), %rax     # 0x2d5e0
movl (%rax), %ebx
leaq 0xe0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x50a0
movl %ebx, %r12d
movl %ebx, %ebp
movl %ebx, (%rsp)
cmpl $-0x1, %ebx
je 0xbd7d
cmpl %ebp, %r12d
jg 0xbd5d
leaq 0x10(%rsp), %r15
leaq 0x1b0(%rsp), %r13
movq %r15, %rdi
leaq 0xe0(%rsp), %rsi
callq 0x50a0
movq %r15, %rdi
movl $0x25, %esi
callq 0x5120
testq %rax, %rax
je 0xbcff
movslq %r12d, %rbx
imulq $0x66666667, %rbx, %rcx # imm = 0x66666667
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x22, %rcx
addl %edx, %ecx
movslq %ecx, %rcx
imulq $0x66666667, %rcx, %rdx # imm = 0x66666667
movq %rdx, %rsi
shrq $0x3f, %rsi
shrq $0x22, %rdx
addl %esi, %edx
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
movl %ecx, %r14d
subl %edx, %r14d
addb $0x30, %r14b
addl %ecx, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %ebx
addb $0x30, %bl
cmpb $0x79, 0x1(%rax)
jne 0xbcff
movb %r14b, (%rax)
movb %bl, 0x1(%rax)
movq %r15, %rdi
movl $0x25, %esi
callq 0x5120
testq %rax, %rax
jne 0xbce1
movq %r13, %rdi
movq 0x8(%rsp), %rsi
movq %r15, %rdx
callq 0xb209
movq %rax, %rdi
leaq 0x127f8(%rip), %rsi     # 0x1e511
callq 0x52a0
testq %rax, %rax
je 0xbd45
movq %rax, %rbx
leaq 0x218b3(%rip), %rax     # 0x2d5e0
movl %r12d, (%rax)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xb47c
movq %rbx, %rdi
callq 0x50e0
jmp 0xbd4c
cmpl $0x0, 0x4(%rsp)
je 0xbdbe
leal 0x1(%r12), %eax
cmpl %ebp, %r12d
movl %eax, %r12d
jne 0xbc78
leaq 0x2187c(%rip), %rax     # 0x2d5e0
movl (%rsp), %ecx
movl %ecx, (%rax)
xorl %eax, %eax
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x21714(%rip), %rax     # 0x2d498
movl (%rax), %r12d
leaq 0x10(%rsp), %rdi
movl $0x25, %esi
callq 0x5120
testq %rax, %rax
je 0xbdb6
cmpb $0x79, 0x1(%rax)
movl %r12d, %ebp
jne 0xbc62
leaq 0x2182d(%rip), %rax     # 0x2d5dc
movl (%rax), %ebp
jmp 0xbc62
movl %r12d, %ebp
jmp 0xbc62
leaq 0x1b0(%rsp), %rdi
callq 0x54f4