#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_CONS;
int /*<<< orphan*/ LOG_DEBUG;
int LOG_ERR;
int LOG_PID;
int LOG_USER;
int /*<<< orphan*/ closelog();
int /*<<< orphan*/ openlog(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int, char *, ...);
int main(int argc, char **argv) {
  syslog(LOG_ERR | LOG_USER, "test - %m/n");
  openlog("SyslogTest", LOG_CONS | LOG_PID, 0);
  syslog(LOG_DEBUG, "This is a syslog test message generated by program '%s'/n",
         argv[0]);
  closelog();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
mov    0x2e92(%rip),%rax
or     (%rax),%edi
lea    0xea1(%rip),%rsi
mov    $0x0,%al
call   1040 <syslog@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%esi
mov    0x2e62(%rip),%rax
or     (%rax),%esi
lea    0xe8d(%rip),%rdi
xor    %edx,%edx
call   1050 <openlog@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe7a(%rip),%rsi
mov    $0x0,%al
call   1040 <syslog@plt>
mov    $0x0,%al
call   1030 <closelog@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
mov    0x2e7d(%rip),%rax
mov    0x2ea6(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
lea    0xeb3(%rip),%rsi
xor    %eax,%eax
call   1040 <syslog@plt>
mov    0x2e75(%rip),%rax
mov    0x2e76(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xe9f(%rip),%rdi
xor    %edx,%edx
call   1050 <openlog@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe90(%rip),%rsi
xor    %eax,%eax
call   1040 <syslog@plt>
xor    %eax,%eax
call   1030 <closelog@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@LOG_ERR = global i32 0
@LOG_USER = global i32 0
@.str = [12 x i8] c"test - %m/n\00"
@.str.1 = [11 x i8] c"SyslogTest\00"
@LOG_CONS = global i32 0
@LOG_PID = global i32 0
@LOG_DEBUG = global i32 0
@.str.2 = [58 x i8] c"This is a syslog test message generated by program '%s'/n\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @LOG_ERR
%7 = load i32, i32* @LOG_USER
%8 = or i32 %6, %7
%9 = call i32 (i32, i8*, ...) @syslog(i32 %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @LOG_CONS
%11 = load i32, i32* @LOG_PID
%12 = or i32 %10, %11
%13 = call i32 @openlog(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 0)
%14 = load i32, i32* @LOG_DEBUG
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 (i32, i8*, ...) @syslog(i32 %14, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = call i32 (...) @closelog()
ret i32 0
}

LLVM IR (-O2):
@LOG_ERR = global i32 0
@LOG_USER = global i32 0
@.str = [12 x i8] c"test - %m/n\00"
@.str.1 = [11 x i8] c"SyslogTest\00"
@LOG_CONS = global i32 0
@LOG_PID = global i32 0
@LOG_DEBUG = global i32 0
@.str.2 = [58 x i8] c"This is a syslog test message generated by program '%s'/n\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @LOG_ERR
%4 = load i32, i32* @LOG_USER
%5 = or i32 %4, %3
%6 = tail call i32 (i32, i8*, ...) @syslog(i32 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @LOG_CONS
%8 = load i32, i32* @LOG_PID
%9 = or i32 %8, %7
%10 = tail call i32 @openlog(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 0)
%11 = load i32, i32* @LOG_DEBUG
%12 = load i8*, i8** %1
%13 = tail call i32 (i32, i8*, ...) @syslog(i32 %11, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = tail call i32 (...) @closelog()
ret i32 0
}