#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*/ fprintf(int /*<<< orphan*/, char *, int);
unsigned int pow(int, int);
int rand();
int /*<<< orphan*/ stdout;
int main() {
  for (unsigned int i = 0; i < pow(10, 12); i++)
    fprintf(stdout, "%d ", rand() % 10000);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0xa,%edi
mov    $0xc,%esi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cmp    %ecx,%eax
jae    11a0 <main+0x70>
mov    0x2e71(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    -0x10(%rbp),%edi
mov    $0x2710,%ecx
cltd
idiv   %ecx
lea    0xe73(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0xa,%edi
mov    $0xc,%esi
call   1040 <pow@plt>
test   %eax,%eax
je     11a9 <main+0x79>
mov    0x2e8f(%rip),%r14
lea    0xea8(%rip),%r15
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r14),%ebp
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%rdx
imul   $0x68db8bad,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%rax
add    %ecx,%eax
imul   $0x2710,%eax,%eax
sub    %eax,%edx
mov    %ebp,%edi
mov    %r15,%rsi
call   1030 <fprintf@plt>
add    $0x1,%ebx
mov    $0xa,%edi
mov    $0xc,%esi
call   1040 <pow@plt>
cmp    %eax,%ebx
jb     1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@stdout = global i32 0
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = tail call i32 @pow(i32 10, i32 12)
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %4
3: ; preds = %4, %0
ret i32 0
4: ; preds = %0, %4
%5 = phi i32 [ %10, %4 ], [ 0, %0 ]
%6 = load i32, i32* @stdout
%7 = tail call i32 (...) @rand()
%8 = srem i32 %7, 10000
%9 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = add nuw i32 %5, 1
%11 = tail call i32 @pow(i32 10, i32 12)
%12 = icmp ult i32 %10, %11
br i1 %12, label %4, label %3
}