#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 LOG_ALERT;
int LOG_CRIT;
int LOG_DEBUG;
int LOG_EMERG;
int LOG_ERR;
int LOG_INFO;
int LOG_NOTICE;
int LOG_WARNING;
const char *snoopy_syslog_convert_levelToStr(int levelInt) {
  char *levelStr;
  if (LOG_EMERG == levelInt) {
    levelStr = "EMERG";
  } else if (LOG_ALERT == levelInt) {
    levelStr = "ALERT";
  } else if (LOG_CRIT == levelInt) {
    levelStr = "CRIT";
  } else if (LOG_ERR == levelInt) {
    levelStr = "ERR";
  } else if (LOG_WARNING == levelInt) {
    levelStr = "WARNING";
  } else if (LOG_NOTICE == levelInt) {
    levelStr = "NOTICE";
  } else if (LOG_INFO == levelInt) {
    levelStr = "INFO";
  } else if (LOG_DEBUG == levelInt) {
    levelStr = "DEBUG";
  } else {
    levelStr = "(invalid)";
  }
  return levelStr;
}


x86 assembly (clang, -O0):
<snoopy_syslog_convert_levelToStr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2eca(%rip),%rax
mov    (%rax),%eax
cmp    -0x4(%rbp),%eax
jne    1129 <snoopy_syslog_convert_levelToStr+0x29>
lea    0xee0(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1245 <snoopy_syslog_convert_levelToStr+0x145>
mov    0x2eb8(%rip),%rax
mov    (%rax),%eax
cmp    -0x4(%rbp),%eax
jne    114b <snoopy_syslog_convert_levelToStr+0x4b>
lea    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1240 <snoopy_syslog_convert_levelToStr+0x140>
mov    0x2e8e(%rip),%rax
mov    (%rax),%eax
cmp    -0x4(%rbp),%eax
jne    116d <snoopy_syslog_convert_levelToStr+0x6d>
lea    0xea8(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    123b <snoopy_syslog_convert_levelToStr+0x13b>
mov    0x2e2c(%rip),%rax
mov    (%rax),%eax
cmp    -0x4(%rbp),%eax
jne    118f <snoopy_syslog_convert_levelToStr+0x8f>
lea    0xe8b(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1236 <snoopy_syslog_convert_levelToStr+0x136>
mov    0x2e3a(%rip),%rax
mov    (%rax),%eax
cmp    -0x4(%rbp),%eax
jne    11b1 <snoopy_syslog_convert_levelToStr+0xb1>
lea    0xe6d(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1231 <snoopy_syslog_convert_levelToStr+0x131>
mov    0x2e08(%rip),%rax
mov    (%rax),%eax
cmp    -0x4(%rbp),%eax
jne    11d3 <snoopy_syslog_convert_levelToStr+0xd3>
lea    0xe53(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    122c <snoopy_syslog_convert_levelToStr+0x12c>
mov    0x2dd6(%rip),%rax
mov    (%rax),%eax
cmp    -0x4(%rbp),%eax
jne    11f5 <snoopy_syslog_convert_levelToStr+0xf5>
lea    0xe38(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1227 <snoopy_syslog_convert_levelToStr+0x127>
mov    0x2dbc(%rip),%rax
mov    (%rax),%eax
cmp    -0x4(%rbp),%eax
jne    1217 <snoopy_syslog_convert_levelToStr+0x117>
lea    0xe1b(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1222 <snoopy_syslog_convert_levelToStr+0x122>
lea    0xe11(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1227 <snoopy_syslog_convert_levelToStr+0x127>
jmp    122c <snoopy_syslog_convert_levelToStr+0x12c>
jmp    1231 <snoopy_syslog_convert_levelToStr+0x131>
jmp    1236 <snoopy_syslog_convert_levelToStr+0x136>
jmp    123b <snoopy_syslog_convert_levelToStr+0x13b>
jmp    1240 <snoopy_syslog_convert_levelToStr+0x140>
jmp    1245 <snoopy_syslog_convert_levelToStr+0x145>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<snoopy_syslog_convert_levelToStr>:
mov    0x2ed1(%rip),%rax
cmp    %edi,(%rax)
jne    1113 <snoopy_syslog_convert_levelToStr+0x13>
lea    0xeee(%rip),%rax
ret
mov    0x2ece(%rip),%rax
cmp    %edi,(%rax)
jne    1126 <snoopy_syslog_convert_levelToStr+0x26>
lea    0xee1(%rip),%rax
ret
mov    0x2eb3(%rip),%rax
cmp    %edi,(%rax)
jne    1139 <snoopy_syslog_convert_levelToStr+0x39>
lea    0xed4(%rip),%rax
ret
mov    0x2e60(%rip),%rax
cmp    %edi,(%rax)
jne    114c <snoopy_syslog_convert_levelToStr+0x4c>
lea    0xec6(%rip),%rax
ret
mov    0x2e7d(%rip),%rax
cmp    %edi,(%rax)
jne    115f <snoopy_syslog_convert_levelToStr+0x5f>
lea    0xeb7(%rip),%rax
ret
mov    0x2e5a(%rip),%rax
cmp    %edi,(%rax)
jne    1172 <snoopy_syslog_convert_levelToStr+0x72>
lea    0xeac(%rip),%rax
ret
mov    0x2e37(%rip),%rax
cmp    %edi,(%rax)
jne    1185 <snoopy_syslog_convert_levelToStr+0x85>
lea    0xea0(%rip),%rax
ret
mov    0x2e2c(%rip),%rax
cmp    %edi,(%rax)
lea    0xe94(%rip),%rcx
lea    0xe93(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@LOG_EMERG = global i32 0
@.str = [6 x i8] c"EMERG\00"
@LOG_ALERT = global i32 0
@.str.1 = [6 x i8] c"ALERT\00"
@LOG_CRIT = global i32 0
@.str.2 = [5 x i8] c"CRIT\00"
@LOG_ERR = global i32 0
@.str.3 = [4 x i8] c"ERR\00"
@LOG_WARNING = global i32 0
@.str.4 = [8 x i8] c"WARNING\00"
@LOG_NOTICE = global i32 0
@.str.5 = [7 x i8] c"NOTICE\00"
@LOG_INFO = global i32 0
@.str.6 = [5 x i8] c"INFO\00"
@LOG_DEBUG = global i32 0
@.str.7 = [6 x i8] c"DEBUG\00"
@.str.8 = [10 x i8] c"(invalid)\00"
define i8* @snoopy_syslog_convert_levelToStr(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* @LOG_EMERG
%5 = load i32, i32* %2
%6 = icmp eq i32 %4, %5
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %3
br label %51
8: ; preds = %1
%9 = load i32, i32* @LOG_ALERT
%10 = load i32, i32* %2
%11 = icmp eq i32 %9, %10
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** %3
br label %50
13: ; preds = %8
%14 = load i32, i32* @LOG_CRIT
%15 = load i32, i32* %2
%16 = icmp eq i32 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %13
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %49
18: ; preds = %13
%19 = load i32, i32* @LOG_ERR
%20 = load i32, i32* %2
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %48
23: ; preds = %18
%24 = load i32, i32* @LOG_WARNING
%25 = load i32, i32* %2
%26 = icmp eq i32 %24, %25
br i1 %26, label %27, label %28
27: ; preds = %23
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %3
br label %47
28: ; preds = %23
%29 = load i32, i32* @LOG_NOTICE
%30 = load i32, i32* %2
%31 = icmp eq i32 %29, %30
br i1 %31, label %32, label %33
32: ; preds = %28
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8** %3
br label %46
33: ; preds = %28
%34 = load i32, i32* @LOG_INFO
%35 = load i32, i32* %2
%36 = icmp eq i32 %34, %35
br i1 %36, label %37, label %38
37: ; preds = %33
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8** %3
br label %45
38: ; preds = %33
%39 = load i32, i32* @LOG_DEBUG
%40 = load i32, i32* %2
%41 = icmp eq i32 %39, %40
br i1 %41, label %42, label %43
42: ; preds = %38
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8** %3
br label %44
43: ; preds = %38
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8** %3
br label %44
44: ; preds = %43, %42
br label %45
45: ; preds = %44, %37
br label %46
46: ; preds = %45, %32
br label %47
47: ; preds = %46, %27
br label %48
48: ; preds = %47, %22
br label %49
49: ; preds = %48, %17
br label %50
50: ; preds = %49, %12
br label %51
51: ; preds = %50, %7
%52 = load i8*, i8** %3
ret i8* %52
}

LLVM IR (-O2):
@LOG_EMERG = global i32 0
@.str = [6 x i8] c"EMERG\00"
@LOG_ALERT = global i32 0
@.str.1 = [6 x i8] c"ALERT\00"
@LOG_CRIT = global i32 0
@.str.2 = [5 x i8] c"CRIT\00"
@LOG_ERR = global i32 0
@.str.3 = [4 x i8] c"ERR\00"
@LOG_WARNING = global i32 0
@.str.4 = [8 x i8] c"WARNING\00"
@LOG_NOTICE = global i32 0
@.str.5 = [7 x i8] c"NOTICE\00"
@LOG_INFO = global i32 0
@.str.6 = [5 x i8] c"INFO\00"
@LOG_DEBUG = global i32 0
@.str.7 = [6 x i8] c"DEBUG\00"
@.str.8 = [10 x i8] c"(invalid)\00"
define i8* @snoopy_syslog_convert_levelToStr(i32 %0) {
%2 = load i32, i32* @LOG_EMERG
%3 = icmp eq i32 %2, %0
br i1 %3, label %26, label %4
4: ; preds = %1
%5 = load i32, i32* @LOG_ALERT
%6 = icmp eq i32 %5, %0
br i1 %6, label %26, label %7
7: ; preds = %4
%8 = load i32, i32* @LOG_CRIT
%9 = icmp eq i32 %8, %0
br i1 %9, label %26, label %10
10: ; preds = %7
%11 = load i32, i32* @LOG_ERR
%12 = icmp eq i32 %11, %0
br i1 %12, label %26, label %13
13: ; preds = %10
%14 = load i32, i32* @LOG_WARNING
%15 = icmp eq i32 %14, %0
br i1 %15, label %26, label %16
16: ; preds = %13
%17 = load i32, i32* @LOG_NOTICE
%18 = icmp eq i32 %17, %0
br i1 %18, label %26, label %19
19: ; preds = %16
%20 = load i32, i32* @LOG_INFO
%21 = icmp eq i32 %20, %0
br i1 %21, label %26, label %22
22: ; preds = %19
%23 = load i32, i32* @LOG_DEBUG
%24 = icmp eq i32 %23, %0
%25 = select i1 %24, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0)
br label %26
26: ; preds = %22, %19, %16, %13, %10, %7, %4, %1
%27 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), %10 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %13 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), %16 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), %19 ], [ %25, %22 ]
ret i8* %27
}