// File: /workspace/github_c_makefile_star2_O0/mmayer[P]pcal/src/readfile.c
// Function: enter_day_info
int enter_day_info (int m, int d, int y, int text_type, char **pword)
{
   static year_info *pyear;
   static int prev_year = 0;
   month_info *pmonth;
   day_info *pday, *plast;
   int is_holiday = text_type == HOLIDAY_TEXT;
   char text[LINSIZ], *tface;

   if (! is_valid(m, d >= FIRST_NOTE_DAY && text_type == NOTE_TEXT ? 1 : d, y)) {
      return (m == FEB && d == 29 && FEB_29_OK) ? PARSE_OK : PARSE_INVDATE;
   }

   if (y != prev_year) {   /* avoid unnecessary year lookup */
      pyear = find_year(y, 1);
   }
   
   --m, --d;   /* adjust for use as subscripts */

   if ((pmonth = pyear->month[m]) == NULL) {   /* find/create month record */
      int i;
      pyear->month[m] = pmonth = (month_info *) alloc((int) sizeof(month_info));
      for (i = 0; i < (int)(ARRAYSIZE(pmonth->day)); i++) pmonth->day[i] = NULL;
   }

   if (is_holiday) pmonth->holidays |= (1L << d);

   /* insert text for day at end of list (preserving the order of entry for
      multiple lines on same day); eliminate those differing only in spacing
      and capitalization from existing entries
   */

   copy_text(text, pword);   /* consolidate text from lbuf into text */

   if (DEBUG(DEBUG_DATES)) {
      char *p;
      fprintf(stderr, "Adding event: %02d/%02d/%d%c '", m+1, d+1, y, is_holiday ? '*' : ' ');
      for (p = text; *p; p++) {
         fprintf(stderr, isprint((int)*p) ? "%c" : "\\%03o", *p & CHAR_MSK);
      }
      fprintf(stderr, "'\n");
   }

#if KEEP_NULL_LINES   /* preserve blank text lines in output */
   if (*text == '\0' && pmonth->day[d]) strcpy(text, BLANK_TEXT);
#endif

   /* check that non-null text is unique */
   
   if (*text) {
      for (plast = NULL, pday = pmonth->day[d];
           pday;
           plast = pday, pday = pday->next) {

         if (ci_strcmp(pday->text, text) == 0
#if KEEP_NULL_LINES
             && strcmp(text, BLANK_TEXT) != 0
#endif
             ) {
            pday->is_holiday |= is_holiday;
            return PARSE_OK;
         }
      }
      
      /* unique - add to end of list */
      
      pday = (day_info *) alloc(sizeof(day_info));
      pday->is_holiday = is_holiday;
      
      if (fontstyle[0] == ROMAN || output_type != OUTPUT_PS) {
         /* copy text intact (no font shift) */
         strcpy(pday->text = (char *) alloc(strlen(text)+1), text);
      } 
      else {
         /* prepend font shift sequence to text */
         tface = fontstyle[0] == BOLD   ? BOLD_FONT : fontstyle[0] == ITALIC ? ITALIC_FONT : "";
         pday->text = (char *) alloc(strlen(tface) + strlen(text) + 2);
         strcpy(pday->text, tface);
         if (*tface) strcat(pday->text, " ");
         strcat(pday->text, text);
      }
      
      pday->next = NULL;
      *(plast ? &plast->next : &pmonth->day[d]) = pday;
   }
   
   return PARSE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x290, %rsp            # imm = 0x290
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movq %r8, -0x20(%rbp)
cmpl $0x1, -0x14(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x3c(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x25c(%rbp)
cmpl $0x20, -0xc(%rbp)
jl 0x1028c
cmpl $0x2, -0x14(%rbp)
jne 0x1028c
movl $0x1, %eax
movl %eax, -0x260(%rbp)
jmp 0x10295
movl -0xc(%rbp), %eax
movl %eax, -0x260(%rbp)
movl -0x25c(%rbp), %edi
movl -0x260(%rbp), %esi
movl -0x10(%rbp), %edx
callq 0xc040
cmpl $0x0, %eax
jne 0x102ef
xorl %eax, %eax
cmpl $0x2, -0x8(%rbp)
movb %al, -0x261(%rbp)
jne 0x102d4
xorl %eax, %eax
cmpl $0x1d, -0xc(%rbp)
movb %al, -0x261(%rbp)
jne 0x102d4
movb $0x1, %al
movb %al, -0x261(%rbp)
jmp 0x102d4
movb -0x261(%rbp), %dl
movl $0x1, %eax
xorl %ecx, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x10722
movl -0x10(%rbp), %eax
cmpl 0x23bf0(%rip), %eax     # 0x33ee8
je 0x1030e
movl -0x10(%rbp), %edi
movl $0x1, %esi
callq 0xefe0
movq %rax, 0x23bd2(%rip)     # 0x33ee0
movl -0x8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8(%rbp)
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq 0x23bb9(%rip), %rax     # 0x33ee0
movslq -0x8(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x10395
movl $0x170, %edi            # imm = 0x170
callq 0xb2b0
movq %rax, %rdx
movq %rdx, -0x28(%rbp)
movq 0x23b8e(%rip), %rax     # 0x33ee0
movslq -0x8(%rbp), %rcx
movq %rdx, 0x8(%rax,%rcx,8)
movl $0x0, -0x24c(%rbp)
cmpl $0x2d, -0x24c(%rbp)
jge 0x10393
movq -0x28(%rbp), %rax
movslq -0x24c(%rbp), %rcx
movq $0x0, 0x8(%rax,%rcx,8)
movl -0x24c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24c(%rbp)
jmp 0x10365
jmp 0x10395
cmpl $0x0, -0x3c(%rbp)
je 0x103b5
movl -0xc(%rbp), %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
movq -0x28(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
leaq -0x240(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xc8e0
leaq 0x22390(%rip), %rax     # 0x3275c
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x104c3
movq 0x1dc17(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
movl -0x8(%rbp), %edx
addl $0x1, %edx
movl -0xc(%rbp), %ecx
addl $0x1, %ecx
movl -0x10(%rbp), %r8d
movl -0x3c(%rbp), %esi
movl $0x20, %r9d
movl $0x2a, %eax
cmpl $0x0, %esi
cmovnel %eax, %r9d
leaq 0x14b9d(%rip), %rsi     # 0x24fad
movb $0x0, %al
callq 0x51b0
leaq -0x240(%rbp), %rax
movq %rax, -0x258(%rbp)
movq -0x258(%rbp), %rax
cmpb $0x0, (%rax)
je 0x104ab
movq 0x1dbc0(%rip), %rax     # 0x2dff8
movq (%rax), %rax
movq %rax, -0x270(%rbp)
callq 0x52e0
movq -0x270(%rbp), %rdi
movq (%rax), %rax
movq -0x258(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x4000, %ecx           # imm = 0x4000
leaq 0x14b5d(%rip), %rsi     # 0x24fcc
leaq 0x1a1a0(%rip), %rax     # 0x2a616
cmpl $0x0, %ecx
cmovneq %rax, %rsi
movq -0x258(%rbp), %rax
movsbl (%rax), %edx
andl $0xff, %edx
movb $0x0, %al
callq 0x51b0
movq -0x258(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x258(%rbp)
jmp 0x10425
movq 0x1db46(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
leaq 0x15da9(%rip), %rsi     # 0x26265
movb $0x0, %al
callq 0x51b0
movsbl -0x240(%rbp), %eax
cmpl $0x0, %eax
jne 0x104f2
movq -0x28(%rbp), %rax
movslq -0xc(%rbp), %rcx
cmpq $0x0, 0x8(%rax,%rcx,8)
je 0x104f2
leaq -0x240(%rbp), %rdi
leaq 0x1a2fb(%rip), %rsi     # 0x2a7e8
callq 0x5080
cmpb $0x0, -0x240(%rbp)
je 0x1071b
movq $0x0, -0x38(%rbp)
movq -0x28(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x1057f
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x240(%rbp), %rsi
callq 0xb320
cmpl $0x0, %eax
jne 0x10567
leaq -0x240(%rbp), %rdi
leaq 0x1a2a2(%rip), %rsi     # 0x2a7e8
callq 0x51a0
cmpl $0x0, %eax
je 0x10567
movl -0x3c(%rbp), %ecx
movq -0x30(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x10722
jmp 0x10569
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x10518
movl $0x18, %edi
callq 0xb2b0
movq %rax, -0x30(%rbp)
movl -0x3c(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
leaq 0x1e6c9(%rip), %rax     # 0x2ec66
movsbl (%rax), %eax
cmpl $0x52, %eax
je 0x105b1
leaq 0x2219c(%rip), %rax     # 0x32748
cmpl $0x0, (%rax)
je 0x105e4
leaq -0x240(%rbp), %rdi
callq 0x50e0
addq $0x1, %rax
movl %eax, %edi
callq 0xb2b0
movq %rax, %rdi
movq -0x30(%rbp), %rax
movq %rdi, 0x8(%rax)
leaq -0x240(%rbp), %rsi
callq 0x5080
jmp 0x106c1
leaq 0x1e67b(%rip), %rax     # 0x2ec66
movsbl (%rax), %eax
cmpl $0x42, %eax
jne 0x10603
leaq 0x14060(%rip), %rax     # 0x2465a
movq %rax, -0x278(%rbp)
jmp 0x10629
leaq 0x1e65c(%rip), %rax     # 0x2ec66
movsbl (%rax), %edx
leaq 0x15677(%rip), %rax     # 0x25c8b
leaq 0x14042(%rip), %rcx     # 0x2465d
cmpl $0x49, %edx
cmoveq %rcx, %rax
movq %rax, -0x278(%rbp)
movq -0x278(%rbp), %rax
movq %rax, -0x248(%rbp)
movq -0x248(%rbp), %rdi
callq 0x50e0
movq %rax, -0x280(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x50e0
movq %rax, %rcx
movq -0x280(%rbp), %rax
addq %rcx, %rax
addq $0x2, %rax
movl %eax, %edi
callq 0xb2b0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x248(%rbp), %rsi
callq 0x5080
movq -0x248(%rbp), %rax
cmpb $0x0, (%rax)
je 0x106ad
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x1a140(%rip), %rsi     # 0x2a7e8
callq 0x5290
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x240(%rbp), %rsi
callq 0x5290
movq -0x30(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x288(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x106f0
movq -0x38(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x290(%rbp)
jmp 0x1070a
movq -0x28(%rbp), %rax
addq $0x8, %rax
movslq -0xc(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x290(%rbp)
movq -0x288(%rbp), %rcx
movq -0x290(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x290, %rsp            # imm = 0x290
popq %rbp
retq
nop