#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(void) {
  int year;
  int month;
  int day = 1;
  int s = 1;
  for (year = 1901; year < 2001; ++year) {
    for (month = 15; month > 3; --month) {
      int Y = month > 12 ? year - 1 : year;
      if (((day + ((month + 1) * 13) / 5 + Y + Y / 4 + 6 * (Y / 100) +
            Y / 400) %
           7) == 1)
        ++s;
    }
  }
  printf("%d\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x76d,-0x8(%rbp)
cmpl   $0x7d1,-0x8(%rbp)
jge    1219 <main+0x109>
movl   $0xf,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jle    1206 <main+0xf6>
cmpl   $0xc,-0xc(%rbp)
jle    116a <main+0x5a>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1170 <main+0x60>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
imul   $0xd,%eax,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
add    %ecx,%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
imul   $0x6,%ecx,%ecx
add    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    11f3 <main+0xe3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11f8 <main+0xe8>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <main+0x38>
jmp    120b <main+0xfb>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1134 <main+0x24>
mov    -0x14(%rbp),%esi
lea    0xddd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%esi
mov    $0x76d,%eax
movdqa 0xeec(%rip),%xmm13
movdqa 0xef3(%rip),%xmm14
movdqa 0xefa(%rip),%xmm9
movdqa 0xf01(%rip),%xmm15
movdqa 0xf08(%rip),%xmm12
movdqa 0xf0f(%rip),%xmm10
movdqa 0xf16(%rip),%xmm11
nopw   0x0(%rax,%rax,1)
movd   %eax,%xmm0
pshufd $0x0,%xmm0,%xmm7
movdqa %xmm7,%xmm3
paddd  0xe8b(%rip),%xmm3
movd   %esi,%xmm0
movdqa %xmm3,%xmm1
psrad  $0x1f,%xmm1
psrld  $0x1e,%xmm1
paddd  %xmm3,%xmm1
psrad  $0x2,%xmm1
pshufd $0xf5,%xmm3,%xmm5
pxor   %xmm6,%xmm6
pcmpgtd %xmm3,%xmm6
paddd  %xmm7,%xmm1
pmuludq %xmm13,%xmm3
pmuludq %xmm13,%xmm5
pshufd $0xed,%xmm5,%xmm5
pshufd $0xed,%xmm3,%xmm3
punpckldq %xmm5,%xmm3
pand   %xmm13,%xmm6
psubd  %xmm6,%xmm3
movdqa %xmm3,%xmm5
psrld  $0x1f,%xmm5
movdqa %xmm3,%xmm6
psrad  $0x7,%xmm6
paddd  %xmm5,%xmm6
psrad  $0x5,%xmm3
paddd  %xmm1,%xmm6
paddd  %xmm5,%xmm3
pshufd $0xf5,%xmm3,%xmm1
pmuludq %xmm14,%xmm3
pshufd $0xe8,%xmm3,%xmm3
pmuludq %xmm14,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm1,%xmm3
paddd  %xmm6,%xmm3
paddd  %xmm9,%xmm3
pxor   %xmm5,%xmm5
movdqa %xmm7,%xmm6
psrld  $0x2,%xmm6
pcmpgtd %xmm3,%xmm5
movdqa %xmm3,%xmm1
paddd  %xmm7,%xmm6
pmuludq %xmm13,%xmm7
pshufd $0xf5,%xmm7,%xmm2
movdqa %xmm2,%xmm7
pmuludq %xmm15,%xmm1
psrld  $0x5,%xmm7
pshufd $0xf5,%xmm7,%xmm4
pmuludq %xmm14,%xmm7
pand   %xmm15,%xmm5
pshufd $0xe8,%xmm7,%xmm8
pmuludq %xmm14,%xmm4
pshufd $0xe8,%xmm4,%xmm4
paddd  %xmm3,%xmm5
punpckldq %xmm4,%xmm8
pshufd $0xf5,%xmm3,%xmm4
pmuludq %xmm15,%xmm4
pshufd $0xed,%xmm1,%xmm7
pshufd $0xed,%xmm4,%xmm1
psrld  $0x7,%xmm2
paddd  %xmm2,%xmm6
punpckldq %xmm1,%xmm7
paddd  %xmm8,%xmm6
movdqa %xmm6,%xmm1
paddd  %xmm10,%xmm1
movdqa %xmm1,%xmm2
pmuludq %xmm15,%xmm2
psubd  %xmm5,%xmm7
pshufd $0xed,%xmm2,%xmm5
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm15,%xmm2
paddd  %xmm3,%xmm7
movdqa %xmm7,%xmm4
pshufd $0xed,%xmm2,%xmm2
punpckldq %xmm2,%xmm5
pxor   %xmm2,%xmm2
psrld  $0x1f,%xmm4
pcmpgtd %xmm1,%xmm2
pand   %xmm15,%xmm2
paddd  %xmm1,%xmm2
psrad  $0x2,%xmm7
psubd  %xmm2,%xmm5
paddd  %xmm1,%xmm5
movdqa %xmm5,%xmm2
psrld  $0x1f,%xmm2
paddd  %xmm4,%xmm7
movdqa %xmm7,%xmm4
psrad  $0x2,%xmm5
paddd  %xmm2,%xmm5
movdqa %xmm5,%xmm2
pslld  $0x3,%xmm2
pslld  $0x3,%xmm4
psubd  %xmm2,%xmm5
paddd  %xmm11,%xmm6
movdqa %xmm6,%xmm2
pmuludq %xmm15,%xmm2
psubd  %xmm4,%xmm7
pshufd $0xed,%xmm2,%xmm2
pshufd $0xf5,%xmm6,%xmm4
pmuludq %xmm15,%xmm4
paddd  %xmm1,%xmm5
pshufd $0xed,%xmm4,%xmm1
punpckldq %xmm1,%xmm2
pxor   %xmm1,%xmm1
paddd  %xmm3,%xmm7
pcmpgtd %xmm6,%xmm1
pand   %xmm15,%xmm1
paddd  %xmm6,%xmm1
pcmpeqd %xmm12,%xmm5
psubd  %xmm1,%xmm2
paddd  %xmm6,%xmm2
movdqa %xmm2,%xmm1
psrld  $0x1f,%xmm1
pcmpeqd %xmm12,%xmm7
psrad  $0x2,%xmm2
paddd  %xmm1,%xmm2
movdqa %xmm2,%xmm1
pslld  $0x3,%xmm1
psubd  %xmm7,%xmm0
psubd  %xmm1,%xmm2
paddd  %xmm6,%xmm2
pcmpeqd %xmm12,%xmm2
psubd  %xmm5,%xmm0
psubd  %xmm2,%xmm0
pshufd $0xee,%xmm0,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
movd   %xmm0,%esi
add    $0x1,%eax
cmp    $0x7d1,%eax
jne    1160 <main+0x50>
lea    0xcbd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
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
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %4
store i32 1, i32* %5
store i32 1901, i32* %2
br label %7
7: ; preds = %52, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 2001
br i1 %9, label %10, label %55
10: ; preds = %7
store i32 15, i32* %3
br label %11
11: ; preds = %48, %10
%12 = load i32, i32* %3
%13 = icmp sgt i32 %12, 3
br i1 %13, label %14, label %51
14: ; preds = %11
%15 = load i32, i32* %3
%16 = icmp sgt i32 %15, 12
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %2
%19 = sub nsw i32 %18, 1
br label %22
20: ; preds = %14
%21 = load i32, i32* %2
br label %22
22: ; preds = %20, %17
%23 = phi i32 [ %19, %17 ], [ %21, %20 ]
store i32 %23, i32* %6
%24 = load i32, i32* %4
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
%27 = mul nsw i32 %26, 13
%28 = sdiv i32 %27, 5
%29 = add nsw i32 %24, %28
%30 = load i32, i32* %6
%31 = add nsw i32 %29, %30
%32 = load i32, i32* %6
%33 = sdiv i32 %32, 4
%34 = add nsw i32 %31, %33
%35 = load i32, i32* %6
%36 = sdiv i32 %35, 100
%37 = mul nsw i32 6, %36
%38 = add nsw i32 %34, %37
%39 = load i32, i32* %6
%40 = sdiv i32 %39, 400
%41 = add nsw i32 %38, %40
%42 = srem i32 %41, 7
%43 = icmp eq i32 %42, 1
br i1 %43, label %44, label %47
44: ; preds = %22
%45 = load i32, i32* %5
%46 = add nsw i32 %45, 1
store i32 %46, i32* %5
br label %47
47: ; preds = %44, %22
br label %48
48: ; preds = %47
%49 = load i32, i32* %3
%50 = add nsw i32 %49, -1
store i32 %50, i32* %3
br label %11
51: ; preds = %11
br label %52
52: ; preds = %51
%53 = load i32, i32* %2
%54 = add nsw i32 %53, 1
store i32 %54, i32* %2
br label %7
55: ; preds = %7
%56 = load i32, i32* %5
%57 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %56)
ret i32 0
}

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