#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_DEBUG;
int LOG_INFO;
int LOG_NOTICE;
int LOG_WARNING;
const char *nm_utils_syslog_to_str(int syslog_level) {
  if (syslog_level >= LOG_DEBUG)
    return "<trace>";
  if (syslog_level >= LOG_INFO)
    return "<debug>";
  if (syslog_level >= LOG_NOTICE)
    return "<info>";
  if (syslog_level >= LOG_WARNING)
    return "<warn>";
  return "<error>";
}


x86 assembly (clang, -O0):
<nm_utils_syslog_to_str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2ebf(%rip),%rcx
cmp    (%rcx),%eax
jl     1129 <nm_utils_syslog_to_str+0x29>
lea    0xee0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119a <nm_utils_syslog_to_str+0x9a>
mov    -0xc(%rbp),%eax
mov    0x2e95(%rip),%rcx
cmp    (%rcx),%eax
jl     114b <nm_utils_syslog_to_str+0x4b>
lea    0xec6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119a <nm_utils_syslog_to_str+0x9a>
mov    -0xc(%rbp),%eax
mov    0x2e83(%rip),%rcx
cmp    (%rcx),%eax
jl     116d <nm_utils_syslog_to_str+0x6d>
lea    0xeac(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119a <nm_utils_syslog_to_str+0x9a>
mov    -0xc(%rbp),%eax
mov    0x2e71(%rip),%rcx
cmp    (%rcx),%eax
jl     118f <nm_utils_syslog_to_str+0x8f>
lea    0xe91(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119a <nm_utils_syslog_to_str+0x9a>
lea    0xe88(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nm_utils_syslog_to_str>:
mov    0x2ec9(%rip),%rax
cmp    %edi,(%rax)
jle    113d <nm_utils_syslog_to_str+0x3d>
mov    0x2eb6(%rip),%rax
cmp    %edi,(%rax)
jle    1145 <nm_utils_syslog_to_str+0x45>
mov    0x2ebb(%rip),%rax
cmp    %edi,(%rax)
jle    114d <nm_utils_syslog_to_str+0x4d>
mov    0x2ec0(%rip),%rax
cmp    %edi,(%rax)
lea    0xeed(%rip),%rcx
lea    0xedf(%rip),%rax
cmovg  %rcx,%rax
ret
lea    0xebc(%rip),%rax
ret
lea    0xebc(%rip),%rax
ret
lea    0xebc(%rip),%rax
ret

LLVM IR (-O0):
@LOG_DEBUG = global i32 0
@.str = [8 x i8] c"<trace>\00"
@LOG_INFO = global i32 0
@.str.1 = [8 x i8] c"<debug>\00"
@LOG_NOTICE = global i32 0
@.str.2 = [7 x i8] c"<info>\00"
@LOG_WARNING = global i32 0
@.str.3 = [7 x i8] c"<warn>\00"
@.str.4 = [8 x i8] c"<error>\00"
define i8* @nm_utils_syslog_to_str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* @LOG_DEBUG
%6 = icmp sge i32 %4, %5
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
br label %24
8: ; preds = %1
%9 = load i32, i32* %3
%10 = load i32, i32* @LOG_INFO
%11 = icmp sge i32 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %8
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %24
13: ; preds = %8
%14 = load i32, i32* %3
%15 = load i32, i32* @LOG_NOTICE
%16 = icmp sge i32 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %13
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %24
18: ; preds = %13
%19 = load i32, i32* %3
%20 = load i32, i32* @LOG_WARNING
%21 = icmp sge i32 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %24
23: ; preds = %18
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %24
24: ; preds = %23, %22, %17, %12, %7
%25 = load i8*, i8** %2
ret i8* %25
}

LLVM IR (-O2):
@LOG_DEBUG = global i32 0
@.str = [8 x i8] c"<trace>\00"
@LOG_INFO = global i32 0
@.str.1 = [8 x i8] c"<debug>\00"
@LOG_NOTICE = global i32 0
@.str.2 = [7 x i8] c"<info>\00"
@LOG_WARNING = global i32 0
@.str.3 = [7 x i8] c"<warn>\00"
@.str.4 = [8 x i8] c"<error>\00"
define i8* @nm_utils_syslog_to_str(i32 %0) {
%2 = load i32, i32* @LOG_DEBUG
%3 = icmp sgt i32 %2, %0
br i1 %3, label %4, label %14
4: ; preds = %1
%5 = load i32, i32* @LOG_INFO
%6 = icmp sgt i32 %5, %0
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* @LOG_NOTICE
%9 = icmp sgt i32 %8, %0
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = load i32, i32* @LOG_WARNING
%12 = icmp sgt i32 %11, %0
%13 = select i1 %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
br label %14
14: ; preds = %10, %7, %4, %1
%15 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), %7 ], [ %13, %10 ]
ret i8* %15
}