// File: /workspace/github_c_makefile_star2_O1/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, %ebx
movl %esi, 0xc(%rsp)
movl %edi, 0x8(%rsp)
movl $0xc, %eax
xorl %edx, %edx
idivl %ebx
movl %ebx, %edx
movl %eax, 0x10(%rsp)
imull %eax, %edx
movl %edx, %ecx
shll $0x3, %ecx
negl %ecx
leal (%rdx,%rcx), %eax
addl $0x64, %eax
leal -0x1(%rbx), %ecx
cltd
idivl %ecx
movl %eax, 0x28(%rsp)
leaq 0xf283(%rip), %rdi      # 0x22238
xorl %esi, %esi
xorl %eax, %eax
callq 0x5130
leaq 0x11685(%rip), %rdi     # 0x2464a
xorl %eax, %eax
callq 0x5130
movq %rbx, 0x18(%rsp)
testl %ebx, %ebx
jle 0x1306d
leaq 0xf315(%rip), %r13      # 0x222f5
movl $0x1, %r15d
xorl %ebx, %ebx
movl 0xc(%rsp), %ebp
movl 0x8(%rsp), %r14d
testl %ebx, %ebx
je 0x13003
leaq 0xf3b3(%rip), %rdi      # 0x223af
xorl %eax, %eax
callq 0x5130
leaq 0xf251(%rip), %rdi      # 0x2225b
leaq 0xf25f(%rip), %rsi      # 0x22270
xorl %eax, %eax
callq 0x5130
leaq 0x1a7f5(%rip), %rax     # 0x2d814
movslq (%rax), %rax
movslq %r14d, %r12
leaq (%rax,%rax,2), %rax
shlq $0x5, %rax
addq 0x14f74(%rip), %rax     # 0x27fa8
movq -0x8(%rax,%r12,8), %rdi
callq 0x12976
leaq 0xf378(%rip), %rdi      # 0x223bd
movl %ebp, %esi
movq %r13, %rdx
xorl %eax, %eax
callq 0x5130
incl %ebx
leal 0x1(%r12), %r14d
xorl %eax, %eax
cmpl $0xc, %r12d
sete %al
cmovel %r15d, %r14d
addl %eax, %ebp
cmpl %ebx, 0x18(%rsp)
jne 0x12ff1
leaq 0x115f4(%rip), %rdi     # 0x24668
callq 0x50b0
leaq 0x115ca(%rip), %rdi     # 0x2464a
xorl %eax, %eax
callq 0x5130
movq 0x18(%rsp), %rbp
testl %ebp, %ebp
jle 0x13173
leaq 0x174a5(%rip), %rdi     # 0x2a540
leaq 0x40(%rsp), %r14
xorl %eax, %eax
movq %rdi, %r15
movl 0x10(%rsp), %r13d
movl %eax, 0x14(%rsp)
testl %eax, %eax
je 0x130c7
leaq 0xf310(%rip), %rdi      # 0x223c9
movl 0x28(%rsp), %esi
xorl %eax, %eax
callq 0x5130
movq %r15, %rdi
xorl %ebp, %ebp
leaq 0xf313(%rip), %r12      # 0x223e3
leaq 0xf306(%rip), %rbx      # 0x223dd
leaq 0x1a736(%rip), %rax     # 0x2d814
movslq (%rax), %rax
leaq 0x19500(%rip), %rcx     # 0x2c5e8
movl (%rcx), %ecx
addl %ebp, %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 %r13d, %esi
xorl %eax, %eax
callq 0x5130
movq %r14, %rdi
callq 0x12976
movq %rbx, %rdi
xorl %eax, %eax
callq 0x5130
movq %r15, %rdi
incl %ebp
cmpl $0x7, %ebp
jne 0x130d7
movl 0x14(%rsp), %eax
incl %eax
movq 0x18(%rsp), %rbp
cmpl %ebp, %eax
jne 0x130aa
leaq 0x114ee(%rip), %rdi     # 0x24668
callq 0x50b0
testl %ebp, %ebp
jle 0x1326f
movq %rbp, %rax
movl $0x5, %ebp
leaq 0x19452(%rip), %r15     # 0x2c5e8
leaq 0x15023(%rip), %r12     # 0x281c0
movl %eax, %r13d
movl 0xc(%rsp), %ebx
movl 0x8(%rsp), %eax
movl %eax, %r14d
movl %r14d, %edi
movl $0x1, %esi
movl %ebx, %edx
callq 0xa53f
movl %r14d, %edx
xorl $0x2, %edx
movl %ebx, %esi
andl $0x3, %esi
xorl %ecx, %ecx
orl %edx, %esi
jne 0x131f7
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 0x131f7
rorl $0x4, %edx
xorl %ecx, %ecx
cmpl $0xa3d70b, %edx         # imm = 0xA3D70B
setb %cl
movl (%r15), %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 0x13248
movl %ebp, %esi
xorl %eax, %eax
cmpl $0xc, %r14d
leal 0x1(%r14), %ecx
sete %al
movl $0x1, %edx
cmovel %edx, %ecx
addl %eax, %ebx
movl %esi, %ebp
movl %ecx, %r14d
decl %r13d
jne 0x131ab
jmp 0x13274
movl $0x5, %esi
leaq 0xf178(%rip), %r12      # 0x223f3
movl $0x0, 0x24(%rsp)
xorl %eax, %eax
movq 0x18(%rsp), %rbx
movl %esi, 0x34(%rsp)
movl %eax, 0x38(%rsp)
leaq 0x113b1(%rip), %rdi     # 0x2464a
xorl %eax, %eax
callq 0x5130
testl %ebx, %ebx
jle 0x1344f
xorl %esi, %esi
movl 0xc(%rsp), %ebp
movl 0x8(%rsp), %eax
movl %eax, %r14d
movl %esi, 0x14(%rsp)
testl %esi, %esi
je 0x132c7
movq %r12, %rdi
xorl %eax, %eax
callq 0x5130
movl %r14d, %edi
movl $0x1, %esi
movl %ebp, %edx
callq 0xa53f
movl %eax, %r13d
leaq 0x19308(%rip), %rax     # 0x2c5e8
movl (%rax), %r15d
movq %r14, 0x28(%rsp)
movslq %r14d, %r14
leaq 0x14ece(%rip), %rax     # 0x281c0
movsbl -0x1(%r14,%rax), %eax
movl %eax, 0x3c(%rsp)
movl %r14d, %eax
xorl $0x2, %eax
movl %ebp, %ecx
andl $0x3, %ecx
xorl %ebx, %ebx
orl %eax, %ecx
jne 0x13337
imull $0xc28f5c29, %ebp, %eax # imm = 0xC28F5C29
addl $0x51eb850, %eax        # imm = 0x51EB850
movl %eax, %ecx
rorl $0x2, %ecx
movl $0x1, %ebx
cmpl $0x28f5c28, %ecx        # imm = 0x28F5C28
ja 0x13337
rorl $0x4, %eax
xorl %ebx, %ebx
cmpl $0xa3d70b, %eax         # imm = 0xA3D70B
setb %bl
movl %ebp, %edi
xorl %esi, %esi
callq 0xc3f7
testq %rax, %rax
je 0x1334b
movq (%rax,%r14,8), %rax
jmp 0x1334d
xorl %eax, %eax
movl %ebp, 0x10(%rsp)
testq %rax, %rax
je 0x1335b
movq (%rax), %r14
jmp 0x1335e
xorl %r14d, %r14d
movl %r13d, %eax
subl %r15d, %eax
negl %r15d
leal (%r15,%r13), %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 0x1340f
movq %r12, %rdi
cmpl %ebx, %r15d
jg 0x1340f
leaq 0xf038(%rip), %rdi      # 0x22401
xorl %eax, %eax
callq 0x5130
btq %rbp, %r14
jae 0x133f7
leaq 0xeef5(%rip), %rdi      # 0x222d2
leaq 0xeef5(%rip), %rsi      # 0x222d9
movl %r15d, %edx
leaq 0xef03(%rip), %rcx      # 0x222f1
xorl %eax, %eax
callq 0x5130
jmp 0x13408
leaq 0xbe7c(%rip), %rdi      # 0x1f27a
movl %r15d, %esi
xorl %eax, %eax
callq 0x5130
leaq 0xefec(%rip), %rdi      # 0x223fb
xorl %eax, %eax
callq 0x5130
decq %r13
jne 0x133ab
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), %ebp
addl %eax, %ebp
movl %ecx, %r14d
movq 0x18(%rsp), %rbx
cmpl %ebx, %esi
jne 0x132b5
leaq 0x11212(%rip), %rdi     # 0x24668
callq 0x50b0
movl 0x38(%rsp), %eax
incl %eax
addl $0x7, 0x24(%rsp)
movl 0x34(%rsp), %esi
cmpl %esi, %eax
jne 0x1328e
leaq 0x111e6(%rip), %rdi     # 0x2465f
callq 0x50b0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq