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


x86 assembly (clang, -O0):
<getData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     11ac <getData+0x9c>
jmp    1133 <getData+0x23>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     11c6 <getData+0xb6>
jmp    1144 <getData+0x34>
mov    -0x14(%rbp),%eax
sub    $0x4,%eax
je     11e0 <getData+0xd0>
jmp    1155 <getData+0x45>
mov    -0x14(%rbp),%eax
sub    $0x8,%eax
je     11fa <getData+0xea>
jmp    1166 <getData+0x56>
mov    -0x14(%rbp),%eax
sub    $0x10,%eax
je     1214 <getData+0x104>
jmp    1177 <getData+0x67>
mov    -0x14(%rbp),%eax
sub    $0x20,%eax
je     122e <getData+0x11e>
jmp    1188 <getData+0x78>
mov    -0x14(%rbp),%eax
sub    $0x40,%eax
je     1248 <getData+0x138>
jmp    1199 <getData+0x89>
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
je     1262 <getData+0x152>
jmp    127c <getData+0x16c>
mov    -0x10(%rbp),%rsi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    %eax,-0x4(%rbp)
jmp    1283 <getData+0x173>
mov    -0x10(%rbp),%rsi
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    %eax,-0x4(%rbp)
jmp    1283 <getData+0x173>
mov    -0x10(%rbp),%rsi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    %eax,-0x4(%rbp)
jmp    1283 <getData+0x173>
mov    -0x10(%rbp),%rsi
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    %eax,-0x4(%rbp)
jmp    1283 <getData+0x173>
mov    -0x10(%rbp),%rsi
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    %eax,-0x4(%rbp)
jmp    1283 <getData+0x173>
mov    -0x10(%rbp),%rsi
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    %eax,-0x4(%rbp)
jmp    1283 <getData+0x173>
mov    -0x10(%rbp),%rsi
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    %eax,-0x4(%rbp)
jmp    1283 <getData+0x173>
mov    -0x10(%rbp),%rsi
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    %eax,-0x4(%rbp)
jmp    1283 <getData+0x173>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getData>:
lea    -0x1(%rdi),%eax
cmp    $0x3f,%eax
ja     113d <getData+0x2d>
lea    0xfe1(%rip),%rdi
lea    0xeda(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xfcd(%rip),%rdi
xor    %eax,%eax
jmp    1030 <scanf@plt>
cmp    $0x80,%edi
jne    1153 <getData+0x43>
lea    0xfce(%rip),%rdi
xor    %eax,%eax
jmp    1030 <scanf@plt>
xor    %eax,%eax
ret
lea    0xfaa(%rip),%rdi
xor    %eax,%eax
jmp    1030 <scanf@plt>
lea    0xf9f(%rip),%rdi
xor    %eax,%eax
jmp    1030 <scanf@plt>
lea    0xf95(%rip),%rdi
xor    %eax,%eax
jmp    1030 <scanf@plt>
lea    0xf8b(%rip),%rdi
xor    %eax,%eax
jmp    1030 <scanf@plt>
lea    0xf82(%rip),%rdi
xor    %eax,%eax
jmp    1030 <scanf@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"%lf\00"
@.str.4 = [4 x i8] c"%ld\00"
@.str.5 = [5 x i8] c"%lld\00"
@.str.6 = [3 x i8] c"%c\00"
@.str.7 = [3 x i8] c"%s\00"
define i32 @getData(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %4
switch i32 %6, label %37 [
i32 1, label %7
i32 2, label %11
i32 4, label %15
i32 8, label %19
i32 16, label %23
i32 32, label %27
i32 64, label %31
i32 128, label %34
]
7: ; preds = %2
%8 = load i8*, i8** %5
%9 = bitcast i8* %8 to i32*
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
store i32 %10, i32* %3
br label %38
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = bitcast i8* %12 to i16*
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i16* %13)
store i32 %14, i32* %3
br label %38
15: ; preds = %2
%16 = load i8*, i8** %5
%17 = bitcast i8* %16 to float*
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %17)
store i32 %18, i32* %3
br label %38
19: ; preds = %2
%20 = load i8*, i8** %5
%21 = bitcast i8* %20 to double*
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %21)
store i32 %22, i32* %3
br label %38
23: ; preds = %2
%24 = load i8*, i8** %5
%25 = bitcast i8* %24 to i64*
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i64* %25)
store i32 %26, i32* %3
br label %38
27: ; preds = %2
%28 = load i8*, i8** %5
%29 = bitcast i8* %28 to i64*
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i64* %29)
store i32 %30, i32* %3
br label %38
31: ; preds = %2
%32 = load i8*, i8** %5
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %32)
store i32 %33, i32* %3
br label %38
34: ; preds = %2
%35 = load i8*, i8** %5
%36 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %35)
store i32 %36, i32* %3
br label %38
37: ; preds = %2
store i32 0, i32* %3
br label %38
38: ; preds = %37, %34, %31, %27, %23, %19, %15, %11, %7
%39 = load i32, i32* %3
ret i32 %39
}

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"%lf\00"
@.str.4 = [4 x i8] c"%ld\00"
@.str.5 = [5 x i8] c"%lld\00"
@.str.6 = [3 x i8] c"%c\00"
@.str.7 = [3 x i8] c"%s\00"
define i32 @getData(i32 %0, i8* %1) {
switch i32 %0, label %13 [
i32 1, label %10
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
]
3: ; preds = %2
br label %10
4: ; preds = %2
br label %10
5: ; preds = %2
br label %10
6: ; preds = %2
br label %10
7: ; preds = %2
br label %10
8: ; preds = %2
br label %10
9: ; preds = %2
br label %10
10: ; preds = %2, %3, %4, %5, %6, %7, %8, %9
%11 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), %9 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), %8 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %2 ]
%12 = tail call i32 (i8*, ...) @scanf(i8* %11, i8* %1)
br label %13
13: ; preds = %10, %2
%14 = phi i32 [ 0, %2 ], [ %12, %10 ]
ret i32 %14
}