// File: /workspace/github_c_makefile_star2_O3/mmayer[P]pcal/src/writefil.c
// Function: multiple_months_html
void multiple_months_html (int first_month, int first_year, int ncols)
{
   long holidays;
   int day, box, len;
   year_info *py;
   month_info *pm;
   int i, m, d, y, w, wd1, wd2, nw;
   
   /* width of dates and spaces between months */
   wd1 = 12 / ncols;
   wd2 = (100 - (ncols * (7 * wd1))) / (ncols - 1);
   
   /* table heading with months and year */
   printf("<table width=100%% border=%d>\n", 0);
   
   printf("<tr>");
   for (i = 0, m = first_month, y = first_year;
        i < ncols;
        i++, BUMP_MONTH_AND_YEAR(m, y)) {
      if (i > 0) printf("<th><br></th>");
      printf("<th colspan=7>%s", MONTHYEAR_W_PRE);
      print_html(months_ml[output_language][m-1]);
      printf(" %d%s</th>\n", y, MONTHYEAR_W_POST);
   }
   printf("</tr>\n");
   
   /* headings for weekday names */
   printf("<tr>");
   for (i = 0; i < ncols; i++) {
      if (i > 0) printf("\n<th width=%d%%><br></th>", wd2);
      for (day = 0; day < 7; day++) {
         char buf[40];
         strcpy(buf, days_ml[output_language][(day + first_day_of_week) % 7]);
#if 0
         buf[ncols == 3 ? 3 : 2] = '\0';
#else
         buf[2] = '\0';   /* truncate to two characters */
#endif
         printf("<th width=%d%%>", wd1);
         print_html(buf);
         printf("</th>");
      }
   }
   printf("</tr>\n");
   
#ifdef CONSISTENT_SPACING
   /* always print 6 weeks (to maintain consistent vertical spacing) */
   nw = 6;
#else
   /* print 5 weeks unless at least one month requires a sixth week */
   nw = 5;
   for (i = 0, m = first_month, y = first_year;
        i < ncols;
        i++, BUMP_MONTH_AND_YEAR(m, y)) {
      if (START_BOX(m, y) + LENGTH_OF(m, y) > 35) nw = 6;
   }
#endif

   /* main loop to print dates (one week at a time) */
   
   for (w = 0; w < nw; w++) {
      printf("<tr>");

      /* print one week of dates for each month */
      
      for (i = 0, m = first_month, y = first_year;
           i < ncols;
           i++, BUMP_MONTH_AND_YEAR(m, y)) {
         if (i > 0) printf("<td><br></td>");

         /* get starting box, month length, holiday info */
         box = START_BOX(m, y);
         len = LENGTH_OF(m, y);
         pm = (py = find_year(y, FALSE)) != NULL ? py->month[m-1] : NULL;
         holidays = pm ? pm->holidays : 0;
         
         /* loop over days in current week and month */
         
         for (d = 1; d <= 7; d++) {
            day = (7 * w) + d - box;
            if (day < 1 || day > len) printf("<td><br></td>");
            else {
               printf("<td align=center>");
               if (holidays & (1L << (day - 1))) {
                  printf("%s%d%s", HOLIDAY_PRE, day, HOLIDAY_POST);
               }
               else printf("%d", day);

               printf("</td>");
            }
         }
      }
      printf("</tr>\n");
   }
   
   /* end of table */
   printf("</table>\n");

   return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edx, %ebp
movl %esi, %r14d
movl %edi, %r13d
movl $0xc, %eax
xorl %edx, %edx
idivl %ebp
movl %eax, %ebx
movl %ebp, %eax
imull %ebx, %eax
movl %eax, %ecx
shll $0x3, %ecx
negl %ecx
addl %ecx, %eax
addl $0x64, %eax
leal -0x1(%rbp), %ecx
cltd
idivl %ecx
movl %eax, 0x28(%rsp)
leaq 0xfe79(%rip), %rdi      # 0x232a8
xorl %esi, %esi
xorl %eax, %eax
callq 0x5130
leaq 0x1227b(%rip), %rdi     # 0x256ba
xorl %eax, %eax
callq 0x5130
testl %ebp, %ebp
movq %rbp, 0x18(%rsp)
movl %r13d, 0xc(%rsp)
movl %r14d, 0x20(%rsp)
jle 0x136fd
movl $0x1, %r15d
xorl %r12d, %r12d
movl %r14d, %ebp
testl %r12d, %r12d
je 0x1347c
leaq 0xffaa(%rip), %rdi      # 0x2341f
xorl %eax, %eax
callq 0x5130
leaq 0xfe48(%rip), %rdi      # 0x232cb
leaq 0xfe56(%rip), %rsi      # 0x232e0
xorl %eax, %eax
callq 0x5130
leaq 0x1b37c(%rip), %rax     # 0x2e814
movslq (%rax), %rax
movslq %r13d, %r14
leaq (%rax,%rax,2), %rax
shlq $0x5, %rax
addq 0x15afb(%rip), %rax     # 0x28fa8
movq -0x8(%rax,%r14,8), %rdi
callq 0x12e02
leaq 0xff6f(%rip), %rdi      # 0x2342d
movl %ebp, %esi
leaq 0xfe9e(%rip), %rdx      # 0x23365
xorl %eax, %eax
callq 0x5130
incl %r12d
leal 0x1(%r14), %r13d
xorl %eax, %eax
cmpl $0xc, %r14d
sete %al
cmovel %r15d, %r13d
addl %eax, %ebp
cmpl %r12d, 0x18(%rsp)
jne 0x13469
leaq 0x121e2(%rip), %rdi     # 0x256d8
callq 0x50b0
leaq 0x121b8(%rip), %rdi     # 0x256ba
xorl %eax, %eax
callq 0x5130
movq 0x18(%rsp), %rbp
testl %ebp, %ebp
jle 0x13717
movl %ebx, 0x10(%rsp)
leaq 0x1801f(%rip), %rdi     # 0x2b540
leaq 0x40(%rsp), %r14
xorl %eax, %eax
movl 0x10(%rsp), %ebp
movl %eax, 0x14(%rsp)
testl %eax, %eax
je 0x1354d
leaq 0xfefe(%rip), %rdi      # 0x23439
movl 0x28(%rsp), %esi
xorl %eax, %eax
callq 0x5130
leaq 0x17ff3(%rip), %rdi     # 0x2b540
xorl %r13d, %r13d
leaq 0x1b2bd(%rip), %rbx     # 0x2e814
leaq 0xfef5(%rip), %r12      # 0x23453
leaq 0xfee8(%rip), %r15      # 0x2344d
movslq (%rbx), %rax
leaq 0x1a079(%rip), %rcx     # 0x2d5e8
movl (%rcx), %ecx
addl %r13d, %ecx
movslq %ecx, %rcx
imulq $-0x6db6db6d, %rcx, %rdx # imm = 0x92492493
shrq $0x20, %rdx
addl %ecx, %edx
movl %edx, %esi
shrl $0x1f, %esi
sarl $0x2, %edx
addl %esi, %edx
leal (,%rdx,8), %esi
subl %esi, %edx
addl %ecx, %edx
movslq %edx, %rcx
leaq (%rcx,%rcx,4), %rcx
imulq $0x8c, %rax, %rax
addq %rdi, %rax
leaq (%rax,%rcx,4), %rsi
movq %r14, %rdi
callq 0x50a0
movb $0x0, 0x42(%rsp)
movq %r12, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x5130
movq %r14, %rdi
callq 0x12e02
movq %r15, %rdi
xorl %eax, %eax
callq 0x5130
leaq 0x17f60(%rip), %rdi     # 0x2b540
incl %r13d
cmpl $0x7, %r13d
jne 0x13565
movl 0x14(%rsp), %eax
incl %eax
cmpl 0x18(%rsp), %eax
jne 0x1352c
leaq 0x120d4(%rip), %rdi     # 0x256d8
callq 0x50b0
movq 0x18(%rsp), %rbp
testl %ebp, %ebp
jle 0x13723
movl $0x5, %r15d
leaq 0x15b9d(%rip), %r12     # 0x291c0
movl %ebp, %r13d
movl 0x20(%rsp), %ebx
movl 0xc(%rsp), %eax
movl %eax, %r14d
movl %r14d, %edi
movl $0x1, %esi
movl %ebx, %edx
callq 0xab15
movl %r14d, %edx
xorl $0x2, %edx
movl %ebx, %esi
andl $0x3, %esi
xorl %ecx, %ecx
orl %edx, %esi
jne 0x1367d
imull $0xc28f5c29, %ebx, %edx # imm = 0xC28F5C29
addl $0x51eb850, %edx        # imm = 0x51EB850
movl %edx, %esi
rorl $0x2, %esi
movl $0x1, %ecx
cmpl $0x28f5c28, %esi        # imm = 0x28F5C28
ja 0x1367d
rorl $0x4, %edx
xorl %ecx, %ecx
cmpl $0xa3d70b, %edx         # imm = 0xA3D70B
setb %cl
leaq 0x19f64(%rip), %rdx     # 0x2d5e8
movl (%rdx), %edx
movl %eax, %esi
subl %edx, %esi
negl %edx
addl %edx, %eax
addl $0x7, %eax
cltq
imulq $-0x6db6db6d, %rax, %rax # imm = 0x92492493
shrq $0x20, %rax
addl %esi, %eax
addl $0x7, %eax
movl %eax, %edx
shrl $0x1f, %edx
sarl $0x2, %eax
addl %edx, %eax
leal (,%rax,8), %edx
subl %edx, %eax
addl %esi, %eax
addl $0x7, %eax
movslq %r14d, %rdx
movsbl -0x1(%rdx,%r12), %edx
addl %eax, %edx
addl %ecx, %edx
movl $0x6, %esi
cmpl $0x24, %edx
jge 0x136d5
movl %r15d, %esi
xorl %eax, %eax
cmpl $0xc, %r14d
leal 0x1(%r14), %ecx
sete %al
movl $0x1, %edx
cmovel %edx, %ecx
addl %eax, %ebx
movl %esi, %r15d
movl %ecx, %r14d
decl %r13d
jne 0x13631
jmp 0x13728
leaq 0x11fd4(%rip), %rdi     # 0x256d8
callq 0x50b0
leaq 0x11faa(%rip), %rdi     # 0x256ba
xorl %eax, %eax
callq 0x5130
leaq 0x11fba(%rip), %rdi     # 0x256d8
callq 0x50b0
movl $0x5, %esi
leaq 0xfd34(%rip), %r12      # 0x23463
movl $0x0, 0x24(%rsp)
xorl %eax, %eax
movl 0xc(%rsp), %ebx
movl %esi, 0x34(%rsp)
movl %eax, 0x38(%rsp)
leaq 0x11f6e(%rip), %rdi     # 0x256ba
xorl %eax, %eax
callq 0x5130
testl %ebp, %ebp
jle 0x13904
xorl %esi, %esi
movl 0x20(%rsp), %r13d
movl %ebx, %r14d
movl %esi, 0x14(%rsp)
testl %esi, %esi
je 0x13777
movq %r12, %rdi
xorl %eax, %eax
callq 0x5130
movl %r14d, %edi
movl $0x1, %esi
movl %r13d, %edx
callq 0xab15
movl %eax, %ebp
leaq 0x19e58(%rip), %rax     # 0x2d5e8
movl (%rax), %r15d
movq %r14, 0x28(%rsp)
movslq %r14d, %r14
leaq 0x15a1e(%rip), %rax     # 0x291c0
movsbl -0x1(%r14,%rax), %eax
movl %eax, 0x3c(%rsp)
movl %r14d, %eax
xorl $0x2, %eax
movl %r13d, %ecx
andl $0x3, %ecx
xorl %ebx, %ebx
orl %eax, %ecx
jne 0x137e9
imull $0xc28f5c29, %r13d, %eax # imm = 0xC28F5C29
addl $0x51eb850, %eax        # imm = 0x51EB850
movl %eax, %ecx
rorl $0x2, %ecx
movl $0x1, %ebx
cmpl $0x28f5c28, %ecx        # imm = 0x28F5C28
ja 0x137e9
rorl $0x4, %eax
xorl %ebx, %ebx
cmpl $0xa3d70b, %eax         # imm = 0xA3D70B
setb %bl
movl %r13d, %edi
xorl %esi, %esi
callq 0xc8d0
testq %rax, %rax
movl %r13d, 0x10(%rsp)
je 0x1380b
movq (%rax,%r14,8), %rax
testq %rax, %rax
je 0x1380b
movq (%rax), %r14
jmp 0x1380e
xorl %r14d, %r14d
movl %ebp, %eax
subl %r15d, %eax
negl %r15d
leal (%r15,%rbp), %ecx
addl $0x7, %ecx
movslq %ecx, %rcx
imulq $-0x6db6db6d, %rcx, %rcx # imm = 0x92492493
shrq $0x20, %rcx
addl %eax, %ecx
addl $0x7, %ecx
movl %ecx, %edx
shrl $0x1f, %edx
sarl $0x2, %ecx
addl %edx, %ecx
leal (,%rcx,8), %edx
subl %edx, %ecx
addl %ecx, %eax
addl $0x7, %eax
addl 0x3c(%rsp), %ebx
movl 0x24(%rsp), %r15d
subl %eax, %r15d
movl $0x7, %r13d
movl %r15d, %ebp
leal 0x1(%rbp), %r15d
movq %r12, %rdi
testl %r15d, %r15d
jle 0x138be
movq %r12, %rdi
cmpl %ebx, %r15d
jg 0x138be
leaq 0xfbf9(%rip), %rdi      # 0x23471
xorl %eax, %eax
callq 0x5130
btq %rbp, %r14
jae 0x138a6
leaq 0xfab6(%rip), %rdi      # 0x23342
leaq 0xfab6(%rip), %rsi      # 0x23349
movl %r15d, %edx
leaq 0xfac4(%rip), %rcx      # 0x23361
xorl %eax, %eax
callq 0x5130
jmp 0x138b7
leaq 0xca3d(%rip), %rdi      # 0x202ea
movl %r15d, %esi
xorl %eax, %eax
callq 0x5130
leaq 0xfbad(%rip), %rdi      # 0x2346b
xorl %eax, %eax
callq 0x5130
decq %r13
jne 0x1385a
movl 0x14(%rsp), %esi
incl %esi
xorl %eax, %eax
movq 0x28(%rsp), %rcx
cmpl $0xc, %ecx
leal 0x1(%rcx), %ecx
movl $0x1, %edx
cmovel %edx, %ecx
sete %al
movl 0x10(%rsp), %r13d
addl %eax, %r13d
movl %ecx, %r14d
movq 0x18(%rsp), %rbp
cmpl %ebp, %esi
movl 0xc(%rsp), %ebx
jne 0x13765
leaq 0x11dcd(%rip), %rdi     # 0x256d8
callq 0x50b0
movl 0x38(%rsp), %eax
incl %eax
addl $0x7, 0x24(%rsp)
movl 0x34(%rsp), %esi
cmpl %esi, %eax
jne 0x13741
leaq 0x11da1(%rip), %rdi     # 0x256cf
callq 0x50b0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq