#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*/ map_rgb(int, int, int);
int rand();
int /*<<< orphan*/ set_pixel(int, int, int /*<<< orphan*/);
void render() {
  static int i, z;
  for (i = 0; i < 480; i++)
    for (z = 0; z < 272; z++)
      set_pixel(i, z, map_rgb(rand() % 255, rand() % 255, rand() % 255));
}


x86 assembly (clang, -O0):
<render>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,0x2efa(%rip)
cmpl   $0x1e0,0x2ef0(%rip)
jge    11f6 <render+0xc6>
movl   $0x0,0x2ee4(%rip)
cmpl   $0x110,0x2eda(%rip)
jge    11dd <render+0xad>
mov    0x2eca(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0x2ec5(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0xff,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0xff,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0xff,%ecx
cltd
idiv   %ecx
call   1030 <map_rgb@plt>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    %eax,%edx
call   1040 <set_pixel@plt>
mov    0x2e71(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e68(%rip)
jmp    115c <render+0x2c>
jmp    11e2 <render+0xb2>
mov    0x2e54(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e4b(%rip)
jmp    1142 <render+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<render>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x2efb(%rip)
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movl   $0x0,0x2ee6(%rip)
xor    %r15d,%r15d
nopl   (%rax)
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0xffffffff80808081,%rax,%rbx
shr    $0x20,%rbx
add    %eax,%ebx
mov    %ebx,%ecx
shr    $0x1f,%ecx
sar    $0x7,%ebx
add    %ecx,%ebx
mov    %ebx,%ecx
shl    $0x8,%ecx
sub    %ecx,%ebx
add    %eax,%ebx
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0xffffffff80808081,%rax,%rbp
shr    $0x20,%rbp
add    %eax,%ebp
mov    %ebp,%ecx
shr    $0x1f,%ecx
sar    $0x7,%ebp
add    %ecx,%ebp
mov    %ebp,%ecx
shl    $0x8,%ecx
sub    %ecx,%ebp
add    %eax,%ebp
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0xffffffff80808081,%rax,%rdx
shr    $0x20,%rdx
add    %eax,%edx
mov    %edx,%ecx
shr    $0x1f,%ecx
sar    $0x7,%edx
add    %ecx,%edx
mov    %edx,%ecx
shl    $0x8,%ecx
sub    %ecx,%edx
add    %eax,%edx
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <map_rgb@plt>
mov    %r14d,%edi
mov    %r15d,%esi
mov    %eax,%edx
call   1040 <set_pixel@plt>
mov    0x2e49(%rip),%eax
lea    0x1(%rax),%r15d
mov    %r15d,0x2e3e(%rip)
mov    0x2e33(%rip),%r14d
cmp    $0x10f,%eax
jl     1160 <render+0x30>
lea    0x1(%r14),%eax
mov    %eax,0x2e1e(%rip)
cmp    $0x1df,%r14d
mov    %eax,%r14d
jl     1150 <render+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@render.i = internal global i32 0
@render.z = internal global i32 0
define void @render() {
store i32 0, i32* @render.i
br label %1
1: ; preds = %23, %0
%2 = load i32, i32* @render.i
%3 = icmp slt i32 %2, 480
br i1 %3, label %4, label %26
4: ; preds = %1
store i32 0, i32* @render.z
br label %5
5: ; preds = %19, %4
%6 = load i32, i32* @render.z
%7 = icmp slt i32 %6, 272
br i1 %7, label %8, label %22
8: ; preds = %5
%9 = load i32, i32* @render.i
%10 = load i32, i32* @render.z
%11 = call i32 (...) @rand()
%12 = srem i32 %11, 255
%13 = call i32 (...) @rand()
%14 = srem i32 %13, 255
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 255
%17 = call i32 @map_rgb(i32 %12, i32 %14, i32 %16)
%18 = call i32 @set_pixel(i32 %9, i32 %10, i32 %17)
br label %19
19: ; preds = %8
%20 = load i32, i32* @render.z
%21 = add nsw i32 %20, 1
store i32 %21, i32* @render.z
br label %5
22: ; preds = %5
br label %23
23: ; preds = %22
%24 = load i32, i32* @render.i
%25 = add nsw i32 %24, 1
store i32 %25, i32* @render.i
br label %1
26: ; preds = %1
ret void
}

LLVM IR (-O2):
@render.i = internal unnamed_addr global i32 0
@render.z = internal unnamed_addr global i32 0
define void @render() {
store i32 0, i32* @render.i
br label %1
1: ; preds = %0, %18
%2 = phi i32 [ 0, %0 ], [ %19, %18 ]
store i32 0, i32* @render.z
br label %3
3: ; preds = %3, %1
%4 = phi i32 [ %2, %1 ], [ %17, %3 ]
%5 = phi i32 [ 0, %1 ], [ %15, %3 ]
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 255
%8 = tail call i32 (...) @rand()
%9 = srem i32 %8, 255
%10 = tail call i32 (...) @rand()
%11 = srem i32 %10, 255
%12 = tail call i32 @map_rgb(i32 %7, i32 %9, i32 %11)
%13 = tail call i32 @set_pixel(i32 %4, i32 %5, i32 %12)
%14 = load i32, i32* @render.z
%15 = add nsw i32 %14, 1
store i32 %15, i32* @render.z
%16 = icmp slt i32 %14, 271
%17 = load i32, i32* @render.i
br i1 %16, label %3, label %18
18: ; preds = %3
%19 = add nsw i32 %17, 1
store i32 %19, i32* @render.i
%20 = icmp slt i32 %17, 479
br i1 %20, label %1, label %21
21: ; preds = %18
ret void
}