#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*/ GL_COLOR_BUFFER_BIT;
int /*<<< orphan*/ GL_QUADS;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glColor3f(int, double, double);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glVertex2f(int, int);
int /*<<< orphan*/ glutSwapBuffers();
void render(void) {
  glClear(GL_COLOR_BUFFER_BIT);
  int i;
  for (i = 0; i < 10; i++) {
    glColor3f(i * 0.1, 0.0, 0.0);
    glBegin(GL_QUADS);
    glVertex2f(i * 10.0, i * 10.0);
    glVertex2f(320 - (i * 10.0), i * 10.0);
    glVertex2f(320 - (i * 10.0), 240 - (i * 10.0));
    glVertex2f(i * 10.0, 240 - (i * 10.0));
    glEnd();
  }
  glutSwapBuffers();
}


x86 assembly (clang, -O0):
<render>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1312 <render+0x1b2>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xe84(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
xorps  %xmm1,%xmm1
movaps %xmm1,%xmm0
call   1060 <glColor3f@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
call   1080 <glBegin@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xe3e(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xe29(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
call   1070 <glVertex2f@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xdf8(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdfc(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xdd7(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
call   1070 <glVertex2f@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xda6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdaa(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
cvtsi2sdl -0x4(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xd6e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd6a(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
call   1070 <glVertex2f@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xd48(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
cvtsi2sdl -0x4(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xd1c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd18(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
call   1070 <glVertex2f@plt>
mov    $0x0,%al
call   1050 <glEnd@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    117d <render+0x1d>
mov    $0x0,%al
call   1040 <glutSwapBuffers@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<render>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
xorpd  %xmm0,%xmm0
mov    $0xa,%r15d
mov    0x2e5d(%rip),%r12
nopl   0x0(%rax,%rax,1)
movapd %xmm0,(%rsp)
movapd (%rsp),%xmm0
mulsd  0xe5e(%rip),%xmm0
cvttsd2si %xmm0,%edi
xorpd  %xmm0,%xmm0
xorps  %xmm1,%xmm1
call   1060 <glColor3f@plt>
mov    (%r12),%edi
call   1080 <glBegin@plt>
movapd (%rsp),%xmm0
movsd  0xe40(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ebx
mov    %ebx,%edi
mov    %ebx,%esi
call   1070 <glVertex2f@plt>
movapd (%rsp),%xmm0
xorpd  0xe4a(%rip),%xmm0
mulsd  0xe1a(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
addsd  0xe14(%rip),%xmm0
cvttsd2si %xmm0,%r14d
mov    %r14d,%edi
mov    %ebx,%esi
call   1070 <glVertex2f@plt>
movapd 0x10(%rsp),%xmm0
addsd  0xdff(%rip),%xmm0
cvttsd2si %xmm0,%ebp
mov    %r14d,%edi
mov    %ebp,%esi
call   1070 <glVertex2f@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1070 <glVertex2f@plt>
xor    %eax,%eax
call   1050 <glEnd@plt>
movapd (%rsp),%xmm0
addsd  0xddc(%rip),%xmm0
add    $0xffffffff,%r15d
jne    1190 <render+0x30>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <glutSwapBuffers@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_QUADS = global i32 0
define void @render() {
%1 = alloca i32
%2 = load i32, i32* @GL_COLOR_BUFFER_BIT
%3 = call i32 @glClear(i32 %2)
store i32 0, i32* %1
br label %4
4: ; preds = %56, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %59
7: ; preds = %4
%8 = load i32, i32* %1
%9 = sitofp i32 %8 to double
%10 = fmul double %9, 1.000000e-01
%11 = fptosi double %10 to i32
%12 = call i32 @glColor3f(i32 %11, double 0.000000e+00, double 0.000000e+00)
%13 = load i32, i32* @GL_QUADS
%14 = call i32 @glBegin(i32 %13)
%15 = load i32, i32* %1
%16 = sitofp i32 %15 to double
%17 = fmul double %16, 1.000000e+01
%18 = fptosi double %17 to i32
%19 = load i32, i32* %1
%20 = sitofp i32 %19 to double
%21 = fmul double %20, 1.000000e+01
%22 = fptosi double %21 to i32
%23 = call i32 @glVertex2f(i32 %18, i32 %22)
%24 = load i32, i32* %1
%25 = sitofp i32 %24 to double
%26 = fneg double %25
%27 = call double @llvm.fmuladd.f64(double %26, double 1.000000e+01, double 3.200000e+02)
%28 = fptosi double %27 to i32
%29 = load i32, i32* %1
%30 = sitofp i32 %29 to double
%31 = fmul double %30, 1.000000e+01
%32 = fptosi double %31 to i32
%33 = call i32 @glVertex2f(i32 %28, i32 %32)
%34 = load i32, i32* %1
%35 = sitofp i32 %34 to double
%36 = fneg double %35
%37 = call double @llvm.fmuladd.f64(double %36, double 1.000000e+01, double 3.200000e+02)
%38 = fptosi double %37 to i32
%39 = load i32, i32* %1
%40 = sitofp i32 %39 to double
%41 = fneg double %40
%42 = call double @llvm.fmuladd.f64(double %41, double 1.000000e+01, double 2.400000e+02)
%43 = fptosi double %42 to i32
%44 = call i32 @glVertex2f(i32 %38, i32 %43)
%45 = load i32, i32* %1
%46 = sitofp i32 %45 to double
%47 = fmul double %46, 1.000000e+01
%48 = fptosi double %47 to i32
%49 = load i32, i32* %1
%50 = sitofp i32 %49 to double
%51 = fneg double %50
%52 = call double @llvm.fmuladd.f64(double %51, double 1.000000e+01, double 2.400000e+02)
%53 = fptosi double %52 to i32
%54 = call i32 @glVertex2f(i32 %48, i32 %53)
%55 = call i32 (...) @glEnd()
br label %56
56: ; preds = %7
%57 = load i32, i32* %1
%58 = add nsw i32 %57, 1
store i32 %58, i32* %1
br label %4
59: ; preds = %4
%60 = call i32 (...) @glutSwapBuffers()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_QUADS = global i32 0
define void @render() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = tail call i32 @glClear(i32 %1)
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %23, %3 ]
%5 = sitofp i32 %4 to double
%6 = fmul double %5, 1.000000e-01
%7 = fptosi double %6 to i32
%8 = tail call i32 @glColor3f(i32 %7, double 0.000000e+00, double 0.000000e+00)
%9 = load i32, i32* @GL_QUADS
%10 = tail call i32 @glBegin(i32 %9)
%11 = fmul double %5, 1.000000e+01
%12 = fptosi double %11 to i32
%13 = tail call i32 @glVertex2f(i32 %12, i32 %12)
%14 = fneg double %5
%15 = tail call double @llvm.fmuladd.f64(double %14, double 1.000000e+01, double 3.200000e+02)
%16 = fptosi double %15 to i32
%17 = tail call i32 @glVertex2f(i32 %16, i32 %12)
%18 = tail call double @llvm.fmuladd.f64(double %14, double 1.000000e+01, double 2.400000e+02)
%19 = fptosi double %18 to i32
%20 = tail call i32 @glVertex2f(i32 %16, i32 %19)
%21 = tail call i32 @glVertex2f(i32 %12, i32 %19)
%22 = tail call i32 (...) @glEnd()
%23 = add nuw nsw i32 %4, 1
%24 = icmp eq i32 %23, 10
br i1 %24, label %25, label %3
25: ; preds = %3
%26 = tail call i32 (...) @glutSwapBuffers()
ret void
}