#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 ndays[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int d = 2;
  int isleap = 0;
  int nsun = 0;
  for (int year = 1901; year <= 2000; year++) {
    if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
      isleap = 1;
      ndays[1] = 29;
    }
    for (int i = 0; i < 12; i++) {
      d += ndays[i];
      d %= 7;
      if (d == 0) {
        nsun++;
      }
    }
    if (isleap == 1) {
      ndays[1] = 28;
    }
  }
  printf("%d\n", nsun);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
movl   $0x2,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x76d,-0x50(%rbp)
cmpl   $0x7d0,-0x50(%rbp)
jg     122e <main+0x10e>
mov    -0x50(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1195 <main+0x75>
mov    -0x50(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11a9 <main+0x89>
mov    -0x50(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b7 <main+0x97>
movl   $0x1,-0x48(%rbp)
movl   $0x1d,-0x3c(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0xc,-0x54(%rbp)
jge    120a <main+0xea>
movslq -0x54(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jne    11f7 <main+0xd7>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11fc <main+0xdc>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11be <main+0x9e>
cmpl   $0x1,-0x48(%rbp)
jne    121b <main+0xfb>
movl   $0x1c,-0x3c(%rbp)
jmp    1220 <main+0x100>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1160 <main+0x40>
mov    -0x4c(%rbp),%esi
lea    0xdf8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x2,%edi
xor    %esi,%esi
mov    $0x76d,%r14d
mov    $0x1c,%r8d
mov    $0x1d,%r9d
mov    $0x1,%r10d
mov    $0x1c,%r15d
xor    %r11d,%r11d
nop
movzwl %r14w,%edx
mov    %edx,%ebx
shr    $0x4,%ebx
imul   $0xa3e,%ebx,%ebx
shr    $0x10,%ebx
imul   $0xfffffe70,%ebx,%ebx
mov    %edx,%ebp
shr    $0x2,%ebp
imul   $0x147b,%ebp,%ebp
shr    $0x11,%ebp
imul   $0xffffff9c,%ebp,%ebp
test   $0x3,%r14b
sete   %al
add    %dx,%bp
setne  %cl
and    %al,%cl
add    %dx,%bx
sete   %al
or     %cl,%al
cmovne %r9d,%r15d
cmovne %r10d,%r11d
lea    0x1f(%rdi),%eax
imul   $0x24924925,%rax,%rcx
shr    $0x20,%rcx
sub    %ecx,%eax
shr    %eax
add    %ecx,%eax
shr    $0x2,%eax
lea    0x0(,%rax,8),%ecx
sub    %ecx,%eax
add    %edi,%eax
add    $0x1f,%eax
cmp    $0x1,%eax
adc    $0x0,%esi
add    %r15d,%eax
cltq
imul   $0xffffffff92492493,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x2,%ecx
add    %edx,%ecx
lea    0x0(,%rcx,8),%edx
sub    %edx,%ecx
add    %eax,%ecx
cmp    $0x1,%ecx
adc    $0x0,%esi
add    $0x1f,%cl
movzbl %cl,%eax
lea    (%rax,%rax,8),%ecx
lea    (%rax,%rcx,4),%ecx
shr    $0x8,%ecx
mov    %eax,%edx
sub    %cl,%dl
shr    %dl
add    %cl,%dl
shr    $0x2,%dl
movzbl %dl,%ecx
lea    0x0(,%rcx,8),%edx
sub    %ecx,%edx
sub    %dl,%al
cmp    $0x1,%al
adc    $0x0,%esi
add    $0x1e,%al
movzbl %al,%eax
lea    (%rax,%rax,8),%ecx
lea    (%rax,%rcx,4),%ecx
shr    $0x8,%ecx
mov    %eax,%edx
sub    %cl,%dl
shr    %dl
add    %cl,%dl
shr    $0x2,%dl
movzbl %dl,%ecx
lea    0x0(,%rcx,8),%edx
sub    %ecx,%edx
sub    %dl,%al
cmp    $0x1,%al
adc    $0x0,%esi
add    $0x1f,%al
movzbl %al,%eax
lea    (%rax,%rax,8),%ecx
lea    (%rax,%rcx,4),%ecx
shr    $0x8,%ecx
mov    %eax,%edx
sub    %cl,%dl
shr    %dl
add    %cl,%dl
shr    $0x2,%dl
movzbl %dl,%ecx
lea    0x0(,%rcx,8),%edx
sub    %ecx,%edx
sub    %dl,%al
cmp    $0x1,%al
adc    $0x0,%esi
add    $0x1e,%al
movzbl %al,%eax
lea    (%rax,%rax,8),%ecx
lea    (%rax,%rcx,4),%ecx
shr    $0x8,%ecx
mov    %eax,%edx
sub    %cl,%dl
shr    %dl
add    %cl,%dl
shr    $0x2,%dl
movzbl %dl,%ecx
lea    0x0(,%rcx,8),%edx
sub    %ecx,%edx
sub    %dl,%al
cmp    $0x1,%al
adc    $0x0,%esi
add    $0x1f,%al
movzbl %al,%eax
lea    (%rax,%rax,8),%ecx
lea    (%rax,%rcx,4),%ecx
shr    $0x8,%ecx
mov    %eax,%edx
sub    %cl,%dl
shr    %dl
add    %cl,%dl
shr    $0x2,%dl
movzbl %dl,%ecx
lea    0x0(,%rcx,8),%edx
sub    %ecx,%edx
sub    %dl,%al
cmp    $0x1,%al
adc    $0x0,%esi
add    $0x1f,%al
movzbl %al,%eax
lea    (%rax,%rax,8),%ecx
lea    (%rax,%rcx,4),%ecx
shr    $0x8,%ecx
mov    %eax,%edx
sub    %cl,%dl
shr    %dl
add    %cl,%dl
shr    $0x2,%dl
movzbl %dl,%ecx
lea    0x0(,%rcx,8),%edx
sub    %ecx,%edx
sub    %dl,%al
cmp    $0x1,%al
adc    $0x0,%esi
add    $0x1e,%al
movzbl %al,%eax
lea    (%rax,%rax,8),%ecx
lea    (%rax,%rcx,4),%ecx
shr    $0x8,%ecx
mov    %eax,%edx
sub    %cl,%dl
shr    %dl
add    %cl,%dl
shr    $0x2,%dl
movzbl %dl,%ecx
lea    0x0(,%rcx,8),%edx
sub    %ecx,%edx
sub    %dl,%al
cmp    $0x1,%al
adc    $0x0,%esi
add    $0x1f,%al
movzbl %al,%eax
lea    (%rax,%rax,8),%ecx
lea    (%rax,%rcx,4),%ecx
shr    $0x8,%ecx
mov    %eax,%edx
sub    %cl,%dl
shr    %dl
add    %cl,%dl
shr    $0x2,%dl
movzbl %dl,%ecx
lea    0x0(,%rcx,8),%edx
sub    %ecx,%edx
sub    %dl,%al
cmp    $0x1,%al
adc    $0x0,%esi
add    $0x1e,%al
movzbl %al,%eax
lea    (%rax,%rax,8),%ecx
lea    (%rax,%rcx,4),%ecx
shr    $0x8,%ecx
mov    %eax,%edx
sub    %cl,%dl
shr    %dl
add    %cl,%dl
shr    $0x2,%dl
movzbl %dl,%ecx
lea    0x0(,%rcx,8),%edx
sub    %ecx,%edx
sub    %dl,%al
cmp    $0x1,%al
adc    $0x0,%esi
add    $0x1f,%al
movzbl %al,%eax
lea    (%rax,%rax,8),%ecx
lea    (%rax,%rcx,4),%ecx
shr    $0x8,%ecx
mov    %eax,%edx
sub    %cl,%dl
shr    %dl
add    %cl,%dl
shr    $0x2,%dl
movzbl %dl,%ecx
lea    0x0(,%rcx,8),%edx
sub    %ecx,%edx
sub    %dl,%al
movzbl %al,%edi
cmp    $0x1,%al
adc    $0x0,%esi
cmp    $0x1,%r11d
cmove  %r8d,%r15d
add    $0x1,%r14d
cmp    $0x7d1,%r14d
jne    1140 <main+0x30>
lea    0xc44(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %3
1: ; preds = %3
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %81)
ret i32 0
3: ; preds = %0, %3
%4 = phi i32 [ 28, %0 ], [ %83, %3 ]
%5 = phi i32 [ 1901, %0 ], [ %84, %3 ]
%6 = phi i32 [ 0, %0 ], [ %81, %3 ]
%7 = phi i32 [ 0, %0 ], [ %19, %3 ]
%8 = phi i32 [ 2, %0 ], [ %78, %3 ]
%9 = and i32 %5, 3
%10 = icmp eq i32 %9, 0
%11 = trunc i32 %5 to i16
%12 = urem i16 %11, 100
%13 = icmp ne i16 %12, 0
%14 = and i1 %10, %13
%15 = urem i16 %11, 400
%16 = icmp eq i16 %15, 0
%17 = select i1 %14, i1 true, i1 %16
%18 = select i1 %17, i32 29, i32 %4
%19 = select i1 %17, i32 1, i32 %7
%20 = add nuw nsw i32 %8, 31
%21 = urem i32 %20, 7
%22 = icmp eq i32 %21, 0
%23 = zext i1 %22 to i32
%24 = add nsw i32 %6, %23
%25 = add nsw i32 %18, %21
%26 = srem i32 %25, 7
%27 = icmp eq i32 %26, 0
%28 = zext i1 %27 to i32
%29 = add nsw i32 %24, %28
%30 = trunc i32 %26 to i8
%31 = add i8 %30, 31
%32 = urem i8 %31, 7
%33 = icmp eq i8 %32, 0
%34 = zext i1 %33 to i32
%35 = add nsw i32 %29, %34
%36 = add nuw nsw i8 %32, 30
%37 = urem i8 %36, 7
%38 = icmp eq i8 %37, 0
%39 = zext i1 %38 to i32
%40 = add nsw i32 %35, %39
%41 = add nuw nsw i8 %37, 31
%42 = urem i8 %41, 7
%43 = icmp eq i8 %42, 0
%44 = zext i1 %43 to i32
%45 = add nsw i32 %40, %44
%46 = add nuw nsw i8 %42, 30
%47 = urem i8 %46, 7
%48 = icmp eq i8 %47, 0
%49 = zext i1 %48 to i32
%50 = add nsw i32 %45, %49
%51 = add nuw nsw i8 %47, 31
%52 = urem i8 %51, 7
%53 = icmp eq i8 %52, 0
%54 = zext i1 %53 to i32
%55 = add nsw i32 %50, %54
%56 = add nuw nsw i8 %52, 31
%57 = urem i8 %56, 7
%58 = icmp eq i8 %57, 0
%59 = zext i1 %58 to i32
%60 = add nsw i32 %55, %59
%61 = add nuw nsw i8 %57, 30
%62 = urem i8 %61, 7
%63 = icmp eq i8 %62, 0
%64 = zext i1 %63 to i32
%65 = add nsw i32 %60, %64
%66 = add nuw nsw i8 %62, 31
%67 = urem i8 %66, 7
%68 = icmp eq i8 %67, 0
%69 = zext i1 %68 to i32
%70 = add nsw i32 %65, %69
%71 = add nuw nsw i8 %67, 30
%72 = urem i8 %71, 7
%73 = icmp eq i8 %72, 0
%74 = zext i1 %73 to i32
%75 = add nsw i32 %70, %74
%76 = add nuw nsw i8 %72, 31
%77 = urem i8 %76, 7
%78 = zext i8 %77 to i32
%79 = icmp eq i8 %77, 0
%80 = zext i1 %79 to i32
%81 = add nsw i32 %75, %80
%82 = icmp eq i32 %19, 1
%83 = select i1 %82, i32 28, i32 %18
%84 = add nuw nsw i32 %5, 1
%85 = icmp eq i32 %84, 2001
br i1 %85, label %1, label %3
}