#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_DAEMON;
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ LOG_PID;
int /*<<< orphan*/ LOG_UPTO(int /*<<< orphan*/);
int /*<<< orphan*/ LOG_WARNING;
int /*<<< orphan*/ closelog();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ openlog(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ setlogmask(int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ unlink(char *);
void SyslogErrExit(char *msg, int err1, int err2) {
  openlog("SSTL_d", LOG_PID, LOG_DAEMON);
  setlogmask(LOG_UPTO(LOG_WARNING));
  if (err2 != -1) {
    syslog(LOG_ERR, msg, err1, err2);
  } else if (err1 != -1) {
    syslog(LOG_ERR, msg, err1);
  } else {
    syslog(LOG_ERR, msg);
  }
  closelog();
  unlink("/tmp/SSTL_d_pid");
  exit(1);
}


x86 assembly (clang, -O0):
<SyslogErrExit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    0x2e47(%rip),%rax
mov    (%rax),%esi
mov    0x2e56(%rip),%rax
mov    (%rax),%edx
lea    0xe65(%rip),%rdi
call   1080 <openlog@plt>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
call   1050 <LOG_UPTO@plt>
mov    %eax,%edi
call   1060 <setlogmask@plt>
cmpl   $0xffffffff,-0x10(%rbp)
je     11de <SyslogErrExit+0x6e>
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    121d <SyslogErrExit+0xad>
cmpl   $0xffffffff,-0xc(%rbp)
je     1204 <SyslogErrExit+0x94>
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    1218 <SyslogErrExit+0xa8>
mov    0x2db5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1070 <syslog@plt>
jmp    121d <SyslogErrExit+0xad>
mov    $0x0,%al
call   1030 <closelog@plt>
lea    0xddc(%rip),%rdi
call   1040 <unlink@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<SyslogErrExit>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
mov    0x2e4e(%rip),%rax
mov    (%rax),%esi
mov    0x2e5d(%rip),%rax
mov    (%rax),%edx
lea    0xe6c(%rip),%rdi
call   1080 <openlog@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
call   1050 <LOG_UPTO@plt>
mov    %eax,%edi
call   1060 <setlogmask@plt>
mov    0x2e0b(%rip),%rax
cmp    $0xffffffff,%ebx
jne    11cd <SyslogErrExit+0x5d>
mov    (%rax),%edi
mov    %r14,%rsi
cmp    $0xffffffff,%ebp
jne    11df <SyslogErrExit+0x6f>
xor    %eax,%eax
call   1070 <syslog@plt>
jmp    11e8 <SyslogErrExit+0x78>
mov    (%rax),%edi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1070 <syslog@plt>
jmp    11e8 <SyslogErrExit+0x78>
mov    %ebp,%edx
xor    %eax,%eax
call   1070 <syslog@plt>
xor    %eax,%eax
call   1030 <closelog@plt>
lea    0xe11(%rip),%rdi
call   1040 <unlink@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"SSTL_d\00"
@LOG_PID = global i32 0
@LOG_DAEMON = global i32 0
@LOG_WARNING = global i32 0
@LOG_ERR = global i32 0
@.str.1 = [16 x i8] c"/tmp/SSTL_d_pid\00"
define void @SyslogErrExit(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* @LOG_PID
%8 = load i32, i32* @LOG_DAEMON
%9 = call i32 @openlog(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
%10 = load i32, i32* @LOG_WARNING
%11 = call i32 @LOG_UPTO(i32 %10)
%12 = call i32 @setlogmask(i32 %11)
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %21
15: ; preds = %3
%16 = load i32, i32* @LOG_ERR
%17 = load i8*, i8** %4
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = call i32 (i32, i8*, ...) @syslog(i32 %16, i8* %17, i32 %18, i32 %19)
br label %34
21: ; preds = %3
%22 = load i32, i32* %5
%23 = icmp ne i32 %22, -1
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = load i32, i32* @LOG_ERR
%26 = load i8*, i8** %4
%27 = load i32, i32* %5
%28 = call i32 (i32, i8*, ...) @syslog(i32 %25, i8* %26, i32 %27)
br label %33
29: ; preds = %21
%30 = load i32, i32* @LOG_ERR
%31 = load i8*, i8** %4
%32 = call i32 (i32, i8*, ...) @syslog(i32 %30, i8* %31)
br label %33
33: ; preds = %29, %24
br label %34
34: ; preds = %33, %15
%35 = call i32 (...) @closelog()
%36 = call i32 @unlink(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%37 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [7 x i8] c"SSTL_d\00"
@LOG_PID = global i32 0
@LOG_DAEMON = global i32 0
@LOG_WARNING = global i32 0
@LOG_ERR = global i32 0
@.str.1 = [16 x i8] c"/tmp/SSTL_d_pid\00"
define void @SyslogErrExit(i8* %0, i32 %1, i32 %2) {
%4 = load i32, i32* @LOG_PID
%5 = load i32, i32* @LOG_DAEMON
%6 = tail call i32 @openlog(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
%7 = load i32, i32* @LOG_WARNING
%8 = tail call i32 @LOG_UPTO(i32 %7)
%9 = tail call i32 @setlogmask(i32 %8)
%10 = icmp eq i32 %2, -1
br i1 %10, label %14, label %11
11: ; preds = %3
%12 = load i32, i32* @LOG_ERR
%13 = tail call i32 (i32, i8*, ...) @syslog(i32 %12, i8* %0, i32 %1, i32 %2)
br label %21
14: ; preds = %3
%15 = icmp eq i32 %1, -1
%16 = load i32, i32* @LOG_ERR
br i1 %15, label %19, label %17
17: ; preds = %14
%18 = tail call i32 (i32, i8*, ...) @syslog(i32 %16, i8* %0, i32 %1)
br label %21
19: ; preds = %14
%20 = tail call i32 (i32, i8*, ...) @syslog(i32 %16, i8* %0)
br label %21
21: ; preds = %17, %19, %11
%22 = tail call i32 (...) @closelog()
%23 = tail call i32 @unlink(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%24 = tail call i32 @exit(i32 1)
unreachable
}