// File: /workspace/github_c_makefile_star2_O2/mmayer[P]pcal/src/writefil.c
// Function: print_month
void print_month (int month, int year)
{
   static int nmonths = 0;
#ifdef EPS_DSC
   static int page = 0;
#endif
   int startbox;

#ifdef EPS_DSC
   /* start of new physical page? */
   if (!do_whole_year || nmonths % 12 == 0) {
      page++;
      printf("%%%%Page: %d %d\n", page, page);
      printf("%%%%BeginPageSetup\n");
      printf("clear flush\n");
      printf("/PageNum { %d } def\n", page);
      printf("/PageState save def\n");
      printf("%%%%EndPageSetup\n\n");
   }
#endif

   if (do_whole_year) {
      /* reset foot strings at start of each page */
      if (nmonths % 12 == 0) {
         def_footstring(lfoot, "Lfootstring");
         def_footstring(cfoot, "Cfootstring");
         def_footstring(rfoot, "Rfootstring");
         def_footstring(notes_hdr, "notesheading");
         printf("\n");
      }
   }
   
   /* set up year and month */
   printf("/year %d def\n", year);
   printf("/month %d def\n", month);
   
   /* move starting box to second row if conflict with small calendars */
   startbox = START_BOX(month, year);
   if (!do_whole_year &&
       (prev_cal_box[small_cal_pos] == startbox ||
        next_cal_box[small_cal_pos] == startbox)) {
      startbox += 7;
   }

   printf("/startbox %d def\n", startbox);
   printf("/ndays %d def\n", LENGTH_OF(month, year));
   
   find_noteboxes(month, year);   /* make list of note boxes */
   print_colors(month, year);   /* make list of date colors */

   /* Are we printing 12 months per page or only one? */
   if (do_whole_year) {
      printf("/posn %d def\n", nmonths % 12);   /* location on page */

      print_julian_info(month, year);   /* Julian date info */
      print_moon_info(month, year);   /* moon info */

      printf("printmonth\n\n");
   }
   else {
      /* reset foot strings each month (may change) */
      def_footstring(lfoot, "Lfootstring");
      def_footstring(cfoot, "Cfootstring");
      def_footstring(rfoot, "Rfootstring");
      def_footstring(notes_hdr, "notesheading");
      
      /* generate information necessary for small calendars */
      
      if (small_cal_pos != SC_NONE) {
         int m, y;
         
         printf("/p_year %d def\n", y = PREV_YEAR(month, year));
         printf("/p_month %d def\n", m = PREV_MONTH(month, year));
         printf("/p_startbox %d def\n", START_BOX(m, y));
         printf("/p_ndays %d def\n", LENGTH_OF(m, y));
         
         printf("/n_year %d def\n", y = NEXT_YEAR(month, year));
         printf("/n_month %d def\n", m = NEXT_MONTH(month, year));
         printf("/n_startbox %d def\n", START_BOX(m, y));
         printf("/n_ndays %d def\n", LENGTH_OF(m, y));
      }

      print_julian_info(month, year);   /* Julian date info */
      print_moon_info(month, year);   /* moon info */
      
      printf("printmonth\n");
      find_daytext(month, year, TRUE);   /* holiday text */
      find_daytext(month, year, FALSE);   /* day and note text */
      find_images(month, year);   /* EPS images */
   }
   
   /* end of physical page? */
   if (!do_whole_year || ++nmonths % 12 == 0) {
#ifdef EPS_DSC
      printf("%%%%PageTrailer\n");
      printf("showpage\n");
      printf("clear flush\n");
      printf("PageState restore\n");
#else
      printf("showpage\n");
#endif
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %r14d
leaq 0x1b78d(%rip), %r15     # 0x2c6b4
cmpl $0x0, (%r15)
pushq $0xc
popq %r13
je 0x10f3f
movl 0x1e191(%rip), %eax     # 0x2f0c8
cltd
idivl %r13d
testl %edx, %edx
jne 0x10fab
movl 0x1e187(%rip), %edx     # 0x2f0cc
incl %edx
movl %edx, 0x1e17f(%rip)     # 0x2f0cc
leaq 0x106e2(%rip), %rdi     # 0x21636
movl %edx, %esi
xorl %eax, %eax
callq 0x5130
leaq 0x106e3(%rip), %rdi     # 0x21647
xorl %eax, %eax
callq 0x5130
leaq 0x126da(%rip), %rdi     # 0x2364c
callq 0x50b0
movl 0x1e14f(%rip), %esi     # 0x2f0cc
leaq 0x106d7(%rip), %rdi     # 0x2165b
xorl %eax, %eax
callq 0x5130
leaq 0x12686(%rip), %rdi     # 0x23618
callq 0x50b0
leaq 0x106d2(%rip), %rdi     # 0x21670
xorl %eax, %eax
callq 0x5130
cmpl $0x0, (%r15)
je 0x1100d
movl 0x1e117(%rip), %eax     # 0x2f0c8
cltd
idivl %r13d
testl %edx, %edx
jne 0x1100d
leaq 0x1b3b0(%rip), %rdi     # 0x2c370
leaq 0x106bc(%rip), %rsi     # 0x21683
callq 0x1310a
leaq 0x1b46d(%rip), %rdi     # 0x2c440
leaq 0x106b5(%rip), %rsi     # 0x2168f
callq 0x1310a
leaq 0x1b52a(%rip), %rdi     # 0x2c510
leaq 0x106ae(%rip), %rsi     # 0x2169b
callq 0x1310a
leaq 0x1b737(%rip), %rdi     # 0x2c730
leaq 0x106a7(%rip), %rsi     # 0x216a7
callq 0x1310a
pushq $0xa
popq %rdi
callq 0x5060
leaq 0x106a0(%rip), %rdi     # 0x216b4
xorl %ebp, %ebp
movl %ebx, %esi
xorl %eax, %eax
callq 0x5130
leaq 0x1069c(%rip), %rdi     # 0x216c2
movl %r14d, %esi
xorl %eax, %eax
callq 0x5130
pushq $0x1
popq %r12
movl %r14d, %edi
movl %r12d, %esi
movl %ebx, %edx
callq 0x9d79
leaq 0x1b590(%rip), %rcx     # 0x2c5d8
movl (%rcx), %ecx
negl %ecx
addl %ecx, %eax
addl $0x7, %eax
pushq $0x7
popq %rcx
cltd
idivl %ecx
cmpl $0x0, (%r15)
jne 0x11082
leaq 0x17538(%rip), %rax     # 0x2859c
movslq (%rax), %rax
leaq 0x17532(%rip), %rcx     # 0x285a0
cmpl %edx, (%rcx,%rax,4)
je 0x1107f
leaq 0x17536(%rip), %rcx     # 0x285b0
cmpl %edx, (%rcx,%rax,4)
jne 0x11082
addl $0x7, %edx
leaq 0x10648(%rip), %rdi     # 0x216d1
movl %edx, %esi
xorl %eax, %eax
callq 0x5130
movslq %r14d, %r15
leaq 0x17114(%rip), %rax     # 0x281b0
movsbl -0x1(%rax,%r15), %ecx
movl %r14d, %eax
xorl $0x2, %eax
movl %ebx, %edx
andl $0x3, %edx
orl %eax, %edx
pushq $0x64
popq %rsi
jne 0x110d2
movl %ebx, %eax
cltd
idivl %esi
movl %r12d, %ebp
testl %edx, %edx
jne 0x110d2
movl $0x190, %esi            # imm = 0x190
movl %ebx, %eax
cltd
idivl %esi
xorl %ebp, %ebp
testl %edx, %edx
sete %bpl
addl %ecx, %ebp
leaq 0x10608(%rip), %rdi     # 0x216e3
movl %ebp, %esi
xorl %eax, %eax
callq 0x5130
movl %r14d, %edi
movl %ebx, %esi
callq 0x136c9
movl %r14d, %edi
movl %ebx, %esi
callq 0x1357f
leaq 0x1b5b5(%rip), %rax     # 0x2c6b4
cmpl $0x0, (%rax)
je 0x11143
movl 0x1dfbe(%rip), %eax     # 0x2f0c8
cltd
idivl %r13d
leaq 0x105dd(%rip), %rdi     # 0x216f2
movl %edx, %esi
xorl %eax, %eax
callq 0x5130
movl %r14d, %edi
movl %ebx, %esi
callq 0x139a6
movl %r14d, %edi
movl %ebx, %esi
callq 0x1375a
leaq 0x124fe(%rip), %rdi     # 0x23637
callq 0x50b0
jmp 0x11363
leaq 0x1b226(%rip), %rdi     # 0x2c370
leaq 0x10532(%rip), %rsi     # 0x21683
callq 0x1310a
leaq 0x1b2e3(%rip), %rdi     # 0x2c440
leaq 0x1052b(%rip), %rsi     # 0x2168f
callq 0x1310a
leaq 0x1b3a0(%rip), %rdi     # 0x2c510
leaq 0x10524(%rip), %rsi     # 0x2169b
callq 0x1310a
leaq 0x1b5ad(%rip), %rdi     # 0x2c730
leaq 0x1051d(%rip), %rsi     # 0x216a7
callq 0x1310a
leaq 0x17406(%rip), %rax     # 0x2859c
cmpl $0x0, (%rax)
je 0x11320
decq %r15
xorl %eax, %eax
cmpl $0x1, %r14d
cmovel %r13d, %r15d
sete %al
movl %ebx, %r13d
subl %eax, %r13d
leaq 0x10544(%rip), %rdi     # 0x21700
xorl %ebp, %ebp
movl %r13d, %esi
xorl %eax, %eax
callq 0x5130
leaq 0x10541(%rip), %rdi     # 0x21710
movl %r15d, %esi
xorl %eax, %eax
callq 0x5130
pushq $0x1
popq %r12
movl %r15d, %edi
movl %r12d, %esi
movl %r13d, %edx
callq 0x9d79
leaq 0x1b3e6(%rip), %rcx     # 0x2c5d8
subl (%rcx), %eax
addl $0x7, %eax
cltd
pushq $0x7
popq %rcx
idivl %ecx
leaq 0x1051d(%rip), %rdi     # 0x21721
movl %edx, %esi
xorl %eax, %eax
callq 0x5130
movslq %r15d, %rax
leaq 0x16f99(%rip), %rcx     # 0x281b0
movsbl -0x1(%rax,%rcx), %ecx
xorl $0x2, %eax
movl %r13d, %edx
andl $0x3, %edx
orl %eax, %edx
movl $0x0, %esi
jne 0x11253
movl %r13d, %eax
cltd
pushq $0x64
popq %rsi
idivl %esi
testl %edx, %edx
je 0x11240
pushq $0x1
popq %rsi
jmp 0x11253
movl $0x190, %esi            # imm = 0x190
movl %r13d, %eax
cltd
idivl %esi
xorl %esi, %esi
testl %edx, %edx
sete %sil
addl %ecx, %esi
leaq 0x104d9(%rip), %rdi     # 0x21735
xorl %eax, %eax
callq 0x5130
leal 0x1(%r14), %r13d
xorl %r15d, %r15d
cmpl $0xc, %r14d
sete %r15b
cmovel %r12d, %r13d
addl %ebx, %r15d
leaq 0x104c6(%rip), %rdi     # 0x21746
movl %r15d, %esi
xorl %eax, %eax
callq 0x5130
leaq 0x104c5(%rip), %rdi     # 0x21756
movl %r13d, %esi
xorl %eax, %eax
callq 0x5130
movl %r13d, %edi
movl %r12d, %esi
movl %r15d, %edx
callq 0x9d79
leaq 0x1b328(%rip), %rcx     # 0x2c5d8
subl (%rcx), %eax
addl $0x7, %eax
cltd
pushq $0x7
popq %rcx
idivl %ecx
leaq 0x104a5(%rip), %rdi     # 0x21767
movl %edx, %esi
xorl %eax, %eax
callq 0x5130
movslq %r13d, %rax
leaq 0x16edb(%rip), %rcx     # 0x281b0
movsbl -0x1(%rax,%rcx), %ecx
xorl $0x2, %eax
movl %r15d, %edx
andl $0x3, %edx
orl %eax, %edx
jne 0x1130a
movl %r15d, %eax
cltd
pushq $0x64
popq %rsi
idivl %esi
movl %r12d, %ebp
testl %edx, %edx
jne 0x1130a
movl $0x190, %esi            # imm = 0x190
movl %r15d, %eax
cltd
idivl %esi
xorl %ebp, %ebp
testl %edx, %edx
sete %bpl
addl %ecx, %ebp
leaq 0x10468(%rip), %rdi     # 0x2177b
movl %ebp, %esi
xorl %eax, %eax
callq 0x5130
pushq $0xc
popq %r13
movl %r14d, %edi
movl %ebx, %esi
callq 0x139a6
movl %r14d, %edi
movl %ebx, %esi
callq 0x1375a
leaq 0x122f1(%rip), %rdi     # 0x2362c
callq 0x50b0
pushq $0x1
popq %rdx
movl %r14d, %edi
movl %ebx, %esi
callq 0x1322d
movl %r14d, %edi
movl %ebx, %esi
xorl %edx, %edx
callq 0x1322d
movl %r14d, %edi
movl %ebx, %esi
callq 0x1343f
leaq 0x1b34a(%rip), %rax     # 0x2c6b4
cmpl $0x0, (%rax)
je 0x11394
movl 0x1dd53(%rip), %eax     # 0x2f0c8
incl %eax
movl %eax, 0x1dd4b(%rip)     # 0x2f0c8
cltd
idivl %r13d
testl %edx, %edx
je 0x11394
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x103f1(%rip), %rdi     # 0x2178c
xorl %eax, %eax
callq 0x5130
leaq 0x1229a(%rip), %rdi     # 0x23643
callq 0x50b0
leaq 0x12297(%rip), %rdi     # 0x2364c
callq 0x50b0
leaq 0x12297(%rip), %rdi     # 0x23658
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x50b0