#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 print_value(int i) {
  switch (i) {
  case 0:
    printf(" ");
    break;
  case 1:
    printf(".");
    break;
  case 2:
    printf("x");
    break;
  case 3:
    printf("W");
    break;
  default:
    printf("????");
  }
}


x86 assembly (clang, -O0):
<print_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     1184 <print_value+0x74>
mov    -0x10(%rbp),%rax
lea    0xec9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
jmp    1190 <print_value+0x80>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
jmp    1190 <print_value+0x80>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
jmp    1190 <print_value+0x80>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
jmp    1190 <print_value+0x80>
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_value>:
cmp    $0x3,%edi
ja     1141 <print_value+0x21>
mov    %edi,%eax
lea    0xed2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x20,%edi
jmp    1030 <putchar@plt>
lea    0xec8(%rip),%rdi
jmp    1040 <printf@plt>
mov    $0x2e,%edi
jmp    1030 <putchar@plt>
mov    $0x78,%edi
jmp    1030 <putchar@plt>
mov    $0x57,%edi
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [2 x i8] c"x\00"
@.str.3 = [2 x i8] c"W\00"
@.str.4 = [5 x i8] c"????\00"
define void @print_value(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %12 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %14
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %14
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %14
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %14
12: ; preds = %1
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %12, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@.str.4 = [5 x i8] c"????\00"
define void @print_value(i32 %0) {
switch i32 %0, label %10 [
i32 0, label %2
i32 1, label %4
i32 2, label %6
i32 3, label %8
]
2: ; preds = %1
%3 = tail call i32 @putchar(i32 32)
br label %12
4: ; preds = %1
%5 = tail call i32 @putchar(i32 46)
br label %12
6: ; preds = %1
%7 = tail call i32 @putchar(i32 120)
br label %12
8: ; preds = %1
%9 = tail call i32 @putchar(i32 87)
br label %12
10: ; preds = %1
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %12
12: ; preds = %10, %8, %6, %4, %2
ret void
}