#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 */
struct tm {
  int tm_year;
  int tm_mon;
  int tm_mday;
  int /*<<< orphan*/ member_0;
};

/* Variables and functions */
scalar_t__ puts(char *);
scalar_t__ strftime(char *, int, char *, struct tm *);
int main(void) {
  int J, a, b, c, d, e, t, m, M, N;
  char T[16];
  struct tm s = {0};
  for (J = 1582; J < 2200; ++J) {
    if (J < 1700) {
      M = 22;
      N = 2;
    } else if (J < 1800) {
      M = 23;
      N = 3;
    } else if (J < 1900) {
      M = 23;
      N = 4;
    } else if (J < 2100) {
      M = 24;
      N = 5;
    } else if (J < 2200) {
      M = 24;
      N = 6;
    }
    a = J % 19;
    b = J % 4;
    c = J % 7;
    d = (19 * a + M) % 30;
    e = (2 * b + 4 * c + 6 * d + N) % 7;
    if (22 + d + e > 31) {
      t = d + e - 9;
      m = 4;
      if (t == 26) {
        t = 19;
      } else {
        if (t == 25 && d == 28 && a > 10)
          t = 18;
      };
    } else {
      t = d + e + 22;
      m = 3;
    }
    s.tm_year = J - 1900;
    s.tm_mon = m - 1;
    s.tm_mday = t;
    (void)strftime(T, sizeof T, "%a %b %d %Y", &s), (void)puts(T);
    ;
  }
  return '^' ^ '^';
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
movl   $0x62e,-0x8(%rbp)
cmpl   $0x898,-0x8(%rbp)
jge    1337 <main+0x207>
cmpl   $0x6a4,-0x8(%rbp)
jge    1183 <main+0x53>
movl   $0x16,-0x28(%rbp)
movl   $0x2,-0x2c(%rbp)
jmp    1212 <main+0xe2>
cmpl   $0x708,-0x8(%rbp)
jge    11a3 <main+0x73>
movl   $0x17,-0x28(%rbp)
movl   $0x3,-0x2c(%rbp)
jmp    120d <main+0xdd>
cmpl   $0x76c,-0x8(%rbp)
jge    11c3 <main+0x93>
movl   $0x17,-0x28(%rbp)
movl   $0x4,-0x2c(%rbp)
jmp    1208 <main+0xd8>
cmpl   $0x834,-0x8(%rbp)
jge    11e3 <main+0xb3>
movl   $0x18,-0x28(%rbp)
movl   $0x5,-0x2c(%rbp)
jmp    1203 <main+0xd3>
cmpl   $0x898,-0x8(%rbp)
jge    11fe <main+0xce>
movl   $0x18,-0x28(%rbp)
movl   $0x6,-0x2c(%rbp)
jmp    1203 <main+0xd3>
jmp    1208 <main+0xd8>
jmp    120d <main+0xdd>
jmp    1212 <main+0xe2>
mov    -0x8(%rbp),%eax
mov    $0x13,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
imul   $0x13,-0xc(%rbp),%eax
add    -0x28(%rbp),%eax
mov    $0x1e,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
add    %ecx,%eax
imul   $0x6,-0x18(%rbp),%ecx
add    %ecx,%eax
add    -0x2c(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x16,%eax
add    -0x1c(%rbp),%eax
cmp    $0x1f,%eax
jle    12da <main+0x1aa>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
sub    $0x9,%eax
mov    %eax,-0x20(%rbp)
movl   $0x4,-0x24(%rbp)
cmpl   $0x1a,-0x20(%rbp)
jne    12ab <main+0x17b>
movl   $0x13,-0x20(%rbp)
jmp    12d5 <main+0x1a5>
cmpl   $0x19,-0x20(%rbp)
jne    12d0 <main+0x1a0>
cmpl   $0x1c,-0x18(%rbp)
jne    12d0 <main+0x1a0>
cmpl   $0xa,-0xc(%rbp)
jle    12d0 <main+0x1a0>
movl   $0x12,-0x20(%rbp)
jmp    12d5 <main+0x1a5>
jmp    12ed <main+0x1bd>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
add    $0x16,%eax
mov    %eax,-0x20(%rbp)
movl   $0x3,-0x24(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x76c,%eax
mov    %eax,-0x50(%rbp)
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
mov    $0x10,%esi
lea    0xce9(%rip),%rdx
lea    -0x50(%rbp),%rcx
call   1050 <strftime@plt>
lea    -0x40(%rbp),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <main+0x26>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movl   $0x0,0xc(%rsp)
mov    $0x62e,%r14d
mov    $0xc5c,%r13d
mov    $0x18b8,%r12w
mov    $0x754e,%bx
mov    $0x756a,%r15w
jmp    11c3 <main+0xa3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x16,%esi
mov    $0x2,%eax
mov    %esi,%edi
mov    %r11d,%ebx
lea    -0x76c(%r14),%ecx
mov    %ecx,(%rsp)
mov    %eax,0x4(%rsp)
mov    %edi,0x8(%rsp)
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x10,%esi
lea    0xe6d(%rip),%rdx
mov    %rsp,%rcx
call   1040 <strftime@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
add    $0x1,%r14d
add    $0x2,%r13d
add    $0x4,%r12d
add    $0x13,%ebx
add    $0x13,%r15d
cmp    $0x898,%r14d
je     131a <main+0x1fa>
movzwl %r14w,%eax
imul   $0x2493,%eax,%ecx
shr    $0x10,%ecx
mov    %r14d,%edx
sub    %ecx,%edx
movzwl %dx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x2,%edx
lea    (%rdx,%rdx,8),%ecx
lea    (%rcx,%rcx,2),%ecx
add    %edx,%ecx
mov    %r12d,%esi
sub    %ecx,%esi
imul   $0xd795,%eax,%r9d
shr    $0x14,%r9d
imul   $0x169,%r9d,%r8d
mov    %r15d,%edi
sub    %r8d,%edi
cmp    $0x6a4,%r14d
jae    1220 <main+0x100>
mov    %ebx,%r11d
mov    $0x2,%r10d
mov    $0x16,%dx
jmp    1260 <main+0x140>
nopl   0x0(%rax)
mov    $0x3,%r10d
mov    $0x17,%dx
mov    %ebx,%r11d
cmp    $0x708,%r14d
jb     1260 <main+0x140>
mov    $0x4,%r10d
cmp    $0x76c,%r14d
jb     1260 <main+0x140>
cmp    $0x834,%r14d
mov    $0x6,%r10d
sbb    $0x0,%r10d
mov    $0x18,%dx
nopw   0x0(%rax,%rax,1)
movzwl %dx,%ebp
lea    (%r15,%rbp,1),%edx
sub    %r8d,%edx
movzwl %dx,%edx
imul   $0x8889,%edx,%edx
shr    $0x14,%edx
mov    %edx,%eax
shl    $0x5,%eax
mov    %edx,%ecx
sub    %eax,%ecx
add    %edx,%ecx
add    %ebp,%ecx
add    %ecx,%edi
movzwl %di,%edi
mov    %r13d,%eax
and    $0x6,%eax
movzwl %si,%edx
add    %eax,%edx
add    %r10d,%edx
lea    (%rdi,%rdi,2),%eax
lea    (%rdx,%rax,2),%eax
movzbl %al,%eax
lea    (%rax,%rax,8),%edx
lea    (%rax,%rdx,4),%edx
shr    $0x8,%edx
mov    %eax,%ebx
sub    %dl,%bl
shr    %bl
add    %dl,%bl
shr    $0x2,%bl
movzbl %bl,%edx
lea    0x0(,%rdx,8),%esi
sub    %edx,%esi
sub    %sil,%al
movzbl %al,%esi
add    %edi,%esi
cmp    $0xa,%esi
jb     1160 <main+0x40>
add    $0xfffffff7,%esi
mov    $0x3,%eax
mov    $0x13,%edi
cmp    $0x1a,%esi
je     116a <main+0x4a>
imul   $0xffffffed,%r9d,%edx
mov    %r11d,%ebx
mov    %r11d,%edi
sub    %r8d,%edi
movzwl %dx,%edx
add    %r14d,%edx
add    %edi,%ecx
cmp    $0xb,%dx
mov    %esi,%edi
mov    $0x12,%edx
cmovae %edx,%edi
test   %cx,%cx
cmovne %esi,%edi
cmp    $0x19,%esi
cmovne %esi,%edi
jmp    116d <main+0x4d>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32 }
@.str = [12 x i8] c"%a %b %d %Y\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [16 x i8]
%13 = alloca %struct.tm
store i32 0, i32* %1
%14 = bitcast %struct.tm* %13 to i8*
store i32 1582, i32* %2
br label %15
15: ; preds = %108, %0
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 2200
br i1 %17, label %18, label %111
18: ; preds = %15
%19 = load i32, i32* %2
%20 = icmp slt i32 %19, 1700
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 22, i32* %10
store i32 2, i32* %11
br label %42
22: ; preds = %18
%23 = load i32, i32* %2
%24 = icmp slt i32 %23, 1800
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 23, i32* %10
store i32 3, i32* %11
br label %41
26: ; preds = %22
%27 = load i32, i32* %2
%28 = icmp slt i32 %27, 1900
br i1 %28, label %29, label %30
29: ; preds = %26
store i32 23, i32* %10
store i32 4, i32* %11
br label %40
30: ; preds = %26
%31 = load i32, i32* %2
%32 = icmp slt i32 %31, 2100
br i1 %32, label %33, label %34
33: ; preds = %30
store i32 24, i32* %10
store i32 5, i32* %11
br label %39
34: ; preds = %30
%35 = load i32, i32* %2
%36 = icmp slt i32 %35, 2200
br i1 %36, label %37, label %38
37: ; preds = %34
store i32 24, i32* %10
store i32 6, i32* %11
br label %38
38: ; preds = %37, %34
br label %39
39: ; preds = %38, %33
br label %40
40: ; preds = %39, %29
br label %41
41: ; preds = %40, %25
br label %42
42: ; preds = %41, %21
%43 = load i32, i32* %2
%44 = srem i32 %43, 19
store i32 %44, i32* %3
%45 = load i32, i32* %2
%46 = srem i32 %45, 4
store i32 %46, i32* %4
%47 = load i32, i32* %2
%48 = srem i32 %47, 7
store i32 %48, i32* %5
%49 = load i32, i32* %3
%50 = mul nsw i32 19, %49
%51 = load i32, i32* %10
%52 = add nsw i32 %50, %51
%53 = srem i32 %52, 30
store i32 %53, i32* %6
%54 = load i32, i32* %4
%55 = mul nsw i32 2, %54
%56 = load i32, i32* %5
%57 = mul nsw i32 4, %56
%58 = add nsw i32 %55, %57
%59 = load i32, i32* %6
%60 = mul nsw i32 6, %59
%61 = add nsw i32 %58, %60
%62 = load i32, i32* %11
%63 = add nsw i32 %61, %62
%64 = srem i32 %63, 7
store i32 %64, i32* %7
%65 = load i32, i32* %6
%66 = add nsw i32 22, %65
%67 = load i32, i32* %7
%68 = add nsw i32 %66, %67
%69 = icmp sgt i32 %68, 31
br i1 %69, label %70, label %90
70: ; preds = %42
%71 = load i32, i32* %6
%72 = load i32, i32* %7
%73 = add nsw i32 %71, %72
%74 = sub nsw i32 %73, 9
store i32 %74, i32* %8
store i32 4, i32* %9
%75 = load i32, i32* %8
%76 = icmp eq i32 %75, 26
br i1 %76, label %77, label %78
77: ; preds = %70
store i32 19, i32* %8
br label %89
78: ; preds = %70
%79 = load i32, i32* %8
%80 = icmp eq i32 %79, 25
br i1 %80, label %81, label %88
81: ; preds = %78
%82 = load i32, i32* %6
%83 = icmp eq i32 %82, 28
br i1 %83, label %84, label %88
84: ; preds = %81
%85 = load i32, i32* %3
%86 = icmp sgt i32 %85, 10
br i1 %86, label %87, label %88
87: ; preds = %84
store i32 18, i32* %8
br label %88
88: ; preds = %87, %84, %81, %78
br label %89
89: ; preds = %88, %77
br label %95
90: ; preds = %42
%91 = load i32, i32* %6
%92 = load i32, i32* %7
%93 = add nsw i32 %91, %92
%94 = add nsw i32 %93, 22
store i32 %94, i32* %8
store i32 3, i32* %9
br label %95
95: ; preds = %90, %89
%96 = load i32, i32* %2
%97 = sub nsw i32 %96, 1900
%98 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 0
store i32 %97, i32* %98
%99 = load i32, i32* %9
%100 = sub nsw i32 %99, 1
%101 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 1
store i32 %100, i32* %101
%102 = load i32, i32* %8
%103 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 2
store i32 %102, i32* %103
%104 = getelementptr inbounds [16 x i8], [16 x i8]* %12, i64 0, i64 0
%105 = call i64 @strftime(i8* %104, i32 16, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %struct.tm* %13)
%106 = getelementptr inbounds [16 x i8], [16 x i8]* %12, i64 0, i64 0
%107 = call i64 @puts(i8* %106)
br label %108
108: ; preds = %95
%109 = load i32, i32* %2
%110 = add nsw i32 %109, 1
store i32 %110, i32* %2
br label %15
111: ; preds = %15
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32 }
@.str = [12 x i8] c"%a %b %d %Y\00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = alloca %struct.tm
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%4 = bitcast %struct.tm* %2 to i8*
%5 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 3
store i32 0, i32* %5
%6 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 0
%7 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 1
%8 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 2
br label %9
9: ; preds = %0, %54
%10 = phi i32 [ 1582, %0 ], [ %60, %54 ]
%11 = icmp ult i32 %10, 1700
br i1 %11, label %19, label %12
12: ; preds = %9
%13 = icmp ult i32 %10, 1800
br i1 %13, label %19, label %14
14: ; preds = %12
%15 = icmp ult i32 %10, 1900
br i1 %15, label %19, label %16
16: ; preds = %14
%17 = icmp ult i32 %10, 2100
%18 = select i1 %17, i32 5, i32 6
br label %19
19: ; preds = %16, %14, %12, %9
%20 = phi i16 [ 22, %9 ], [ 23, %12 ], [ 23, %14 ], [ 24, %16 ]
%21 = phi i32 [ 2, %9 ], [ 3, %12 ], [ 4, %14 ], [ %18, %16 ]
%22 = trunc i32 %10 to i16
%23 = urem i16 %22, 19
%24 = urem i16 %22, 7
%25 = mul nuw nsw i16 %23, 19
%26 = add nuw nsw i16 %20, %25
%27 = urem i16 %26, 30
%28 = zext i16 %27 to i32
%29 = shl nuw nsw i32 %10, 1
%30 = and i32 %29, 6
%31 = shl nuw nsw i16 %24, 2
%32 = zext i16 %31 to i32
%33 = add nuw nsw i32 %30, %32
%34 = mul nuw nsw i32 %28, 6
%35 = add nuw nsw i32 %33, %21
%36 = add nuw nsw i32 %35, %34
%37 = trunc i32 %36 to i8
%38 = urem i8 %37, 7
%39 = zext i8 %38 to i32
%40 = add nuw nsw i32 %39, %28
%41 = icmp ugt i32 %40, 9
br i1 %41, label %42, label %52
42: ; preds = %19
%43 = add nsw i32 %40, -9
%44 = icmp eq i32 %43, 26
br i1 %44, label %54, label %45
45: ; preds = %42
%46 = icmp eq i32 %43, 25
%47 = icmp eq i16 %27, 28
%48 = select i1 %46, i1 %47, i1 false
%49 = icmp ugt i16 %23, 10
%50 = select i1 %48, i1 %49, i1 false
%51 = select i1 %50, i32 18, i32 %43
br label %54
52: ; preds = %19
%53 = add nuw nsw i32 %40, 22
br label %54
54: ; preds = %42, %45, %52
%55 = phi i32 [ %51, %45 ], [ %53, %52 ], [ 19, %42 ]
%56 = phi i32 [ 3, %45 ], [ 2, %52 ], [ 3, %42 ]
%57 = add nsw i32 %10, -1900
store i32 %57, i32* %6
store i32 %56, i32* %7
store i32 %55, i32* %8
%58 = call i64 @strftime(i8* %3, i32 16, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %struct.tm* %2)
%59 = call i64 @puts(i8* %3)
%60 = add nuw nsw i32 %10, 1
%61 = icmp eq i32 %60, 2200
br i1 %61, label %62, label %9
62: ; preds = %54
ret i32 0
}