#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*/ covertToUpper(char *);
scalar_t__ strcmp(char *, int /*<<< orphan*/);
int getIntLevel(char *strLevel) {
  if (strLevel == NULL) {
    return 1;
  }
  if (strcmp("DEBUG", covertToUpper(strLevel)) == 0) {
    return 0;
  } else if (strcmp("WARN", covertToUpper(strLevel)) == 0) {
    return 2;
  } else if (strcmp("ERROR", covertToUpper(strLevel)) == 0) {
    return 3;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<getIntLevel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <getIntLevel+0x23>
movl   $0x1,-0x4(%rbp)
jmp    11d1 <getIntLevel+0xb1>
mov    -0x10(%rbp),%rdi
call   1030 <covertToUpper@plt>
mov    %eax,%esi
lea    0xeab(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1170 <getIntLevel+0x50>
movl   $0x0,-0x4(%rbp)
jmp    11d1 <getIntLevel+0xb1>
mov    -0x10(%rbp),%rdi
call   1030 <covertToUpper@plt>
mov    %eax,%esi
lea    0xe84(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    119d <getIntLevel+0x7d>
movl   $0x2,-0x4(%rbp)
jmp    11d1 <getIntLevel+0xb1>
mov    -0x10(%rbp),%rdi
call   1030 <covertToUpper@plt>
mov    %eax,%esi
lea    0xe5c(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ca <getIntLevel+0xaa>
movl   $0x3,-0x4(%rbp)
jmp    11d1 <getIntLevel+0xb1>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getIntLevel>:
push   %rbx
test   %rdi,%rdi
je     1182 <getIntLevel+0x62>
mov    %rdi,%rbx
call   1030 <covertToUpper@plt>
lea    0xecb(%rip),%rdi
mov    %eax,%esi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1189 <getIntLevel+0x69>
mov    %rbx,%rdi
call   1030 <covertToUpper@plt>
lea    0xeb6(%rip),%rdi
mov    %eax,%esi
call   1040 <strcmp@plt>
test   %rax,%rax
je     118d <getIntLevel+0x6d>
mov    %rbx,%rdi
call   1030 <covertToUpper@plt>
lea    0xea0(%rip),%rdi
mov    %eax,%esi
call   1040 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
lea    (%rcx,%rcx,1),%eax
add    $0x1,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
mov    $0x2,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"DEBUG\00"
@.str.1 = [5 x i8] c"WARN\00"
@.str.2 = [6 x i8] c"ERROR\00"
define i32 @getIntLevel(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %26
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @covertToUpper(i8* %8)
%10 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %7
store i32 0, i32* %2
br label %26
13: ; preds = %7
%14 = load i8*, i8** %3
%15 = call i32 @covertToUpper(i8* %14)
%16 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %13
store i32 2, i32* %2
br label %26
19: ; preds = %13
%20 = load i8*, i8** %3
%21 = call i32 @covertToUpper(i8* %20)
%22 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %19
store i32 3, i32* %2
br label %26
25: ; preds = %19
store i32 1, i32* %2
br label %26
26: ; preds = %25, %24, %18, %12, %6
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
@.str = [6 x i8] c"DEBUG\00"
@.str.1 = [5 x i8] c"WARN\00"
@.str.2 = [6 x i8] c"ERROR\00"
define i32 @getIntLevel(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = tail call i32 @covertToUpper(i8* %0)
%5 = tail call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %3
%8 = tail call i32 @covertToUpper(i8* %0)
%9 = tail call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %7
%12 = tail call i32 @covertToUpper(i8* %0)
%13 = tail call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = icmp eq i64 %13, 0
%15 = select i1 %14, i32 3, i32 1
br label %16
16: ; preds = %11, %7, %3, %1
%17 = phi i32 [ 1, %1 ], [ 0, %3 ], [ 2, %7 ], [ %15, %11 ]
ret i32 %17
}