#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int, int, int,
                           int, int, int);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int main() {
  FILE *fin = fopen("friday.in", "r");
  FILE *fout = fopen("friday.out", "w");
  int days_in_month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int res[7] = {0};
  int year = 1900, month = 1, day = 1;
  int n, end_year;
  int which_day = 1;
  fscanf(fin, "%d", &n);
  end_year = 1900 + n - 1;
  while (year <= end_year) {
    if (day == 13)
      res[which_day]++;
    if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0))
      days_in_month[2] = 29;
    else
      days_in_month[2] = 28;
    if (day < days_in_month[month])
      day++;
    else {
      day = 1;
      if (month < 12)
        month++;
      else {
        month = 1;
        year++;
      }
    }
    which_day++;
    which_day %= 7;
  }
  fprintf(fout, "%d %d %d %d %d %d %d\n", res[6], res[0], res[1], res[2],
          res[3], res[4], res[5]);
  fclose(fin);
  fclose(fout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe87(%rip),%rdi
lea    0xe8a(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe7c(%rip),%rdi
lea    0xe80(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xe95(%rip),%rsi
mov    $0x34,%edx
call   1070 <memcpy@plt>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x1c,%edx
call   1040 <memset@plt>
movl   $0x76c,-0x74(%rbp)
movl   $0x1,-0x78(%rbp)
movl   $0x1,-0x7c(%rbp)
movl   $0x1,-0x88(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe2a(%rip),%rsi
lea    -0x80(%rbp),%rdx
call   1050 <fscanf@plt>
mov    -0x80(%rbp),%eax
add    $0x76c,%eax
sub    $0x1,%eax
mov    %eax,-0x84(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x84(%rbp),%eax
jg     12fe <main+0x19e>
cmpl   $0xd,-0x7c(%rbp)
jne    1234 <main+0xd4>
movslq -0x88(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x70(%rbp,%rax,4)
mov    -0x74(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1270 <main+0x110>
mov    -0x74(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     127c <main+0x11c>
mov    -0x74(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    127c <main+0x11c>
movl   $0x1d,-0x48(%rbp)
jmp    1283 <main+0x123>
movl   $0x1c,-0x48(%rbp)
mov    -0x7c(%rbp),%eax
movslq -0x78(%rbp),%rcx
cmp    -0x50(%rbp,%rcx,4),%eax
jge    12a2 <main+0x142>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    12d6 <main+0x176>
movl   $0x1,-0x7c(%rbp)
cmpl   $0xc,-0x78(%rbp)
jge    12c1 <main+0x161>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    12d1 <main+0x171>
movl   $0x1,-0x78(%rbp)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    12d6 <main+0x176>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
mov    -0x88(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x88(%rbp)
jmp    1209 <main+0xa9>
mov    -0x18(%rbp),%rdi
mov    -0x58(%rbp),%edx
mov    -0x70(%rbp),%ecx
mov    -0x6c(%rbp),%r8d
mov    -0x68(%rbp),%r9d
mov    -0x64(%rbp),%r11d
mov    -0x60(%rbp),%r10d
mov    -0x5c(%rbp),%eax
lea    0xcfa(%rip),%rsi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
lea    0xeb0(%rip),%rdi
lea    0xeb3(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
lea    0xea6(%rip),%rdi
lea    0xeaa(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r15
mov    0xef5(%rip),%eax
mov    %eax,0x60(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xebe(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xea2(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x1c(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0xe62(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %r14,%rdi
call   1040 <fscanf@plt>
mov    0xc(%rsp),%r8d
test   %r8d,%r8d
jle    12c3 <main+0x183>
add    $0x76b,%r8d
mov    $0x76c,%ecx
mov    $0x1,%edx
mov    $0x1,%edi
mov    $0x1,%esi
jmp    1227 <main+0xe7>
nop
add    $0x1,%edi
mov    %edx,%eax
add    $0x1,%eax
cltq
imul   $0xffffffff92492493,%rax,%rax
shr    $0x20,%rax
add    %edx,%eax
add    $0x1,%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
sar    $0x2,%eax
add    %ebx,%eax
lea    0x0(,%rax,8),%ebx
sub    %ebx,%eax
add    %eax,%edx
add    $0x1,%edx
cmp    %r8d,%ecx
jg     12a2 <main+0x162>
cmp    $0xd,%edi
jne    1234 <main+0xf4>
movslq %edx,%rbx
addl   $0x1,0x10(%rsp,%rbx,4)
imul   $0xc28f5c29,%ecx,%eax
add    $0x51eb850,%eax
mov    %eax,%ebx
ror    $0x4,%ebx
cmp    $0xa3d70b,%ebx
jb     1270 <main+0x130>
ror    $0x2,%eax
cmp    $0x28f5c29,%eax
setae  %al
test   $0x3,%cl
sete   %bl
and    %al,%bl
movzbl %bl,%ebx
or     $0x1c,%ebx
jmp    1275 <main+0x135>
nopw   0x0(%rax,%rax,1)
mov    $0x1d,%ebx
mov    %ebx,0x38(%rsp)
movslq %esi,%rax
cmp    0x30(%rsp,%rax,4),%edi
jl     11f0 <main+0xb0>
cmp    $0xb,%esi
jg     1290 <main+0x150>
add    $0x1,%esi
jmp    1298 <main+0x158>
add    $0x1,%ecx
mov    $0x1,%esi
mov    $0x1,%edi
jmp    11f3 <main+0xb3>
mov    0x28(%rsp),%edx
mov    0x10(%rsp),%ecx
mov    0x14(%rsp),%r8d
mov    0x18(%rsp),%r9d
mov    0x1c(%rsp),%r10d
mov    0x20(%rsp),%ebx
mov    0x24(%rsp),%eax
jmp    12d4 <main+0x194>
xor    %eax,%eax
xor    %ebx,%ebx
xor    %r10d,%r10d
xor    %r9d,%r9d
xor    %r8d,%r8d
xor    %ecx,%ecx
xor    %edx,%edx
sub    $0x8,%rsp
lea    0xd3d(%rip),%rsi
mov    %r15,%rdi
push   %rax
push   %rbx
push   %r10
call   1050 <fprintf@plt>
add    $0x20,%rsp
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    %r15,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"friday.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"friday.out\00"
@.str.3 = [2 x i8] c"w\00"
@__const.main.days_in_month = [13 x i32] [i32 0, 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 = [3 x i8] c"%d\00"
@.str.5 = [22 x i8] c"%d %d %d %d %d %d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca [13 x i32]
%5 = alloca [7 x i32]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
%12 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %2
%13 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %13, i32** %3
%14 = bitcast [13 x i32]* %4 to i8*
%15 = bitcast [7 x i32]* %5 to i8*
store i32 1900, i32* %6
store i32 1, i32* %7
store i32 1, i32* %8
store i32 1, i32* %11
%16 = load i32*, i32** %2
%17 = call i32 @fscanf(i32* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %9)
%18 = load i32, i32* %9
%19 = add nsw i32 1900, %18
%20 = sub nsw i32 %19, 1
store i32 %20, i32* %10
br label %21
21: ; preds = %70, %0
%22 = load i32, i32* %6
%23 = load i32, i32* %10
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %75
25: ; preds = %21
%26 = load i32, i32* %8
%27 = icmp eq i32 %26, 13
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = load i32, i32* %11
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = add nsw i32 %32, 1
store i32 %33, i32* %31
br label %34
34: ; preds = %28, %25
%35 = load i32, i32* %6
%36 = srem i32 %35, 400
%37 = icmp eq i32 %36, 0
br i1 %37, label %46, label %38
38: ; preds = %34
%39 = load i32, i32* %6
%40 = srem i32 %39, 100
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %48
42: ; preds = %38
%43 = load i32, i32* %6
%44 = srem i32 %43, 4
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %42, %34
%47 = getelementptr inbounds [13 x i32], [13 x i32]* %4, i64 0, i64 2
store i32 29, i32* %47
br label %50
48: ; preds = %42, %38
%49 = getelementptr inbounds [13 x i32], [13 x i32]* %4, i64 0, i64 2
store i32 28, i32* %49
br label %50
50: ; preds = %48, %46
%51 = load i32, i32* %8
%52 = load i32, i32* %7
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [13 x i32], [13 x i32]* %4, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = icmp slt i32 %51, %55
br i1 %56, label %57, label %60
57: ; preds = %50
%58 = load i32, i32* %8
%59 = add nsw i32 %58, 1
store i32 %59, i32* %8
br label %70
60: ; preds = %50
store i32 1, i32* %8
%61 = load i32, i32* %7
%62 = icmp slt i32 %61, 12
br i1 %62, label %63, label %66
63: ; preds = %60
%64 = load i32, i32* %7
%65 = add nsw i32 %64, 1
store i32 %65, i32* %7
br label %69
66: ; preds = %60
store i32 1, i32* %7
%67 = load i32, i32* %6
%68 = add nsw i32 %67, 1
store i32 %68, i32* %6
br label %69
69: ; preds = %66, %63
br label %70
70: ; preds = %69, %57
%71 = load i32, i32* %11
%72 = add nsw i32 %71, 1
store i32 %72, i32* %11
%73 = load i32, i32* %11
%74 = srem i32 %73, 7
store i32 %74, i32* %11
br label %21
75: ; preds = %21
%76 = load i32*, i32** %3
%77 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 6
%78 = load i32, i32* %77
%79 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 0
%80 = load i32, i32* %79
%81 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 1
%82 = load i32, i32* %81
%83 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 2
%84 = load i32, i32* %83
%85 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 3
%86 = load i32, i32* %85
%87 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 4
%88 = load i32, i32* %87
%89 = getelementptr inbounds [7 x i32], [7 x i32]* %5, i64 0, i64 5
%90 = load i32, i32* %89
%91 = call i32 @fprintf(i32* %76, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %78, i32 %80, i32 %82, i32 %84, i32 %86, i32 %88, i32 %90)
%92 = load i32*, i32** %2
%93 = call i32 @fclose(i32* %92)
%94 = load i32*, i32** %3
%95 = call i32 @fclose(i32* %94)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"friday.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [11 x i8] c"friday.out\00"
@.str.3 = [2 x i8] c"w\00"
@__const.main.days_in_month = [13 x i32] [i32 0, 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 = [3 x i8] c"%d\00"
@.str.5 = [22 x i8] c"%d %d %d %d %d %d %d\0A\00"
define i32 @main() {
%1 = alloca [13 x i32]
%2 = alloca [7 x i32]
%3 = alloca i32
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%6 = bitcast [13 x i32]* %1 to i8*
%7 = bitcast [7 x i32]* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = call i32 @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1899
%12 = icmp slt i32 %10, 1
br i1 %12, label %72, label %13
13: ; preds = %0
%14 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 2
br label %15
15: ; preds = %13, %50
%16 = phi i32 [ 1, %13 ], [ %55, %50 ]
%17 = phi i32 [ 1900, %13 ], [ %53, %50 ]
%18 = phi i32 [ 1, %13 ], [ %52, %50 ]
%19 = phi i32 [ 1, %13 ], [ %51, %50 ]
%20 = icmp eq i32 %18, 13
br i1 %20, label %21, label %26
21: ; preds = %15
%22 = sext i32 %16 to i64
%23 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = add nsw i32 %24, 1
store i32 %25, i32* %23
br label %26
26: ; preds = %21, %15
%27 = srem i32 %17, 400
%28 = icmp eq i32 %27, 0
br i1 %28, label %36, label %29
29: ; preds = %26
%30 = srem i32 %17, 100
%31 = icmp ne i32 %30, 0
%32 = and i32 %17, 3
%33 = icmp eq i32 %32, 0
%34 = and i1 %31, %33
%35 = select i1 %34, i32 29, i32 28
br label %36
36: ; preds = %29, %26
%37 = phi i32 [ 29, %26 ], [ %35, %29 ]
store i32 %37, i32* %14
%38 = sext i32 %19 to i64
%39 = getelementptr inbounds [13 x i32], [13 x i32]* %1, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = icmp slt i32 %18, %40
br i1 %41, label %42, label %44
42: ; preds = %36
%43 = add nsw i32 %18, 1
br label %50
44: ; preds = %36
%45 = icmp slt i32 %19, 12
br i1 %45, label %46, label %48
46: ; preds = %44
%47 = add nsw i32 %19, 1
br label %50
48: ; preds = %44
%49 = add nsw i32 %17, 1
br label %50
50: ; preds = %46, %48, %42
%51 = phi i32 [ %19, %42 ], [ %47, %46 ], [ 1, %48 ]
%52 = phi i32 [ %43, %42 ], [ 1, %46 ], [ 1, %48 ]
%53 = phi i32 [ %17, %42 ], [ %17, %46 ], [ %49, %48 ]
%54 = add nsw i32 %16, 1
%55 = srem i32 %54, 7
%56 = icmp sgt i32 %53, %11
br i1 %56, label %57, label %15
57: ; preds = %50
%58 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 6
%59 = load i32, i32* %58
%60 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%61 = load i32, i32* %60
%62 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 1
%63 = load i32, i32* %62
%64 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 2
%65 = load i32, i32* %64
%66 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 3
%67 = load i32, i32* %66
%68 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 4
%69 = load i32, i32* %68
%70 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 5
%71 = load i32, i32* %70
br label %72
72: ; preds = %57, %0
%73 = phi i32 [ %71, %57 ], [ 0, %0 ]
%74 = phi i32 [ %69, %57 ], [ 0, %0 ]
%75 = phi i32 [ %67, %57 ], [ 0, %0 ]
%76 = phi i32 [ %65, %57 ], [ 0, %0 ]
%77 = phi i32 [ %63, %57 ], [ 0, %0 ]
%78 = phi i32 [ %61, %57 ], [ 0, %0 ]
%79 = phi i32 [ %59, %57 ], [ 0, %0 ]
%80 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %79, i32 %78, i32 %77, i32 %76, i32 %75, i32 %74, i32 %73)
%81 = call i32 @fclose(i32* %4)
%82 = call i32 @fclose(i32* %5)
ret i32 0
}