#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__ months_to_days(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int day = 4;
  int days, months;
  scanf("%d %d", &days, &months);
  day += (days - 1) + months_to_days(months);
  day %= 7;
  switch (day) {
  case 0:
    printf("Sunday\n");
    break;
  case 1:
    printf("Monday\n");
    break;
  case 2:
    printf("Tuesday\n");
    break;
  case 3:
    printf("Wednesday\n");
    break;
  case 4:
    printf("Thursday\n");
    break;
  case 5:
    printf("Friday\n");
    break;
  case 6:
    printf("Saturday\n");
    break;
  default:
    printf("Saturday\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
lea    0xecf(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <months_to_days@plt>
mov    -0x1c(%rbp),%edx
add    %eax,%edx
mov    -0x8(%rbp),%ecx
mov    %ecx,%eax
mov    %edx,%ecx
lea    -0x1(%rax,%rcx,1),%eax
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rcx
mov    %ecx,%eax
imul   $0xffffffff92492493,%rcx,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x2,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x3,%edx
sub    %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x6,%rax
ja     1240 <main+0x110>
mov    -0x18(%rbp),%rax
lea    0xe40(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
jmp    124c <main+0x11c>
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
jmp    124c <main+0x11c>
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
jmp    124c <main+0x11c>
lea    0xe38(%rip),%rdi
call   1030 <printf@plt>
jmp    124c <main+0x11c>
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
jmp    124c <main+0x11c>
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
jmp    124c <main+0x11c>
lea    0xe22(%rip),%rdi
call   1030 <printf@plt>
jmp    124c <main+0x11c>
lea    0xe11(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
mov    0xc(%rsp),%ebx
mov    0x8(%rsp),%edi
call   1050 <months_to_days@plt>
mov    %ebx,%ecx
add    %eax,%ecx
add    %ebx,%eax
add    $0x3,%eax
cltq
imul   $0xffffffff92492493,%rax,%rax
shr    $0x20,%rax
add    %ecx,%eax
add    $0x3,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0x2,%eax
add    %edx,%eax
lea    0x0(,%rax,8),%edx
sub    %edx,%eax
add    %ecx,%eax
add    $0x3,%eax
cmp    $0x6,%eax
ja     11a2 <main+0x72>
cltq
lea    0xea7(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
jmp    11a9 <main+0x79>
lea    0xe8d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [8 x i8] c"Sunday\0A\00"
@.str.2 = [8 x i8] c"Monday\0A\00"
@.str.3 = [9 x i8] c"Tuesday\0A\00"
@.str.4 = [11 x i8] c"Wednesday\0A\00"
@.str.5 = [10 x i8] c"Thursday\0A\00"
@.str.6 = [8 x i8] c"Friday\0A\00"
@.str.7 = [10 x i8] c"Saturday\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 4, i32* %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%6 = load i32, i32* %3
%7 = sub nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = load i32, i32* %4
%10 = call i64 @months_to_days(i32 %9)
%11 = add nsw i64 %8, %10
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = add nsw i64 %13, %11
%15 = trunc i64 %14 to i32
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = srem i32 %16, 7
store i32 %17, i32* %2
%18 = load i32, i32* %2
switch i32 %18, label %33 [
i32 0, label %19
i32 1, label %21
i32 2, label %23
i32 3, label %25
i32 4, label %27
i32 5, label %29
i32 6, label %31
]
19: ; preds = %0
%20 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %35
21: ; preds = %0
%22 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %35
23: ; preds = %0
%24 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %35
25: ; preds = %0
%26 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %35
27: ; preds = %0
%28 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %35
29: ; preds = %0
%30 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %35
31: ; preds = %0
%32 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
br label %35
33: ; preds = %0
%34 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
br label %35
35: ; preds = %33, %31, %29, %27, %25, %23, %21, %19
ret i32 0
}

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