void PrintResult(dayCase, yearCase) {
  switch (dayCase) {
  case 0:
    printf("\n%d Monday\n", yearCase);
    break;
  case 1:
    printf("\n%d Tuesday\n", yearCase);
    break;
  case 2:
    printf("\n%d Wednesday\n", yearCase);
    break;
  case 3:
    printf("\n%d Thursday\n", yearCase);
    break;
  case 4:
    printf("\n%d Friday\n", yearCase);
    break;
  case 5:
    printf("\n%d Saturday\n", yearCase);
    break;
  case 6:
    printf("\n%d Sunday\n", yearCase);
    break;
  default:
    printf("\nERROR\n");
  }
}


x86 assembly (clang, -O0):
<PrintResult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x6,%rax
ja     11dd <PrintResult+0xcd>
mov    -0x10(%rbp),%rax
lea    0xec6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%esi
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11eb <PrintResult+0xdb>
mov    -0x8(%rbp),%esi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11eb <PrintResult+0xdb>
mov    -0x8(%rbp),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11eb <PrintResult+0xdb>
mov    -0x8(%rbp),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11eb <PrintResult+0xdb>
mov    -0x8(%rbp),%esi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11eb <PrintResult+0xdb>
mov    -0x8(%rbp),%esi
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11eb <PrintResult+0xdb>
mov    -0x8(%rbp),%esi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11eb <PrintResult+0xdb>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintResult>:
cmp    $0x6,%edi
ja     1145 <PrintResult+0x25>
mov    %edi,%eax
lea    0xed2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xede(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
lea    0xf2c(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xed0(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
lea    0xecf(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
lea    0xed0(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
lea    0xed0(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
lea    0xece(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
lea    0xece(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [12 x i8] c"\0A%d Monday\0A\00"
@.str.1 = [13 x i8] c"\0A%d Tuesday\0A\00"
@.str.2 = [15 x i8] c"\0A%d Wednesday\0A\00"
@.str.3 = [14 x i8] c"\0A%d Thursday\0A\00"
@.str.4 = [12 x i8] c"\0A%d Friday\0A\00"
@.str.5 = [14 x i8] c"\0A%d Saturday\0A\00"
@.str.6 = [12 x i8] c"\0A%d Sunday\0A\00"
@str = [7 x i8] c"\0AERROR\00"
define void @PrintResult(i32 %0, i32 %1) {
switch i32 %0, label %17 [
i32 0, label %3
i32 1, label %5
i32 2, label %7
i32 3, label %9
i32 4, label %11
i32 5, label %13
i32 6, label %15
]
3: ; preds = %2
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %19
5: ; preds = %2
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %1)
br label %19
7: ; preds = %2
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %1)
br label %19
9: ; preds = %2
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %1)
br label %19
11: ; preds = %2
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %1)
br label %19
13: ; preds = %2
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %1)
br label %19
15: ; preds = %2
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i32 %1)
br label %19
17: ; preds = %2
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %19
19: ; preds = %17, %15, %13, %11, %9, %7, %5, %3
ret void
}