#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 */
int code_month(int);
int code_year(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int day, month, year;
  scanf("%d", &day);
  scanf("%d", &month);
  scanf("%d", &year);
  int ans = (day + code_month(month) + code_year(year)) % 7;
  if (ans == 0)
    printf("%s", "Saturday");
  if (ans == 1)
    printf("%s", "Sunday");
  if (ans == 2)
    printf("%s", "Monday");
  if (ans == 3)
    printf("%s", "Tuesday");
  if (ans == 4)
    printf("%s", "Wednesday");
  if (ans == 5)
    printf("%s", "Thursday");
  if (ans == 6)
    printf("%s", "Friday");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xe9a(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xe8a(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <code_month@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <code_year@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11ce <main+0x8e>
lea    0xe41(%rip),%rdi
lea    0xe3d(%rip),%rsi
call   1040 <printf@plt>
cmpl   $0x1,-0x14(%rbp)
jne    11eb <main+0xab>
lea    0xe24(%rip),%rdi
lea    0xe29(%rip),%rsi
call   1040 <printf@plt>
cmpl   $0x2,-0x14(%rbp)
jne    1208 <main+0xc8>
lea    0xe07(%rip),%rdi
lea    0xe13(%rip),%rsi
call   1040 <printf@plt>
cmpl   $0x3,-0x14(%rbp)
jne    1225 <main+0xe5>
lea    0xdea(%rip),%rdi
lea    0xdfd(%rip),%rsi
call   1040 <printf@plt>
cmpl   $0x4,-0x14(%rbp)
jne    1242 <main+0x102>
lea    0xdcd(%rip),%rdi
lea    0xde8(%rip),%rsi
call   1040 <printf@plt>
cmpl   $0x5,-0x14(%rbp)
jne    125f <main+0x11f>
lea    0xdb0(%rip),%rdi
lea    0xdd5(%rip),%rsi
call   1040 <printf@plt>
cmpl   $0x6,-0x14(%rbp)
jne    127c <main+0x13c>
lea    0xd93(%rip),%rdi
lea    0xdc1(%rip),%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xeb3(%rip),%rbx
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    0x14(%rsp),%ebp
mov    0x10(%rsp),%edi
call   1050 <code_month@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    0xc(%rsp),%edi
call   1030 <code_year@plt>
add    %ebx,%eax
movslq %eax,%rcx
imul   $0xffffffff92492493,%rcx,%rax
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0x2,%eax
add    %edx,%eax
lea    0x0(,%rax,8),%edx
sub    %edx,%eax
add    %ecx,%eax
cmp    $0x6,%eax
ja     11d6 <main+0x96>
cltq
lea    0xe7d(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    0xe32(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [9 x i8] c"Saturday\00"
@.str.3 = [7 x i8] c"Sunday\00"
@.str.4 = [7 x i8] c"Monday\00"
@.str.5 = [8 x i8] c"Tuesday\00"
@.str.6 = [10 x i8] c"Wednesday\00"
@.str.7 = [9 x i8] c"Thursday\00"
@.str.8 = [7 x i8] c"Friday\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = call i32 @code_month(i32 %10)
%12 = add nsw i32 %9, %11
%13 = load i32, i32* %4
%14 = call i32 @code_year(i32 %13)
%15 = add nsw i32 %12, %14
%16 = srem i32 %15, 7
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %0
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %0
%22 = load i32, i32* %5
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %24, %21
%27 = load i32, i32* %5
%28 = icmp eq i32 %27, 2
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %31
31: ; preds = %29, %26
%32 = load i32, i32* %5
%33 = icmp eq i32 %32, 3
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %36
36: ; preds = %34, %31
%37 = load i32, i32* %5
%38 = icmp eq i32 %37, 4
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
br label %41
41: ; preds = %39, %36
%42 = load i32, i32* %5
%43 = icmp eq i32 %42, 5
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
br label %46
46: ; preds = %44, %41
%47 = load i32, i32* %5
%48 = icmp eq i32 %47, 6
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
br label %51
51: ; preds = %49, %46
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [9 x i8] c"Saturday\00"
@.str.3 = [7 x i8] c"Sunday\00"
@.str.4 = [7 x i8] c"Monday\00"
@.str.5 = [8 x i8] c"Tuesday\00"
@.str.6 = [10 x i8] c"Wednesday\00"
@.str.7 = [9 x i8] c"Thursday\00"
@.str.8 = [7 x i8] c"Friday\00"
@reltable.main = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.7 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.8 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%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 i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = call i32 @code_month(i32 %11)
%13 = add nsw i32 %12, %10
%14 = load i32, i32* %3
%15 = call i32 @code_year(i32 %14)
%16 = add nsw i32 %13, %15
%17 = srem i32 %16, 7
%18 = icmp ult i32 %17, 7
br i1 %18, label %19, label %24
19: ; preds = %0
%20 = sext i32 %17 to i64
%21 = shl i64 %20, 2
%22 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.main to i8*), i64 %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %0, %19
ret i32 0
}