#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 */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
int rand();
int main(int argc, char *argv[]) {
  char a[480 * 800];
  for (int i = 0; i < sizeof(a); i++) {
    a[i] = 0;
  }
  for (int i = 0; i < 300; i++) {
    a[rand() % sizeof(a)] = 0x80 + (rand() & 0x7f);
  }
  printf("P2\n%d %d\n255\n", 800, 480);
  for (int i = 0; i < sizeof(a); i++) {
    printf("%d ", (int)a[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x5dc20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x5dc14(%rbp)
movslq -0x5dc14(%rbp),%rax
cmp    $0x5dc00,%rax
jae    1179 <main+0x59>
movslq -0x5dc14(%rbp),%rax
movb   $0x0,-0x5dc10(%rbp,%rax,1)
mov    -0x5dc14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5dc14(%rbp)
jmp    1143 <main+0x23>
movl   $0x0,-0x5dc18(%rbp)
cmpl   $0x12c,-0x5dc18(%rbp)
jge    11dc <main+0xbc>
mov    $0x0,%al
call   1040 <rand@plt>
and    $0x7f,%eax
add    $0x80,%eax
mov    %al,-0x5dc1d(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
cltq
mov    $0x5dc00,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x5dc1d(%rbp),%al
mov    %al,-0x5dc10(%rbp,%rdx,1)
mov    -0x5dc18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5dc18(%rbp)
jmp    1183 <main+0x63>
lea    0xe1d(%rip),%rdi
mov    $0x320,%esi
mov    $0x1e0,%edx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x5dc1c(%rbp)
movslq -0x5dc1c(%rbp),%rax
cmp    $0x5dc00,%rax
jae    1242 <main+0x122>
movslq -0x5dc1c(%rbp),%rax
movsbl -0x5dc10(%rbp,%rax,1),%esi
ff
lea    0xde7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x5dc1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5dc1c(%rbp)
jmp    11fe <main+0xde>
xor    %eax,%eax
add    $0x5dc20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x5dc00,%rsp
mov    %rsp,%rdi
mov    $0x5dc00,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    $0x12c,%ebp
movabs $0xaec33e1f671529a5,%r14
3e c3 ae
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <rand@plt>
mov    %eax,%ebx
or     $0x80,%bl
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%rcx
mov    %rcx,%rax
mul    %r14
shr    $0x12,%rdx
imul   $0x5dc00,%rdx,%rax
sub    %rax,%rcx
mov    %bl,(%rsp,%rcx,1)
add    $0xffffffff,%ebp
jne    1160 <main+0x30>
lea    0xe67(%rip),%rdi
mov    $0x320,%esi
mov    $0x1e0,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe5d(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%rsp,%rbp,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbp
cmp    $0x5dc00,%rbp
jne    11c0 <main+0x90>
xor    %eax,%eax
add    $0x5dc00,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"P2\0A%d %d\0A255\0A\00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [384000 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %10
10: ; preds = %18, %2
%11 = load i32, i32* %7
%12 = sext i32 %11 to i64
%13 = icmp ult i64 %12, 384000
br i1 %13, label %14, label %21
14: ; preds = %10
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [384000 x i8], [384000 x i8]* %6, i64 0, i64 %16
store i8 0, i8* %17
br label %18
18: ; preds = %14
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
br label %10
21: ; preds = %10
store i32 0, i32* %8
br label %22
22: ; preds = %34, %21
%23 = load i32, i32* %8
%24 = icmp slt i32 %23, 300
br i1 %24, label %25, label %37
25: ; preds = %22
%26 = call i32 (...) @rand()
%27 = and i32 %26, 127
%28 = add nsw i32 128, %27
%29 = trunc i32 %28 to i8
%30 = call i32 (...) @rand()
%31 = sext i32 %30 to i64
%32 = urem i64 %31, 384000
%33 = getelementptr inbounds [384000 x i8], [384000 x i8]* %6, i64 0, i64 %32
store i8 %29, i8* %33
br label %34
34: ; preds = %25
%35 = load i32, i32* %8
%36 = add nsw i32 %35, 1
store i32 %36, i32* %8
br label %22
37: ; preds = %22
%38 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 800, i32 480)
store i32 0, i32* %9
br label %39
39: ; preds = %50, %37
%40 = load i32, i32* %9
%41 = sext i32 %40 to i64
%42 = icmp ult i64 %41, 384000
br i1 %42, label %43, label %53
43: ; preds = %39
%44 = load i32, i32* %9
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [384000 x i8], [384000 x i8]* %6, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %43
%51 = load i32, i32* %9
%52 = add nsw i32 %51, 1
store i32 %52, i32* %9
br label %39
53: ; preds = %39
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"P2\0A%d %d\0A255\0A\00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [384000 x i8]
%4 = getelementptr inbounds [384000 x i8], [384000 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [384000 x i8], [384000 x i8]* %3, i64 0, i64 0
br label %8
6: ; preds = %8
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 800, i32 480)
br label %20
8: ; preds = %2, %8
%9 = phi i32 [ %17, %8 ], [ 0, %2 ]
%10 = tail call i32 (...) @rand()
%11 = trunc i32 %10 to i8
%12 = or i8 %11, -128
%13 = tail call i32 (...) @rand()
%14 = sext i32 %13 to i64
%15 = urem i64 %14, 384000
%16 = getelementptr inbounds [384000 x i8], [384000 x i8]* %3, i64 0, i64 %15
store i8 %12, i8* %16
%17 = add nuw nsw i32 %9, 1
%18 = icmp eq i32 %17, 300
br i1 %18, label %6, label %8
19: ; preds = %20
ret i32 0
20: ; preds = %6, %20
%21 = phi i64 [ 0, %6 ], [ %26, %20 ]
%22 = getelementptr inbounds [384000 x i8], [384000 x i8]* %3, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = add nuw nsw i64 %21, 1
%27 = icmp eq i64 %26, 384000
br i1 %27, label %19, label %20
}