#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*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
char *findtype(int size) {
  if (size == 8 * sizeof(char)) {
    return "char";
  } else if (size == 8 * sizeof(short)) {
    return "short";
  } else if (size == 8 * sizeof(int)) {
    return "int";
  } else if (size == 8 * sizeof(long long)) {
    return "long long";
  } else if (size == 8 * sizeof(long)) {
    return "long";
  } else {
    fprintf(stderr, "*** this machine has no type matching %d bits!\n", size);
    abort();
    return 0;
  }
}


x86 assembly (clang, -O0):
<findtype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmp    $0x8,%rax
jne    1149 <findtype+0x29>
lea    0xec0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <findtype+0xc0>
movslq -0xc(%rbp),%rax
cmp    $0x10,%rax
jne    1167 <findtype+0x47>
lea    0xea7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <findtype+0xc0>
movslq -0xc(%rbp),%rax
cmp    $0x20,%rax
jne    1185 <findtype+0x65>
lea    0xe8f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <findtype+0xc0>
movslq -0xc(%rbp),%rax
cmp    $0x40,%rax
jne    11a3 <findtype+0x83>
lea    0xe75(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <findtype+0xc0>
movslq -0xc(%rbp),%rax
cmp    $0x40,%rax
jne    11c1 <findtype+0xa1>
lea    0xe5c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e0 <findtype+0xc0>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
lea    0xe45(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findtype>:
push   %rax
mov    %edi,%edx
lea    -0x8(%rdx),%eax
rol    $0x1d,%eax
cmp    $0x8,%eax
jae    114a <findtype+0x2a>
mov    $0x8b,%ecx
bt     %eax,%ecx
jae    114a <findtype+0x2a>
cltq
lea    0xf0b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
pop    %rcx
ret
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
lea    0xebf(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"char\00"
@.str.1 = [6 x i8] c"short\00"
@.str.2 = [4 x i8] c"int\00"
@.str.3 = [10 x i8] c"long long\00"
@.str.4 = [5 x i8] c"long\00"
@stderr = global i32 0
@.str.5 = [48 x i8] c"*** this machine has no type matching %d bits!\0A\00"
define i8* @findtype(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = sext i32 %4 to i64
%6 = icmp eq i64 %5, 8
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %33
8: ; preds = %1
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = icmp eq i64 %10, 16
br i1 %11, label %12, label %13
12: ; preds = %8
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %33
13: ; preds = %8
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = icmp eq i64 %15, 32
br i1 %16, label %17, label %18
17: ; preds = %13
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %33
18: ; preds = %13
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = icmp eq i64 %20, 64
br i1 %21, label %22, label %23
22: ; preds = %18
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %33
23: ; preds = %18
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = icmp eq i64 %25, 64
br i1 %26, label %27, label %28
27: ; preds = %23
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %33
28: ; preds = %23
%29 = load i32, i32* @stderr
%30 = load i32, i32* %3
%31 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i32 %30)
%32 = call i32 (...) @abort()
unreachable
33: ; preds = %27, %22, %17, %12, %7
%34 = load i8*, i8** %2
ret i8* %34
}

LLVM IR (-O2):
@.str = [5 x i8] c"char\00"
@.str.1 = [6 x i8] c"short\00"
@.str.2 = [4 x i8] c"int\00"
@.str.3 = [10 x i8] c"long long\00"
@stderr = global i32 0
@.str.5 = [48 x i8] c"*** this machine has no type matching %d bits!\0A\00"
@reltable.findtype = [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.findtype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.1 to i64), i64 ptrtoint ([8 x i32]* @reltable.findtype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.findtype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([8 x i32]* @reltable.findtype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.findtype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.findtype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.findtype to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.3 to i64), i64 ptrtoint ([8 x i32]* @reltable.findtype to i64)) to i32)]
define i8* @findtype(i32 %0) {
%2 = add i32 %0, -8
%3 = tail call i32 @llvm.fshl.i32(i32 %2, i32 %2, i32 29)
%4 = icmp ult i32 %3, 8
br i1 %4, label %9, label %5
5: ; preds = %9, %1
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i32 %0)
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %1
%10 = trunc i32 %3 to i8
%11 = lshr i8 -117, %10
%12 = and i8 %11, 1
%13 = icmp eq i8 %12, 0
br i1 %13, label %5, label %14
14: ; preds = %9
%15 = sext i32 %3 to i64
%16 = shl i64 %15, 2
%17 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.findtype to i8*), i64 %16)
ret i8* %17
}