#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 *);
void weekDisplay(int dayCount) {
  char *weekday[] = {"Sunday",   "Monday", "Tuesday", "Wednesday",
                     "Thursday", "Friday", "Saturday"};
  dayCount--;
  printf("You have selected, %s\n", weekday[dayCount]);
  return;
}


x86 assembly (clang, -O0):
<weekDisplay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0x2caa(%rip),%rsi
mov    $0x38,%edx
call   1040 <memcpy@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rsi
lea    0xee0(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<weekDisplay>:
movslq %edi,%rax
lea    0xf36(%rip),%rcx
movslq -0x4(%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    0xf10(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"Sunday\00"
@.str.1 = [7 x i8] c"Monday\00"
@.str.2 = [8 x i8] c"Tuesday\00"
@.str.3 = [10 x i8] c"Wednesday\00"
@.str.4 = [9 x i8] c"Thursday\00"
@.str.5 = [7 x i8] c"Friday\00"
@.str.6 = [9 x i8] c"Saturday\00"
@__const.weekDisplay.weekday = [7 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i32 0, i32 0)]
@.str.7 = [23 x i8] c"You have selected, %s\0A\00"
define void @weekDisplay(i32 %0) {
%2 = alloca i32
%3 = alloca [7 x i8*]
store i32 %0, i32* %2
%4 = bitcast [7 x i8*]* %3 to i8*
%5 = load i32, i32* %2
%6 = add nsw i32 %5, -1
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 %8
%10 = load i8*, i8** %9
%11 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"Sunday\00"
@.str.1 = [7 x i8] c"Monday\00"
@.str.2 = [8 x i8] c"Tuesday\00"
@.str.3 = [10 x i8] c"Wednesday\00"
@.str.4 = [9 x i8] c"Thursday\00"
@.str.5 = [7 x i8] c"Friday\00"
@.str.6 = [9 x i8] c"Saturday\00"
@reltable.weekDisplay = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.weekDisplay to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.weekDisplay to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.weekDisplay to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.weekDisplay to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.weekDisplay to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.weekDisplay to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.weekDisplay to i64)) to i32)]
@.str.7 = [23 x i8] c"You have selected, %s\0A\00"
define void @weekDisplay(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = sext i32 %2 to i64
%4 = shl i64 %3, 2
%5 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.weekDisplay to i8*), i64 %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %5)
ret void
}