#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, int *, int *, int *);
int weekday(int, int, int);
void training_days() {
  int day, month, year;
  int result;
  int Mon = 0, Tues = 0, Wed = 0, Thurs = 0, Fri = 0, Sat = 0, Sun = 0;
  while (scanf("%d:%d:%d", &day, &month, &year) != EOF) {
    result = 0;
    result = weekday(day, month, year);
    if (result + 1 == 1) {
      Mon += 1;
    } else if (result + 1 == 2) {
      Tues += 1;
    } else if (result + 1 == 3) {
      Wed += 1;
    } else if (result + 1 == 4) {
      Thurs += 1;
    } else if (result + 1 == 4) {
      Fri += 1;
    } else if (result + 1 == 6) {
      Sat += 1;
    } else if (result + 1 == 7) {
      Sun += 1;
    } else {
      printf("Error!!! This date was not added\n");
    }
  }
  printf("Mon: %d\nTues: %d\nWed: %d\nThur: %d\nFri: %d\nSat: %d\nSun: %d\n",
         Mon, Tues, Wed, Thurs, Fri, Sat, Sun);
}


x86 assembly (clang, -O0):
<training_days>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
lea    0xe90(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1050 <scanf@plt>
mov    0x2e60(%rip),%rcx
cmp    (%rcx),%rax
je     12a5 <training_days+0x175>
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <weekday@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cmp    $0x1,%eax
jne    11c6 <training_days+0x96>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12a0 <training_days+0x170>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cmp    $0x2,%eax
jne    11e3 <training_days+0xb3>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    129b <training_days+0x16b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cmp    $0x3,%eax
jne    1200 <training_days+0xd0>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1296 <training_days+0x166>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cmp    $0x4,%eax
jne    121d <training_days+0xed>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1291 <training_days+0x161>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cmp    $0x4,%eax
jne    123a <training_days+0x10a>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    128c <training_days+0x15c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cmp    $0x6,%eax
jne    1257 <training_days+0x127>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1287 <training_days+0x157>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cmp    $0x7,%eax
jne    1274 <training_days+0x144>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1282 <training_days+0x152>
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1287 <training_days+0x157>
jmp    128c <training_days+0x15c>
jmp    1291 <training_days+0x161>
jmp    1296 <training_days+0x166>
jmp    129b <training_days+0x16b>
jmp    12a0 <training_days+0x170>
jmp    1169 <training_days+0x39>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    -0x28(%rbp),%r10d
mov    -0x2c(%rbp),%eax
lea    0xd67(%rip),%rdi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<training_days>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xec7(%rip),%rdi
lea    0x24(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x1c(%rsp),%rcx
call   1060 <scanf@plt>
mov    0x2e78(%rip),%r13
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0x18(%rsp)
mov    $0x0,%ecx
mov    %rcx,0x28(%rsp)
mov    $0x0,%ecx
mov    %rcx,0x30(%rsp)
cmp    0x0(%r13),%rax
jne    11e3 <training_days+0xa3>
lea    0xe74(%rip),%rdi
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    0x18(%rsp),%r8d
xor    %r9d,%r9d
xor    %eax,%eax
push   0x30(%rsp)
push   0x30(%rsp)
call   1040 <printf@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
mov    %rax,0x30(%rsp)
lea    0xe2b(%rip),%rbp
lea    0x24(%rsp),%r12
lea    0x20(%rsp),%r14
lea    0x1c(%rsp),%r15
lea    0xdf9(%rip),%rbx
xor    %eax,%eax
mov    %rax,0x28(%rsp)
movl   $0x0,0x18(%rsp)
movl   $0x0,0x14(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x10(%rsp)
jmp    125b <training_days+0x11b>
lea    0xe29(%rip),%rdi
call   1030 <puts@plt>
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
call   1060 <scanf@plt>
cmp    0x0(%r13),%rax
je     11aa <training_days+0x6a>
mov    0x24(%rsp),%edi
mov    0x20(%rsp),%esi
mov    0x1c(%rsp),%edx
call   1050 <weekday@plt>
cmp    $0x6,%eax
ja     1230 <training_days+0xf0>
mov    %eax,%eax
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
addl   $0x1,0x10(%rsp)
jmp    1240 <training_days+0x100>
addl   $0x1,0xc(%rsp)
jmp    1240 <training_days+0x100>
addl   $0x1,0x14(%rsp)
jmp    1240 <training_days+0x100>
addl   $0x1,0x18(%rsp)
jmp    1240 <training_days+0x100>
mov    0x28(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x28(%rsp)
jmp    1240 <training_days+0x100>
mov    0x30(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x30(%rsp)
jmp    1240 <training_days+0x100>

LLVM IR (-O0):
@.str = [9 x i8] c"%d:%d:%d\00"
@EOF = global i64 0
@.str.1 = [34 x i8] c"Error!!! This date was not added\0A\00"
@.str.2 = [59 x i8] c"Mon: %d\0ATues: %d\0AWed: %d\0AThur: %d\0AFri: %d\0ASat: %d\0ASun: %d\0A\00"
define void @training_days() {
%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
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
br label %12
12: ; preds = %77, %0
%13 = call i64 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%14 = load i64, i64* @EOF
%15 = icmp ne i64 %13, %14
br i1 %15, label %16, label %78
16: ; preds = %12
store i32 0, i32* %4
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i32 @weekday(i32 %17, i32 %18, i32 %19)
store i32 %20, i32* %4
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %27
24: ; preds = %16
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %77
27: ; preds = %16
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
%30 = icmp eq i32 %29, 2
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
br label %76
34: ; preds = %27
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
%37 = icmp eq i32 %36, 3
br i1 %37, label %38, label %41
38: ; preds = %34
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %75
41: ; preds = %34
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 1
%44 = icmp eq i32 %43, 4
br i1 %44, label %45, label %48
45: ; preds = %41
%46 = load i32, i32* %8
%47 = add nsw i32 %46, 1
store i32 %47, i32* %8
br label %74
48: ; preds = %41
%49 = load i32, i32* %4
%50 = add nsw i32 %49, 1
%51 = icmp eq i32 %50, 4
br i1 %51, label %52, label %55
52: ; preds = %48
%53 = load i32, i32* %9
%54 = add nsw i32 %53, 1
store i32 %54, i32* %9
br label %73
55: ; preds = %48
%56 = load i32, i32* %4
%57 = add nsw i32 %56, 1
%58 = icmp eq i32 %57, 6
br i1 %58, label %59, label %62
59: ; preds = %55
%60 = load i32, i32* %10
%61 = add nsw i32 %60, 1
store i32 %61, i32* %10
br label %72
62: ; preds = %55
%63 = load i32, i32* %4
%64 = add nsw i32 %63, 1
%65 = icmp eq i32 %64, 7
br i1 %65, label %66, label %69
66: ; preds = %62
%67 = load i32, i32* %11
%68 = add nsw i32 %67, 1
store i32 %68, i32* %11
br label %71
69: ; preds = %62
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %71
71: ; preds = %69, %66
br label %72
72: ; preds = %71, %59
br label %73
73: ; preds = %72, %52
br label %74
74: ; preds = %73, %45
br label %75
75: ; preds = %74, %38
br label %76
76: ; preds = %75, %31
br label %77
77: ; preds = %76, %24
br label %12
78: ; preds = %12
%79 = load i32, i32* %5
%80 = load i32, i32* %6
%81 = load i32, i32* %7
%82 = load i32, i32* %8
%83 = load i32, i32* %9
%84 = load i32, i32* %10
%85 = load i32, i32* %11
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), i32 %79, i32 %80, i32 %81, i32 %82, i32 %83, i32 %84, i32 %85)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d:%d:%d\00"
@EOF = global i64 0
@.str.2 = [59 x i8] c"Mon: %d\0ATues: %d\0AWed: %d\0AThur: %d\0AFri: %d\0ASat: %d\0ASun: %d\0A\00"
@str = [33 x i8] c"Error!!! This date was not added\00"
define void @training_days() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i64 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%8 = load i64, i64* @EOF
%9 = icmp eq i64 %7, %8
br i1 %9, label %45, label %10
10: ; preds = %0, %35
%11 = phi i32 [ %41, %35 ], [ 0, %0 ]
%12 = phi i32 [ %40, %35 ], [ 0, %0 ]
%13 = phi i32 [ %39, %35 ], [ 0, %0 ]
%14 = phi i32 [ %38, %35 ], [ 0, %0 ]
%15 = phi i32 [ %37, %35 ], [ 0, %0 ]
%16 = phi i32 [ %36, %35 ], [ 0, %0 ]
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i32 @weekday(i32 %17, i32 %18, i32 %19)
switch i32 %20, label %33 [
i32 0, label %21
i32 1, label %23
i32 2, label %25
i32 3, label %27
i32 5, label %29
i32 6, label %31
]
21: ; preds = %10
%22 = add nsw i32 %16, 1
br label %35
23: ; preds = %10
%24 = add nsw i32 %15, 1
br label %35
25: ; preds = %10
%26 = add nsw i32 %14, 1
br label %35
27: ; preds = %10
%28 = add nsw i32 %13, 1
br label %35
29: ; preds = %10
%30 = add nsw i32 %12, 1
br label %35
31: ; preds = %10
%32 = add nsw i32 %11, 1
br label %35
33: ; preds = %10
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
br label %35
35: ; preds = %23, %27, %29, %33, %31, %25, %21
%36 = phi i32 [ %22, %21 ], [ %16, %23 ], [ %16, %25 ], [ %16, %27 ], [ %16, %29 ], [ %16, %31 ], [ %16, %33 ]
%37 = phi i32 [ %15, %21 ], [ %24, %23 ], [ %15, %25 ], [ %15, %27 ], [ %15, %29 ], [ %15, %31 ], [ %15, %33 ]
%38 = phi i32 [ %14, %21 ], [ %14, %23 ], [ %26, %25 ], [ %14, %27 ], [ %14, %29 ], [ %14, %31 ], [ %14, %33 ]
%39 = phi i32 [ %13, %21 ], [ %13, %23 ], [ %13, %25 ], [ %28, %27 ], [ %13, %29 ], [ %13, %31 ], [ %13, %33 ]
%40 = phi i32 [ %12, %21 ], [ %12, %23 ], [ %12, %25 ], [ %12, %27 ], [ %30, %29 ], [ %12, %31 ], [ %12, %33 ]
%41 = phi i32 [ %11, %21 ], [ %11, %23 ], [ %11, %25 ], [ %11, %27 ], [ %11, %29 ], [ %32, %31 ], [ %11, %33 ]
%42 = call i64 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%43 = load i64, i64* @EOF
%44 = icmp eq i64 %42, %43
br i1 %44, label %45, label %10
45: ; preds = %35, %0
%46 = phi i32 [ 0, %0 ], [ %36, %35 ]
%47 = phi i32 [ 0, %0 ], [ %37, %35 ]
%48 = phi i32 [ 0, %0 ], [ %38, %35 ]
%49 = phi i32 [ 0, %0 ], [ %39, %35 ]
%50 = phi i32 [ 0, %0 ], [ %40, %35 ]
%51 = phi i32 [ 0, %0 ], [ %41, %35 ]
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), i32 %46, i32 %47, i32 %48, i32 %49, i32 0, i32 %50, i32 %51)
ret void
}