#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 dayofweek(int, int, int);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int main() {
  switch (dayofweek(2014, 3, 25)) {
  case 0:
    printf("7");
    break;
  case 1:
    printf("1");
    break;
  case 2:
    printf("2");
    break;
  case 3:
    printf("3");
    break;
  case 4:
    printf("4");
    break;
  case 5:
    printf("5");
    break;
  case 6:
    printf("6");
    break;
  }
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x7de,%edi
mov    $0x3,%esi
mov    $0x19,%edx
call   1030 <dayofweek@plt>
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x6,%eax
ja     11e8 <main+0xb8>
mov    -0x10(%rbp),%rax
lea    0xe93(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
jmp    11e8 <main+0xb8>
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
jmp    11e8 <main+0xb8>
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
jmp    11e8 <main+0xb8>
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
jmp    11e8 <main+0xb8>
lea    0xe63(%rip),%rdi
call   1040 <printf@plt>
jmp    11e8 <main+0xb8>
lea    0xe54(%rip),%rdi
call   1040 <printf@plt>
jmp    11e8 <main+0xb8>
lea    0xe45(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x7de,%edi
mov    $0x3,%esi
mov    $0x19,%edx
call   1030 <dayofweek@plt>
cmp    $0x6,%eax
ja     115b <main+0x2b>
cltq
lea    0xead(%rip),%rcx
mov    (%rcx,%rax,4),%edi
call   1040 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"7\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [2 x i8] c"2\00"
@.str.3 = [2 x i8] c"3\00"
@.str.4 = [2 x i8] c"4\00"
@.str.5 = [2 x i8] c"5\00"
@.str.6 = [2 x i8] c"6\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @dayofweek(i32 2014, i32 3, i32 25)
switch i32 %2, 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 = %0
%4 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %17
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %17
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %17
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %17
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %17
13: ; preds = %0
%14 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %17
15: ; preds = %0
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %17
17: ; preds = %0, %15, %13, %11, %9, %7, %5, %3
%18 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@switch.table.main = [7 x i32] [i32 55, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54]
define i32 @main() {
%1 = tail call i32 @dayofweek(i32 2014, i32 3, i32 25)
%2 = icmp ult i32 %1, 7
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds [7 x i32], [7 x i32]* @switch.table.main, i64 0, i64 %4
%6 = load i32, i32* %5
%7 = tail call i32 @putchar(i32 %6)
br label %8
8: ; preds = %0, %3
%9 = tail call i32 (...) @getchar()
ret i32 0
}