#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 GL_COLOR_BUFFER_BIT;
int GL_DEPTH_BUFFER_BIT;
int /*<<< orphan*/ GL_POLYGON;
int /*<<< orphan*/ InitGL();
double Random();
int /*<<< orphan*/ RandomColor();
int /*<<< orphan*/ drawBox(double, double, double, double, double, double,
                           int /*<<< orphan*/);
int /*<<< orphan*/ glClear(int);
int /*<<< orphan*/ glClearColor(double, double, double, double);
int /*<<< orphan*/ glFinish();
int /*<<< orphan*/ glPopMatrix();
int /*<<< orphan*/ glPushMatrix();
int /*<<< orphan*/ glRotatef(float, float, float, float);
int /*<<< orphan*/ glScalef(float, float, float);
int /*<<< orphan*/ glTranslatef(float, float, float);
void Render(void) {
  int NumBoxes = 100;
  int i;
  InitGL();
  glClearColor(0.2, 0.2, 0.9, 0.0);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  for (i = 0; i < NumBoxes; i++) {
    float tx = -2.0 + 4.0 * Random();
    float ty = -2.0 + 4.0 * Random();
    float tz = 4.0 - 16.0 * Random();
    float sx = 0.1 + Random() * 0.4;
    float sy = 0.1 + Random() * 0.4;
    float sz = 0.1 + Random() * 0.4;
    float rx = Random();
    float ry = Random();
    float rz = Random();
    float ra = Random() * 360.0;
    glPushMatrix();
    glTranslatef(tx, ty, tz);
    glRotatef(ra, rx, ry, rz);
    glScalef(sx, sy, sz);
    RandomColor();
    drawBox(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0, GL_POLYGON);
    glPopMatrix();
  }
  glFinish();
}


x86 assembly (clang, -O0):
<Render>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x64,-0x4(%rbp)
mov    $0x0,%al
call   10a0 <InitGL@plt>
movsd  0xe22(%rip),%xmm1
movsd  0xe22(%rip),%xmm2
xorps  %xmm3,%xmm3
movaps %xmm1,%xmm0
call   1060 <glClearColor@plt>
mov    0x2dd8(%rip),%rax
mov    (%rax),%edi
mov    0x2ddf(%rip),%rax
or     (%rax),%edi
call   1030 <glClear@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    13e5 <Render+0x225>
mov    $0x0,%al
call   1040 <Random@plt>
movsd  0xe16(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe12(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <Random@plt>
movsd  0xdee(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdea(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <Random@plt>
movsd  0xdbe(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdba(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <Random@plt>
movsd  0xd86(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd82(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <Random@plt>
movsd  0xd5e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd5a(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    $0x0,%al
call   1040 <Random@plt>
movsd  0xd36(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd32(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1040 <Random@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
mov    $0x0,%al
call   1040 <Random@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
mov    $0x0,%al
call   1040 <Random@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    $0x0,%al
call   1040 <Random@plt>
movsd  0xcd6(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x30(%rbp)
mov    $0x0,%al
call   1090 <glPushMatrix@plt>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
call   10b0 <glTranslatef@plt>
movss  -0x30(%rbp),%xmm0
movss  -0x24(%rbp),%xmm1
movss  -0x28(%rbp),%xmm2
movss  -0x2c(%rbp),%xmm3
call   10e0 <glRotatef@plt>
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
movss  -0x20(%rbp),%xmm2
call   1080 <glScalef@plt>
mov    $0x0,%al
call   10c0 <RandomColor@plt>
mov    0x2c4b(%rip),%rax
mov    (%rax),%edi
movsd  0xc59(%rip),%xmm4
movsd  0xc59(%rip),%xmm5
movaps %xmm4,%xmm0
movaps %xmm5,%xmm1
movaps %xmm4,%xmm2
movaps %xmm5,%xmm3
call   10d0 <drawBox@plt>
mov    $0x0,%al
call   1070 <glPopMatrix@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    120f <Render+0x4f>
mov    $0x0,%al
call   1050 <glFinish@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Render>:
push   %r14
push   %rbx
sub    $0x28,%rsp
xor    %eax,%eax
call   10a0 <InitGL@plt>
movsd  0xe2a(%rip),%xmm0
movsd  0xe2a(%rip),%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
call   1060 <glClearColor@plt>
mov    0x2dde(%rip),%rax
mov    0x2de7(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   1030 <glClear@plt>
mov    $0x64,%ebx
mov    0x2dea(%rip),%r14
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <Random@plt>
movsd  0xdf1(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xded(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x24(%rsp)
xor    %eax,%eax
call   1040 <Random@plt>
mulsd  0xdc8(%rip),%xmm0
addsd  0xdc8(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x20(%rsp)
xor    %eax,%eax
call   1040 <Random@plt>
mulsd  0xdb7(%rip),%xmm0
addsd  0xd9f(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x18(%rsp)
xor    %eax,%eax
call   1040 <Random@plt>
movsd  0xd9e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd9a(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x1c(%rsp)
xor    %eax,%eax
call   1040 <Random@plt>
mulsd  0xd75(%rip),%xmm0
addsd  0xd75(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x14(%rsp)
xor    %eax,%eax
call   1040 <Random@plt>
mulsd  0xd54(%rip),%xmm0
addsd  0xd54(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1040 <Random@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   1040 <Random@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1040 <Random@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
xor    %eax,%eax
call   1040 <Random@plt>
mulsd  0xd10(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1090 <glPushMatrix@plt>
movss  0x24(%rsp),%xmm0
movss  0x20(%rsp),%xmm1
movss  0x18(%rsp),%xmm2
call   10b0 <glTranslatef@plt>
movss  (%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movss  0x8(%rsp),%xmm2
movss  0x4(%rsp),%xmm3
call   10e0 <glRotatef@plt>
movss  0x1c(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
movss  0x10(%rsp),%xmm2
call   1080 <glScalef@plt>
xor    %eax,%eax
call   10c0 <RandomColor@plt>
mov    (%r14),%edi
movsd  0xcac(%rip),%xmm0
movsd  0xcac(%rip),%xmm1
movapd %xmm0,%xmm2
movapd %xmm1,%xmm3
movapd %xmm0,%xmm4
movapd %xmm1,%xmm5
call   10d0 <drawBox@plt>
xor    %eax,%eax
call   1070 <glPopMatrix@plt>
add    $0xffffffff,%ebx
jne    1210 <Render+0x50>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
jmp    1050 <glFinish@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
@GL_POLYGON = global i32 0
define void @Render() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store i32 100, i32* %1
%13 = call i32 (...) @InitGL()
%14 = call i32 @glClearColor(double 2.000000e-01, double 2.000000e-01, double 9.000000e-01, double 0.000000e+00)
%15 = load i32, i32* @GL_COLOR_BUFFER_BIT
%16 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%17 = or i32 %15, %16
%18 = call i32 @glClear(i32 %17)
store i32 0, i32* %2
br label %19
19: ; preds = %69, %0
%20 = load i32, i32* %2
%21 = load i32, i32* %1
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %72
23: ; preds = %19
%24 = call double (...) @Random()
%25 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %24, double -2.000000e+00)
%26 = fptrunc double %25 to float
store float %26, float* %3
%27 = call double (...) @Random()
%28 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %27, double -2.000000e+00)
%29 = fptrunc double %28 to float
store float %29, float* %4
%30 = call double (...) @Random()
%31 = call double @llvm.fmuladd.f64(double -1.600000e+01, double %30, double 4.000000e+00)
%32 = fptrunc double %31 to float
store float %32, float* %5
%33 = call double (...) @Random()
%34 = call double @llvm.fmuladd.f64(double %33, double 4.000000e-01, double 1.000000e-01)
%35 = fptrunc double %34 to float
store float %35, float* %6
%36 = call double (...) @Random()
%37 = call double @llvm.fmuladd.f64(double %36, double 4.000000e-01, double 1.000000e-01)
%38 = fptrunc double %37 to float
store float %38, float* %7
%39 = call double (...) @Random()
%40 = call double @llvm.fmuladd.f64(double %39, double 4.000000e-01, double 1.000000e-01)
%41 = fptrunc double %40 to float
store float %41, float* %8
%42 = call double (...) @Random()
%43 = fptrunc double %42 to float
store float %43, float* %9
%44 = call double (...) @Random()
%45 = fptrunc double %44 to float
store float %45, float* %10
%46 = call double (...) @Random()
%47 = fptrunc double %46 to float
store float %47, float* %11
%48 = call double (...) @Random()
%49 = fmul double %48, 3.600000e+02
%50 = fptrunc double %49 to float
store float %50, float* %12
%51 = call i32 (...) @glPushMatrix()
%52 = load float, float* %3
%53 = load float, float* %4
%54 = load float, float* %5
%55 = call i32 @glTranslatef(float %52, float %53, float %54)
%56 = load float, float* %12
%57 = load float, float* %9
%58 = load float, float* %10
%59 = load float, float* %11
%60 = call i32 @glRotatef(float %56, float %57, float %58, float %59)
%61 = load float, float* %6
%62 = load float, float* %7
%63 = load float, float* %8
%64 = call i32 @glScalef(float %61, float %62, float %63)
%65 = call i32 (...) @RandomColor()
%66 = load i32, i32* @GL_POLYGON
%67 = call i32 @drawBox(double -1.000000e+00, double 1.000000e+00, double -1.000000e+00, double 1.000000e+00, double -1.000000e+00, double 1.000000e+00, i32 %66)
%68 = call i32 (...) @glPopMatrix()
br label %69
69: ; preds = %23
%70 = load i32, i32* %2
%71 = add nsw i32 %70, 1
store i32 %71, i32* %2
br label %19
72: ; preds = %19
%73 = call i32 (...) @glFinish()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
@GL_POLYGON = global i32 0
define void @Render() {
%1 = tail call i32 (...) @InitGL()
%2 = tail call i32 @glClearColor(double 2.000000e-01, double 2.000000e-01, double 9.000000e-01, double 0.000000e+00)
%3 = load i32, i32* @GL_COLOR_BUFFER_BIT
%4 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%5 = or i32 %4, %3
%6 = tail call i32 @glClear(i32 %5)
br label %7
7: ; preds = %0, %7
%8 = phi i32 [ 0, %0 ], [ %44, %7 ]
%9 = tail call double (...) @Random()
%10 = tail call double @llvm.fmuladd.f64(double %9, double 4.000000e+00, double -2.000000e+00)
%11 = fptrunc double %10 to float
%12 = tail call double (...) @Random()
%13 = tail call double @llvm.fmuladd.f64(double %12, double 4.000000e+00, double -2.000000e+00)
%14 = fptrunc double %13 to float
%15 = tail call double (...) @Random()
%16 = tail call double @llvm.fmuladd.f64(double %15, double -1.600000e+01, double 4.000000e+00)
%17 = fptrunc double %16 to float
%18 = tail call double (...) @Random()
%19 = tail call double @llvm.fmuladd.f64(double %18, double 4.000000e-01, double 1.000000e-01)
%20 = fptrunc double %19 to float
%21 = tail call double (...) @Random()
%22 = tail call double @llvm.fmuladd.f64(double %21, double 4.000000e-01, double 1.000000e-01)
%23 = fptrunc double %22 to float
%24 = tail call double (...) @Random()
%25 = tail call double @llvm.fmuladd.f64(double %24, double 4.000000e-01, double 1.000000e-01)
%26 = fptrunc double %25 to float
%27 = tail call double (...) @Random()
%28 = fptrunc double %27 to float
%29 = tail call double (...) @Random()
%30 = fptrunc double %29 to float
%31 = tail call double (...) @Random()
%32 = fptrunc double %31 to float
%33 = tail call double (...) @Random()
%34 = fmul double %33, 3.600000e+02
%35 = fptrunc double %34 to float
%36 = tail call i32 (...) @glPushMatrix()
%37 = tail call i32 @glTranslatef(float %11, float %14, float %17)
%38 = tail call i32 @glRotatef(float %35, float %28, float %30, float %32)
%39 = tail call i32 @glScalef(float %20, float %23, float %26)
%40 = tail call i32 (...) @RandomColor()
%41 = load i32, i32* @GL_POLYGON
%42 = tail call i32 @drawBox(double -1.000000e+00, double 1.000000e+00, double -1.000000e+00, double 1.000000e+00, double -1.000000e+00, double 1.000000e+00, i32 %41)
%43 = tail call i32 (...) @glPopMatrix()
%44 = add nuw nsw i32 %8, 1
%45 = icmp eq i32 %44, 100
br i1 %45, label %46, label %7
46: ; preds = %7
%47 = tail call i32 (...) @glFinish()
ret void
}