// File: /workspace/github_c_makefile_star2_O3/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 0xc255
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 0xc12b
leaq 0x10(%rsp), %rdi
callq 0x5100
movzbl 0xf(%rsp,%rax), %ecx
cmpl $0x3e, %ecx
je 0xc126
cmpl $0x22, %ecx
jne 0xc12b
movb $0x0, 0xf(%rsp,%rax)
leaq 0x224ae(%rip), %rax     # 0x2e5e0
movl (%rax), %ebx
leaq 0xe0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x50a0
movl %ebx, %ebp
movl %ebx, %r12d
movl %ebx, (%rsp)
cmpl $-0x1, %ebx
je 0xc269
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 0xc1eb
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 0xc1eb
movb %r14b, (%rax)
movb %bl, 0x1(%rax)
movq %r15, %rdi
movl $0x25, %esi
callq 0x5120
testq %rax, %rax
jne 0xc1cd
movq %r13, %rdi
movq 0x8(%rsp), %rsi
movq %r15, %rdx
callq 0xb775
movq %rax, %rdi
leaq 0x13383(%rip), %rsi     # 0x1f588
callq 0x52a0
testq %rax, %rax
je 0xc231
movq %rax, %rbx
leaq 0x223c7(%rip), %rax     # 0x2e5e0
movl %r12d, (%rax)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xb9a4
movq %rbx, %rdi
callq 0x50e0
jmp 0xc238
cmpl $0x0, 0x4(%rsp)
je 0xc2ac
leal 0x1(%r12), %eax
cmpl %ebp, %r12d
movl %eax, %r12d
jne 0xc164
leaq 0x22390(%rip), %rax     # 0x2e5e0
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 0x22228(%rip), %rax     # 0x2e498
movl (%rax), %r12d
leaq 0x10(%rsp), %rdi
movl $0x25, %esi
callq 0x5120
testq %rax, %rax
je 0xc2a4
cmpb $0x79, 0x1(%rax)
movl %r12d, %ebp
jne 0xc299
leaq 0x22345(%rip), %rax     # 0x2e5dc
movl (%rax), %ebp
cmpl %ebp, %r12d
jle 0xc157
jmp 0xc249
movl %r12d, %ebp
jmp 0xc157
leaq 0x1b0(%rsp), %rdi
callq 0x54c3