#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*/ abort();
int /*<<< orphan*/ sprintf(char *, char *, char *);
char *data_type(char *prefix, int bytes) {
  static char buf[64];
  switch (bytes) {
  case 1:
    sprintf(buf, "%s_8", prefix);
    return buf;
  case 2:
    sprintf(buf, "%s_16", prefix);
    return buf;
  case 4:
    sprintf(buf, "%s_32", prefix);
    return buf;
  case 8:
    sprintf(buf, "%s_64", prefix);
    return buf;
  default:
    return "I_GIVE_UP";
  }
  abort();
}


x86 assembly (clang, -O0):
<data_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x7,%eax
ja     11e4 <data_type+0xd4>
mov    -0x20(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdx
lea    0x2eed(%rip),%rdi
lea    0xec6(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2eda(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ef <data_type+0xdf>
mov    -0x10(%rbp),%rdx
lea    0x2ec6(%rip),%rdi
lea    0xea4(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2eb3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ef <data_type+0xdf>
mov    -0x10(%rbp),%rdx
lea    0x2e9f(%rip),%rdi
lea    0xe83(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2e8c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ef <data_type+0xdf>
mov    -0x10(%rbp),%rdx
lea    0x2e78(%rip),%rdi
lea    0xe62(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2e65(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ef <data_type+0xdf>
lea    0xe4c(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<data_type>:
push   %rbx
add    $0xffffffff,%esi
lea    0xefc(%rip),%rbx
cmp    $0x7,%esi
ja     114d <data_type+0x3d>
mov    $0x8b,%eax
bt     %esi,%eax
jae    114d <data_type+0x3d>
mov    %rdi,%rdx
movslq %esi,%rax
lea    0xeed(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    0x2efb(%rip),%rbx
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@data_type.buf = internal global [64 x i8] zeroinitializer
@.str = [5 x i8] c"%s_8\00"
@.str.1 = [6 x i8] c"%s_16\00"
@.str.2 = [6 x i8] c"%s_32\00"
@.str.3 = [6 x i8] c"%s_64\00"
@.str.4 = [10 x i8] c"I_GIVE_UP\00"
define i8* @data_type(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
switch i32 %6, label %19 [
i32 1, label %7
i32 2, label %10
i32 4, label %13
i32 8, label %16
]
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = call i32 @sprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @data_type.buf, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %8)
store i8* getelementptr inbounds ([64 x i8], [64 x i8]* @data_type.buf, i64 0, i64 0), i8** %3
br label %20
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = call i32 @sprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @data_type.buf, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %11)
store i8* getelementptr inbounds ([64 x i8], [64 x i8]* @data_type.buf, i64 0, i64 0), i8** %3
br label %20
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = call i32 @sprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @data_type.buf, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %14)
store i8* getelementptr inbounds ([64 x i8], [64 x i8]* @data_type.buf, i64 0, i64 0), i8** %3
br label %20
16: ; preds = %2
%17 = load i8*, i8** %4
%18 = call i32 @sprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @data_type.buf, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %17)
store i8* getelementptr inbounds ([64 x i8], [64 x i8]* @data_type.buf, i64 0, i64 0), i8** %3
br label %20
19: ; preds = %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8** %3
br label %20
20: ; preds = %19, %16, %13, %10, %7
%21 = load i8*, i8** %3
ret i8* %21
}

LLVM IR (-O2):
@data_type.buf = internal global [64 x i8] zeroinitializer
@.str = [5 x i8] c"%s_8\00"
@.str.1 = [6 x i8] c"%s_16\00"
@.str.2 = [6 x i8] c"%s_32\00"
@.str.3 = [6 x i8] c"%s_64\00"
@.str.4 = [10 x i8] c"I_GIVE_UP\00"
@reltable.data_type = [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.data_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.1 to i64), i64 ptrtoint ([8 x i32]* @reltable.data_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.data_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.2 to i64), i64 ptrtoint ([8 x i32]* @reltable.data_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.data_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.data_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.data_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.3 to i64), i64 ptrtoint ([8 x i32]* @reltable.data_type to i64)) to i32)]
define i8* @data_type(i8* %0, i32 %1) {
%3 = add i32 %1, -1
%4 = icmp ult i32 %3, 8
br i1 %4, label %5, label %15
5: ; preds = %2
%6 = trunc i32 %3 to i8
%7 = lshr i8 -117, %6
%8 = and i8 %7, 1
%9 = icmp eq i8 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %5
%11 = sext i32 %3 to i64
%12 = shl i64 %11, 2
%13 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.data_type to i8*), i64 %12)
%14 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @data_type.buf, i64 0, i64 0), i8* dereferenceable(1) %13, i8* %0)
br label %15
15: ; preds = %5, %2, %10
%16 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), %2 ], [ getelementptr inbounds ([64 x i8], [64 x i8]* @data_type.buf, i64 0, i64 0), %10 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), %5 ]
ret i8* %16
}