#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_ERR;
int /*<<< orphan*/ LOG_LOCAL1;
int LOG_NDELAY;
int LOG_PID;
int /*<<< orphan*/ closelog();
int /*<<< orphan*/ openlog(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, char *);
void MySAR_syslog(char *mlog) {
  openlog("mysar", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
  syslog(LOG_ERR, "%s", mlog);
  closelog();
}


x86 assembly (clang, -O0):
<MySAR_syslog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e95(%rip),%rax
mov    (%rax),%esi
mov    0x2e94(%rip),%rax
or     (%rax),%esi
mov    0x2e6b(%rip),%rax
or     (%rax),%esi
mov    0x2e72(%rip),%rax
mov    (%rax),%edx
lea    0xe99(%rip),%rdi
call   1050 <openlog@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe86(%rip),%rsi
call   1040 <syslog@plt>
mov    $0x0,%al
call   1030 <closelog@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MySAR_syslog>:
push   %rbx
mov    %rdi,%rbx
mov    0x2e9d(%rip),%rax
mov    0x2e9e(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e73(%rip),%rax
or     (%rax),%esi
mov    0x2e7a(%rip),%rax
mov    (%rax),%edx
lea    0xea1(%rip),%rdi
call   1050 <openlog@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
lea    0xe92(%rip),%rsi
mov    %rbx,%rdx
call   1040 <syslog@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <closelog@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"mysar\00"
@LOG_CONS = global i32 0
@LOG_PID = global i32 0
@LOG_NDELAY = global i32 0
@LOG_LOCAL1 = global i32 0
@LOG_ERR = global i32 0
@.str.1 = [3 x i8] c"%s\00"
define void @MySAR_syslog(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @LOG_CONS
%4 = load i32, i32* @LOG_PID
%5 = or i32 %3, %4
%6 = load i32, i32* @LOG_NDELAY
%7 = or i32 %5, %6
%8 = load i32, i32* @LOG_LOCAL1
%9 = call i32 @openlog(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
%10 = load i32, i32* @LOG_ERR
%11 = load i8*, i8** %2
%12 = call i32 @syslog(i32 %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = call i32 (...) @closelog()
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"mysar\00"
@LOG_CONS = global i32 0
@LOG_PID = global i32 0
@LOG_NDELAY = global i32 0
@LOG_LOCAL1 = global i32 0
@LOG_ERR = global i32 0
@.str.1 = [3 x i8] c"%s\00"
define void @MySAR_syslog(i8* %0) {
%2 = load i32, i32* @LOG_CONS
%3 = load i32, i32* @LOG_PID
%4 = or i32 %3, %2
%5 = load i32, i32* @LOG_NDELAY
%6 = or i32 %4, %5
%7 = load i32, i32* @LOG_LOCAL1
%8 = tail call i32 @openlog(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = load i32, i32* @LOG_ERR
%10 = tail call i32 @syslog(i32 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%11 = tail call i32 (...) @closelog()
ret void
}