#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 *, char *, ...);
void sPrintData(char *str, int type, void *data) {
  switch (type) {
  case 0x00000001:
    printf(str, "%d", *(int *)data);
    return;
  case 0x00000002:
    printf(str, "%hd", *(short *)data);
    return;
  case 0x00000004:
    printf(str, "%f", *(float *)data);
    return;
  case 0x00000008:
    printf(str, "%f", *(double *)data);
    return;
  case 0x00000010:
    printf(str, "%ld", *(long *)data);
    return;
  case 0x00000020:
    printf(str, "%lld", *(long long *)data);
    return;
  case 0x00000040:
    printf(str, "%c", *(char *)data);
    return;
  case 0x00000080:
    printf(str, "%s", (char *)data);
    return;
  }
}


x86 assembly (clang, -O0):
<sPrintData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x1,%eax
je     11b0 <sPrintData+0xa0>
jmp    1137 <sPrintData+0x27>
mov    -0x1c(%rbp),%eax
sub    $0x2,%eax
je     11cd <sPrintData+0xbd>
jmp    1148 <sPrintData+0x38>
mov    -0x1c(%rbp),%eax
sub    $0x4,%eax
je     11eb <sPrintData+0xdb>
jmp    1159 <sPrintData+0x49>
mov    -0x1c(%rbp),%eax
sub    $0x8,%eax
je     120e <sPrintData+0xfe>
jmp    116a <sPrintData+0x5a>
mov    -0x1c(%rbp),%eax
sub    $0x10,%eax
je     122d <sPrintData+0x11d>
jmp    117b <sPrintData+0x6b>
mov    -0x1c(%rbp),%eax
sub    $0x20,%eax
je     124b <sPrintData+0x13b>
jmp    118c <sPrintData+0x7c>
mov    -0x1c(%rbp),%eax
sub    $0x40,%eax
je     1269 <sPrintData+0x159>
jmp    119d <sPrintData+0x8d>
mov    -0x1c(%rbp),%eax
sub    $0x80,%eax
je     1287 <sPrintData+0x177>
jmp    129d <sPrintData+0x18d>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xe3f(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    129d <sPrintData+0x18d>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movswl (%rax),%edx
lea    0xe24(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    129d <sPrintData+0x18d>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe05(%rip),%rsi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    129d <sPrintData+0x18d>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xde6(%rip),%rsi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    129d <sPrintData+0x18d>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
lea    0xdcb(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    129d <sPrintData+0x18d>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
lea    0xdb1(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    129d <sPrintData+0x18d>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
movsbl (%rax),%edx
lea    0xd98(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    129d <sPrintData+0x18d>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xd80(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sPrintData>:
lea    -0x1(%rsi),%eax
cmp    $0x3f,%eax
ja     1138 <sPrintData+0x28>
lea    0xee1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    (%rdx),%edx
lea    0xfcf(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>
cmp    $0x80,%esi
jne    114e <sPrintData+0x3e>
lea    0xfcf(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>
ret
movswl (%rdx),%edx
lea    0xfaa(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>
movss  (%rdx),%xmm0
cvtss2sd %xmm0,%xmm0
jmp    116e <sPrintData+0x5e>
movsd  (%rdx),%xmm0
lea    0xf92(%rip),%rsi
mov    $0x1,%al
jmp    1030 <printf@plt>
mov    (%rdx),%rdx
lea    0xf84(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>
mov    (%rdx),%rdx
lea    0xf77(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>
movsbl (%rdx),%edx
lea    0xf6b(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%hd\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [4 x i8] c"%ld\00"
@.str.4 = [5 x i8] c"%lld\00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [3 x i8] c"%s\00"
define void @sPrintData(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
switch i32 %7, label %56 [
i32 1, label %8
i32 2, label %14
i32 4, label %21
i32 8, label %28
i32 16, label %34
i32 32, label %40
i32 64, label %46
i32 128, label %52
]
8: ; preds = %3
%9 = load i8*, i8** %4
%10 = load i8*, i8** %6
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
%13 = call i32 (i8*, i8*, ...) @printf(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %56
14: ; preds = %3
%15 = load i8*, i8** %4
%16 = load i8*, i8** %6
%17 = bitcast i8* %16 to i16*
%18 = load i16, i16* %17
%19 = sext i16 %18 to i32
%20 = call i32 (i8*, i8*, ...) @printf(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %19)
br label %56
21: ; preds = %3
%22 = load i8*, i8** %4
%23 = load i8*, i8** %6
%24 = bitcast i8* %23 to float*
%25 = load float, float* %24
%26 = fpext float %25 to double
%27 = call i32 (i8*, i8*, ...) @printf(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), double %26)
br label %56
28: ; preds = %3
%29 = load i8*, i8** %4
%30 = load i8*, i8** %6
%31 = bitcast i8* %30 to double*
%32 = load double, double* %31
%33 = call i32 (i8*, i8*, ...) @printf(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), double %32)
br label %56
34: ; preds = %3
%35 = load i8*, i8** %4
%36 = load i8*, i8** %6
%37 = bitcast i8* %36 to i64*
%38 = load i64, i64* %37
%39 = call i32 (i8*, i8*, ...) @printf(i8* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64 %38)
br label %56
40: ; preds = %3
%41 = load i8*, i8** %4
%42 = load i8*, i8** %6
%43 = bitcast i8* %42 to i64*
%44 = load i64, i64* %43
%45 = call i32 (i8*, i8*, ...) @printf(i8* %41, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 %44)
br label %56
46: ; preds = %3
%47 = load i8*, i8** %4
%48 = load i8*, i8** %6
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = call i32 (i8*, i8*, ...) @printf(i8* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %50)
br label %56
52: ; preds = %3
%53 = load i8*, i8** %4
%54 = load i8*, i8** %6
%55 = call i32 (i8*, i8*, ...) @printf(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %54)
br label %56
56: ; preds = %8, %14, %21, %28, %34, %40, %46, %52, %3
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%hd\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [4 x i8] c"%ld\00"
@.str.4 = [5 x i8] c"%lld\00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [3 x i8] c"%s\00"
define void @sPrintData(i8* %0, i32 %1, i8* %2) {
switch i32 %1, label %36 [
i32 1, label %4
i32 2, label %8
i32 4, label %13
i32 8, label %18
i32 16, label %22
i32 32, label %26
i32 64, label %30
i32 128, label %34
]
4: ; preds = %3
%5 = bitcast i8* %2 to i32*
%6 = load i32, i32* %5
%7 = tail call i32 (i8*, i8*, ...) @printf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %36
8: ; preds = %3
%9 = bitcast i8* %2 to i16*
%10 = load i16, i16* %9
%11 = sext i16 %10 to i32
%12 = tail call i32 (i8*, i8*, ...) @printf(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %36
13: ; preds = %3
%14 = bitcast i8* %2 to float*
%15 = load float, float* %14
%16 = fpext float %15 to double
%17 = tail call i32 (i8*, i8*, ...) @printf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), double %16)
br label %36
18: ; preds = %3
%19 = bitcast i8* %2 to double*
%20 = load double, double* %19
%21 = tail call i32 (i8*, i8*, ...) @printf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), double %20)
br label %36
22: ; preds = %3
%23 = bitcast i8* %2 to i64*
%24 = load i64, i64* %23
%25 = tail call i32 (i8*, i8*, ...) @printf(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64 %24)
br label %36
26: ; preds = %3
%27 = bitcast i8* %2 to i64*
%28 = load i64, i64* %27
%29 = tail call i32 (i8*, i8*, ...) @printf(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 %28)
br label %36
30: ; preds = %3
%31 = load i8, i8* %2
%32 = sext i8 %31 to i32
%33 = tail call i32 (i8*, i8*, ...) @printf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %32)
br label %36
34: ; preds = %3
%35 = tail call i32 (i8*, i8*, ...) @printf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %2)
br label %36
36: ; preds = %4, %8, %13, %18, %22, %26, %30, %34, %3
ret void
}