#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 prtype(int type) {
  switch (type & 0x0f) {
  case 0:
    break;
  case 1:
    printf("void ");
    break;
  case 2:
    printf("char ");
    break;
  case 3:
    printf("int  ");
    break;
  default:
    printf("?type%d ", type & 0x0f);
    break;
  }
}


x86 assembly (clang, -O0):
<prtype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%eax
ja     1180 <prtype+0x70>
mov    -0x10(%rbp),%rax
lea    0xec7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1194 <prtype+0x84>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1194 <prtype+0x84>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1194 <prtype+0x84>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1194 <prtype+0x84>
mov    -0x4(%rbp),%esi
and    $0xf,%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prtype>:
mov    %edi,%esi
and    $0xf,%esi
cmp    $0x3,%esi
ja     112b <prtype+0x1b>
lea    0xedf(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
ret
lea    0xef0(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xed0(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xec8(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xec0(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"void \00"
@.str.1 = [6 x i8] c"char \00"
@.str.2 = [6 x i8] c"int \00"
@.str.3 = [9 x i8] c"?type%d \00"
define void @prtype(i32 %0) {
%2 = and i32 %0, 15
switch i32 %2, label %9 [
i32 0, label %11
i32 1, label %3
i32 2, label %5
i32 3, label %7
]
3: ; preds = %1
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %11
5: ; preds = %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %11
7: ; preds = %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %11
9: ; preds = %1
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %2)
br label %11
11: ; preds = %9, %7, %5, %3, %1
ret void
}