#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, ...);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int leap_checker(int);
main() {
  FILE *fin = fopen("friday.in", "r");
  FILE *fout = fopen("friday.out", "w");
  int mountdays[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int mountdays_leap[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  int *year_p;
  int days[] = {0, 0, 0, 0, 0, 0, 0};
  int n, days_sum_n = 0, i, j, flag, x = 0, ind;
  fscanf(fin, "%d", &n);
  for (i = 0; i < n; ++i) {
    year_p = mountdays;
    flag = leap_checker(1900 + i);
    if (flag == 1) {
      year_p = mountdays_leap;
    }
    for (j = 0; j < 12; ++j) {
      ind = (x + 13) % 7 - 1;
      if (ind == -1) {
        ind += 7;
      }
      days[ind]++;
      x += year_p[j];
    }
  }
  fprintf(fout, "%d %d ", days[5], days[6]);
  for (i = 0; i < 5; ++i) {
    if (i < 4)
      fprintf(fout, "%d ", days[i]);
    else
      fprintf(fout, "%d\n", days[i]);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe77(%rip),%rdi
lea    0xe7a(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe6c(%rip),%rdi
lea    0xe70(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xe75(%rip),%rsi
mov    $0x30,%edx
call   1070 <memcpy@plt>
lea    -0x80(%rbp),%rdi
lea    0xe90(%rip),%rsi
mov    $0x30,%edx
call   1070 <memcpy@plt>
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x1c,%edx
call   1040 <memset@plt>
movl   $0x0,-0xb8(%rbp)
movl   $0x0,-0xc8(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe0d(%rip),%rsi
lea    -0xb4(%rbp),%rdx
call   1050 <fscanf@plt>
movl   $0x0,-0xbc(%rbp)
mov    -0xbc(%rbp),%eax
cmp    -0xb4(%rbp),%eax
jge    131d <main+0x1ad>
lea    -0x50(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0xbc(%rbp),%edi
add    $0x76c,%edi
call   1030 <leap_checker@plt>
mov    %eax,-0xc4(%rbp)
cmpl   $0x1,-0xc4(%rbp)
jne    126e <main+0xfe>
lea    -0x80(%rbp),%rax
mov    %rax,-0x88(%rbp)
movl   $0x0,-0xc0(%rbp)
cmpl   $0xc,-0xc0(%rbp)
jge    1304 <main+0x194>
mov    -0xc8(%rbp),%eax
add    $0xd,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
sub    $0x1,%edx
mov    %edx,-0xcc(%rbp)
cmpl   $0xffffffff,-0xcc(%rbp)
jne    12bb <main+0x14b>
mov    -0xcc(%rbp),%eax
add    $0x7,%eax
mov    %eax,-0xcc(%rbp)
movslq -0xcc(%rbp),%rax
mov    -0xb0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0xb0(%rbp,%rax,4)
mov    -0x88(%rbp),%rax
movslq -0xc0(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0xc8(%rbp),%eax
mov    %eax,-0xc8(%rbp)
mov    -0xc0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc0(%rbp)
jmp    1278 <main+0x108>
jmp    1309 <main+0x199>
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
jmp    1222 <main+0xb2>
mov    -0x18(%rbp),%rdi
mov    -0x9c(%rbp),%edx
mov    -0x98(%rbp),%ecx
lea    0xce8(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0x0,-0xbc(%rbp)
cmpl   $0x5,-0xbc(%rbp)
jge    13bd <main+0x24d>
cmpl   $0x4,-0xbc(%rbp)
jge    1384 <main+0x214>
mov    -0x18(%rbp),%rdi
movslq -0xbc(%rbp),%rax
mov    -0xb0(%rbp,%rax,4),%edx
lea    0xca7(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    13a4 <main+0x234>
mov    -0x18(%rbp),%rdi
movslq -0xbc(%rbp),%rax
mov    -0xb0(%rbp,%rax,4),%edx
lea    0xc86(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    13a9 <main+0x239>
mov    -0xbc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xbc(%rbp)
jmp    1345 <main+0x1d5>
xor    %edi,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
lea    0xe98(%rip),%rdi
lea    0xe9b(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbp
lea    0xe8e(%rip),%rdi
lea    0xe92(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r15
movaps 0xebc(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xe9d(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xe81(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xec5(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xea9(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe8d(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x1c(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0xe2d(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rbp,%rdi
call   1040 <fscanf@plt>
xor    %r14d,%r14d
cmpl   $0x0,0xc(%rsp)
mov    $0x0,%ecx
mov    $0x0,%edx
jle    12b1 <main+0x161>
xor    %ebp,%ebp
lea    0x30(%rsp),%r14
lea    0x60(%rsp),%r12
mov    $0x6,%ebx
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x76c(%r13),%edi
call   1030 <leap_checker@plt>
cmp    $0x1,%eax
mov    %r12,%rax
cmove  %r14,%rax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
lea    0xd(%rbp),%edx
movslq %edx,%rdx
imul   $0xffffffff92492493,%rdx,%rdx
shr    $0x20,%rdx
add    %ebp,%edx
add    $0xd,%edx
mov    %edx,%esi
shr    $0x1f,%esi
sar    $0x2,%edx
add    %esi,%edx
lea    0x0(,%rdx,8),%esi
sub    %esi,%edx
add    %ebp,%edx
add    $0xd,%edx
sub    $0x1,%edx
cmovb  %ebx,%edx
movslq %edx,%rdx
addl   $0x1,0x10(%rsp,%rdx,4)
add    (%rax,%rcx,4),%ebp
add    $0x1,%rcx
cmp    $0xc,%rcx
jne    1250 <main+0x100>
add    $0x1,%r13d
cmp    0xc(%rsp),%r13d
jl     1230 <main+0xe0>
mov    0x20(%rsp),%r14d
mov    0x24(%rsp),%edx
mov    0x28(%rsp),%ecx
lea    0xd64(%rip),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x10(%rsp),%edx
lea    0xd52(%rip),%rbp
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x14(%rsp),%edx
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x18(%rsp),%edx
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x1c(%rsp),%edx
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xd0f(%rip),%rsi
mov    %r15,%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

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

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.mountdays = [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]
@__const.main.mountdays_leap = [12 x i32] [i32 31, i32 29, 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 = [7 x i8] c"%d %d \00"
@.str.6 = [4 x i8] c"%d \00"
@.str.7 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [12 x i32]
%2 = alloca [12 x i32]
%3 = alloca [7 x i32]
%4 = alloca i32
%5 = 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))
%6 = 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))
%7 = bitcast [12 x i32]* %1 to i8*
%8 = bitcast [12 x i32]* %2 to i8*
%9 = bitcast [7 x i32]* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%12 = load i32, i32* %4
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %49
14: ; preds = %0, %38
%15 = phi i32 [ %35, %38 ], [ 0, %0 ]
%16 = phi i32 [ %39, %38 ], [ 0, %0 ]
%17 = add nuw nsw i32 %16, 1900
%18 = call i32 @leap_checker(i32 %17)
%19 = icmp eq i32 %18, 1
%20 = select i1 %19, [12 x i32]* %2, [12 x i32]* %1
br label %21
21: ; preds = %14, %21
%22 = phi i64 [ 0, %14 ], [ %36, %21 ]
%23 = phi i32 [ %15, %14 ], [ %35, %21 ]
%24 = add nsw i32 %23, 13
%25 = srem i32 %24, 7
%26 = add nsw i32 %25, -1
%27 = icmp eq i32 %25, 0
%28 = select i1 %27, i32 6, i32 %26
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = add nsw i32 %31, 1
store i32 %32, i32* %30
%33 = getelementptr inbounds [12 x i32], [12 x i32]* %20, i64 0, i64 %22
%34 = load i32, i32* %33
%35 = add nsw i32 %34, %23
%36 = add nuw nsw i64 %22, 1
%37 = icmp eq i64 %36, 12
br i1 %37, label %38, label %21
38: ; preds = %21
%39 = add nuw nsw i32 %16, 1
%40 = load i32, i32* %4
%41 = icmp slt i32 %39, %40
br i1 %41, label %14, label %42
42: ; preds = %38
%43 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 5
%44 = load i32, i32* %43
%45 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 6
%46 = load i32, i32* %45
%47 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 4
%48 = load i32, i32* %47
br label %49
49: ; preds = %42, %0
%50 = phi i32 [ %48, %42 ], [ 0, %0 ]
%51 = phi i32 [ %46, %42 ], [ 0, %0 ]
%52 = phi i32 [ %44, %42 ], [ 0, %0 ]
%53 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %52, i32 %51)
%54 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%55 = load i32, i32* %54
%56 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %55)
%57 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 1
%58 = load i32, i32* %57
%59 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %58)
%60 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 2
%61 = load i32, i32* %60
%62 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %61)
%63 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 3
%64 = load i32, i32* %63
%65 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %64)
%66 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %50)
%67 = call i32 @exit(i32 0)
unreachable
}