#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 /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int month[] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
  char *day[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
  int x, y;
  scanf("%d %d", &x, &y);
  printf("%s", day[(month[x - 1] + y) % 7]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
lea    -0x80(%rbp),%rdi
lea    0x2c7e(%rip),%rsi
mov    $0x38,%edx
call   1040 <memcpy@plt>
lea    0xed9(%rip),%rdi
lea    -0x84(%rbp),%rsi
lea    -0x88(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x84(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x40(%rbp,%rax,4),%eax
add    -0x88(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
mov    -0x80(%rbp,%rax,8),%rsi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf40(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
movslq 0x4(%rsp),%rax
lea    0xebf(%rip),%rcx
mov    (%rsp),%edx
add    -0x4(%rcx,%rax,4),%edx
movslq %edx,%rax
imul   $0xffffffff92492493,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x2,%ecx
add    %edx,%ecx
lea    0x0(,%rcx,8),%edx
sub    %edx,%ecx
add    %eax,%ecx
movslq %ecx,%rax
lea    0xeb9(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    0xee9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.month = [12 x i32] [i32 0, i32 31, i32 59, i32 90, i32 120, i32 151, i32 181, i32 212, i32 243, i32 273, i32 304, i32 334]
@.str = [4 x i8] c"SUN\00"
@.str.1 = [4 x i8] c"MON\00"
@.str.2 = [4 x i8] c"TUE\00"
@.str.3 = [4 x i8] c"WED\00"
@.str.4 = [4 x i8] c"THU\00"
@.str.5 = [4 x i8] c"FRI\00"
@.str.6 = [4 x i8] c"SAT\00"
@__const.main.day = [7 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0)]
@.str.7 = [6 x i8] c"%d %d\00"
@.str.8 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [12 x i32]
%3 = alloca [7 x i8*]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [12 x i32]* %2 to i8*
%7 = bitcast [7 x i8*]* %3 to i8*
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32* %4, i32* %5)
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [12 x i32], [12 x i32]* %2, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = load i32, i32* %5
%15 = add nsw i32 %13, %14
%16 = srem i32 %15, 7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %19)
ret i32 0
}

LLVM IR (-O2):
@__const.main.month = [12 x i32] [i32 0, i32 31, i32 59, i32 90, i32 120, i32 151, i32 181, i32 212, i32 243, i32 273, i32 304, i32 334]
@.str = [4 x i8] c"SUN\00"
@.str.1 = [4 x i8] c"MON\00"
@.str.2 = [4 x i8] c"TUE\00"
@.str.3 = [4 x i8] c"WED\00"
@.str.4 = [4 x i8] c"THU\00"
@.str.5 = [4 x i8] c"FRI\00"
@.str.6 = [4 x i8] c"SAT\00"
@reltable.main = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32)]
@.str.7 = [6 x i8] c"%d %d\00"
@.str.8 = [3 x i8] c"%s\00"
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.7, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = add nsw i32 %6, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [12 x i32], [12 x i32]* @__const.main.month, i64 0, i64 %8
%10 = load i32, i32* %9
%11 = load i32, i32* %2
%12 = add nsw i32 %11, %10
%13 = srem i32 %12, 7
%14 = sext i32 %13 to i64
%15 = shl i64 %14, 2
%16 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.main to i8*), i64 %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %16)
ret i32 0
}