#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_INFO;
int LOG_NOTICE;
int /*<<< orphan*/ syslog(int, char *, char *);
int os_syslog(int level, char *msg) {
  int priority;
  switch (level) {
  case 0:
  case 1:
    priority = LOG_ALERT;
    break;
  case 2:
  case 3:
  case 4:
    priority = LOG_NOTICE;
    break;
  case 5:
  case 6:
  case 7:
  case 8:
    priority = LOG_INFO;
    break;
  case 9:
  default:
    priority = LOG_DEBUG;
    break;
  }
  syslog(priority, "%s", msg);
  return 1;
}


x86 assembly (clang, -O0):
<os_syslog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x9,%rax
ja     117c <os_syslog+0x6c>
mov    -0x20(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
jmp    1188 <os_syslog+0x78>
mov    0x2e7c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
jmp    1188 <os_syslog+0x78>
mov    0x2e5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
jmp    1188 <os_syslog+0x78>
jmp    117c <os_syslog+0x6c>
mov    0x2e4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xe92(%rip),%rsi
call   1030 <syslog@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_syslog>:
push   %rax
mov    %rsi,%rdx
cmp    $0x8,%edi
ja     1129 <os_syslog+0x19>
movslq %edi,%rax
lea    0x2cad(%rip),%rcx
mov    (%rcx,%rax,8),%rax
jmp    1130 <os_syslog+0x20>
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    0xec7(%rip),%rsi
call   1030 <syslog@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@LOG_ALERT = global i32 0
@LOG_NOTICE = global i32 0
@LOG_INFO = global i32 0
@LOG_DEBUG = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @os_syslog(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
switch i32 %6, label %14 [
i32 0, label %7
i32 1, label %7
i32 2, label %9
i32 3, label %9
i32 4, label %9
i32 5, label %11
i32 6, label %11
i32 7, label %11
i32 8, label %11
i32 9, label %13
]
7: ; preds = %2, %2
%8 = load i32, i32* @LOG_ALERT
store i32 %8, i32* %5
br label %16
9: ; preds = %2, %2, %2
%10 = load i32, i32* @LOG_NOTICE
store i32 %10, i32* %5
br label %16
11: ; preds = %2, %2, %2, %2
%12 = load i32, i32* @LOG_INFO
store i32 %12, i32* %5
br label %16
13: ; preds = %2
br label %14
14: ; preds = %2, %13
%15 = load i32, i32* @LOG_DEBUG
store i32 %15, i32* %5
br label %16
16: ; preds = %14, %11, %9, %7
%17 = load i32, i32* %5
%18 = load i8*, i8** %4
%19 = call i32 @syslog(i32 %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %18)
ret i32 1
}

LLVM IR (-O2):
@LOG_ALERT = global i32 0
@LOG_NOTICE = global i32 0
@LOG_INFO = global i32 0
@LOG_DEBUG = global i32 0
@.str = [3 x i8] c"%s\00"
@switch.table.os_syslog = [9 x i32*] [i32* @LOG_ALERT, i32* @LOG_ALERT, i32* @LOG_NOTICE, i32* @LOG_NOTICE, i32* @LOG_NOTICE, i32* @LOG_INFO, i32* @LOG_INFO, i32* @LOG_INFO, i32* @LOG_INFO]
define i32 @os_syslog(i32 %0, i8* %1) {
%3 = icmp ult i32 %0, 9
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = sext i32 %0 to i64
%6 = getelementptr inbounds [9 x i32*], [9 x i32*]* @switch.table.os_syslog, i64 0, i64 %5
%7 = load i32*, i32** %6
br label %8
8: ; preds = %2, %4
%9 = phi i32* [ %7, %4 ], [ @LOG_DEBUG, %2 ]
%10 = load i32, i32* %9
%11 = tail call i32 @syslog(i32 %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 1
}