#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_INFO;
int LOG_PID;
int /*<<< orphan*/ LOG_USER;
int /*<<< orphan*/ basename(char *);
int /*<<< orphan*/ closelog();
int /*<<< orphan*/ openlog(int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *);
int main(int argc __attribute__((unused)), char **argv) {
  openlog(basename(argv[0]), LOG_PID | LOG_CONS, LOG_USER);
  syslog(LOG_INFO, "A different kind of Hello world ... ");
  closelog();
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <basename@plt>
mov    %eax,%edi
mov    0x2e6d(%rip),%rax
mov    (%rax),%esi
mov    0x2e5c(%rip),%rax
or     (%rax),%esi
mov    0x2e6b(%rip),%rax
mov    (%rax),%edx
call   1060 <openlog@plt>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
lea    0xe6c(%rip),%rsi
call   1050 <syslog@plt>
mov    $0x0,%al
call   1030 <closelog@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    (%rsi),%rdi
call   1040 <basename@plt>
mov    0x2e88(%rip),%rcx
mov    0x2e79(%rip),%rdx
mov    (%rdx),%esi
or     (%rcx),%esi
mov    0x2e86(%rip),%rcx
mov    (%rcx),%edx
mov    %eax,%edi
call   1060 <openlog@plt>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
lea    0xe85(%rip),%rsi
call   1050 <syslog@plt>
xor    %eax,%eax
call   1030 <closelog@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@LOG_PID = global i32 0
@LOG_CONS = global i32 0
@LOG_USER = global i32 0
@LOG_INFO = global i32 0
@.str = [37 x i8] c"A different kind of Hello world ... \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = call i32 @basename(i8* %8)
%10 = load i32, i32* @LOG_PID
%11 = load i32, i32* @LOG_CONS
%12 = or i32 %10, %11
%13 = load i32, i32* @LOG_USER
%14 = call i32 @openlog(i32 %9, i32 %12, i32 %13)
%15 = load i32, i32* @LOG_INFO
%16 = call i32 @syslog(i32 %15, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%17 = call i32 (...) @closelog()
ret i32 0
}

LLVM IR (-O2):
@LOG_PID = global i32 0
@LOG_CONS = global i32 0
@LOG_USER = global i32 0
@LOG_INFO = global i32 0
@.str = [37 x i8] c"A different kind of Hello world ... \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 @basename(i8* %3)
%5 = load i32, i32* @LOG_PID
%6 = load i32, i32* @LOG_CONS
%7 = or i32 %6, %5
%8 = load i32, i32* @LOG_USER
%9 = tail call i32 @openlog(i32 %4, i32 %7, i32 %8)
%10 = load i32, i32* @LOG_INFO
%11 = tail call i32 @syslog(i32 %10, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 (...) @closelog()
ret i32 0
}