#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 */
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_datatype(uint16_t datatype) {
  switch (datatype) {
  case 0:
    printf("DT_NONE/DT_UNKNOWN\n");
    break;
  case 1:
    printf("DT_BINARY\n");
    break;
  case 2:
    printf("DT_UNSIGNED_CHAR\n");
    break;
  case 4:
    printf("DT_SIGNED_SHORT\n");
    break;
  case 8:
    printf("DT_SIGNED_INT\n");
    break;
  case 16:
    printf("DT_FLOAT\n");
    break;
  case 32:
    printf("DT_COMPLEX\n");
    break;
  case 64:
    printf("DT_DOUBLE\n");
    break;
  case 128:
    printf("DT_RGB\n");
    break;
  case 255:
    printf("DT_ALL\n");
    break;
  default:
    printf("unknown type\n");
    break;
  }
}


x86 assembly (clang, -O0):
<print_datatype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     11cb <print_datatype+0xbb>
jmp    112e <print_datatype+0x1e>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
je     11dc <print_datatype+0xcc>
jmp    113f <print_datatype+0x2f>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     11ed <print_datatype+0xdd>
jmp    1150 <print_datatype+0x40>
mov    -0x8(%rbp),%eax
sub    $0x4,%eax
je     11fe <print_datatype+0xee>
jmp    1161 <print_datatype+0x51>
mov    -0x8(%rbp),%eax
sub    $0x8,%eax
je     120f <print_datatype+0xff>
jmp    1172 <print_datatype+0x62>
mov    -0x8(%rbp),%eax
sub    $0x10,%eax
je     1220 <print_datatype+0x110>
jmp    1183 <print_datatype+0x73>
mov    -0x8(%rbp),%eax
sub    $0x20,%eax
je     1231 <print_datatype+0x121>
jmp    1194 <print_datatype+0x84>
mov    -0x8(%rbp),%eax
sub    $0x40,%eax
je     1242 <print_datatype+0x132>
jmp    11a5 <print_datatype+0x95>
mov    -0x8(%rbp),%eax
sub    $0x80,%eax
je     1253 <print_datatype+0x143>
jmp    11b8 <print_datatype+0xa8>
mov    -0x8(%rbp),%eax
sub    $0xff,%eax
je     1264 <print_datatype+0x154>
jmp    1275 <print_datatype+0x165>
lea    0xe2e(%rip),%rdi
call   1030 <printf@plt>
jmp    1281 <print_datatype+0x171>
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
jmp    1281 <print_datatype+0x171>
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
jmp    1281 <print_datatype+0x171>
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
jmp    1281 <print_datatype+0x171>
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
jmp    1281 <print_datatype+0x171>
lea    0xe2a(%rip),%rdi
call   1030 <printf@plt>
jmp    1281 <print_datatype+0x171>
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
jmp    1281 <print_datatype+0x171>
lea    0xe1e(%rip),%rdi
call   1030 <printf@plt>
jmp    1281 <print_datatype+0x171>
lea    0xe18(%rip),%rdi
call   1030 <printf@plt>
jmp    1281 <print_datatype+0x171>
lea    0xe0f(%rip),%rdi
call   1030 <printf@plt>
jmp    1281 <print_datatype+0x171>
lea    0xe06(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_datatype>:
mov    %edi,%eax
cmp    $0x40,%edi
ja     113c <print_datatype+0x2c>
lea    0x104b(%rip),%rdi
mov    %eax,%eax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1028(%rip),%rdi
jmp    1030 <puts@plt>
cmp    $0x80,%eax
je     11aa <print_datatype+0x9a>
cmp    $0xff,%eax
jne    1156 <print_datatype+0x46>
lea    0xfb3(%rip),%rdi
jmp    1030 <puts@plt>
lea    0x101f(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xfe5(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xfc9(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xfaf(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xf9a(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xf83(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xf6d(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xf5a(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"DT_NONE/DT_UNKNOWN\0A\00"
@.str.1 = [11 x i8] c"DT_BINARY\0A\00"
@.str.2 = [18 x i8] c"DT_UNSIGNED_CHAR\0A\00"
@.str.3 = [17 x i8] c"DT_SIGNED_SHORT\0A\00"
@.str.4 = [15 x i8] c"DT_SIGNED_INT\0A\00"
@.str.5 = [10 x i8] c"DT_FLOAT\0A\00"
@.str.6 = [12 x i8] c"DT_COMPLEX\0A\00"
@.str.7 = [11 x i8] c"DT_DOUBLE\0A\00"
@.str.8 = [8 x i8] c"DT_RGB\0A\00"
@.str.9 = [8 x i8] c"DT_ALL\0A\00"
@.str.10 = [14 x i8] c"unknown type\0A\00"
define void @print_datatype(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %24 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 4, label %10
i32 8, label %12
i32 16, label %14
i32 32, label %16
i32 64, label %18
i32 128, label %20
i32 255, label %22
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %26
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %26
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %26
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %26
12: ; preds = %1
%13 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
br label %26
14: ; preds = %1
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %26
16: ; preds = %1
%17 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
br label %26
18: ; preds = %1
%19 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
br label %26
20: ; preds = %1
%21 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
br label %26
22: ; preds = %1
%23 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
br label %26
24: ; preds = %1
%25 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
br label %26
26: ; preds = %24, %22, %20, %18, %16, %14, %12, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"DT_ALL\00"
@str.11 = [7 x i8] c"DT_RGB\00"
@str.12 = [10 x i8] c"DT_DOUBLE\00"
@str.13 = [11 x i8] c"DT_COMPLEX\00"
@str.14 = [9 x i8] c"DT_FLOAT\00"
@str.15 = [14 x i8] c"DT_SIGNED_INT\00"
@str.16 = [16 x i8] c"DT_SIGNED_SHORT\00"
@str.17 = [17 x i8] c"DT_UNSIGNED_CHAR\00"
@str.18 = [10 x i8] c"DT_BINARY\00"
@str.19 = [19 x i8] c"DT_NONE/DT_UNKNOWN\00"
@str.20 = [13 x i8] c"unknown type\00"
define void @print_datatype(i32 %0) {
switch i32 %0, label %11 [
i32 0, label %12
i32 1, label %2
i32 2, label %3
i32 4, label %4
i32 8, label %5
i32 16, label %6
i32 32, label %7
i32 64, label %8
i32 128, label %9
i32 255, label %10
]
2: ; preds = %1
br label %12
3: ; preds = %1
br label %12
4: ; preds = %1
br label %12
5: ; preds = %1
br label %12
6: ; preds = %1
br label %12
7: ; preds = %1
br label %12
8: ; preds = %1
br label %12
9: ; preds = %1
br label %12
10: ; preds = %1
br label %12
11: ; preds = %1
br label %12
12: ; preds = %1, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%13 = phi i8* [ getelementptr inbounds ([13 x i8], [13 x i8]* @str.20, i64 0, i64 0), %11 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0), %10 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.11, i64 0, i64 0), %9 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.12, i64 0, i64 0), %8 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @str.13, i64 0, i64 0), %7 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.14, i64 0, i64 0), %6 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @str.15, i64 0, i64 0), %5 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.16, i64 0, i64 0), %4 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @str.17, i64 0, i64 0), %3 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.18, i64 0, i64 0), %2 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.19, i64 0, i64 0), %1 ]
%14 = tail call i32 @puts(i8* dereferenceable(1) %13)
ret void
}