#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 *);
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
int get_width(char *buf) {
  int size = 0;
  if (!strcmp(buf, "void")) {
    size = 0;
  } else if (!strcmp(buf, "i1")) {
    size = 1;
  } else if (!strcmp(buf, "i8")) {
    size = 8;
  } else if (!strcmp(buf, "i16")) {
    size = 16;
  } else if (!strcmp(buf, "i32")) {
    size = 32;
  } else if (buf[strlen(buf) - 1] == '*') {
    size = 32;
  } else {
    size = 32;
    printf("[WRANING] get_width(): %s\n", buf);
  }
  return size;
}


x86 assembly (clang, -O0):
<get_width>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1168 <get_width+0x38>
movl   $0x0,-0xc(%rbp)
jmp    1262 <get_width+0x132>
mov    -0x8(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    118d <get_width+0x5d>
movl   $0x1,-0xc(%rbp)
jmp    125d <get_width+0x12d>
mov    -0x8(%rbp),%rdi
lea    0xe70(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11b2 <get_width+0x82>
movl   $0x8,-0xc(%rbp)
jmp    1258 <get_width+0x128>
mov    -0x8(%rbp),%rdi
lea    0xe4e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11d7 <get_width+0xa7>
movl   $0x10,-0xc(%rbp)
jmp    1253 <get_width+0x123>
mov    -0x8(%rbp),%rdi
lea    0xe2d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11fc <get_width+0xcc>
movl   $0x20,-0xc(%rbp)
jmp    124e <get_width+0x11e>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2a,%eax
jne    1232 <get_width+0x102>
movl   $0x20,-0xc(%rbp)
jmp    1249 <get_width+0x119>
movl   $0x20,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xdcf(%rip),%rdi
call   1040 <printf@plt>
jmp    124e <get_width+0x11e>
jmp    1253 <get_width+0x123>
jmp    1258 <get_width+0x128>
jmp    125d <get_width+0x12d>
jmp    1262 <get_width+0x132>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_width>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xec3(%rip),%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11b9 <get_width+0x89>
lea    0xeb8(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11bd <get_width+0x8d>
lea    0xea8(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11c4 <get_width+0x94>
lea    0xe98(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11cb <get_width+0x9b>
lea    0xe89(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
mov    $0x20,%ebp
test   %eax,%eax
je     11d0 <get_width+0xa0>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0x2a,-0x1(%rax,%rbx,1)
je     11d0 <get_width+0xa0>
lea    0xe64(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
jmp    11d0 <get_width+0xa0>
xor    %ebp,%ebp
jmp    11d0 <get_width+0xa0>
mov    $0x1,%ebp
jmp    11d0 <get_width+0xa0>
mov    $0x8,%ebp
jmp    11d0 <get_width+0xa0>
mov    $0x10,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"void\00"
@.str.1 = [3 x i8] c"i1\00"
@.str.2 = [3 x i8] c"i8\00"
@.str.3 = [4 x i8] c"i16\00"
@.str.4 = [4 x i8] c"i32\00"
@.str.5 = [27 x i8] c"[WRANING] get_width(): %s\0A\00"
define i32 @get_width(i8* %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %25, label %4
4: ; preds = %1
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %25, label %7
7: ; preds = %4
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %25, label %10
10: ; preds = %7
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %25, label %13
13: ; preds = %10
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %25, label %16
16: ; preds = %13
%17 = tail call i32 @strlen(i8* %0)
%18 = add nsw i32 %17, -1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %0, i64 %19
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 42
br i1 %22, label %25, label %23
23: ; preds = %16
%24 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8* %0)
br label %25
25: ; preds = %16, %13, %10, %7, %4, %1, %23
%26 = phi i32 [ 32, %23 ], [ 0, %1 ], [ 1, %4 ], [ 8, %7 ], [ 16, %10 ], [ 32, %13 ], [ 32, %16 ]
ret i32 %26
}