#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_DEBUG;
int LOG_ERR;
int LOG_INFO;
int LOG_WARNING;
int syslogLevel(int lev) {
  switch (lev) {
  case (0):
    return LOG_INFO;
  case (7):
  case (21):
    return LOG_DEBUG;
  case (23):
    return LOG_WARNING;
  case (24):
    return LOG_ERR;
  case (25):
    return LOG_ALERT;
  }
  return lev >= (1) && lev <= (25) ? LOG_INFO : 0;
}


x86 assembly (clang, -O0):
<syslogLevel>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x19,%rax
ja     1181 <syslogLevel+0x81>
mov    -0x10(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11b6 <syslogLevel+0xb6>
mov    0x2e8c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11b6 <syslogLevel+0xb6>
mov    0x2e8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11b6 <syslogLevel+0xb6>
mov    0x2e52(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11b6 <syslogLevel+0xb6>
mov    0x2e71(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11b6 <syslogLevel+0xb6>
cmpl   $0x1,-0x8(%rbp)
jl     11a6 <syslogLevel+0xa6>
cmpl   $0x19,-0x8(%rbp)
jg     11a6 <syslogLevel+0xa6>
mov    0x2e2c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
jmp    11b0 <syslogLevel+0xb0>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    11b0 <syslogLevel+0xb0>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<syslogLevel>:
cmp    $0x19,%edi
ja     1120 <syslogLevel+0x20>
mov    %edi,%eax
lea    0xef2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2eb2(%rip),%rax
jmp    114c <syslogLevel+0x4c>
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0x19,%edi
jae    114e <syslogLevel+0x4e>
mov    0x2e97(%rip),%rax
jmp    114c <syslogLevel+0x4c>
mov    0x2ea6(%rip),%rax
jmp    114c <syslogLevel+0x4c>
mov    0x2e75(%rip),%rax
jmp    114c <syslogLevel+0x4c>
mov    0x2e9c(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@LOG_INFO = global i32 0
@LOG_DEBUG = global i32 0
@LOG_WARNING = global i32 0
@LOG_ERR = global i32 0
@LOG_ALERT = global i32 0
define i32 @syslogLevel(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %15 [
i32 0, label %5
i32 7, label %7
i32 21, label %7
i32 23, label %9
i32 24, label %11
i32 25, label %13
]
5: ; preds = %1
%6 = load i32, i32* @LOG_INFO
store i32 %6, i32* %2
br label %26
7: ; preds = %1, %1
%8 = load i32, i32* @LOG_DEBUG
store i32 %8, i32* %2
br label %26
9: ; preds = %1
%10 = load i32, i32* @LOG_WARNING
store i32 %10, i32* %2
br label %26
11: ; preds = %1
%12 = load i32, i32* @LOG_ERR
store i32 %12, i32* %2
br label %26
13: ; preds = %1
%14 = load i32, i32* @LOG_ALERT
store i32 %14, i32* %2
br label %26
15: ; preds = %1
%16 = load i32, i32* %3
%17 = icmp sge i32 %16, 1
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = load i32, i32* %3
%20 = icmp sle i32 %19, 25
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = load i32, i32* @LOG_INFO
br label %24
23: ; preds = %18, %15
br label %24
24: ; preds = %23, %21
%25 = phi i32 [ %22, %21 ], [ 0, %23 ]
store i32 %25, i32* %2
br label %26
26: ; preds = %24, %13, %11, %9, %7, %5
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
@LOG_INFO = global i32 0
@LOG_DEBUG = global i32 0
@LOG_WARNING = global i32 0
@LOG_ERR = global i32 0
@LOG_ALERT = global i32 0
define i32 @syslogLevel(i32 %0) {
switch i32 %0, label %12 [
i32 0, label %2
i32 7, label %4
i32 21, label %4
i32 23, label %6
i32 24, label %8
i32 25, label %10
]
2: ; preds = %1
%3 = load i32, i32* @LOG_INFO
br label %17
4: ; preds = %1, %1
%5 = load i32, i32* @LOG_DEBUG
br label %17
6: ; preds = %1
%7 = load i32, i32* @LOG_WARNING
br label %17
8: ; preds = %1
%9 = load i32, i32* @LOG_ERR
br label %17
10: ; preds = %1
%11 = load i32, i32* @LOG_ALERT
br label %17
12: ; preds = %1
%13 = add i32 %0, -1
%14 = icmp ult i32 %13, 25
%15 = load i32, i32* @LOG_INFO
%16 = select i1 %14, i32 %15, i32 0
br label %17
17: ; preds = %12, %10, %8, %6, %4, %2
%18 = phi i32 [ %16, %12 ], [ %11, %10 ], [ %9, %8 ], [ %7, %6 ], [ %5, %4 ], [ %3, %2 ]
ret i32 %18
}