#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_POLYGON;
float cos(float const);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glColor3f(int, int, int);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glFlush();
int /*<<< orphan*/ glVertex2f(float, float);
float sin(float const);
void display(void) {
  glClear(GL_COLOR_BUFFER_BIT);
  int i;
  float radius = 0.25f;
  const float PI = 3.1415926f;
  const float x0 = 0.5f;
  const float y0 = 0.5f;
  glBegin(GL_POLYGON);
  for (i = 0; i <= 360; i += 2) {
    glColor3f(i / 360.0f, i / 540.0f, i / 720.0f);
    glVertex2f(radius * cos(PI * i / 180.0f) + x0,
               radius * sin(PI * i / 180.0f) + y0);
  }
  glEnd();
  glFlush();
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
movss  0xe6a(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xe59(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe48(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe3b(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
call   10a0 <glBegin@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x168,-0x4(%rbp)
jg     12d5 <display+0x155>
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xe1f(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xe06(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%esi
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xded(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%edx
call   1060 <glColor3f@plt>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm1
movss  0xdbd(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  0xdb9(%rip),%xmm1
divss  %xmm1,%xmm0
call   1090 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x20(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  0xd90(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm1
movss  0xd74(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  0xd70(%rip),%xmm1
divss  %xmm1,%xmm0
call   1050 <sin@plt>
movss  -0x1c(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x18(%rbp),%xmm0
mulss  %xmm2,%xmm1
movss  0xd42(%rip),%xmm2
addss  %xmm2,%xmm1
call   1080 <glVertex2f@plt>
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
jmp    11df <display+0x5f>
mov    $0x0,%al
call   1040 <glEnd@plt>
mov    $0x0,%al
call   1070 <glFlush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rbx
sub    $0x10,%rsp
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
call   10a0 <glBegin@plt>
mov    $0xfffffffe,%ebx
cs nopw 0x0(%rax,%rax,1)
add    $0x2,%ebx
xorps  %xmm1,%xmm1
cvtsi2ss %ebx,%xmm1
movss  %xmm1,0x8(%rsp)
movaps %xmm1,%xmm0
divss  0xe35(%rip),%xmm0
cvttss2si %xmm0,%edi
movaps %xmm1,%xmm0
divss  0xe2a(%rip),%xmm0
cvttss2si %xmm0,%esi
movaps %xmm1,%xmm0
divss  0xe1f(%rip),%xmm0
cvttss2si %xmm0,%edx
call   1060 <glColor3f@plt>
movss  0x8(%rsp),%xmm0
mulss  0xe0c(%rip),%xmm0
divss  0xe08(%rip),%xmm0
movss  %xmm0,0x8(%rsp)
call   1090 <cos@plt>
movaps %xmm0,%xmm1
movss  0xdf6(%rip),%xmm0
mulss  %xmm0,%xmm1
movss  0xdee(%rip),%xmm0
addss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
mulss  0xdca(%rip),%xmm1
addss  0xdc6(%rip),%xmm1
movss  0xc(%rsp),%xmm0
call   1080 <glVertex2f@plt>
cmp    $0x167,%ebx
jb     11b0 <display+0x30>
xor    %eax,%eax
call   1040 <glEnd@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1070 <glFlush@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_POLYGON = global i32 0
define void @display() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = load i32, i32* @GL_COLOR_BUFFER_BIT
%7 = call i32 @glClear(i32 %6)
store float 2.500000e-01, float* %2
store float 0x400921FB40000000, float* %3
store float 5.000000e-01, float* %4
store float 5.000000e-01, float* %5
%8 = load i32, i32* @GL_POLYGON
%9 = call i32 @glBegin(i32 %8)
store i32 0, i32* %1
br label %10
10: ; preds = %42, %0
%11 = load i32, i32* %1
%12 = icmp sle i32 %11, 360
br i1 %12, label %13, label %45
13: ; preds = %10
%14 = load i32, i32* %1
%15 = sitofp i32 %14 to float
%16 = fdiv float %15, 3.600000e+02
%17 = fptosi float %16 to i32
%18 = load i32, i32* %1
%19 = sitofp i32 %18 to float
%20 = fdiv float %19, 5.400000e+02
%21 = fptosi float %20 to i32
%22 = load i32, i32* %1
%23 = sitofp i32 %22 to float
%24 = fdiv float %23, 7.200000e+02
%25 = fptosi float %24 to i32
%26 = call i32 @glColor3f(i32 %17, i32 %21, i32 %25)
%27 = load float, float* %2
%28 = load i32, i32* %1
%29 = sitofp i32 %28 to float
%30 = fmul float 0x400921FB40000000, %29
%31 = fdiv float %30, 1.800000e+02
%32 = call float @cos(float %31)
%33 = call float @llvm.fmuladd.f32(float %27, float %32, float 5.000000e-01)
%34 = load float, float* %2
%35 = load i32, i32* %1
%36 = sitofp i32 %35 to float
%37 = fmul float 0x400921FB40000000, %36
%38 = fdiv float %37, 1.800000e+02
%39 = call float @sin(float %38)
%40 = call float @llvm.fmuladd.f32(float %34, float %39, float 5.000000e-01)
%41 = call i32 @glVertex2f(float %33, float %40)
br label %42
42: ; preds = %13
%43 = load i32, i32* %1
%44 = add nsw i32 %43, 2
store i32 %44, i32* %1
br label %10
45: ; preds = %10
%46 = call i32 (...) @glEnd()
%47 = call i32 (...) @glFlush()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_POLYGON = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = tail call i32 @glClear(i32 %1)
%3 = load i32, i32* @GL_POLYGON
%4 = tail call i32 @glBegin(i32 %3)
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ 0, %0 ], [ %22, %5 ]
%7 = sitofp i32 %6 to float
%8 = fdiv float %7, 3.600000e+02
%9 = fptosi float %8 to i32
%10 = fdiv float %7, 5.400000e+02
%11 = fptosi float %10 to i32
%12 = fdiv float %7, 7.200000e+02
%13 = fptosi float %12 to i32
%14 = tail call i32 @glColor3f(i32 %9, i32 %11, i32 %13)
%15 = fmul float %7, 0x400921FB40000000
%16 = fdiv float %15, 1.800000e+02
%17 = tail call float @cos(float %16)
%18 = tail call float @llvm.fmuladd.f32(float %17, float 2.500000e-01, float 5.000000e-01)
%19 = tail call float @sin(float %16)
%20 = tail call float @llvm.fmuladd.f32(float %19, float 2.500000e-01, float 5.000000e-01)
%21 = tail call i32 @glVertex2f(float %18, float %20)
%22 = add nuw nsw i32 %6, 2
%23 = icmp ult i32 %6, 359
br i1 %23, label %5, label %24
24: ; preds = %5
%25 = tail call i32 (...) @glEnd()
%26 = tail call i32 (...) @glFlush()
ret void
}