#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 *);
void day_of_week(int day) {
  switch (day) {
  case 0:
    printf("\n\nYou selected Sunday.\n\n");
    break;
  case 1:
    printf("\n\nYou selected Monday.\n\n");
    break;
  case 2:
    printf("\n\nYou selected Tuesday.\n\n");
    break;
  case 3:
    printf("\n\nYou selected Wednesday.\n\n");
    break;
  case 4:
    printf("\n\nYou selected Thursday.\n\n");
    break;
  case 5:
    printf("\n\nYou selected Friday.\n\n");
    break;
  case 6:
    printf("\n\nYou selected Saturday.\n\n");
    break;
  default:
    printf("\n\nYou did not enter a valid day of the week.");
    printf("\nPlease run the program again. Thanks!\n\n");
    break;
  }
  return;
}


x86 assembly (clang, -O0):
<day_of_week>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x6,%rax
ja     11b7 <day_of_week+0xa7>
mov    -0x10(%rbp),%rax
lea    0xec9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
jmp    11cf <day_of_week+0xbf>
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
jmp    11cf <day_of_week+0xbf>
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
jmp    11cf <day_of_week+0xbf>
lea    0xeee(%rip),%rdi
call   1030 <printf@plt>
jmp    11cf <day_of_week+0xbf>
lea    0xef9(%rip),%rdi
call   1030 <printf@plt>
jmp    11cf <day_of_week+0xbf>
lea    0xf03(%rip),%rdi
call   1030 <printf@plt>
jmp    11cf <day_of_week+0xbf>
lea    0xf0b(%rip),%rdi
call   1030 <printf@plt>
jmp    11cf <day_of_week+0xbf>
lea    0xf15(%rip),%rdi
call   1030 <printf@plt>
lea    0xf36(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<day_of_week>:
push   %rax
cmp    $0x7,%edi
jae    113d <day_of_week+0x1d>
movslq %edi,%rax
lea    0xfd8(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
lea    0xf8d(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"\0A\0AYou selected Sunday.\0A\0A\00"
@.str.1 = [25 x i8] c"\0A\0AYou selected Monday.\0A\0A\00"
@.str.2 = [26 x i8] c"\0A\0AYou selected Tuesday.\0A\0A\00"
@.str.3 = [28 x i8] c"\0A\0AYou selected Wednesday.\0A\0A\00"
@.str.4 = [27 x i8] c"\0A\0AYou selected Thursday.\0A\0A\00"
@.str.5 = [25 x i8] c"\0A\0AYou selected Friday.\0A\0A\00"
@.str.6 = [27 x i8] c"\0A\0AYou selected Saturday.\0A\0A\00"
@.str.7 = [45 x i8] c"\0A\0AYou did not enter a valid day of the week.\00"
@.str.8 = [41 x i8] c"\0APlease run the program again. Thanks!\0A\0A\00"
define void @day_of_week(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %18 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
i32 5, label %14
i32 6, label %16
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %21
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %21
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %21
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
br label %21
12: ; preds = %1
%13 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %21
14: ; preds = %1
%15 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %21
16: ; preds = %1
%17 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
br label %21
18: ; preds = %1
%19 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0))
br label %21
21: ; preds = %18, %16, %14, %12, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@.str.7 = [45 x i8] c"\0A\0AYou did not enter a valid day of the week.\00"
@str = [26 x i8] c"\0A\0AYou selected Saturday.\0A\00"
@str.9 = [24 x i8] c"\0A\0AYou selected Friday.\0A\00"
@str.10 = [26 x i8] c"\0A\0AYou selected Thursday.\0A\00"
@str.11 = [27 x i8] c"\0A\0AYou selected Wednesday.\0A\00"
@str.12 = [25 x i8] c"\0A\0AYou selected Tuesday.\0A\00"
@str.13 = [24 x i8] c"\0A\0AYou selected Monday.\0A\00"
@str.14 = [24 x i8] c"\0A\0AYou selected Sunday.\0A\00"
@str.15 = [40 x i8] c"\0APlease run the program again. Thanks!\0A\00"
@reltable.day_of_week = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @str.14 to i64), i64 ptrtoint ([7 x i32]* @reltable.day_of_week to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @str.13 to i64), i64 ptrtoint ([7 x i32]* @reltable.day_of_week to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @str.12 to i64), i64 ptrtoint ([7 x i32]* @reltable.day_of_week to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @str.11 to i64), i64 ptrtoint ([7 x i32]* @reltable.day_of_week to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @str.10 to i64), i64 ptrtoint ([7 x i32]* @reltable.day_of_week to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @str.9 to i64), i64 ptrtoint ([7 x i32]* @reltable.day_of_week to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @str to i64), i64 ptrtoint ([7 x i32]* @reltable.day_of_week to i64)) to i32)]
define void @day_of_week(i32 %0) {
%2 = icmp ult i32 %0, 7
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0))
br label %9
5: ; preds = %1
%6 = sext i32 %0 to i64
%7 = shl i64 %6, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.day_of_week to i8*), i64 %7)
br label %9
9: ; preds = %5, %3
%10 = phi i8* [ getelementptr inbounds ([40 x i8], [40 x i8]* @str.15, i64 0, i64 0), %3 ], [ %8, %5 ]
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
ret void
}