#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_PID;
int /*<<< orphan*/ LOG_USER;
int /*<<< orphan*/ openlog(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *);
int main(void) {
  int i;
  openlog("syslog_flood", LOG_PID, LOG_USER);
  for (i = 0; i < 100; ++i) {
    syslog(LOG_ALERT, "Good-bye, World!");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%esi
mov    0x2ea9(%rip),%rax
mov    (%rax),%edx
lea    0xeb8(%rip),%rdi
call   1040 <openlog@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1181 <main+0x61>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
call   1030 <syslog@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <main+0x34>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    0x2ea5(%rip),%rax
mov    (%rax),%esi
mov    0x2eb4(%rip),%rax
mov    (%rax),%edx
lea    0xec3(%rip),%rdi
call   1040 <openlog@plt>
mov    $0x64,%ebp
mov    0x2e92(%rip),%r14
lea    0xeb8(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14),%edi
mov    %rbx,%rsi
call   1030 <syslog@plt>
add    $0xffffffff,%ebp
jne    1160 <main+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"syslog_flood\00"
@LOG_PID = global i32 0
@LOG_USER = global i32 0
@LOG_ALERT = global i32 0
@.str.1 = [17 x i8] c"Good-bye, World!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @LOG_PID
%4 = load i32, i32* @LOG_USER
%5 = call i32 @openlog(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
store i32 0, i32* %2
br label %6
6: ; preds = %12, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 100
br i1 %8, label %9, label %15
9: ; preds = %6
%10 = load i32, i32* @LOG_ALERT
%11 = call i32 @syslog(i32 %10, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %9
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %6
15: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"syslog_flood\00"
@LOG_PID = global i32 0
@LOG_USER = global i32 0
@LOG_ALERT = global i32 0
@.str.1 = [17 x i8] c"Good-bye, World!\00"
define i32 @main() {
%1 = load i32, i32* @LOG_PID
%2 = load i32, i32* @LOG_USER
%3 = tail call i32 @openlog(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
br label %4
4: ; preds = %0, %4
%5 = phi i32 [ 0, %0 ], [ %8, %4 ]
%6 = load i32, i32* @LOG_ALERT
%7 = tail call i32 @syslog(i32 %6, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%8 = add nuw nsw i32 %5, 1
%9 = icmp eq i32 %8, 100
br i1 %9, label %10, label %4
10: ; preds = %4
ret i32 0
}