#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/ *);
void print_month_header(FILE *f) {
  const char *month_header =
      "/Row 0 def\n"
      "/Col 0 def\n"
      "/DayNumber 0 def\n"
      "/LM  60 def\n"
      "/RM 780 def\n"
      "/TM 550 def\n"
      "/BM  50 def\n"
      "\n"
      "%------------------------------------------------------------------\n"
      "% Utility routines are up here\n"
      "\n"
      "/Rectangle {\n"
      "        newpath 4 2 roll m exch dup 3 1 roll 0 rl 0 exch rl neg 0\n"
      "        rl closepath\n"
      "} def\n"
      "/DrawBox { slw Rectangle stroke 1 slw } def\n"
      "/ColToX { BoxWidth mul LM add } def\n"
      "/RowToY { 4 exch sub BoxHeight mul BM add } def\n"
      "/DaysOfWeek {\n"
      "        FDOW 0 eq {\n"
      "                [(Sun) (Mon) (Tue) (Wed) (Thu) (Fri) (Sat)]\n"
      "        } {\n"
      "                [(Mon) (Tue) (Wed) (Thu) (Fri) (Sat) (Sun)]\n"
      "        } ifelse\n"
      "} def\n"
      "\n"
      "%------------------------------------------------------------------\n"
      "\n"
      "/InitialisePage {\n"
      "        /FDOW edef          % First day of week; 1 = Mon, 0 = Sun\n"
      "        /JpilotVersion edef % Jpilot version string\n"
      "        /TodaysDate edef    % String for date of printing\n"
      "        /FirstDay edef      % Day of 1st of month (0=Sun, 1=Mon...)\n"
      "        /MonthName edef     % Month/year string\n"
      "        %----------------------------------------------------------\n"
      "        % Orient page and scale to fit paper size\n"
      "        initgraphics\n"
      "        A4Y ScaleY mul 0 translate\n"
      "        90 rotate\n"
      "        ScaleX ScaleY Min dup scale\n"
      "\n"
      "        %----------------------------------------------------------\n"
      "        % Draw various headings\n"
      "        /Helvetica-Bold findfont fontsize 3 mul scalefont setfont\n"
      "        LM TM 30 sub RM MonthName CenterText\n"
      "        /Helvetica findfont fontsize 0.8 mul scalefont setfont\n"
      "        LM TM 30 sub m (Printed on: ) show TodaysDate show\n"
      "        RM TM 30 sub JpilotVersion RightText\n"
      "\n"
      "        %----------------------------------------------------------\n"
      "        % Now draw the seven days of week across top\n"
      "        /X LM def\n"
      "        /Y TM 60 sub def\n"
      "        /BoxWidth RM LM sub 7 div def\n"
      "        /BoxHeight Y BM sub 5 div def\n"
      "        /Helvetica-Bold findfont 16 scalefont setfont\n"
      "        DaysOfWeek\n"
      "        {\n"
      "            /DayName edef\n"
      "            0.5 setgray X Y BoxWidth 20 Rectangle fill\n"
      "            0   setgray X Y BoxWidth 20 1 DrawBox\n"
      "            1 setgray X Y 3 add X BoxWidth add DayName CenterText\n"
      "            /X X BoxWidth add def\n"
      "        } forall\n"
      "        0 setgray\n"
      "\n"
      "        %----------------------------------------------------------\n"
      "        % Now draw all the empty, slightly gray boxes that are the\n"
      "        % backdrop\n"
      "\n"
      "        0 1 6 {\n"
      "            /Col edef\n"
      "            0 1 4 {\n"
      "                /Row edef\n"
      "                Col ColToX Row RowToY BoxWidth BoxHeight Rectangle\n"
      "                gsave 0.95 setgray fill grestore 0 setgray stroke\n"
      "            } for\n"
      "        } for\n"
      "        /Col FirstDay FDOW 1 add sub def\n"
      "        Col -2 eq { /Col 5 def } if\n"
      "        /Row 0 def\n"
      "        gsave\n"
      "} def\n"
      "\n"
      "%------------------------------------------------------------------\n"
      "\n"
      "/NextDay {\n"
      "        grestore gsave  % This copes with a changing clipping path\n"
      "        /DayNumber DayNumber 1 add def\n"
      "        /Col Col 1 add def\n"
      "        Col 7 eq { \n"
      "                /Row Row 1 add def /Col 0 def \n"
      "                Row 5 eq { /Row 0 def } if\n"
      "        } if\n"
      "        %----------------------------------------------------------\n"
      "        % First box the thing off in white, and set a clipping path\n"
      "        Col ColToX Row RowToY BoxWidth BoxHeight Rectangle\n"
      "        gsave 1 setgray fill grestore 0 setgray stroke\n"
      "\n"
      "        Col ColToX 1 add Row RowToY 1 add BoxWidth 2 sub BoxHeight\n"
      "        2 sub Rectangle clip\n"
      "\n"
      "        %----------------------------------------------------------\n"
      "        % Then put up the large number for the day...\n"
      "        /Helvetica-Bold findfont fontsize 2 mul scalefont setfont\n"
      "        Col ColToX 3 add\n"
      "        Row RowToY BoxHeight fontsize 2 mul 1 add sub add m\n"
      "        DayNumber nstr cvs show\n"
      "\n"
      "        %----------------------------------------------------------\n"
      "        % Finally, set variables for the items\n"
      "        /X Col ColToX 3 add def\n"
      "        /Y Row RowToY BoxHeight fontsize sub 2 sub add def\n"
      "        /Ytop2 Row RowToY BoxHeight fontsize 3 mul sub add def\n"
      "        /fsize fontsize 0.8 mul def\n"
      "} def\n"
      "\n"
      "%------------------------------------------------------------------\n"
      "% 'spacify' routine to replace line-feeds with spaces in strings\n"
      "%  passed in - places string back on stack where it came from.\n"
      "\n"
      "/spacify {\n"
      "        /LF 10 def\n"
      "        /SP 32 def\n"
      "\n"
      "        /String edef\n"
      "\n"
      "        0 1 String length 1 sub {\n"
      "                /I edef\n"
      "                String I get LF eq {\n"
      "                        String I SP put\n"
      "                } if\n"
      "        } for\n"
      "        String\n"
      "} def\n"
      "\n"
      "%------------------------------------------------------------------\n"
      "% Move onto the next line\n"
      "\n"
      "/incY { /X X_LM def /Y Y fsize sub def } def\n"
      "\n"
      "%------------------------------------------------------------------\n"
      "% This routine will do automatic line-breaking of the item text, so\n"
      "% that as much of it as possible is visible.\n"
      "%\n"
      "% Arguments are: 'Paragraph Y para'\n"
      "\n"
      "/para {\n"
      "    /RMpara X PrintBoxWidth add def\n"
      "    /LMpara X def\n"
      "    /Y edef\n"
      "    spacify\n"
      "    /Paragraph edef\n"
      "    /SpaceW ( ) stringwidth pop def\n"
      "    RMpara LMpara sub Paragraph stringwidth pop gt\n"
      "    {\n"
      "        %----------------------------------------------\n"
      "        % The whole paragraph fits on one line - so\n"
      "        % just print it!\n"
      "        %----------------------------------------------\n"
      "        LMpara Y m Paragraph show\n"
      "    } {\n"
      "        %----------------------------------------------\n"
      "        % Have to do our clever formatting\n"
      "        %----------------------------------------------\n"
      "        /X LMpara def\n"
      "        /I 0 def\n"
      "        {\n"
      "            Paragraph ( ) search\n"
      "            {\n"
      "                %--------------------------------------------\n"
      "                % Found a space - so check where to print it.\n"
      "                %--------------------------------------------\n"
      "                dup\n"
      "                stringwidth pop /SW edef\n"
      "                SW RMpara X sub gt { /I I 1 add def I 2 eq { exit } if "
      "incY } if\n"
      "                X Y m show\n"
      "                pop\n"
      "                /X X SW SpaceW add add def\n"
      "                /Paragraph edef\n"
      "            } {\n"
      "                %----------------------------------------\n"
      "                % No space. Print rest of string and exit\n"
      "                %----------------------------------------\n"
      "                RMpara X sub Paragraph stringwidth pop lt\n"
      "                { /I I 1 add def I 2 eq { exit } if incY } if\n"
      "                X Y m Paragraph show\n"
      "                pop\n"
      "                exit\n"
      "            } ifelse\n"
      "        } loop\n"
      "    } ifelse\n"
      "} def\n"
      "\n"
      "%------------------------------------------------------------------\n"
      "% This procedure prints an item\n"
      "\n"
      "/TimedItem {\n"
      "        /ApptText edef\n"
      "        Y Ytop2 gt { /Y Ytop2 def } if\n"
      "        /Helvetica-Oblique findfont fsize scalefont setfont\n"
      "        X Y m show\n"
      "        /Helvetica-ISOLatin1 findfont fsize scalefont setfont\n"
      "        /X_LM X def\n"
      "        /X X 4.2 fsize mul add def\n"
      "        /PrintBoxWidth BoxWidth X X_LM sub sub 3 sub def\n"
      "        ApptText Y para\n"
      "        incY\n"
      "} def\n"
      "\n"
      "/UntimedItem {\n"
      "        /ApptText edef\n"
      "        /Helvetica-ISOLatin1 findfont fsize scalefont setfont\n"
      "        /X_LM_save X def\n"
      "        /X X 3 fsize mul add def\n"
      "        /X_LM X def\n"
      "        /PrintBoxWidth BoxWidth X X_LM_save sub sub 3 sub def\n"
      "        ApptText Y para\n"
      "        /X_LM X_LM_save def\n"
      "        incY\n"
      "} def\n"
      "\n"
      "%------------------------------------------------------------------\n"
      "\n"
      "/SmallMonth {\n"
      "        grestore gsave  % This copes with a changing clipping path\n"
      "        /S_FDOM    edef\n"
      "        /NumDays   edef\n"
      "        /MonthName edef\n"
      "        /S_row     edef\n"
      "        /S_col     edef\n"
      "\n"
      "        /X1 S_col ColToX def\n"
      "        /X2 S_col 1 add ColToX def\n"
      "        /Y1 S_row RowToY def\n"
      "        /Y2 S_row 1 sub RowToY def\n"
      "        /SmallBoxWidth .125 BoxWidth mul def\n"
      "        /SmallLeftMargin X1 .16 BoxWidth mul add def\n"
      "        /Helvetica-Bold findfont 10 scalefont setfont \n"
      "        X1 Y2 12 sub X2 MonthName CenterText\n"
      "        /Helvetica-Bold findfont 8 scalefont setfont \n"
      "        /X SmallLeftMargin def\n"
      "        /DayName 1 string def\n"
      "        DaysOfWeek\n"
      "        {\n"
      "                0 get DayName 0 3 2 roll put\n"
      "                X S_row 1 sub RowToY 24 sub DayName RightText\n"
      "                /X X SmallBoxWidth add def\n"
      "        } forall\n"
      "        /Helvetica findfont 8 scalefont setfont \n"
      "        /SmallRow 0 def\n"
      "        /SmallCol S_FDOM FDOW sub def\n"
      "        SmallCol FDOW lt { /SmallCol SmallCol 7 add 7 mod def } if\n"
      "        1 1 NumDays {\n"
      "                /Day edef\n"
      "                SmallLeftMargin SmallCol SmallBoxWidth mul add\n"
      "                Y1 4 SmallRow sub 11 mul 10 add add\n"
      "                Day nstr cvs RightText\n"
      "                /SmallCol SmallCol 1 add def\n"
      "                SmallCol 7 ge {\n"
      "                        /SmallCol 0 def\n"
      "                        /SmallRow SmallRow 1 add def\n"
      "                        SmallRow 4 gt { /SmallRow 0 def } if\n"
      "                } if\n"
      "        } for\n"
      "} def\n"
      "\n"
      "%------------------------------------------------------------------\n"
      "\n"
      "/SmallMonths {\n"
      "        /NumDays2       edef\n"
      "        /FDOM2          edef\n"
      "        /MonthName2     edef\n"
      "        /NumDays1       edef\n"
      "        /FDOM1          edef\n"
      "        /MonthName1     edef\n"
      "\n"
      "        Col 5 lt {\n"
      "            Row 0 ne {\n"
      "                5 4 MonthName1 NumDays1 FDOM1 SmallMonth\n"
      "                6 4 MonthName2 NumDays2 FDOM2 SmallMonth\n"
      "            } {\n"
      "                Col 2 add 0 MonthName1 NumDays1 FDOM1 SmallMonth\n"
      "                Col 3 add 0 MonthName2 NumDays2 FDOM2 SmallMonth\n"
      "            } ifelse\n"
      "        } {\n"
      "            Row 4 eq {\n"
      "                0 0 MonthName1 NumDays1 FDOM1 SmallMonth\n"
      "                1 0 MonthName2 NumDays2 FDOM2 SmallMonth\n"
      "            } {\n"
      "                5 4 MonthName1 NumDays1 FDOM1 SmallMonth\n"
      "                6 4 MonthName2 NumDays2 FDOM2 SmallMonth\n"
      "            } ifelse\n"
      "        } ifelse\n"
      "} def\n"
      "\n"
      "%------------------------------------------------------------------\n"
      "% This is the end of the header\n"
      "%------------------------------------------------------------------\n"
      "\n";
  fputs(month_header, f);
}


x86 assembly (clang, -O0):
<print_month_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <fputs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_month_header>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    $0x2666,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [9831 x i8] c"/Row 0 def\0A/Col 0 def\0A/DayNumber 0 def\0A/LM 60 def\0A/RM 780 def\0A/TM 550 def\0A/BM 50 def\0A\0A%------------------------------------------------------------------\0A% Utility routines are up here\0A\0A/Rectangle {\0A newpath 4 2 roll m exch dup 3 1 roll 0 rl 0 exch rl neg 0\0A rl closepath\0A} def\0A/DrawBox { slw Rectangle stroke 1 slw } def\0A/ColToX { BoxWidth mul LM add } def\0A/RowToY { 4 exch sub BoxHeight mul BM add } def\0A/DaysOfWeek {\0A FDOW 0 eq {\0A [(Sun) (Mon) (Tue) (Wed) (Thu) (Fri) (Sat)]\0A } {\0A [(Mon) (Tue) (Wed) (Thu) (Fri) (Sat) (Sun)]\0A } ifelse\0A} def\0A\0A%------------------------------------------------------------------\0A\0A/InitialisePage {\0A /FDOW edef % First day of week; 1 = Mon, 0 = Sun\0A /JpilotVersion edef % Jpilot version string\0A /TodaysDate edef % String for date of printing\0A /FirstDay edef % Day of 1st of month (0=Sun, 1=Mon...)\0A /MonthName edef % Month/year string\0A %----------------------------------------------------------\0A % Orient page and scale to fit paper size\0A initgraphics\0A A4Y ScaleY mul 0 translate\0A 90 rotate\0A ScaleX ScaleY Min dup scale\0A\0A %----------------------------------------------------------\0A % Draw various headings\0A /Helvetica-Bold findfont fontsize 3 mul scalefont setfont\0A LM TM 30 sub RM MonthName CenterText\0A /Helvetica findfont fontsize 0.8 mul scalefont setfont\0A LM TM 30 sub m (Printed on: ) show TodaysDate show\0A RM TM 30 sub JpilotVersion RightText\0A\0A %----------------------------------------------------------\0A % Now draw the seven days of week across top\0A /X LM def\0A /Y TM 60 sub def\0A /BoxWidth RM LM sub 7 div def\0A /BoxHeight Y BM sub 5 div def\0A /Helvetica-Bold findfont 16 scalefont setfont\0A DaysOfWeek\0A {\0A /DayName edef\0A 0.5 setgray X Y BoxWidth 20 Rectangle fill\0A 0 setgray X Y BoxWidth 20 1 DrawBox\0A 1 setgray X Y 3 add X BoxWidth add DayName CenterText\0A /X X BoxWidth add def\0A } forall\0A 0 setgray\0A\0A %----------------------------------------------------------\0A % Now draw all the empty, slightly gray boxes that are the\0A % backdrop\0A\0A 0 1 6 {\0A /Col edef\0A 0 1 4 {\0A /Row edef\0A Col ColToX Row RowToY BoxWidth BoxHeight Rectangle\0A gsave 0.95 setgray fill grestore 0 setgray stroke\0A } for\0A } for\0A /Col FirstDay FDOW 1 add sub def\0A Col -2 eq { /Col 5 def } if\0A /Row 0 def\0A gsave\0A} def\0A\0A%------------------------------------------------------------------\0A\0A/NextDay {\0A grestore gsave % This copes with a changing clipping path\0A /DayNumber DayNumber 1 add def\0A /Col Col 1 add def\0A Col 7 eq { \0A /Row Row 1 add def /Col 0 def \0A Row 5 eq { /Row 0 def } if\0A } if\0A %----------------------------------------------------------\0A % First box the thing off in white, and set a clipping path\0A Col ColToX Row RowToY BoxWidth BoxHeight Rectangle\0A gsave 1 setgray fill grestore 0 setgray stroke\0A\0A Col ColToX 1 add Row RowToY 1 add BoxWidth 2 sub BoxHeight\0A 2 sub Rectangle clip\0A\0A %----------------------------------------------------------\0A % Then put up the large number for the day...\0A /Helvetica-Bold findfont fontsize 2 mul scalefont setfont\0A Col ColToX 3 add\0A Row RowToY BoxHeight fontsize 2 mul 1 add sub add m\0A DayNumber nstr cvs show\0A\0A %----------------------------------------------------------\0A % Finally, set variables for the items\0A /X Col ColToX 3 add def\0A /Y Row RowToY BoxHeight fontsize sub 2 sub add def\0A /Ytop2 Row RowToY BoxHeight fontsize 3 mul sub add def\0A /fsize fontsize 0.8 mul def\0A} def\0A\0A%------------------------------------------------------------------\0A% 'spacify' routine to replace line-feeds with spaces in strings\0A% passed in - places string back on stack where it came from.\0A\0A/spacify {\0A /LF 10 def\0A /SP 32 def\0A\0A /String edef\0A\0A 0 1 String length 1 sub {\0A /I edef\0A String I get LF eq {\0A String I SP put\0A } if\0A } for\0A String\0A} def\0A\0A%------------------------------------------------------------------\0A% Move onto the next line\0A\0A/incY { /X X_LM def /Y Y fsize sub def } def\0A\0A%------------------------------------------------------------------\0A% This routine will do automatic line-breaking of the item text, so\0A% that as much of it as possible is visible.\0A%\0A% Arguments are: 'Paragraph Y para'\0A\0A/para {\0A /RMpara X PrintBoxWidth add def\0A /LMpara X def\0A /Y edef\0A spacify\0A /Paragraph edef\0A /SpaceW ( ) stringwidth pop def\0A RMpara LMpara sub Paragraph stringwidth pop gt\0A {\0A %----------------------------------------------\0A % The whole paragraph fits on one line - so\0A % just print it!\0A %----------------------------------------------\0A LMpara Y m Paragraph show\0A } {\0A %----------------------------------------------\0A % Have to do our clever formatting\0A %----------------------------------------------\0A /X LMpara def\0A /I 0 def\0A {\0A Paragraph ( ) search\0A {\0A %--------------------------------------------\0A % Found a space - so check where to print it.\0A %--------------------------------------------\0A dup\0A stringwidth pop /SW edef\0A SW RMpara X sub gt { /I I 1 add def I 2 eq { exit } if incY } if\0A X Y m show\0A pop\0A /X X SW SpaceW add add def\0A /Paragraph edef\0A } {\0A %----------------------------------------\0A % No space. Print rest of string and exit\0A %----------------------------------------\0A RMpara X sub Paragraph stringwidth pop lt\0A { /I I 1 add def I 2 eq { exit } if incY } if\0A X Y m Paragraph show\0A pop\0A exit\0A } ifelse\0A } loop\0A } ifelse\0A} def\0A\0A%------------------------------------------------------------------\0A% This procedure prints an item\0A\0A/TimedItem {\0A /ApptText edef\0A Y Ytop2 gt { /Y Ytop2 def } if\0A /Helvetica-Oblique findfont fsize scalefont setfont\0A X Y m show\0A /Helvetica-ISOLatin1 findfont fsize scalefont setfont\0A /X_LM X def\0A /X X 4.2 fsize mul add def\0A /PrintBoxWidth BoxWidth X X_LM sub sub 3 sub def\0A ApptText Y para\0A incY\0A} def\0A\0A/UntimedItem {\0A /ApptText edef\0A /Helvetica-ISOLatin1 findfont fsize scalefont setfont\0A /X_LM_save X def\0A /X X 3 fsize mul add def\0A /X_LM X def\0A /PrintBoxWidth BoxWidth X X_LM_save sub sub 3 sub def\0A ApptText Y para\0A /X_LM X_LM_save def\0A incY\0A} def\0A\0A%------------------------------------------------------------------\0A\0A/SmallMonth {\0A grestore gsave % This copes with a changing clipping path\0A /S_FDOM edef\0A /NumDays edef\0A /MonthName edef\0A /S_row edef\0A /S_col edef\0A\0A /X1 S_col ColToX def\0A /X2 S_col 1 add ColToX def\0A /Y1 S_row RowToY def\0A /Y2 S_row 1 sub RowToY def\0A /SmallBoxWidth .125 BoxWidth mul def\0A /SmallLeftMargin X1 .16 BoxWidth mul add def\0A /Helvetica-Bold findfont 10 scalefont setfont \0A X1 Y2 12 sub X2 MonthName CenterText\0A /Helvetica-Bold findfont 8 scalefont setfont \0A /X SmallLeftMargin def\0A /DayName 1 string def\0A DaysOfWeek\0A {\0A 0 get DayName 0 3 2 roll put\0A X S_row 1 sub RowToY 24 sub DayName RightText\0A /X X SmallBoxWidth add def\0A } forall\0A /Helvetica findfont 8 scalefont setfont \0A /SmallRow 0 def\0A /SmallCol S_FDOM FDOW sub def\0A SmallCol FDOW lt { /SmallCol SmallCol 7 add 7 mod def } if\0A 1 1 NumDays {\0A /Day edef\0A SmallLeftMargin SmallCol SmallBoxWidth mul add\0A Y1 4 SmallRow sub 11 mul 10 add add\0A Day nstr cvs RightText\0A /SmallCol SmallCol 1 add def\0A SmallCol 7 ge {\0A /SmallCol 0 def\0A /SmallRow SmallRow 1 add def\0A SmallRow 4 gt { /SmallRow 0 def } if\0A } if\0A } for\0A} def\0A\0A%------------------------------------------------------------------\0A\0A/SmallMonths {\0A /NumDays2 edef\0A /FDOM2 edef\0A /MonthName2 edef\0A /NumDays1 edef\0A /FDOM1 edef\0A /MonthName1 edef\0A\0A Col 5 lt {\0A Row 0 ne {\0A 5 4 MonthName1 NumDays1 FDOM1 SmallMonth\0A 6 4 MonthName2 NumDays2 FDOM2 SmallMonth\0A } {\0A Col 2 add 0 MonthName1 NumDays1 FDOM1 SmallMonth\0A Col 3 add 0 MonthName2 NumDays2 FDOM2 SmallMonth\0A } ifelse\0A } {\0A Row 4 eq {\0A 0 0 MonthName1 NumDays1 FDOM1 SmallMonth\0A 1 0 MonthName2 NumDays2 FDOM2 SmallMonth\0A } {\0A 5 4 MonthName1 NumDays1 FDOM1 SmallMonth\0A 6 4 MonthName2 NumDays2 FDOM2 SmallMonth\0A } ifelse\0A } ifelse\0A} def\0A\0A%------------------------------------------------------------------\0A% This is the end of the header\0A%------------------------------------------------------------------\0A\0A\00"
define void @print_month_header(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
store i32* %0, i32** %2
store i8* getelementptr inbounds ([9831 x i8], [9831 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %3
%5 = load i32*, i32** %2
%6 = call i32 @fputs(i8* %4, i32* %5)
ret void
}

LLVM IR (-O2):
@.str = [9831 x i8] c"/Row 0 def\0A/Col 0 def\0A/DayNumber 0 def\0A/LM 60 def\0A/RM 780 def\0A/TM 550 def\0A/BM 50 def\0A\0A%------------------------------------------------------------------\0A% Utility routines are up here\0A\0A/Rectangle {\0A newpath 4 2 roll m exch dup 3 1 roll 0 rl 0 exch rl neg 0\0A rl closepath\0A} def\0A/DrawBox { slw Rectangle stroke 1 slw } def\0A/ColToX { BoxWidth mul LM add } def\0A/RowToY { 4 exch sub BoxHeight mul BM add } def\0A/DaysOfWeek {\0A FDOW 0 eq {\0A [(Sun) (Mon) (Tue) (Wed) (Thu) (Fri) (Sat)]\0A } {\0A [(Mon) (Tue) (Wed) (Thu) (Fri) (Sat) (Sun)]\0A } ifelse\0A} def\0A\0A%------------------------------------------------------------------\0A\0A/InitialisePage {\0A /FDOW edef % First day of week; 1 = Mon, 0 = Sun\0A /JpilotVersion edef % Jpilot version string\0A /TodaysDate edef % String for date of printing\0A /FirstDay edef % Day of 1st of month (0=Sun, 1=Mon...)\0A /MonthName edef % Month/year string\0A %----------------------------------------------------------\0A % Orient page and scale to fit paper size\0A initgraphics\0A A4Y ScaleY mul 0 translate\0A 90 rotate\0A ScaleX ScaleY Min dup scale\0A\0A %----------------------------------------------------------\0A % Draw various headings\0A /Helvetica-Bold findfont fontsize 3 mul scalefont setfont\0A LM TM 30 sub RM MonthName CenterText\0A /Helvetica findfont fontsize 0.8 mul scalefont setfont\0A LM TM 30 sub m (Printed on: ) show TodaysDate show\0A RM TM 30 sub JpilotVersion RightText\0A\0A %----------------------------------------------------------\0A % Now draw the seven days of week across top\0A /X LM def\0A /Y TM 60 sub def\0A /BoxWidth RM LM sub 7 div def\0A /BoxHeight Y BM sub 5 div def\0A /Helvetica-Bold findfont 16 scalefont setfont\0A DaysOfWeek\0A {\0A /DayName edef\0A 0.5 setgray X Y BoxWidth 20 Rectangle fill\0A 0 setgray X Y BoxWidth 20 1 DrawBox\0A 1 setgray X Y 3 add X BoxWidth add DayName CenterText\0A /X X BoxWidth add def\0A } forall\0A 0 setgray\0A\0A %----------------------------------------------------------\0A % Now draw all the empty, slightly gray boxes that are the\0A % backdrop\0A\0A 0 1 6 {\0A /Col edef\0A 0 1 4 {\0A /Row edef\0A Col ColToX Row RowToY BoxWidth BoxHeight Rectangle\0A gsave 0.95 setgray fill grestore 0 setgray stroke\0A } for\0A } for\0A /Col FirstDay FDOW 1 add sub def\0A Col -2 eq { /Col 5 def } if\0A /Row 0 def\0A gsave\0A} def\0A\0A%------------------------------------------------------------------\0A\0A/NextDay {\0A grestore gsave % This copes with a changing clipping path\0A /DayNumber DayNumber 1 add def\0A /Col Col 1 add def\0A Col 7 eq { \0A /Row Row 1 add def /Col 0 def \0A Row 5 eq { /Row 0 def } if\0A } if\0A %----------------------------------------------------------\0A % First box the thing off in white, and set a clipping path\0A Col ColToX Row RowToY BoxWidth BoxHeight Rectangle\0A gsave 1 setgray fill grestore 0 setgray stroke\0A\0A Col ColToX 1 add Row RowToY 1 add BoxWidth 2 sub BoxHeight\0A 2 sub Rectangle clip\0A\0A %----------------------------------------------------------\0A % Then put up the large number for the day...\0A /Helvetica-Bold findfont fontsize 2 mul scalefont setfont\0A Col ColToX 3 add\0A Row RowToY BoxHeight fontsize 2 mul 1 add sub add m\0A DayNumber nstr cvs show\0A\0A %----------------------------------------------------------\0A % Finally, set variables for the items\0A /X Col ColToX 3 add def\0A /Y Row RowToY BoxHeight fontsize sub 2 sub add def\0A /Ytop2 Row RowToY BoxHeight fontsize 3 mul sub add def\0A /fsize fontsize 0.8 mul def\0A} def\0A\0A%------------------------------------------------------------------\0A% 'spacify' routine to replace line-feeds with spaces in strings\0A% passed in - places string back on stack where it came from.\0A\0A/spacify {\0A /LF 10 def\0A /SP 32 def\0A\0A /String edef\0A\0A 0 1 String length 1 sub {\0A /I edef\0A String I get LF eq {\0A String I SP put\0A } if\0A } for\0A String\0A} def\0A\0A%------------------------------------------------------------------\0A% Move onto the next line\0A\0A/incY { /X X_LM def /Y Y fsize sub def } def\0A\0A%------------------------------------------------------------------\0A% This routine will do automatic line-breaking of the item text, so\0A% that as much of it as possible is visible.\0A%\0A% Arguments are: 'Paragraph Y para'\0A\0A/para {\0A /RMpara X PrintBoxWidth add def\0A /LMpara X def\0A /Y edef\0A spacify\0A /Paragraph edef\0A /SpaceW ( ) stringwidth pop def\0A RMpara LMpara sub Paragraph stringwidth pop gt\0A {\0A %----------------------------------------------\0A % The whole paragraph fits on one line - so\0A % just print it!\0A %----------------------------------------------\0A LMpara Y m Paragraph show\0A } {\0A %----------------------------------------------\0A % Have to do our clever formatting\0A %----------------------------------------------\0A /X LMpara def\0A /I 0 def\0A {\0A Paragraph ( ) search\0A {\0A %--------------------------------------------\0A % Found a space - so check where to print it.\0A %--------------------------------------------\0A dup\0A stringwidth pop /SW edef\0A SW RMpara X sub gt { /I I 1 add def I 2 eq { exit } if incY } if\0A X Y m show\0A pop\0A /X X SW SpaceW add add def\0A /Paragraph edef\0A } {\0A %----------------------------------------\0A % No space. Print rest of string and exit\0A %----------------------------------------\0A RMpara X sub Paragraph stringwidth pop lt\0A { /I I 1 add def I 2 eq { exit } if incY } if\0A X Y m Paragraph show\0A pop\0A exit\0A } ifelse\0A } loop\0A } ifelse\0A} def\0A\0A%------------------------------------------------------------------\0A% This procedure prints an item\0A\0A/TimedItem {\0A /ApptText edef\0A Y Ytop2 gt { /Y Ytop2 def } if\0A /Helvetica-Oblique findfont fsize scalefont setfont\0A X Y m show\0A /Helvetica-ISOLatin1 findfont fsize scalefont setfont\0A /X_LM X def\0A /X X 4.2 fsize mul add def\0A /PrintBoxWidth BoxWidth X X_LM sub sub 3 sub def\0A ApptText Y para\0A incY\0A} def\0A\0A/UntimedItem {\0A /ApptText edef\0A /Helvetica-ISOLatin1 findfont fsize scalefont setfont\0A /X_LM_save X def\0A /X X 3 fsize mul add def\0A /X_LM X def\0A /PrintBoxWidth BoxWidth X X_LM_save sub sub 3 sub def\0A ApptText Y para\0A /X_LM X_LM_save def\0A incY\0A} def\0A\0A%------------------------------------------------------------------\0A\0A/SmallMonth {\0A grestore gsave % This copes with a changing clipping path\0A /S_FDOM edef\0A /NumDays edef\0A /MonthName edef\0A /S_row edef\0A /S_col edef\0A\0A /X1 S_col ColToX def\0A /X2 S_col 1 add ColToX def\0A /Y1 S_row RowToY def\0A /Y2 S_row 1 sub RowToY def\0A /SmallBoxWidth .125 BoxWidth mul def\0A /SmallLeftMargin X1 .16 BoxWidth mul add def\0A /Helvetica-Bold findfont 10 scalefont setfont \0A X1 Y2 12 sub X2 MonthName CenterText\0A /Helvetica-Bold findfont 8 scalefont setfont \0A /X SmallLeftMargin def\0A /DayName 1 string def\0A DaysOfWeek\0A {\0A 0 get DayName 0 3 2 roll put\0A X S_row 1 sub RowToY 24 sub DayName RightText\0A /X X SmallBoxWidth add def\0A } forall\0A /Helvetica findfont 8 scalefont setfont \0A /SmallRow 0 def\0A /SmallCol S_FDOM FDOW sub def\0A SmallCol FDOW lt { /SmallCol SmallCol 7 add 7 mod def } if\0A 1 1 NumDays {\0A /Day edef\0A SmallLeftMargin SmallCol SmallBoxWidth mul add\0A Y1 4 SmallRow sub 11 mul 10 add add\0A Day nstr cvs RightText\0A /SmallCol SmallCol 1 add def\0A SmallCol 7 ge {\0A /SmallCol 0 def\0A /SmallRow SmallRow 1 add def\0A SmallRow 4 gt { /SmallRow 0 def } if\0A } if\0A } for\0A} def\0A\0A%------------------------------------------------------------------\0A\0A/SmallMonths {\0A /NumDays2 edef\0A /FDOM2 edef\0A /MonthName2 edef\0A /NumDays1 edef\0A /FDOM1 edef\0A /MonthName1 edef\0A\0A Col 5 lt {\0A Row 0 ne {\0A 5 4 MonthName1 NumDays1 FDOM1 SmallMonth\0A 6 4 MonthName2 NumDays2 FDOM2 SmallMonth\0A } {\0A Col 2 add 0 MonthName1 NumDays1 FDOM1 SmallMonth\0A Col 3 add 0 MonthName2 NumDays2 FDOM2 SmallMonth\0A } ifelse\0A } {\0A Row 4 eq {\0A 0 0 MonthName1 NumDays1 FDOM1 SmallMonth\0A 1 0 MonthName2 NumDays2 FDOM2 SmallMonth\0A } {\0A 5 4 MonthName1 NumDays1 FDOM1 SmallMonth\0A 6 4 MonthName2 NumDays2 FDOM2 SmallMonth\0A } ifelse\0A } ifelse\0A} def\0A\0A%------------------------------------------------------------------\0A% This is the end of the header\0A%------------------------------------------------------------------\0A\0A\00"
define void @print_month_header(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([9831 x i8], [9831 x i8]* @.str, i64 0, i64 0), i64 9830, i64 1, i32* %0)
ret void
}