#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*/ file_write(int /*<<< orphan*/, char *);
int /*<<< orphan*/ rand();
void main() {
  unsigned i;
  for (i = 0; i < 4096; i++) {
    file_write(rand(), "x");
    file_write(rand(), "y");
    file_write(rand(), "z");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x1000,-0x4(%rbp)
jae    1189 <main+0x69>
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,%edi
lea    0xeb4(%rip),%rsi
call   1030 <file_write@plt>
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,%edi
lea    0xea1(%rip),%rsi
call   1030 <file_write@plt>
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,%edi
lea    0xe8e(%rip),%rsi
call   1030 <file_write@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <main+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1000,%ebp
lea    0xecd(%rip),%r14
lea    0xec8(%rip),%r15
lea    0xec3(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1030 <file_write@plt>
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%edi
mov    %r15,%rsi
call   1030 <file_write@plt>
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1030 <file_write@plt>
add    $0xffffffff,%ebp
jne    1150 <main+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"x\00"
@.str.1 = [2 x i8] c"y\00"
@.str.2 = [2 x i8] c"z\00"
define void @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %12, %0
%3 = load i32, i32* %1
%4 = icmp ult i32 %3, 4096
br i1 %4, label %5, label %15
5: ; preds = %2
%6 = call i32 (...) @rand()
%7 = call i32 @file_write(i32 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @rand()
%9 = call i32 @file_write(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (...) @rand()
%11 = call i32 @file_write(i32 %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %5
%13 = load i32, i32* %1
%14 = add i32 %13, 1
store i32 %14, i32* %1
br label %2
15: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"x\00"
@.str.1 = [2 x i8] c"y\00"
@.str.2 = [2 x i8] c"z\00"
define void @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %9, %1 ]
%3 = tail call i32 (...) @rand()
%4 = tail call i32 @file_write(i32 %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (...) @rand()
%6 = tail call i32 @file_write(i32 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 (...) @rand()
%8 = tail call i32 @file_write(i32 %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%9 = add nuw nsw i32 %2, 1
%10 = icmp eq i32 %9, 4096
br i1 %10, label %11, label %1
11: ; preds = %1
ret void
}