#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 */

/* Variables and functions */
int dayno(int, int, int, int);
int /*<<< orphan*/ printf(char *, ...);
void prt3mon(int yr, int a, char *prtmon) {
  static char *letters = " m  t  w  t  f  s  s     "
                         " m  t  w  t  f  s  s     "
                         " m  t  w  t  f  s  s\n";
  int b, i, j, x;
  printf("%s\n\n", prtmon);
  printf("%s", letters);
  for (i = 0; i < 6; i++) {
    for (b = 1; b <= 3; b++) {
      for (j = 0; j < 7; j++) {
        x = dayno(yr, a * 3 + b, i, j);
        if (x)
          printf("%2d ", x);
        else
          printf("   ");
      }
      printf("    ");
    }
    printf("\n");
  }
  printf("\n\n\n\n");
  return;
}


x86 assembly (clang, -O0):
<prt3mon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xf0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2ee5(%rip),%rsi
lea    0xefb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x6,-0x18(%rbp)
jge    121d <prt3mon+0xfd>
movl   $0x1,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jg     1201 <prt3mon+0xe1>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x7,-0x1c(%rbp)
jge    11e5 <prt3mon+0xc5>
mov    -0x4(%rbp),%edi
imul   $0x3,-0x8(%rbp),%esi
add    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1040 <dayno@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     11c4 <prt3mon+0xa4>
mov    -0x20(%rbp),%esi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d2 <prt3mon+0xb2>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d7 <prt3mon+0xb7>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1182 <prt3mon+0x62>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1171 <prt3mon+0x51>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1160 <prt3mon+0x40>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prt3mon>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%r13d
lea    0xea9(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea7(%rip),%rdi
call   1040 <puts@plt>
lea    (%rbx,%rbx,2),%eax
mov    %rax,(%rsp)
lea    0xe90(%rip),%r14
lea    0xe83(%rip),%r12
xor    %ebp,%ebp
jmp    11a6 <prt3mon+0x66>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    $0x6,%ebp
je     1324 <prt3mon+0x1e4>
mov    $0x1,%r15d
jmp    11d2 <prt3mon+0x92>
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe49(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15d
cmp    $0x4,%r15d
je     1190 <prt3mon+0x50>
mov    (%rsp),%rax
lea    (%rax,%r15,1),%ebx
mov    %r13d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1060 <dayno@plt>
test   %eax,%eax
je     1200 <prt3mon+0xc0>
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    120a <prt3mon+0xca>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x1,%ecx
call   1060 <dayno@plt>
test   %eax,%eax
je     1230 <prt3mon+0xf0>
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    123a <prt3mon+0xfa>
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x2,%ecx
call   1060 <dayno@plt>
test   %eax,%eax
je     1260 <prt3mon+0x120>
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    126a <prt3mon+0x12a>
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x3,%ecx
call   1060 <dayno@plt>
test   %eax,%eax
je     1290 <prt3mon+0x150>
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    129a <prt3mon+0x15a>
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x4,%ecx
call   1060 <dayno@plt>
test   %eax,%eax
je     12c0 <prt3mon+0x180>
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    12ca <prt3mon+0x18a>
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x5,%ecx
call   1060 <dayno@plt>
test   %eax,%eax
je     12f0 <prt3mon+0x1b0>
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    12fa <prt3mon+0x1ba>
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x6,%ecx
call   1060 <dayno@plt>
test   %eax,%eax
je     11b0 <prt3mon+0x70>
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11ba <prt3mon+0x7a>
lea    0xd2b(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@prt3mon.letters = internal global i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i32 0, i32 0)
@.str = [72 x i8] c" m t w t f s s m t w t f s s m t w t f s s\0A\00"
@.str.1 = [5 x i8] c"%s\0A\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [5 x i8] c"%2d \00"
@.str.4 = [4 x i8] c" \00"
@.str.5 = [5 x i8] c" \00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [5 x i8] c"\0A\0A\0A\0A\00"
define void @prt3mon(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%11 = load i8*, i8** %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = load i8*, i8** @prt3mon.letters
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %13)
store i32 0, i32* %8
br label %15
15: ; preds = %53, %3
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 6
br i1 %17, label %18, label %56
18: ; preds = %15
store i32 1, i32* %7
br label %19
19: ; preds = %48, %18
%20 = load i32, i32* %7
%21 = icmp sle i32 %20, 3
br i1 %21, label %22, label %51
22: ; preds = %19
store i32 0, i32* %9
br label %23
23: ; preds = %43, %22
%24 = load i32, i32* %9
%25 = icmp slt i32 %24, 7
br i1 %25, label %26, label %46
26: ; preds = %23
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = mul nsw i32 %28, 3
%30 = load i32, i32* %7
%31 = add nsw i32 %29, %30
%32 = load i32, i32* %8
%33 = load i32, i32* %9
%34 = call i32 @dayno(i32 %27, i32 %31, i32 %32, i32 %33)
store i32 %34, i32* %10
%35 = load i32, i32* %10
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %26
%38 = load i32, i32* %10
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %38)
br label %42
40: ; preds = %26
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %42
42: ; preds = %40, %37
br label %43
43: ; preds = %42
%44 = load i32, i32* %9
%45 = add nsw i32 %44, 1
store i32 %45, i32* %9
br label %23
46: ; preds = %23
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %48
48: ; preds = %46
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
br label %19
51: ; preds = %19
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %53
53: ; preds = %51
%54 = load i32, i32* %8
%55 = add nsw i32 %54, 1
store i32 %55, i32* %8
br label %15
56: ; preds = %15
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%s\0A\0A\00"
@.str.3 = [5 x i8] c"%2d \00"
@.str.4 = [4 x i8] c" \00"
@.str.5 = [5 x i8] c" \00"
@str = [71 x i8] c" m t w t f s s m t w t f s s m t w t f s s\00"
@str.8 = [4 x i8] c"\0A\0A\0A\00"
define void @prt3mon(i32 %0, i32 %1, i8* %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str, i64 0, i64 0))
%6 = mul nsw i32 %1, 3
br label %7
7: ; preds = %3, %64
%8 = phi i32 [ 0, %3 ], [ %66, %64 ]
br label %9
9: ; preds = %7, %60
%10 = phi i32 [ 1, %7 ], [ %62, %60 ]
%11 = add nsw i32 %10, %6
%12 = tail call i32 @dayno(i32 %0, i32 %11, i32 %8, i32 0)
%13 = icmp eq i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %12)
br label %18
16: ; preds = %9
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %18
18: ; preds = %14, %16
%19 = tail call i32 @dayno(i32 %0, i32 %11, i32 %8, i32 1)
%20 = icmp eq i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %19)
br label %25
23: ; preds = %18
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %23, %21
%26 = tail call i32 @dayno(i32 %0, i32 %11, i32 %8, i32 2)
%27 = icmp eq i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %26)
br label %32
30: ; preds = %25
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %32
32: ; preds = %30, %28
%33 = tail call i32 @dayno(i32 %0, i32 %11, i32 %8, i32 3)
%34 = icmp eq i32 %33, 0
br i1 %34, label %37, label %35
35: ; preds = %32
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %33)
br label %39
37: ; preds = %32
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %39
39: ; preds = %37, %35
%40 = tail call i32 @dayno(i32 %0, i32 %11, i32 %8, i32 4)
%41 = icmp eq i32 %40, 0
br i1 %41, label %44, label %42
42: ; preds = %39
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %40)
br label %46
44: ; preds = %39
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %46
46: ; preds = %44, %42
%47 = tail call i32 @dayno(i32 %0, i32 %11, i32 %8, i32 5)
%48 = icmp eq i32 %47, 0
br i1 %48, label %51, label %49
49: ; preds = %46
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %47)
br label %53
51: ; preds = %46
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %53
53: ; preds = %51, %49
%54 = tail call i32 @dayno(i32 %0, i32 %11, i32 %8, i32 6)
%55 = icmp eq i32 %54, 0
br i1 %55, label %58, label %56
56: ; preds = %53
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %54)
br label %60
58: ; preds = %53
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %60
60: ; preds = %58, %56
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%62 = add nuw nsw i32 %10, 1
%63 = icmp eq i32 %62, 4
br i1 %63, label %64, label %9
64: ; preds = %60
%65 = tail call i32 @putchar(i32 10)
%66 = add nuw nsw i32 %8, 1
%67 = icmp eq i32 %66, 6
br i1 %67, label %68, label %7
68: ; preds = %64
%69 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.8, i64 0, i64 0))
ret void
}