#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_INFO;
int LOG_ODELAY;
int LOG_USER;
int /*<<< orphan*/ closelog();
int /*<<< orphan*/ openlog(char const *, int, int);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, char const *);
int main(int argc, char **argv) {
  const char *ident = "MYLOG";
  int option = LOG_ODELAY;
  int facility = LOG_USER;
  openlog(ident, option, facility);
  const char *message = "This is a test message";
  syslog(LOG_INFO, "%s", message);
  closelog();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e90(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e7c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1050 <openlog@plt>
lea    0xe87(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xe86(%rip),%rsi
call   1040 <syslog@plt>
mov    $0x0,%al
call   1030 <closelog@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
mov    0x2e9f(%rip),%rax
mov    (%rax),%edx
lea    0xeb6(%rip),%rdi
call   1050 <openlog@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
lea    0xebe(%rip),%rsi
lea    0xea0(%rip),%rdx
call   1040 <syslog@plt>
xor    %eax,%eax
call   1030 <closelog@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"MYLOG\00"
@LOG_ODELAY = global i32 0
@LOG_USER = global i32 0
@.str.1 = [23 x i8] c"This is a test message\00"
@LOG_INFO = global i32 0
@.str.2 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %6
%10 = load i32, i32* @LOG_ODELAY
store i32 %10, i32* %7
%11 = load i32, i32* @LOG_USER
store i32 %11, i32* %8
%12 = load i8*, i8** %6
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = call i32 @openlog(i8* %12, i32 %13, i32 %14)
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8** %9
%16 = load i32, i32* @LOG_INFO
%17 = load i8*, i8** %9
%18 = call i32 @syslog(i32 %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = call i32 (...) @closelog()
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"MYLOG\00"
@LOG_ODELAY = global i32 0
@LOG_USER = global i32 0
@.str.1 = [23 x i8] c"This is a test message\00"
@LOG_INFO = global i32 0
@.str.2 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @LOG_ODELAY
%4 = load i32, i32* @LOG_USER
%5 = tail call i32 @openlog(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%6 = load i32, i32* @LOG_INFO
%7 = tail call i32 @syslog(i32 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 (...) @closelog()
ret i32 0
}