#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_ALERT;
int /*<<< orphan*/ LOG_CRIT;
int /*<<< orphan*/ LOG_DEBUG;
int /*<<< orphan*/ LOG_EMERG;
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ LOG_INFO;
int /*<<< orphan*/ LOG_NOTICE;
int /*<<< orphan*/ LOG_WARNING;
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ tsyslog(int /*<<< orphan*/, char *);
int /*<<< orphan*/ tsyslog_init(char *);
int main(int argc, char *argv[]) {
  tsyslog_init("logtest");
  while (1) {
    tsyslog(LOG_DEBUG, "Detta är en debug utskrift\n");
    tsyslog(LOG_INFO, "Detta är en info utskrift\n");
    tsyslog(LOG_NOTICE, "Detta är en notice utskrift\n");
    tsyslog(LOG_WARNING, "Detta är en warning utskrift\n");
    tsyslog(LOG_ERR, "Detta är en error utskrift\n");
    tsyslog(LOG_CRIT, "Detta är en critical utskrift\n");
    tsyslog(LOG_ALERT, "Detta är en alert utskrift\n");
    tsyslog(LOG_EMERG, "Detta är en emergency utskrift\n");
    sleep(2);
  }
}


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)
lea    0xeb3(%rip),%rdi
call   1030 <tsyslog_init@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
call   1040 <tsyslog@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
lea    0xeae(%rip),%rsi
call   1040 <tsyslog@plt>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
lea    0xeb5(%rip),%rsi
call   1040 <tsyslog@plt>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
lea    0xebe(%rip),%rsi
call   1040 <tsyslog@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
lea    0xec8(%rip),%rsi
call   1040 <tsyslog@plt>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
lea    0xed0(%rip),%rsi
call   1040 <tsyslog@plt>
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
lea    0xedb(%rip),%rsi
call   1040 <tsyslog@plt>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
lea    0xee3(%rip),%rsi
call   1040 <tsyslog@plt>
mov    $0x2,%edi
call   1050 <sleep@plt>
jmp    1152 <main+0x22>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
call   1030 <tsyslog_init@plt>
mov    0x2e92(%rip),%r13
lea    0xf46(%rip),%rbp
mov    0x2e8c(%rip),%r12
lea    0xf58(%rip),%r14
mov    0x2e6e(%rip),%rbx
lea    0xf67(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
lea    0xe78(%rip),%rsi
call   1040 <tsyslog@plt>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
call   1040 <tsyslog@plt>
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
lea    0xe87(%rip),%rsi
call   1040 <tsyslog@plt>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
call   1040 <tsyslog@plt>
mov    0x2dc5(%rip),%rax
mov    (%rax),%edi
lea    0xe9a(%rip),%rsi
call   1040 <tsyslog@plt>
mov    0x0(%r13),%edi
mov    %rbp,%rsi
call   1040 <tsyslog@plt>
mov    (%r12),%edi
mov    %r14,%rsi
call   1040 <tsyslog@plt>
mov    (%rbx),%edi
mov    %r15,%rsi
call   1040 <tsyslog@plt>
mov    $0x2,%edi
call   1050 <sleep@plt>
jmp    1180 <main+0x50>

LLVM IR (-O0):
@.str = [8 x i8] c"logtest\00"
@LOG_DEBUG = global i32 0
@.str.1 = [29 x i8] c"Detta \C3\A4r en debug utskrift\0A\00"
@LOG_INFO = global i32 0
@.str.2 = [28 x i8] c"Detta \C3\A4r en info utskrift\0A\00"
@LOG_NOTICE = global i32 0
@.str.3 = [30 x i8] c"Detta \C3\A4r en notice utskrift\0A\00"
@LOG_WARNING = global i32 0
@.str.4 = [31 x i8] c"Detta \C3\A4r en warning utskrift\0A\00"
@LOG_ERR = global i32 0
@.str.5 = [29 x i8] c"Detta \C3\A4r en error utskrift\0A\00"
@LOG_CRIT = global i32 0
@.str.6 = [32 x i8] c"Detta \C3\A4r en critical utskrift\0A\00"
@LOG_ALERT = global i32 0
@.str.7 = [29 x i8] c"Detta \C3\A4r en alert utskrift\0A\00"
@LOG_EMERG = global i32 0
@.str.8 = [33 x i8] c"Detta \C3\A4r en emergency utskrift\0A\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 = call i32 @tsyslog_init(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %2, %7
%8 = load i32, i32* @LOG_DEBUG
%9 = call i32 @tsyslog(i32 %8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @LOG_INFO
%11 = call i32 @tsyslog(i32 %10, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32, i32* @LOG_NOTICE
%13 = call i32 @tsyslog(i32 %12, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%14 = load i32, i32* @LOG_WARNING
%15 = call i32 @tsyslog(i32 %14, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%16 = load i32, i32* @LOG_ERR
%17 = call i32 @tsyslog(i32 %16, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%18 = load i32, i32* @LOG_CRIT
%19 = call i32 @tsyslog(i32 %18, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
%20 = load i32, i32* @LOG_ALERT
%21 = call i32 @tsyslog(i32 %20, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%22 = load i32, i32* @LOG_EMERG
%23 = call i32 @tsyslog(i32 %22, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0))
%24 = call i32 @sleep(i32 2)
br label %7
}

LLVM IR (-O2):
@.str = [8 x i8] c"logtest\00"
@LOG_DEBUG = global i32 0
@.str.1 = [29 x i8] c"Detta \C3\A4r en debug utskrift\0A\00"
@LOG_INFO = global i32 0
@.str.2 = [28 x i8] c"Detta \C3\A4r en info utskrift\0A\00"
@LOG_NOTICE = global i32 0
@.str.3 = [30 x i8] c"Detta \C3\A4r en notice utskrift\0A\00"
@LOG_WARNING = global i32 0
@.str.4 = [31 x i8] c"Detta \C3\A4r en warning utskrift\0A\00"
@LOG_ERR = global i32 0
@.str.5 = [29 x i8] c"Detta \C3\A4r en error utskrift\0A\00"
@LOG_CRIT = global i32 0
@.str.6 = [32 x i8] c"Detta \C3\A4r en critical utskrift\0A\00"
@LOG_ALERT = global i32 0
@.str.7 = [29 x i8] c"Detta \C3\A4r en alert utskrift\0A\00"
@LOG_EMERG = global i32 0
@.str.8 = [33 x i8] c"Detta \C3\A4r en emergency utskrift\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @tsyslog_init(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %2, %4
%5 = load i32, i32* @LOG_DEBUG
%6 = tail call i32 @tsyslog(i32 %5, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* @LOG_INFO
%8 = tail call i32 @tsyslog(i32 %7, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32, i32* @LOG_NOTICE
%10 = tail call i32 @tsyslog(i32 %9, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
%11 = load i32, i32* @LOG_WARNING
%12 = tail call i32 @tsyslog(i32 %11, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
%13 = load i32, i32* @LOG_ERR
%14 = tail call i32 @tsyslog(i32 %13, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%15 = load i32, i32* @LOG_CRIT
%16 = tail call i32 @tsyslog(i32 %15, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
%17 = load i32, i32* @LOG_ALERT
%18 = tail call i32 @tsyslog(i32 %17, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%19 = load i32, i32* @LOG_EMERG
%20 = tail call i32 @tsyslog(i32 %19, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0))
%21 = tail call i32 @sleep(i32 2)
br label %4
}