#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_CRIT;
int LOG_DEBUG;
int LOG_ERR;
int LOG_INFO;
int LOG_WARNING;
int mapLogLevel(int level) {
  switch (level) {
  case 10:
    return LOG_DEBUG;
  case 20:
    return LOG_INFO;
  case 30:
    return LOG_WARNING;
  case 50:
    return LOG_CRIT;
  case 40:
  default:
    return LOG_ERR;
  }
}


x86 assembly (clang, -O0):
<mapLogLevel>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xfffffff6,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x28,%eax
ja     1179 <mapLogLevel+0x79>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e99(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1185 <mapLogLevel+0x85>
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1185 <mapLogLevel+0x85>
mov    0x2e87(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1185 <mapLogLevel+0x85>
mov    0x2e7e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1185 <mapLogLevel+0x85>
jmp    1179 <mapLogLevel+0x79>
mov    0x2e38(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mapLogLevel>:
cmp    $0x1d,%edi
jg     1119 <mapLogLevel+0x19>
cmp    $0xa,%edi
je     1137 <mapLogLevel+0x37>
cmp    $0x14,%edi
jne    112d <mapLogLevel+0x2d>
mov    0x2eb2(%rip),%rax
mov    (%rax),%eax
ret
cmp    $0x1e,%edi
je     1141 <mapLogLevel+0x41>
cmp    $0x32,%edi
jne    112d <mapLogLevel+0x2d>
mov    0x2ebe(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e84(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e92(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@LOG_DEBUG = global i32 0
@LOG_INFO = global i32 0
@LOG_WARNING = global i32 0
@LOG_CRIT = global i32 0
@LOG_ERR = global i32 0
define i32 @mapLogLevel(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %14 [
i32 10, label %5
i32 20, label %7
i32 30, label %9
i32 50, label %11
i32 40, label %13
]
5: ; preds = %1
%6 = load i32, i32* @LOG_DEBUG
store i32 %6, i32* %2
br label %16
7: ; preds = %1
%8 = load i32, i32* @LOG_INFO
store i32 %8, i32* %2
br label %16
9: ; preds = %1
%10 = load i32, i32* @LOG_WARNING
store i32 %10, i32* %2
br label %16
11: ; preds = %1
%12 = load i32, i32* @LOG_CRIT
store i32 %12, i32* %2
br label %16
13: ; preds = %1
br label %14
14: ; preds = %1, %13
%15 = load i32, i32* @LOG_ERR
store i32 %15, i32* %2
br label %16
16: ; preds = %14, %11, %9, %7, %5
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@LOG_DEBUG = global i32 0
@LOG_INFO = global i32 0
@LOG_WARNING = global i32 0
@LOG_CRIT = global i32 0
@LOG_ERR = global i32 0
define i32 @mapLogLevel(i32 %0) {
switch i32 %0, label %5 [
i32 10, label %6
i32 20, label %2
i32 30, label %3
i32 50, label %4
]
2: ; preds = %1
br label %6
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %5, %4, %3, %2
%7 = phi i32* [ @LOG_ERR, %5 ], [ @LOG_CRIT, %4 ], [ @LOG_WARNING, %3 ], [ @LOG_INFO, %2 ], [ @LOG_DEBUG, %1 ]
%8 = load i32, i32* %7
ret i32 %8
}