#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 /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int sundays = 0;
  int weekday = 1;
  int year, month;
  for (year = 1900; year < 2001; year++) {
    for (month = 0; month < 12; month++) {
      if (year >= 1901 && weekday == 0)
        sundays++;
      weekday += days[month];
      if (month == 1 && year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))
        weekday++;
      weekday %= 7;
    }
  }
  printf("%d\n", sundays);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xebf(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x44(%rbp)
movl   $0x1,-0x48(%rbp)
movl   $0x76c,-0x4c(%rbp)
cmpl   $0x7d1,-0x4c(%rbp)
jge    122a <main+0x10a>
movl   $0x0,-0x50(%rbp)
cmpl   $0xc,-0x50(%rbp)
jge    1217 <main+0xf7>
cmpl   $0x76d,-0x4c(%rbp)
jl     119e <main+0x7e>
cmpl   $0x0,-0x48(%rbp)
jne    119e <main+0x7e>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
movslq -0x50(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
cmpl   $0x1,-0x50(%rbp)
jne    11fb <main+0xdb>
mov    -0x4c(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11fb <main+0xdb>
mov    -0x4c(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11f2 <main+0xd2>
mov    -0x4c(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11fb <main+0xdb>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x48(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1174 <main+0x54>
jmp    121c <main+0xfc>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1160 <main+0x40>
mov    -0x44(%rbp),%esi
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x76c,%r10d
lea    0xedb(%rip),%r8
cs nopw 0x0(%rax,%rax,1)
nop
imul   $0xc28f5c29,%r10d,%ecx
mov    %ecx,%edi
ror    $0x2,%edi
cmp    $0x28f5c29,%edi
setae  %dil
ror    $0x4,%ecx
cmp    $0xa3d70b,%ecx
setb   %r9b
or     %dil,%r9b
xor    %edi,%edi
nopl   0x0(%rax,%rax,1)
test   $0x3,%r10b
sete   %r11b
cmp    $0x76d,%r10d
setae  %al
test   %edx,%edx
sete   %cl
and    %al,%cl
movzbl %cl,%eax
add    %eax,%esi
add    (%rdi,%r8,1),%edx
cmp    $0x4,%rdi
sete   %al
and    %r11b,%al
and    %r9b,%al
movzbl %al,%eax
add    %edx,%eax
cltq
imul   $0xffffffff92492493,%rax,%rdx
shr    $0x20,%rdx
add    %eax,%edx
mov    %edx,%ecx
shr    $0x1f,%ecx
sar    $0x2,%edx
add    %ecx,%edx
lea    0x0(,%rdx,8),%ecx
sub    %ecx,%edx
add    %eax,%edx
add    $0x4,%rdi
cmp    $0x30,%rdi
jne    1160 <main+0x50>
add    $0x1,%r10d
cmp    $0x7d1,%r10d
jne    1130 <main+0x20>
lea    0xe56(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.days = [12 x i32] [i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [12 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [12 x i32]* %6 to i8*
store i32 0, i32* %7
store i32 1, i32* %8
store i32 1900, i32* %9
br label %12
12: ; preds = %59, %2
%13 = load i32, i32* %9
%14 = icmp slt i32 %13, 2001
br i1 %14, label %15, label %62
15: ; preds = %12
store i32 0, i32* %10
br label %16
16: ; preds = %55, %15
%17 = load i32, i32* %10
%18 = icmp slt i32 %17, 12
br i1 %18, label %19, label %58
19: ; preds = %16
%20 = load i32, i32* %9
%21 = icmp sge i32 %20, 1901
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = load i32, i32* %8
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
br label %28
28: ; preds = %25, %22, %19
%29 = load i32, i32* %10
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [12 x i32], [12 x i32]* %6, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = load i32, i32* %8
%34 = add nsw i32 %33, %32
store i32 %34, i32* %8
%35 = load i32, i32* %10
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %52
37: ; preds = %28
%38 = load i32, i32* %9
%39 = srem i32 %38, 4
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %52
41: ; preds = %37
%42 = load i32, i32* %9
%43 = srem i32 %42, 100
%44 = icmp ne i32 %43, 0
br i1 %44, label %49, label %45
45: ; preds = %41
%46 = load i32, i32* %9
%47 = srem i32 %46, 400
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %45, %41
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 1
store i32 %51, i32* %8
br label %52
52: ; preds = %49, %45, %37, %28
%53 = load i32, i32* %8
%54 = srem i32 %53, 7
store i32 %54, i32* %8
br label %55
55: ; preds = %52
%56 = load i32, i32* %10
%57 = add nsw i32 %56, 1
store i32 %57, i32* %10
br label %16
58: ; preds = %16
br label %59
59: ; preds = %58
%60 = load i32, i32* %9
%61 = add nsw i32 %60, 1
store i32 %61, i32* %9
br label %12
62: ; preds = %12
%63 = load i32, i32* %7
%64 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %63)
ret i32 0
}

LLVM IR (-O2):
@__const.main.days = [12 x i32] [i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %34
%4 = phi i32 [ 1900, %2 ], [ %35, %34 ]
%5 = phi i32 [ 1, %2 ], [ %31, %34 ]
%6 = phi i32 [ 0, %2 ], [ %22, %34 ]
%7 = icmp ugt i32 %4, 1900
%8 = and i32 %4, 3
%9 = icmp eq i32 %8, 0
%10 = urem i32 %4, 100
%11 = icmp ne i32 %10, 0
%12 = urem i32 %4, 400
%13 = icmp eq i32 %12, 0
%14 = or i1 %11, %13
br label %15
15: ; preds = %3, %15
%16 = phi i64 [ 0, %3 ], [ %32, %15 ]
%17 = phi i32 [ %5, %3 ], [ %31, %15 ]
%18 = phi i32 [ %6, %3 ], [ %22, %15 ]
%19 = icmp eq i32 %17, 0
%20 = select i1 %7, i1 %19, i1 false
%21 = zext i1 %20 to i32
%22 = add nsw i32 %18, %21
%23 = getelementptr inbounds [12 x i32], [12 x i32]* @__const.main.days, i64 0, i64 %16
%24 = load i32, i32* %23
%25 = add nsw i32 %24, %17
%26 = icmp eq i64 %16, 1
%27 = select i1 %26, i1 %9, i1 false
%28 = select i1 %27, i1 %14, i1 false
%29 = zext i1 %28 to i32
%30 = add nsw i32 %25, %29
%31 = srem i32 %30, 7
%32 = add nuw nsw i64 %16, 1
%33 = icmp eq i64 %32, 12
br i1 %33, label %34, label %15
34: ; preds = %15
%35 = add nuw nsw i32 %4, 1
%36 = icmp eq i32 %35, 2001
br i1 %36, label %37, label %3
37: ; preds = %34
%38 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
ret i32 0
}