#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 *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  char *week[] = {"Monday", "Tuesday",  "Wednesday", "Thirsday",
                  "Friday", "Saturday", "Sunday"};
  int choice = -1;
  printf("input a day:");
  scanf("%d", &choice);
  if (choice >= 1 && choice <= 7)
    printf("It is %s.\n", week[choice - 1]);
  else
    printf("Out of range. The input number must between [1,7].\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0x2c96(%rip),%rsi
mov    $0x38,%edx
call   1040 <memcpy@plt>
movl   $0xffffffff,-0x44(%rbp)
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x44(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,-0x44(%rbp)
jl     11ad <main+0x7d>
cmpl   $0x7,-0x44(%rbp)
jg     11ad <main+0x7d>
mov    -0x44(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x40(%rbp,%rax,8),%rsi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bb <main+0x8b>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0xffffffff,0x4(%rsp)
ff
lea    0xef9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x6,%eax
ja     1184 <main+0x54>
mov    %eax,%eax
lea    0xf1b(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1190 <main+0x60>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"Monday\00"
@.str.1 = [8 x i8] c"Tuesday\00"
@.str.2 = [10 x i8] c"Wednesday\00"
@.str.3 = [9 x i8] c"Thirsday\00"
@.str.4 = [7 x i8] c"Friday\00"
@.str.5 = [9 x i8] c"Saturday\00"
@.str.6 = [7 x i8] c"Sunday\00"
@__const.main.week = [7 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0)]
@.str.7 = [13 x i8] c"input a day:\00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [11 x i8] c"It is %s.\0A\00"
@.str.10 = [52 x i8] c"Out of range. The input number must between [1,7].\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8*]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [7 x i8*]* %2 to i8*
store i32 -1, i32* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = icmp sge i32 %7, 1
br i1 %8, label %9, label %19
9: ; preds = %0
%10 = load i32, i32* %3
%11 = icmp sle i32 %10, 7
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [7 x i8*], [7 x i8*]* %2, i64 0, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i8* %17)
br label %21
19: ; preds = %9, %0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.10, i64 0, i64 0))
br label %21
21: ; preds = %19, %12
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str = [7 x i8] c"Monday\00"
@.str.1 = [8 x i8] c"Tuesday\00"
@.str.2 = [10 x i8] c"Wednesday\00"
@.str.3 = [9 x i8] c"Thirsday\00"
@.str.4 = [7 x i8] c"Friday\00"
@.str.5 = [9 x i8] c"Saturday\00"
@.str.6 = [7 x i8] c"Sunday\00"
@reltable.main = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 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 ([9 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.main to i64)) to i32)]
@.str.7 = [13 x i8] c"input a day:\00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [11 x i8] c"It is %s.\0A\00"
@str = [51 x i8] c"Out of range. The input number must between [1,7].\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 -1, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = add i32 %5, -1
%7 = icmp ult i32 %6, 7
br i1 %7, label %8, label %13
8: ; preds = %0
%9 = zext i32 %6 to i64
%10 = shl i64 %9, 2
%11 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.main to i8*), i64 %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i8* %11)
br label %15
13: ; preds = %0
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
br label %15
15: ; preds = %13, %8
ret i32 0
}