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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int month_len(int, int);
int main(void) {
  FILE *fin;
  FILE *fout;
  int i;
  int m;
  int day_of_week;
  int N;
  int y;
  int day_of_week_numbers[7];
  fin = fopen("friday.in", "r");
  fout = fopen("friday.out", "w");
  assert(fin != NULL && fout != NULL);
  fscanf(fin, "%d", &N);
  memset(day_of_week_numbers, 0, sizeof(day_of_week_numbers));
  day_of_week = 0;
  for (y = 1900; y < 1900 + N; ++y) {
    for (m = 0; m < 12; ++m) {
      ++day_of_week_numbers[day_of_week];
      day_of_week = (day_of_week + month_len(y, m)) % 7;
    }
  }
  for (i = 0; i < 7; ++i) {
    if (i) {
      fprintf(fout, " ");
    }
    fprintf(fout, "%d", day_of_week_numbers[i]);
  }
  fprintf(fout, "\n");
  fclose(fin);
  fclose(fout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
lea    0xe7d(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe6f(%rip),%rdi
lea    0xe73(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x51(%rbp)
je     11c8 <main+0x58>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xe39(%rip),%rsi
lea    -0x28(%rbp),%rdx
call   1050 <fscanf@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x1c,%edx
call   1040 <memset@plt>
movl   $0x0,-0x24(%rbp)
movl   $0x76c,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x28(%rbp),%ecx
add    $0x76c,%ecx
cmp    %ecx,%eax
jge    127f <main+0x10f>
movl   $0x0,-0x20(%rbp)
cmpl   $0xc,-0x20(%rbp)
jge    126c <main+0xfc>
movslq -0x24(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1090 <month_len@plt>
mov    %eax,%ecx
mov    -0x58(%rbp),%eax
add    %ecx,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1222 <main+0xb2>
jmp    1271 <main+0x101>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1207 <main+0x97>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x7,-0x1c(%rbp)
jge    12d4 <main+0x164>
cmpl   $0x0,-0x1c(%rbp)
je     12ac <main+0x13c>
mov    -0x18(%rbp),%rdi
lea    0xd77(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
movslq -0x1c(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edx
lea    0xd5a(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1286 <main+0x116>
mov    -0x18(%rbp),%rdi
lea    0xd3f(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xe6b(%rip),%rdi
lea    0xe6e(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r14
lea    0xe61(%rip),%rdi
lea    0xe65(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r12
test   %r14,%r14
setne  %al
test   %r12,%r12
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1070 <assert@plt>
lea    0xe42(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %r14,%rdi
call   1050 <fscanf@plt>
lea    0x10(%rsp),%rdi
xor    %ebx,%ebx
xor    %esi,%esi
mov    $0x1c,%edx
call   1040 <memset@plt>
cmpl   $0x0,0xc(%rsp)
jle    1274 <main+0xf4>
mov    $0x76c,%r13d
mov    $0x76b,%r15d
nopw   0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq %ebx,%rbx
addl   $0x1,0x10(%rsp,%rbx,4)
mov    %r13d,%edi
mov    %ebp,%esi
call   10a0 <month_len@plt>
add    %eax,%ebx
movslq %ebx,%rax
imul   $0xffffffff92492493,%rax,%rbx
shr    $0x20,%rbx
add    %eax,%ebx
mov    %ebx,%ecx
shr    $0x1f,%ecx
sar    $0x2,%ebx
add    %ecx,%ebx
lea    0x0(,%rbx,8),%ecx
sub    %ecx,%ebx
add    %eax,%ebx
add    $0x1,%ebp
cmp    $0xc,%ebp
jne    1220 <main+0xa0>
lea    0x1(%r13),%eax
mov    0xc(%rsp),%ecx
add    %r15d,%ecx
cmp    %ecx,%r13d
mov    %eax,%r13d
jl     1210 <main+0x90>
mov    0x10(%rsp),%edx
lea    0xd9a(%rip),%r15
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x20,%edi
mov    %r12,%rsi
call   1060 <fputc@plt>
mov    0x14(%rsp),%edx
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x20,%edi
mov    %r12,%rsi
call   1060 <fputc@plt>
mov    0x18(%rsp),%edx
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x20,%edi
mov    %r12,%rsi
call   1060 <fputc@plt>
mov    0x1c(%rsp),%edx
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x20,%edi
mov    %r12,%rsi
call   1060 <fputc@plt>
mov    0x20(%rsp),%edx
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x20,%edi
mov    %r12,%rsi
call   1060 <fputc@plt>
mov    0x24(%rsp),%edx
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x20,%edi
mov    %r12,%rsi
call   1060 <fputc@plt>
mov    0x28(%rsp),%edx
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xa,%edi
mov    %r12,%rsi
call   1060 <fputc@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    %r12,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
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"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [2 x i8] c" \00"
@.str.6 = [2 x i8] c"\0A\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 [7 x i32]
store i32 0, i32* %1
%10 = 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* %10, i32** %2
%11 = 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* %11, i32** %3
%12 = load i32*, i32** %2
%13 = icmp ne i32* %12, null
br i1 %13, label %14, label %17
14: ; preds = %0
%15 = load i32*, i32** %3
%16 = icmp ne i32* %15, null
br label %17
17: ; preds = %14, %0
%18 = phi i1 [ false, %0 ], [ %16, %14 ]
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load i32*, i32** %2
%22 = call i32 @fscanf(i32* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %7)
%23 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 0
%24 = call i32 @memset(i32* %23, i32 0, i32 28)
store i32 0, i32* %6
store i32 1900, i32* %8
br label %25
25: ; preds = %50, %17
%26 = load i32, i32* %8
%27 = load i32, i32* %7
%28 = add nsw i32 1900, %27
%29 = icmp slt i32 %26, %28
br i1 %29, label %30, label %53
30: ; preds = %25
store i32 0, i32* %5
br label %31
31: ; preds = %46, %30
%32 = load i32, i32* %5
%33 = icmp slt i32 %32, 12
br i1 %33, label %34, label %49
34: ; preds = %31
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = add nsw i32 %38, 1
store i32 %39, i32* %37
%40 = load i32, i32* %6
%41 = load i32, i32* %8
%42 = load i32, i32* %5
%43 = call i32 @month_len(i32 %41, i32 %42)
%44 = add nsw i32 %40, %43
%45 = srem i32 %44, 7
store i32 %45, i32* %6
br label %46
46: ; preds = %34
%47 = load i32, i32* %5
%48 = add nsw i32 %47, 1
store i32 %48, i32* %5
br label %31
49: ; preds = %31
br label %50
50: ; preds = %49
%51 = load i32, i32* %8
%52 = add nsw i32 %51, 1
store i32 %52, i32* %8
br label %25
53: ; preds = %25
store i32 0, i32* %4
br label %54
54: ; preds = %70, %53
%55 = load i32, i32* %4
%56 = icmp slt i32 %55, 7
br i1 %56, label %57, label %73
57: ; preds = %54
%58 = load i32, i32* %4
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %57
%61 = load i32*, i32** %3
%62 = call i32 (i32*, i8*, ...) @fprintf(i32* %61, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %63
63: ; preds = %60, %57
%64 = load i32*, i32** %3
%65 = load i32, i32* %4
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [7 x i32], [7 x i32]* %9, i64 0, i64 %66
%68 = load i32, i32* %67
%69 = call i32 (i32*, i8*, ...) @fprintf(i32* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %68)
br label %70
70: ; preds = %63
%71 = load i32, i32* %4
%72 = add nsw i32 %71, 1
store i32 %72, i32* %4
br label %54
73: ; preds = %54
%74 = load i32*, i32** %3
%75 = call i32 (i32*, i8*, ...) @fprintf(i32* %74, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%76 = load i32*, i32** %2
%77 = call i32 @fclose(i32* %76)
%78 = load i32*, i32** %3
%79 = call i32 @fclose(i32* %78)
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"
@.str.4 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i32]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [7 x i32]* %2 to i8*
%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 = icmp ne i32* %5, null
%8 = icmp ne i32* %6, null
%9 = and i1 %7, %8
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%13 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%14 = call i32 @memset(i32* %13, i32 0, i32 28)
%15 = load i32, i32* %1
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %37
17: ; preds = %0, %32
%18 = phi i32 [ %33, %32 ], [ 1900, %0 ]
%19 = phi i32 [ %29, %32 ], [ 0, %0 ]
br label %20
20: ; preds = %17, %20
%21 = phi i32 [ %19, %17 ], [ %29, %20 ]
%22 = phi i32 [ 0, %17 ], [ %30, %20 ]
%23 = sext i32 %21 to i64
%24 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = add nsw i32 %25, 1
store i32 %26, i32* %24
%27 = call i32 @month_len(i32 %18, i32 %22)
%28 = add nsw i32 %27, %21
%29 = srem i32 %28, 7
%30 = add nuw nsw i32 %22, 1
%31 = icmp eq i32 %30, 12
br i1 %31, label %32, label %20
32: ; preds = %20
%33 = add nuw nsw i32 %18, 1
%34 = load i32, i32* %1
%35 = add nsw i32 %34, 1899
%36 = icmp slt i32 %18, %35
br i1 %36, label %17, label %37
37: ; preds = %32, %0
%38 = load i32, i32* %13
%39 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %38)
%40 = call i32 @fputc(i32 32, i32* %6)
%41 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 1
%42 = load i32, i32* %41
%43 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %42)
%44 = call i32 @fputc(i32 32, i32* %6)
%45 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 2
%46 = load i32, i32* %45
%47 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %46)
%48 = call i32 @fputc(i32 32, i32* %6)
%49 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 3
%50 = load i32, i32* %49
%51 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %50)
%52 = call i32 @fputc(i32 32, i32* %6)
%53 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 4
%54 = load i32, i32* %53
%55 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %54)
%56 = call i32 @fputc(i32 32, i32* %6)
%57 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 5
%58 = load i32, i32* %57
%59 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %58)
%60 = call i32 @fputc(i32 32, i32* %6)
%61 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 6
%62 = load i32, i32* %61
%63 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %62)
%64 = call i32 @fputc(i32 10, i32* %6)
%65 = call i32 @fclose(i32* %5)
%66 = call i32 @fclose(i32* %6)
ret i32 0
}