#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 *, int);
void find_size(int size) {
  int found = 0;
  if (size == sizeof(int)) {
    printf("%d bytes is a int\n", size);
    found = 1;
  }
  if (size == sizeof(short)) {
    printf("%d bytes is a short\n", size);
    found = 1;
  }
  if (size == sizeof(char)) {
    printf("%d bytes is a char\n", size);
    found = 1;
  }
  if (size == sizeof(long)) {
    printf("%d bytes is a long\n", size);
    found = 1;
  }
  if (size == sizeof(long long)) {
    printf("%d bytes is a long long\n", size);
    found = 1;
  }
  if (size == sizeof(double)) {
    printf("%d bytes is a double\n", size);
    found = 1;
  }
}


x86 assembly (clang, -O0):
<find_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0x4,%rax
jne    1146 <find_size+0x36>
mov    -0x4(%rbp),%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0x2,%rax
jne    116a <find_size+0x5a>
mov    -0x4(%rbp),%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0x1,%rax
jne    118e <find_size+0x7e>
mov    -0x4(%rbp),%esi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0x8,%rax
jne    11b2 <find_size+0xa2>
mov    -0x4(%rbp),%esi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0x8,%rax
jne    11d6 <find_size+0xc6>
mov    -0x4(%rbp),%esi
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0x8,%rax
jne    11fa <find_size+0xea>
mov    -0x4(%rbp),%esi
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_size>:
push   %rax
add    $0xffffffff,%edi
cmp    $0x7,%edi
ja     114d <find_size+0x3d>
lea    0xee0(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xf18(%rip),%rdi
mov    $0x1,%esi
pop    %rax
jmp    1030 <printf@plt>
lea    0xef1(%rip),%rdi
mov    $0x2,%esi
pop    %rax
jmp    1030 <printf@plt>
pop    %rax
ret
lea    0xeca(%rip),%rdi
mov    $0x4,%esi
pop    %rax
jmp    1030 <printf@plt>
lea    0xef4(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
mov    $0x8,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"%d bytes is a int\0A\00"
@.str.1 = [21 x i8] c"%d bytes is a short\0A\00"
@.str.2 = [20 x i8] c"%d bytes is a char\0A\00"
@.str.3 = [20 x i8] c"%d bytes is a long\0A\00"
@.str.4 = [25 x i8] c"%d bytes is a long long\0A\00"
@.str.5 = [22 x i8] c"%d bytes is a double\0A\00"
define void @find_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = icmp eq i64 %5, 4
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %8)
store i32 1, i32* %3
br label %10
10: ; preds = %7, %1
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = icmp eq i64 %12, 2
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* %2
%16 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %15)
store i32 1, i32* %3
br label %17
17: ; preds = %14, %10
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = icmp eq i64 %19, 1
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* %2
%23 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %22)
store i32 1, i32* %3
br label %24
24: ; preds = %21, %17
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = icmp eq i64 %26, 8
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i32, i32* %2
%30 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %29)
store i32 1, i32* %3
br label %31
31: ; preds = %28, %24
%32 = load i32, i32* %2
%33 = sext i32 %32 to i64
%34 = icmp eq i64 %33, 8
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = load i32, i32* %2
%37 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %36)
store i32 1, i32* %3
br label %38
38: ; preds = %35, %31
%39 = load i32, i32* %2
%40 = sext i32 %39 to i64
%41 = icmp eq i64 %40, 8
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = load i32, i32* %2
%44 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %43)
store i32 1, i32* %3
br label %45
45: ; preds = %42, %38
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"%d bytes is a int\0A\00"
@.str.1 = [21 x i8] c"%d bytes is a short\0A\00"
@.str.2 = [20 x i8] c"%d bytes is a char\0A\00"
@.str.3 = [20 x i8] c"%d bytes is a long\0A\00"
@.str.4 = [25 x i8] c"%d bytes is a long long\0A\00"
@.str.5 = [22 x i8] c"%d bytes is a double\0A\00"
define void @find_size(i32 %0) {
switch i32 %0, label %12 [
i32 4, label %2
i32 2, label %4
i32 1, label %6
i32 8, label %8
]
2: ; preds = %1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 4)
br label %12
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 2)
br label %12
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 1)
br label %12
8: ; preds = %1
%9 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 8)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 8)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 8)
br label %12
12: ; preds = %6, %2, %4, %1, %8
ret void
}