#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 */
scalar_t__ strcmp(char *, char *);
unsigned char getcode(char *path) {
  unsigned char code = 255;
  if (strcmp("ERROR", path) == 0) {
    code = 1;
  } else if (strcmp("INF", path) == 0) {
    code = 2;
  } else if (strcmp("DEBUG", path) == 0) {
    code = 4;
  } else if (strcmp("NONE", path) == 0) {
    code = 0;
  }
  return code;
}


x86 assembly (clang, -O0):
<getcode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0xff,-0x9(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed5(%rip),%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1143 <getcode+0x33>
movb   $0x1,-0x9(%rbp)
jmp    11b6 <getcode+0xa6>
mov    -0x8(%rbp),%rsi
lea    0xeb8(%rip),%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1166 <getcode+0x56>
movb   $0x2,-0x9(%rbp)
jmp    11b1 <getcode+0xa1>
mov    -0x8(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1189 <getcode+0x79>
movb   $0x4,-0x9(%rbp)
jmp    11ac <getcode+0x9c>
mov    -0x8(%rbp),%rsi
lea    0xe7c(%rip),%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11a7 <getcode+0x97>
movb   $0x0,-0x9(%rbp)
jmp    11ac <getcode+0x9c>
jmp    11b1 <getcode+0xa1>
jmp    11b6 <getcode+0xa6>
movzbl -0x9(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getcode>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1166 <getcode+0x56>
lea    0xed7(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     116a <getcode+0x5a>
lea    0xec7(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     116e <getcode+0x5e>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
neg    %rax
sbb    %eax,%eax
pop    %rbx
ret
mov    $0x1,%al
pop    %rbx
ret
mov    $0x2,%al
pop    %rbx
ret
mov    $0x4,%al
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"ERROR\00"
@.str.1 = [4 x i8] c"INF\00"
@.str.2 = [6 x i8] c"DEBUG\00"
@.str.3 = [5 x i8] c"NONE\00"
define zeroext i8 @getcode(i8* %0) {
%2 = tail call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = tail call i64 @strcmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = tail call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = tail call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%12 = icmp ne i64 %11, 0
%13 = sext i1 %12 to i8
br label %14
14: ; preds = %10, %7, %4, %1
%15 = phi i8 [ 1, %1 ], [ 2, %4 ], [ 4, %7 ], [ %13, %10 ]
ret i8 %15
}