// File: /workspace/github_c_makefile_star2_O2/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, %r14d
movl %esi, %r15d
movl %edi, %r13d
pushq $0xc
popq %rax
xorl %ebp, %ebp
xorl %edx, %edx
idivl %r14d
movl %eax, %ebx
imull %r14d, %eax
imull $-0x7, %eax, %eax
movl %eax, 0xc(%rsp)
leal -0x1(%r14), %eax
movl %eax, 0x10(%rsp)
leaq 0xf316(%rip), %rdi      # 0x21258
xorl %esi, %esi
xorl %eax, %eax
callq 0x5130
leaq 0x11718(%rip), %rdi     # 0x2366a
xorl %eax, %eax
callq 0x5130
testl %r14d, %r14d
cmovlel %ebp, %r14d
movq %r14, 0x20(%rsp)
leaq 0xf3a9(%rip), %r12      # 0x21315
movl %r13d, 0x14(%rsp)
movl %r13d, %ebp
movl %r15d, 0x18(%rsp)
movl %r15d, %r14d
xorl %r15d, %r15d
cmpl %r15d, 0x20(%rsp)
je 0x11fff
testl %r15d, %r15d
je 0x11f99
leaq 0xf43d(%rip), %rdi      # 0x213cf
xorl %eax, %eax
callq 0x5130
leaq 0xf2db(%rip), %rdi      # 0x2127b
leaq 0xf2e9(%rip), %rsi      # 0x21290
xorl %eax, %eax
callq 0x5130
leaq 0x1b84f(%rip), %rax     # 0x2d804
movslq (%rax), %rax
movslq %ebp, %r13
imulq $0x60, %rax, %rax
addq 0x15fe2(%rip), %rax     # 0x27fa8
movq -0x8(%rax,%r13,8), %rdi
callq 0x11aa6
leaq 0xf406(%rip), %rdi      # 0x213dd
movl %r14d, %esi
movq %r12, %rdx
xorl %eax, %eax
callq 0x5130
incl %r15d
leal 0x1(%r13), %ebp
xorl %eax, %eax
cmpl $0xc, %r13d
sete %al
pushq $0x1
popq %rcx
cmovel %ecx, %ebp
addl %eax, %r14d
jmp 0x11f7f
movl 0xc(%rsp), %eax
addl $0x64, %eax
cltd
idivl 0x10(%rsp)
movl %eax, 0xc(%rsp)
leaq 0x11672(%rip), %rdi     # 0x23688
callq 0x50b0
leaq 0x11648(%rip), %rdi     # 0x2366a
xorl %eax, %eax
callq 0x5130
leaq 0x18500(%rip), %r15     # 0x2a530
leaq 0x40(%rsp), %r14
leaq 0xf3c7(%rip), %r12      # 0x21403
leaq 0xf3ba(%rip), %r13      # 0x213fd
xorl %eax, %eax
cmpl 0x20(%rsp), %eax
je 0x120d9
movl %eax, 0x10(%rsp)
testl %eax, %eax
je 0x12069
leaq 0xf38b(%rip), %rdi      # 0x213e9
movl 0xc(%rsp), %esi
xorl %eax, %eax
callq 0x5130
xorl %ebp, %ebp
cmpl $0x7, %ebp
je 0x120ce
leaq 0x1b78d(%rip), %rax     # 0x2d804
movslq (%rax), %rcx
leaq 0x1a557(%rip), %rax     # 0x2c5d8
movl (%rax), %eax
addl %ebp, %eax
cltd
pushq $0x7
popq %rsi
idivl %esi
movslq %edx, %rax
imulq $0x14, %rax, %rax
imulq $0x8c, %rcx, %rsi
addq %r15, %rsi
addq %rax, %rsi
movq %r14, %rdi
callq 0x50a0
movb $0x0, 0x42(%rsp)
movq %r12, %rdi
movl %ebx, %esi
xorl %eax, %eax
callq 0x5130
movq %r14, %rdi
callq 0x11aa6
movq %r13, %rdi
xorl %eax, %eax
callq 0x5130
incl %ebp
jmp 0x1206b
movl 0x10(%rsp), %eax
incl %eax
jmp 0x12045
leaq 0x115a8(%rip), %rdi     # 0x23688
callq 0x50b0
pushq $0x5
popq %r15
movl $0x190, %ebp            # imm = 0x190
pushq $0x6
popq %r12
movq 0x20(%rsp), %rax
movl %eax, %r13d
movl 0x14(%rsp), %eax
movl %eax, %r14d
movl 0x18(%rsp), %ebx
pushq $0x1
popq %rsi
subl $0x1, %r13d
jb 0x12195
movl %r14d, %edi
movl %ebx, %edx
callq 0x9d79
pushq $0x1
popq %rsi
leaq 0x1a4b2(%rip), %rcx     # 0x2c5d8
movl (%rcx), %ecx
negl %ecx
addl %ecx, %eax
addl $0x7, %eax
cltd
pushq $0x7
popq %rcx
idivl %ecx
movl %edx, %ecx
movslq %r14d, %rdx
leaq 0x1606f(%rip), %rax     # 0x281b0
movsbl -0x1(%rdx,%rax), %r8d
xorl $0x2, %edx
movl %ebx, %edi
andl $0x3, %edi
xorl %eax, %eax
orl %edx, %edi
jne 0x1216f
movl %ebx, %eax
cltd
pushq $0x64
popq %rdi
idivl %edi
movl %esi, %eax
testl %edx, %edx
jne 0x1216f
movl %ebx, %eax
cltd
idivl %ebp
xorl %eax, %eax
testl %edx, %edx
sete %al
addl %r8d, %ecx
addl %eax, %ecx
cmpl $0x24, %ecx
cmovgel %r12d, %r15d
xorl %eax, %eax
cmpl $0xc, %r14d
leal 0x1(%r14), %ecx
sete %al
cmovel %esi, %ecx
addl %eax, %ebx
movl %ecx, %r14d
jmp 0x12108
xorl %eax, %eax
testl %r15d, %r15d
cmovlel %eax, %r15d
movl %r15d, 0x2c(%rsp)
pushq $0x1
popq %rbx
leaq 0xf266(%rip), %rbp      # 0x21413
movl $0x0, 0x1c(%rsp)
xorl %eax, %eax
cmpl 0x2c(%rsp), %eax
je 0x12367
movl %eax, 0x30(%rsp)
xorl %r14d, %r14d
leaq 0x1149b(%rip), %rdi     # 0x2366a
xorl %eax, %eax
callq 0x5130
movl 0x14(%rsp), %eax
movl %eax, %r12d
movl 0x18(%rsp), %r15d
cmpl 0x20(%rsp), %r14d
je 0x1234b
movl %r14d, 0x10(%rsp)
testl %r14d, %r14d
je 0x12201
movq %rbp, %rdi
xorl %eax, %eax
callq 0x5130
movl %r12d, %edi
movl %ebx, %esi
movl %r15d, %edx
callq 0x9d79
leaq 0x1a3c3(%rip), %rcx     # 0x2c5d8
movl (%rcx), %ecx
negl %ecx
addl %ecx, %eax
addl $0x7, %eax
cltd
pushq $0x7
popq %rcx
idivl %ecx
movl %edx, 0x34(%rsp)
movq %r12, 0x38(%rsp)
movslq %r12d, %r14
leaq 0x15f79(%rip), %rax     # 0x281b0
movsbl -0x1(%r14,%rax), %r13d
movl %r14d, %eax
xorl $0x2, %eax
movl %r15d, %ecx
andl $0x3, %ecx
xorl %r12d, %r12d
orl %eax, %ecx
jne 0x12274
movl %r15d, %eax
cltd
pushq $0x64
popq %rcx
idivl %ecx
movl %ebx, %r12d
testl %edx, %edx
jne 0x12274
movl %r15d, %eax
cltd
movl $0x190, %ecx            # imm = 0x190
idivl %ecx
xorl %r12d, %r12d
testl %edx, %edx
sete %r12b
movl %r15d, %edi
xorl %esi, %esi
callq 0xb9d3
testq %rax, %rax
movl %r15d, 0xc(%rsp)
je 0x12296
movq (%rax,%r14,8), %rax
testq %rax, %rax
je 0x12296
movq (%rax), %r15
jmp 0x12299
xorl %r15d, %r15d
addl %r13d, %r12d
movl 0x1c(%rsp), %r13d
subl 0x34(%rsp), %r13d
pushq $0x7
popq %r14
subq $0x1, %r14
jb 0x1231d
movl %r13d, %ebx
leal 0x1(%rbx), %r13d
movq %rbp, %rdi
testl %r13d, %r13d
jle 0x12314
movq %rbp, %rdi
cmpl %r12d, %r13d
jg 0x12314
leaq 0xf153(%rip), %rdi      # 0x21421
xorl %eax, %eax
callq 0x5130
btq %rbx, %r15
jae 0x122fc
leaq 0xf010(%rip), %rdi      # 0x212f2
leaq 0xf010(%rip), %rsi      # 0x212f9
movl %r13d, %edx
leaq 0xf01e(%rip), %rcx      # 0x21311
xorl %eax, %eax
callq 0x5130
jmp 0x1230d
leaq 0xbf97(%rip), %rdi      # 0x1e29a
movl %r13d, %esi
xorl %eax, %eax
callq 0x5130
leaq 0xf107(%rip), %rdi      # 0x2141b
xorl %eax, %eax
callq 0x5130
jmp 0x122aa
movl 0x10(%rsp), %r14d
incl %r14d
xorl %eax, %eax
movq 0x38(%rsp), %rcx
cmpl $0xc, %ecx
leal 0x1(%rcx), %ecx
sete %al
pushq $0x1
popq %rbx
cmovel %ebx, %ecx
movl 0xc(%rsp), %r15d
addl %eax, %r15d
movl %ecx, %r12d
jmp 0x121e2
leaq 0x11336(%rip), %rdi     # 0x23688
callq 0x50b0
movl 0x30(%rsp), %eax
incl %eax
addl $0x7, 0x1c(%rsp)
jmp 0x121b7
leaq 0x11311(%rip), %rdi     # 0x2367f
callq 0x50b0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq