#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 /*<<< orphan*/ LOG_ALERT;
int /*<<< orphan*/ LOG_CRIT;
int /*<<< orphan*/ LOG_DEBUG;
int /*<<< orphan*/ LOG_EMERG;
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ LOG_INFO;
int /*<<< orphan*/ LOG_NOTICE;
int /*<<< orphan*/ LOG_WARNING;
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, char *);
void write_to_syslog(void) {
  syslog(LOG_EMERG, "%s", "This is LOG_EMERG");
  syslog(LOG_ALERT, "%s", "This is LOG_ALERT");
  syslog(LOG_CRIT, "%s", "This is LOG_CRIT");
  syslog(LOG_ERR, "%s", "This is LOG_ERR");
  syslog(LOG_WARNING, "%s", "This is LOG_WARNING");
  syslog(LOG_NOTICE, "%s", "This is LOG_NOTICE");
  syslog(LOG_INFO, "%s", "This is LOG_INFO");
  syslog(LOG_DEBUG, "%s", "This is LOG_DEBUG");
}


x86 assembly (clang, -O0):
<write_to_syslog>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
lea    0xed8(%rip),%rdx
call   1030 <syslog@plt>
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
lea    0xec0(%rip),%rsi
lea    0xece(%rip),%rdx
call   1030 <syslog@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
lea    0xea4(%rip),%rsi
lea    0xec4(%rip),%rdx
call   1030 <syslog@plt>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
lea    0xe88(%rip),%rsi
lea    0xeb9(%rip),%rdx
call   1030 <syslog@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
lea    0xe6c(%rip),%rsi
lea    0xead(%rip),%rdx
call   1030 <syslog@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
lea    0xe50(%rip),%rsi
lea    0xea5(%rip),%rdx
call   1030 <syslog@plt>
mov    0x2ded(%rip),%rax
mov    (%rax),%edi
lea    0xe34(%rip),%rsi
lea    0xe9c(%rip),%rdx
call   1030 <syslog@plt>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
lea    0xe18(%rip),%rsi
lea    0xe91(%rip),%rdx
call   1030 <syslog@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_to_syslog>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rbx
lea    0xedb(%rip),%rdx
mov    %rbx,%rsi
call   1030 <syslog@plt>
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
lea    0xed5(%rip),%rdx
mov    %rbx,%rsi
call   1030 <syslog@plt>
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rdx
mov    %rbx,%rsi
call   1030 <syslog@plt>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    0xec8(%rip),%rdx
mov    %rbx,%rsi
call   1030 <syslog@plt>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
lea    0xec0(%rip),%rdx
mov    %rbx,%rsi
call   1030 <syslog@plt>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
lea    0xebc(%rip),%rdx
mov    %rbx,%rsi
call   1030 <syslog@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
lea    0xeb7(%rip),%rdx
mov    %rbx,%rsi
call   1030 <syslog@plt>
mov    0x2df1(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rdx
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <syslog@plt>

LLVM IR (-O0):
@LOG_EMERG = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [18 x i8] c"This is LOG_EMERG\00"
@LOG_ALERT = global i32 0
@.str.2 = [18 x i8] c"This is LOG_ALERT\00"
@LOG_CRIT = global i32 0
@.str.3 = [17 x i8] c"This is LOG_CRIT\00"
@LOG_ERR = global i32 0
@.str.4 = [16 x i8] c"This is LOG_ERR\00"
@LOG_WARNING = global i32 0
@.str.5 = [20 x i8] c"This is LOG_WARNING\00"
@LOG_NOTICE = global i32 0
@.str.6 = [19 x i8] c"This is LOG_NOTICE\00"
@LOG_INFO = global i32 0
@.str.7 = [17 x i8] c"This is LOG_INFO\00"
@LOG_DEBUG = global i32 0
@.str.8 = [18 x i8] c"This is LOG_DEBUG\00"
define void @write_to_syslog() {
%1 = load i32, i32* @LOG_EMERG
%2 = call i32 @syslog(i32 %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%3 = load i32, i32* @LOG_ALERT
%4 = call i32 @syslog(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%5 = load i32, i32* @LOG_CRIT
%6 = call i32 @syslog(i32 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%7 = load i32, i32* @LOG_ERR
%8 = call i32 @syslog(i32 %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%9 = load i32, i32* @LOG_WARNING
%10 = call i32 @syslog(i32 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%11 = load i32, i32* @LOG_NOTICE
%12 = call i32 @syslog(i32 %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%13 = load i32, i32* @LOG_INFO
%14 = call i32 @syslog(i32 %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%15 = load i32, i32* @LOG_DEBUG
%16 = call i32 @syslog(i32 %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@LOG_EMERG = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [18 x i8] c"This is LOG_EMERG\00"
@LOG_ALERT = global i32 0
@.str.2 = [18 x i8] c"This is LOG_ALERT\00"
@LOG_CRIT = global i32 0
@.str.3 = [17 x i8] c"This is LOG_CRIT\00"
@LOG_ERR = global i32 0
@.str.4 = [16 x i8] c"This is LOG_ERR\00"
@LOG_WARNING = global i32 0
@.str.5 = [20 x i8] c"This is LOG_WARNING\00"
@LOG_NOTICE = global i32 0
@.str.6 = [19 x i8] c"This is LOG_NOTICE\00"
@LOG_INFO = global i32 0
@.str.7 = [17 x i8] c"This is LOG_INFO\00"
@LOG_DEBUG = global i32 0
@.str.8 = [18 x i8] c"This is LOG_DEBUG\00"
define void @write_to_syslog() {
%1 = load i32, i32* @LOG_EMERG
%2 = tail call i32 @syslog(i32 %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%3 = load i32, i32* @LOG_ALERT
%4 = tail call i32 @syslog(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%5 = load i32, i32* @LOG_CRIT
%6 = tail call i32 @syslog(i32 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%7 = load i32, i32* @LOG_ERR
%8 = tail call i32 @syslog(i32 %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%9 = load i32, i32* @LOG_WARNING
%10 = tail call i32 @syslog(i32 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%11 = load i32, i32* @LOG_NOTICE
%12 = tail call i32 @syslog(i32 %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%13 = load i32, i32* @LOG_INFO
%14 = tail call i32 @syslog(i32 %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%15 = load i32, i32* @LOG_DEBUG
%16 = tail call i32 @syslog(i32 %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
ret void
}