#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_NOTICE;
int LOG_PID;
int /*<<< orphan*/ LOG_USER;
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ openlog(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, int /*<<< orphan*/,
                          int /*<<< orphan*/);
void createLog() {
  int logmask;
  openlog("logmask", LOG_PID | LOG_CONS, LOG_USER);
  syslog(LOG_NOTICE, "informative message, pid = %d log_level = %d\n", getpid(),
         LOG_NOTICE);
  sleep(1);
}


x86 assembly (clang, -O0):
<createLog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e89(%rip),%rax
mov    (%rax),%esi
mov    0x2e78(%rip),%rax
or     (%rax),%esi
mov    0x2e87(%rip),%rax
mov    (%rax),%edx
lea    0xe96(%rip),%rdi
call   1050 <openlog@plt>
mov    0x2e52(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%edx
mov    0x2e3a(%rip),%rax
mov    (%rax),%ecx
lea    0xe71(%rip),%rsi
call   1040 <syslog@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createLog>:
push   %r14
push   %rbx
push   %rax
mov    0x2e8d(%rip),%rax
mov    0x2e7e(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e8b(%rip),%rax
mov    (%rax),%edx
lea    0xe9a(%rip),%rdi
call   1050 <openlog@plt>
mov    0x2e56(%rip),%r14
mov    (%r14),%ebx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    (%r14),%ecx
lea    0xe82(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
call   1040 <syslog@plt>
mov    $0x1,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <sleep@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"logmask\00"
@LOG_PID = global i32 0
@LOG_CONS = global i32 0
@LOG_USER = global i32 0
@LOG_NOTICE = global i32 0
@.str.1 = [46 x i8] c"informative message, pid = %d log_level = %d\0A\00"
define void @createLog() {
%1 = alloca i32
%2 = load i32, i32* @LOG_PID
%3 = load i32, i32* @LOG_CONS
%4 = or i32 %2, %3
%5 = load i32, i32* @LOG_USER
%6 = call i32 @openlog(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
%7 = load i32, i32* @LOG_NOTICE
%8 = call i32 (...) @getpid()
%9 = load i32, i32* @LOG_NOTICE
%10 = call i32 @syslog(i32 %7, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %9)
%11 = call i32 @sleep(i32 1)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"logmask\00"
@LOG_PID = global i32 0
@LOG_CONS = global i32 0
@LOG_USER = global i32 0
@LOG_NOTICE = global i32 0
@.str.1 = [46 x i8] c"informative message, pid = %d log_level = %d\0A\00"
define void @createLog() {
%1 = load i32, i32* @LOG_PID
%2 = load i32, i32* @LOG_CONS
%3 = or i32 %2, %1
%4 = load i32, i32* @LOG_USER
%5 = tail call i32 @openlog(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%6 = load i32, i32* @LOG_NOTICE
%7 = tail call i32 (...) @getpid()
%8 = load i32, i32* @LOG_NOTICE
%9 = tail call i32 @syslog(i32 %6, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %8)
%10 = tail call i32 @sleep(i32 1)
ret void
}