// File: /workspace/github_c_makefile_star2_O0/mmayer[P]pcal/src/readfile.c
// Function: delete_day_info
int delete_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, *pdel = NULL, *pldel = NULL;
   int is_holiday = FALSE;
   int found = FALSE;
   char text[LINSIZ];
   
   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) {   /* ignore delete if no entries exist */
      return PARSE_OK;
   }
   if (pmonth->day[d] == NULL) return PARSE_OK;
   
   /* delete text for day from list ignoring differences in only spacing and
      capitalization in the existing entry.
   */
   
   copy_text(text, pword); /* consolidate text from lbuf into text */
   
   if (DEBUG(DEBUG_DATES)) {
      char *p;
      fprintf(stderr, "Deleting 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 if non-null and find entry to delete */
   
   if (*text) {
      for (plast = NULL, pday = pmonth->day[d];
           pday;
           plast = pday, pday = pday->next) {
         if (ci_strcmp(pday->text, text) == 0) {
            found = TRUE;
            pdel = pday;
            pldel = plast;
         } 
         else is_holiday |= pday->is_holiday;
      }
      
      if (found) {
         if (pldel) pldel->next = pdel->next;
         else pmonth->day[d] = pdel->next;
         free(pdel);
         
         if (is_holiday) pmonth->holidays |= (1L << d);
         else pmonth->holidays &= ~(1L << d);
      }
   }
   
   return PARSE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x270, %rsp            # imm = 0x270
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movq %r8, -0x20(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x50(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x25c(%rbp)
cmpl $0x20, -0xc(%rbp)
jl 0x1078b
cmpl $0x2, -0x14(%rbp)
jne 0x1078b
movl $0x1, %eax
movl %eax, -0x260(%rbp)
jmp 0x10794
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 0x107ee
xorl %eax, %eax
cmpl $0x2, -0x8(%rbp)
movb %al, -0x261(%rbp)
jne 0x107d3
xorl %eax, %eax
cmpl $0x1d, -0xc(%rbp)
movb %al, -0x261(%rbp)
jne 0x107d3
movb $0x1, %al
movb %al, -0x261(%rbp)
jmp 0x107d3
movb -0x261(%rbp), %dl
movl $0x1, %eax
xorl %ecx, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x10aa9
movl -0x10(%rbp), %eax
cmpl 0x23701(%rip), %eax     # 0x33ef8
je 0x1080d
movl -0x10(%rbp), %edi
movl $0x1, %esi
callq 0xefe0
movq %rax, 0x236e3(%rip)     # 0x33ef0
movl -0x8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8(%rbp)
movl -0xc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xc(%rbp)
movq 0x236ca(%rip), %rax     # 0x33ef0
movslq -0x8(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x10845
movl $0x0, -0x4(%rbp)
jmp 0x10aa9
movq -0x28(%rbp), %rax
movslq -0xc(%rbp), %rcx
cmpq $0x0, 0x8(%rax,%rcx,8)
jne 0x10861
movl $0x0, -0x4(%rbp)
jmp 0x10aa9
leaq -0x250(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xc8e0
leaq 0x21ee4(%rip), %rax     # 0x3275c
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x1096f
movq 0x1d76b(%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 -0x4c(%rbp), %esi
movl $0x20, %r9d
movl $0x2a, %eax
cmpl $0x0, %esi
cmovnel %eax, %r9d
leaq 0x14716(%rip), %rsi     # 0x24fd2
movb $0x0, %al
callq 0x51b0
leaq -0x250(%rbp), %rax
movq %rax, -0x258(%rbp)
movq -0x258(%rbp), %rax
cmpb $0x0, (%rax)
je 0x10957
movq 0x1d714(%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 0x146b1(%rip), %rsi     # 0x24fcc
leaq 0x19cf4(%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 0x108d1
movq 0x1d69a(%rip), %rax     # 0x2dff8
movq (%rax), %rdi
leaq 0x158fd(%rip), %rsi     # 0x26265
movb $0x0, %al
callq 0x51b0
movsbl -0x250(%rbp), %eax
cmpl $0x0, %eax
jne 0x1099e
movq -0x28(%rbp), %rax
movslq -0xc(%rbp), %rcx
cmpq $0x0, 0x8(%rax,%rcx,8)
je 0x1099e
leaq -0x250(%rbp), %rdi
leaq 0x19e4f(%rip), %rsi     # 0x2a7e8
callq 0x5080
cmpb $0x0, -0x250(%rbp)
je 0x10aa2
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 0x10a21
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x250(%rbp), %rsi
callq 0xb320
cmpl $0x0, %eax
jne 0x109fd
movl $0x1, -0x50(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x10a09
movq -0x30(%rbp), %rax
movl (%rax), %eax
orl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
jmp 0x10a0b
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x109c4
cmpl $0x0, -0x50(%rbp)
je 0x10aa0
cmpq $0x0, -0x48(%rbp)
je 0x10a40
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x10a55
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x28(%rbp), %rax
movslq -0xc(%rbp), %rcx
movq %rdx, 0x8(%rax,%rcx,8)
movq -0x40(%rbp), %rdi
callq 0x5040
cmpl $0x0, -0x4c(%rbp)
je 0x10a80
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)
jmp 0x10a9e
movl -0xc(%rbp), %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, %rcx
xorq $-0x1, %rcx
movq -0x28(%rbp), %rax
andq (%rax), %rcx
movq %rcx, (%rax)
jmp 0x10aa0
jmp 0x10aa2
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x270, %rsp            # imm = 0x270
popq %rbp
retq
nopw %cs:(%rax,%rax)