#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 *, unsigned char);
void PrintUtfType(void *data, int type) {
  switch (type) {
  case 0x0b:
    printf("%08X", *(unsigned long *)data);
    break;
  case 0x0a:
    printf("%08X", *(unsigned long *)data);
    break;
  case 0x09:
    printf("%f", *(double *)data);
    break;
  case 0x08:
    printf("%f", *(float *)data);
    break;
  case 0x07:
    printf("%016X", *(unsigned long long *)data);
    break;
  case 0x06:
    printf("%016X", *(unsigned long long *)data);
    break;
  case 0x05:
    printf("%08X", *(unsigned long *)data);
    break;
  case 0x04:
    printf("%08X", *(unsigned long *)data);
    break;
  case 0x03:
    printf("%04X", *(unsigned short *)data);
    break;
  case 0x02:
    printf("%04X", *(unsigned short *)data);
    break;
  case 0x01:
    printf("%02X", *(unsigned char *)data);
    break;
  case 0x00:
    printf("%02X", *(unsigned char *)data);
    break;
  }
}


x86 assembly (clang, -O0):
<PrintUtfType>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0xb,%rax
ja     127f <PrintUtfType+0x16f>
mov    -0x18(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
lea    0xede(%rip),%rdi
movzbl %al,%esi
call   1030 <printf@plt>
jmp    127f <PrintUtfType+0x16f>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
lea    0xec3(%rip),%rdi
movzbl %al,%esi
call   1030 <printf@plt>
jmp    127f <PrintUtfType+0x16f>
mov    -0x8(%rbp),%rax
cvttsd2si (%rax),%eax
lea    0xeac(%rip),%rdi
movzbl %al,%esi
call   1030 <printf@plt>
jmp    127f <PrintUtfType+0x16f>
mov    -0x8(%rbp),%rax
cvttss2si (%rax),%eax
lea    0xe90(%rip),%rdi
movzbl %al,%esi
call   1030 <printf@plt>
jmp    127f <PrintUtfType+0x16f>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
lea    0xe78(%rip),%rdi
movzbl %al,%esi
call   1030 <printf@plt>
jmp    127f <PrintUtfType+0x16f>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
lea    0xe5d(%rip),%rdi
movzbl %al,%esi
call   1030 <printf@plt>
jmp    127f <PrintUtfType+0x16f>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
lea    0xe3a(%rip),%rdi
movzbl %al,%esi
call   1030 <printf@plt>
jmp    127f <PrintUtfType+0x16f>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
lea    0xe1f(%rip),%rdi
movzbl %al,%esi
call   1030 <printf@plt>
jmp    127f <PrintUtfType+0x16f>
mov    -0x8(%rbp),%rax
mov    (%rax),%ax
lea    0xe12(%rip),%rdi
movzbl %al,%esi
call   1030 <printf@plt>
jmp    127f <PrintUtfType+0x16f>
mov    -0x8(%rbp),%rax
mov    (%rax),%ax
lea    0xdf7(%rip),%rdi
movzbl %al,%esi
call   1030 <printf@plt>
jmp    127f <PrintUtfType+0x16f>
mov    -0x8(%rbp),%rax
lea    0xde4(%rip),%rdi
movzbl (%rax),%esi
call   1030 <printf@plt>
jmp    127f <PrintUtfType+0x16f>
mov    -0x8(%rbp),%rax
lea    0xdcc(%rip),%rdi
movzbl (%rax),%esi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintUtfType>:
cmp    $0xb,%esi
ja     117c <PrintUtfType+0x6c>
mov    %esi,%eax
lea    0xee2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movzbl (%rdi),%esi
lea    0xeff(%rip),%rdi
jmp    1030 <printf@plt>
movzbl (%rdi),%esi
lea    0xf03(%rip),%rdi
jmp    1030 <printf@plt>
movzbl (%rdi),%esi
lea    0xeef(%rip),%rdi
jmp    1030 <printf@plt>
movzbl (%rdi),%esi
lea    0xeda(%rip),%rdi
jmp    1030 <printf@plt>
cvttss2si (%rdi),%eax
jmp    116d <PrintUtfType+0x5d>
cvttsd2si (%rdi),%eax
movzbl %al,%esi
lea    0xebe(%rip),%rdi
jmp    1030 <printf@plt>
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%08X\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [6 x i8] c"%016X\00"
@.str.3 = [5 x i8] c"%04X\00"
@.str.4 = [5 x i8] c"%02X\00"
define void @PrintUtfType(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %74 [
i32 11, label %6
i32 10, label %12
i32 9, label %18
i32 8, label %24
i32 7, label %30
i32 6, label %36
i32 5, label %42
i32 4, label %48
i32 3, label %54
i32 2, label %60
i32 1, label %66
i32 0, label %70
]
6: ; preds = %2
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i64*
%9 = load i64, i64* %8
%10 = trunc i64 %9 to i8
%11 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %10)
br label %74
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = bitcast i8* %13 to i64*
%15 = load i64, i64* %14
%16 = trunc i64 %15 to i8
%17 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %16)
br label %74
18: ; preds = %2
%19 = load i8*, i8** %3
%20 = bitcast i8* %19 to double*
%21 = load double, double* %20
%22 = fptoui double %21 to i8
%23 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %22)
br label %74
24: ; preds = %2
%25 = load i8*, i8** %3
%26 = bitcast i8* %25 to float*
%27 = load float, float* %26
%28 = fptoui float %27 to i8
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %28)
br label %74
30: ; preds = %2
%31 = load i8*, i8** %3
%32 = bitcast i8* %31 to i64*
%33 = load i64, i64* %32
%34 = trunc i64 %33 to i8
%35 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %34)
br label %74
36: ; preds = %2
%37 = load i8*, i8** %3
%38 = bitcast i8* %37 to i64*
%39 = load i64, i64* %38
%40 = trunc i64 %39 to i8
%41 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %40)
br label %74
42: ; preds = %2
%43 = load i8*, i8** %3
%44 = bitcast i8* %43 to i64*
%45 = load i64, i64* %44
%46 = trunc i64 %45 to i8
%47 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %46)
br label %74
48: ; preds = %2
%49 = load i8*, i8** %3
%50 = bitcast i8* %49 to i64*
%51 = load i64, i64* %50
%52 = trunc i64 %51 to i8
%53 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %52)
br label %74
54: ; preds = %2
%55 = load i8*, i8** %3
%56 = bitcast i8* %55 to i16*
%57 = load i16, i16* %56
%58 = trunc i16 %57 to i8
%59 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8 zeroext %58)
br label %74
60: ; preds = %2
%61 = load i8*, i8** %3
%62 = bitcast i8* %61 to i16*
%63 = load i16, i16* %62
%64 = trunc i16 %63 to i8
%65 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8 zeroext %64)
br label %74
66: ; preds = %2
%67 = load i8*, i8** %3
%68 = load i8, i8* %67
%69 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8 zeroext %68)
br label %74
70: ; preds = %2
%71 = load i8*, i8** %3
%72 = load i8, i8* %71
%73 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8 zeroext %72)
br label %74
74: ; preds = %2, %70, %66, %60, %54, %48, %42, %36, %30, %24, %18, %12, %6
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%08X\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [6 x i8] c"%016X\00"
@.str.3 = [5 x i8] c"%04X\00"
@.str.4 = [5 x i8] c"%02X\00"
define void @PrintUtfType(i8* nocapture %0, i32 %1) {
switch i32 %1, label %59 [
i32 11, label %3
i32 10, label %8
i32 9, label %13
i32 8, label %18
i32 7, label %23
i32 6, label %28
i32 5, label %33
i32 4, label %38
i32 3, label %43
i32 2, label %48
i32 1, label %53
i32 0, label %56
]
3: ; preds = %2
%4 = bitcast i8* %0 to i64*
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i8
%7 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
br label %59
8: ; preds = %2
%9 = bitcast i8* %0 to i64*
%10 = load i64, i64* %9
%11 = trunc i64 %10 to i8
%12 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %11)
br label %59
13: ; preds = %2
%14 = bitcast i8* %0 to double*
%15 = load double, double* %14
%16 = fptoui double %15 to i8
%17 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %16)
br label %59
18: ; preds = %2
%19 = bitcast i8* %0 to float*
%20 = load float, float* %19
%21 = fptoui float %20 to i8
%22 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %21)
br label %59
23: ; preds = %2
%24 = bitcast i8* %0 to i64*
%25 = load i64, i64* %24
%26 = trunc i64 %25 to i8
%27 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %26)
br label %59
28: ; preds = %2
%29 = bitcast i8* %0 to i64*
%30 = load i64, i64* %29
%31 = trunc i64 %30 to i8
%32 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %31)
br label %59
33: ; preds = %2
%34 = bitcast i8* %0 to i64*
%35 = load i64, i64* %34
%36 = trunc i64 %35 to i8
%37 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %36)
br label %59
38: ; preds = %2
%39 = bitcast i8* %0 to i64*
%40 = load i64, i64* %39
%41 = trunc i64 %40 to i8
%42 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %41)
br label %59
43: ; preds = %2
%44 = bitcast i8* %0 to i16*
%45 = load i16, i16* %44
%46 = trunc i16 %45 to i8
%47 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8 zeroext %46)
br label %59
48: ; preds = %2
%49 = bitcast i8* %0 to i16*
%50 = load i16, i16* %49
%51 = trunc i16 %50 to i8
%52 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8 zeroext %51)
br label %59
53: ; preds = %2
%54 = load i8, i8* %0
%55 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8 zeroext %54)
br label %59
56: ; preds = %2
%57 = load i8, i8* %0
%58 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8 zeroext %57)
br label %59
59: ; preds = %2, %56, %53, %48, %43, %38, %33, %28, %23, %18, %13, %8, %3
ret void
}