#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 */
scalar_t__ day_of_week(int, int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int year, month, temp = 0;
  for (year = 1901; year <= 2000; year++) {
    for (month = 1; month <= 12; month++) {
      if (day_of_week(year, month, 1) == 0) {
        temp++;
      }
    }
  }
  printf("%d\n", temp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x76d,-0x8(%rbp)
cmpl   $0x7d0,-0x8(%rbp)
jg     11a4 <main+0x84>
movl   $0x1,-0xc(%rbp)
cmpl   $0xc,-0xc(%rbp)
jg     1191 <main+0x71>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x1,%edx
call   1030 <day_of_week@plt>
cmp    $0x0,%rax
jne    117e <main+0x5e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1183 <main+0x63>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1151 <main+0x31>
jmp    1196 <main+0x76>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <main+0x1d>
mov    -0x10(%rbp),%esi
lea    0xe52(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x76d,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <day_of_week@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
mov    %ebp,%edi
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <day_of_week@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
mov    %ebp,%edi
mov    $0x3,%esi
mov    $0x1,%edx
call   1030 <day_of_week@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
mov    %ebp,%edi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <day_of_week@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
mov    %ebp,%edi
mov    $0x5,%esi
mov    $0x1,%edx
call   1030 <day_of_week@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
mov    %ebp,%edi
mov    $0x6,%esi
mov    $0x1,%edx
call   1030 <day_of_week@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
mov    %ebp,%edi
mov    $0x7,%esi
mov    $0x1,%edx
call   1030 <day_of_week@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
mov    %ebp,%edi
mov    $0x8,%esi
mov    $0x1,%edx
call   1030 <day_of_week@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
mov    %ebp,%edi
mov    $0x9,%esi
mov    $0x1,%edx
call   1030 <day_of_week@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
mov    %ebp,%edi
mov    $0xa,%esi
mov    $0x1,%edx
call   1030 <day_of_week@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
mov    %ebp,%edi
mov    $0xb,%esi
mov    $0x1,%edx
call   1030 <day_of_week@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
mov    %ebp,%edi
mov    $0xc,%esi
mov    $0x1,%edx
call   1030 <day_of_week@plt>
cmp    $0x1,%rax
adc    $0x0,%ebx
add    $0x1,%ebp
cmp    $0x7d1,%ebp
jne    1130 <main+0x10>
lea    0xd9a(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 1901, i32* %2
br label %5
5: ; preds = %25, %0
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 2000
br i1 %7, label %8, label %28
8: ; preds = %5
store i32 1, i32* %3
br label %9
9: ; preds = %21, %8
%10 = load i32, i32* %3
%11 = icmp sle i32 %10, 12
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = call i64 @day_of_week(i32 %13, i32 %14, i32 1)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %20
20: ; preds = %17, %12
br label %21
21: ; preds = %20
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %9
24: ; preds = %9
br label %25
25: ; preds = %24
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %5
28: ; preds = %5
%29 = load i32, i32* %4
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %51, %1 ]
%3 = phi i32 [ 1901, %0 ], [ %52, %1 ]
%4 = tail call i64 @day_of_week(i32 %3, i32 1, i32 1)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
%7 = add nsw i32 %2, %6
%8 = tail call i64 @day_of_week(i32 %3, i32 2, i32 1)
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
%11 = add nsw i32 %7, %10
%12 = tail call i64 @day_of_week(i32 %3, i32 3, i32 1)
%13 = icmp eq i64 %12, 0
%14 = zext i1 %13 to i32
%15 = add nsw i32 %11, %14
%16 = tail call i64 @day_of_week(i32 %3, i32 4, i32 1)
%17 = icmp eq i64 %16, 0
%18 = zext i1 %17 to i32
%19 = add nsw i32 %15, %18
%20 = tail call i64 @day_of_week(i32 %3, i32 5, i32 1)
%21 = icmp eq i64 %20, 0
%22 = zext i1 %21 to i32
%23 = add nsw i32 %19, %22
%24 = tail call i64 @day_of_week(i32 %3, i32 6, i32 1)
%25 = icmp eq i64 %24, 0
%26 = zext i1 %25 to i32
%27 = add nsw i32 %23, %26
%28 = tail call i64 @day_of_week(i32 %3, i32 7, i32 1)
%29 = icmp eq i64 %28, 0
%30 = zext i1 %29 to i32
%31 = add nsw i32 %27, %30
%32 = tail call i64 @day_of_week(i32 %3, i32 8, i32 1)
%33 = icmp eq i64 %32, 0
%34 = zext i1 %33 to i32
%35 = add nsw i32 %31, %34
%36 = tail call i64 @day_of_week(i32 %3, i32 9, i32 1)
%37 = icmp eq i64 %36, 0
%38 = zext i1 %37 to i32
%39 = add nsw i32 %35, %38
%40 = tail call i64 @day_of_week(i32 %3, i32 10, i32 1)
%41 = icmp eq i64 %40, 0
%42 = zext i1 %41 to i32
%43 = add nsw i32 %39, %42
%44 = tail call i64 @day_of_week(i32 %3, i32 11, i32 1)
%45 = icmp eq i64 %44, 0
%46 = zext i1 %45 to i32
%47 = add nsw i32 %43, %46
%48 = tail call i64 @day_of_week(i32 %3, i32 12, i32 1)
%49 = icmp eq i64 %48, 0
%50 = zext i1 %49 to i32
%51 = add nsw i32 %47, %50
%52 = add nuw nsw i32 %3, 1
%53 = icmp eq i32 %52, 2001
br i1 %53, label %54, label %1
54: ; preds = %1
%55 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %51)
ret i32 0
}