#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 */
struct rlimit {
  int rlim_cur;
};

/* Variables and functions */
int /*<<< orphan*/ RLIMIT_FSIZE;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ getrlimit(int /*<<< orphan*/, struct rlimit *);
int /*<<< orphan*/ setrlimit(int /*<<< orphan*/, struct rlimit *);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  struct rlimit rl;
  getrlimit(RLIMIT_FSIZE, &rl);
  rl.rlim_cur = 5;
  setrlimit(RLIMIT_FSIZE, &rl);
  while (1) {
    fprintf(stdout, "Hello World!\n");
    fflush(stdout);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
call   1060 <getrlimit@plt>
movl   $0x5,-0x18(%rbp)
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
call   1050 <setrlimit@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
lea    0xe6f(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
jmp    1181 <main+0x41>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2e85(%rip),%r14
mov    (%r14),%edi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1060 <getrlimit@plt>
movl   $0x5,(%rsp)
mov    (%r14),%edi
mov    %rbx,%rsi
call   1050 <setrlimit@plt>
mov    0x2e6e(%rip),%rbx
lea    0xe87(%rip),%r14
nopl   0x0(%rax)
mov    (%rbx),%edi
mov    %r14,%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
call   1040 <fflush@plt>
jmp    1180 <main+0x40>

LLVM IR (-O0):
%struct.rlimit = type { i32 }
@RLIMIT_FSIZE = global i32 0
@stdout = global i32 0
@.str = [14 x i8] c"Hello World!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.rlimit
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* @RLIMIT_FSIZE
%8 = call i32 @getrlimit(i32 %7, %struct.rlimit* %6)
%9 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %6, i32 0, i32 0
store i32 5, i32* %9
%10 = load i32, i32* @RLIMIT_FSIZE
%11 = call i32 @setrlimit(i32 %10, %struct.rlimit* %6)
br label %12
12: ; preds = %2, %12
%13 = load i32, i32* @stdout
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @stdout
%16 = call i32 @fflush(i32 %15)
br label %12
}

LLVM IR (-O2):
%struct.rlimit = type { i32 }
@RLIMIT_FSIZE = global i32 0
@stdout = global i32 0
@.str = [14 x i8] c"Hello World!\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.rlimit
%4 = bitcast %struct.rlimit* %3 to i8*
%5 = load i32, i32* @RLIMIT_FSIZE
%6 = call i32 @getrlimit(i32 %5, %struct.rlimit* %3)
%7 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %3, i64 0, i32 0
store i32 5, i32* %7
%8 = load i32, i32* @RLIMIT_FSIZE
%9 = call i32 @setrlimit(i32 %8, %struct.rlimit* %3)
br label %10
10: ; preds = %10, %2
%11 = load i32, i32* @stdout
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @stdout
%14 = call i32 @fflush(i32 %13)
br label %10
}