#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 GLint;

/* Variables and functions */
int /*<<< orphan*/ GL_COLOR_BUFFER_BIT;
int /*<<< orphan*/ GL_POLYGON;
int /*<<< orphan*/ cos(double);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glColor3f(double, double, double);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glFlush();
int /*<<< orphan*/ glVertex2f(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sin(double);
void display() {
  glClear(GL_COLOR_BUFFER_BIT);
  const double PI = 3.14159265358979;
  GLint circlePoints = 128;
  glColor3f(1.0, 1.0, 1.0);
  glBegin(GL_POLYGON);
  int i;
  double angle;
  for (i = 0; i < circlePoints; i++) {
    angle = 2 * PI * i / circlePoints;
    glVertex2f(cos(angle), sin(angle));
  }
  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>
movsd  0xe6a(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movl   $0x80,-0xc(%rbp)
movsd  0xe4e(%rip),%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1060 <glColor3f@plt>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
call   10a0 <glBegin@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    122c <display+0xac>
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xe25(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1090 <cos@plt>
mov    %eax,-0x1c(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <sin@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
call   1080 <glVertex2f@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11d2 <display+0x52>
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   %rbp
push   %rbx
sub    $0x18,%rsp
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
movsd  0xe64(%rip),%xmm0
movapd %xmm0,%xmm1
movapd %xmm0,%xmm2
call   1060 <glColor3f@plt>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
call   10a0 <glBegin@plt>
xorpd  %xmm0,%xmm0
mov    $0x80,%ebp
movsd  %xmm0,0x10(%rsp)
mulsd  0xe3a(%rip),%xmm0
mulsd  0xe3a(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1090 <cos@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1050 <sin@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1080 <glVertex2f@plt>
movsd  0x10(%rsp),%xmm0
addsd  0xdfb(%rip),%xmm0
add    $0xffffffff,%ebp
jne    11c0 <display+0x40>
xor    %eax,%eax
call   1040 <glEnd@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
jmp    1070 <glFlush@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_POLYGON = global i32 0
define void @display() {
%1 = alloca double
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = load i32, i32* @GL_COLOR_BUFFER_BIT
%6 = call i32 @glClear(i32 %5)
store double 0x400921FB54442D11, double* %1
store i32 128, i32* %2
%7 = call i32 @glColor3f(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00)
%8 = load i32, i32* @GL_POLYGON
%9 = call i32 @glBegin(i32 %8)
store i32 0, i32* %3
br label %10
10: ; preds = %26, %0
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %29
14: ; preds = %10
%15 = load i32, i32* %3
%16 = sitofp i32 %15 to double
%17 = fmul double 0x401921FB54442D11, %16
%18 = load i32, i32* %2
%19 = sitofp i32 %18 to double
%20 = fdiv double %17, %19
store double %20, double* %4
%21 = load double, double* %4
%22 = call i32 @cos(double %21)
%23 = load double, double* %4
%24 = call i32 @sin(double %23)
%25 = call i32 @glVertex2f(i32 %22, i32 %24)
br label %26
26: ; preds = %14
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %10
29: ; preds = %10
%30 = call i32 (...) @glEnd()
%31 = 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 = tail call i32 @glColor3f(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00)
%4 = load i32, i32* @GL_POLYGON
%5 = tail call i32 @glBegin(i32 %4)
br label %6
6: ; preds = %0, %6
%7 = phi i32 [ 0, %0 ], [ %14, %6 ]
%8 = sitofp i32 %7 to double
%9 = fmul double %8, 0x401921FB54442D11
%10 = fmul double %9, 7.812500e-03
%11 = tail call i32 @cos(double %10)
%12 = tail call i32 @sin(double %10)
%13 = tail call i32 @glVertex2f(i32 %11, i32 %12)
%14 = add nuw nsw i32 %7, 1
%15 = icmp eq i32 %14, 128
br i1 %15, label %16, label %6
16: ; preds = %6
%17 = tail call i32 (...) @glEnd()
%18 = tail call i32 (...) @glFlush()
ret void
}