#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 /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ LOG_INFO;
int /*<<< orphan*/ LOG_LOCAL1;
int LOG_NDELAY;
int /*<<< orphan*/ LOG_NOTICE;
int LOG_PID;
int /*<<< orphan*/ LOG_UPTO(int /*<<< orphan*/);
int /*<<< orphan*/ closelog();
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ getuid();
int /*<<< orphan*/ openlog(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ setlogmask(int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, ...);
void errorLogger() {
  setlogmask(LOG_UPTO(LOG_NOTICE));
  openlog("TERMlogger", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
  syslog(LOG_ERR, "Program started by User %d", getuid());
  syslog(LOG_DEBUG, "Check error on Event");
  syslog(LOG_INFO, "PID -> %d", getpid());
  syslog(LOG_INFO, "Debug --CRITICAL");
  closelog();
}


x86 assembly (clang, -O0):
<errorLogger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
call   1050 <LOG_UPTO@plt>
mov    %eax,%edi
call   1070 <setlogmask@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%esi
mov    0x2e43(%rip),%rax
or     (%rax),%esi
mov    0x2e02(%rip),%rax
or     (%rax),%esi
mov    0x2e21(%rip),%rax
mov    (%rax),%edx
lea    0xe48(%rip),%rdi
call   1090 <openlog@plt>
mov    0x2ddc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <getuid@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%edx
lea    0xe2f(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    0x2dd6(%rip),%rax
mov    (%rax),%edi
lea    0xe33(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    0x2db7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x4(%rbp),%edi
mov    %eax,%edx
lea    0xe22(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    0x2d91(%rip),%rax
mov    (%rax),%edi
lea    0xe15(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    $0x0,%al
call   1030 <closelog@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errorLogger>:
push   %r14
push   %rbx
push   %rax
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
call   1050 <LOG_UPTO@plt>
mov    %eax,%edi
call   1070 <setlogmask@plt>
mov    0x2e48(%rip),%rax
mov    0x2e49(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e06(%rip),%rax
or     (%rax),%esi
mov    0x2e25(%rip),%rax
mov    (%rax),%edx
lea    0xe4c(%rip),%rdi
call   1090 <openlog@plt>
mov    0x2de0(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1060 <getuid@plt>
lea    0xe3b(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <syslog@plt>
mov    0x2dde(%rip),%rax
mov    (%rax),%edi
lea    0xe3b(%rip),%rsi
xor    %eax,%eax
call   1080 <syslog@plt>
mov    0x2dbf(%rip),%r14
mov    (%r14),%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xe31(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <syslog@plt>
mov    (%r14),%edi
lea    0xe26(%rip),%rsi
xor    %eax,%eax
call   1080 <syslog@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <closelog@plt>

LLVM IR (-O0):
@LOG_NOTICE = global i32 0
@.str = [11 x i8] c"TERMlogger\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 = [27 x i8] c"Program started by User %d\00"
@LOG_DEBUG = global i32 0
@.str.2 = [21 x i8] c"Check error on Event\00"
@LOG_INFO = global i32 0
@.str.3 = [10 x i8] c"PID -> %d\00"
@.str.4 = [17 x i8] c"Debug --CRITICAL\00"
define void @errorLogger() {
%1 = load i32, i32* @LOG_NOTICE
%2 = call i32 @LOG_UPTO(i32 %1)
%3 = call i32 @setlogmask(i32 %2)
%4 = load i32, i32* @LOG_CONS
%5 = load i32, i32* @LOG_PID
%6 = or i32 %4, %5
%7 = load i32, i32* @LOG_NDELAY
%8 = or i32 %6, %7
%9 = load i32, i32* @LOG_LOCAL1
%10 = call i32 @openlog(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
%11 = load i32, i32* @LOG_ERR
%12 = call i32 (...) @getuid()
%13 = call i32 (i32, i8*, ...) @syslog(i32 %11, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32, i32* @LOG_DEBUG
%15 = call i32 (i32, i8*, ...) @syslog(i32 %14, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%16 = load i32, i32* @LOG_INFO
%17 = call i32 (...) @getpid()
%18 = call i32 (i32, i8*, ...) @syslog(i32 %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = load i32, i32* @LOG_INFO
%20 = call i32 (i32, i8*, ...) @syslog(i32 %19, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%21 = call i32 (...) @closelog()
ret void
}

LLVM IR (-O2):
@LOG_NOTICE = global i32 0
@.str = [11 x i8] c"TERMlogger\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 = [27 x i8] c"Program started by User %d\00"
@LOG_DEBUG = global i32 0
@.str.2 = [21 x i8] c"Check error on Event\00"
@LOG_INFO = global i32 0
@.str.3 = [10 x i8] c"PID -> %d\00"
@.str.4 = [17 x i8] c"Debug --CRITICAL\00"
define void @errorLogger() {
%1 = load i32, i32* @LOG_NOTICE
%2 = tail call i32 @LOG_UPTO(i32 %1)
%3 = tail call i32 @setlogmask(i32 %2)
%4 = load i32, i32* @LOG_CONS
%5 = load i32, i32* @LOG_PID
%6 = or i32 %5, %4
%7 = load i32, i32* @LOG_NDELAY
%8 = or i32 %6, %7
%9 = load i32, i32* @LOG_LOCAL1
%10 = tail call i32 @openlog(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
%11 = load i32, i32* @LOG_ERR
%12 = tail call i32 (...) @getuid()
%13 = tail call i32 (i32, i8*, ...) @syslog(i32 %11, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32, i32* @LOG_DEBUG
%15 = tail call i32 (i32, i8*, ...) @syslog(i32 %14, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%16 = load i32, i32* @LOG_INFO
%17 = tail call i32 (...) @getpid()
%18 = tail call i32 (i32, i8*, ...) @syslog(i32 %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = load i32, i32* @LOG_INFO
%20 = tail call i32 (i32, i8*, ...) @syslog(i32 %19, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%21 = tail call i32 (...) @closelog()
ret void
}