#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_LINE_LOOP;
float 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*/ glVertex3f(float, float, float);
float sin(double);
void display(void) {
  glClear(GL_COLOR_BUFFER_BIT);
  glColor3f(1.0, 1.0, 1.0);
  glBegin(GL_LINE_LOOP);
  int n = 256;
  float r = 0.3;
  for (int i = 0; i < n; i++) {
    float x = r * cos(2.0 * 3.1415926536 * (float)i / (float)n);
    float y = r * sin(2.0 * 3.1415926536 * (float)i / (float)n);
    float z = 0.0;
    glVertex3f(x, y, z);
  }
  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),%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1070 <glColor3f@plt>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
call   10a0 <glBegin@plt>
movl   $0x100,-0x4(%rbp)
movss  0xe3a(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    128c <display+0x10c>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe17(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2ssl -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
call   1090 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x20(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdd5(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2ssl -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
call   1060 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
movss  -0x18(%rbp),%xmm2
call   1040 <glVertex3f@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11d2 <display+0x52>
mov    $0x0,%al
call   1050 <glEnd@plt>
mov    $0x0,%al
call   1080 <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>
movsd  0xe65(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
call   1070 <glColor3f@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   10a0 <glBegin@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe35(%rip),%xmm0
mulsd  0xe35(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1090 <cos@plt>
movapd %xmm0,%xmm1
movss  0xe26(%rip),%xmm0
mulss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movsd  0x8(%rsp),%xmm0
call   1060 <sin@plt>
movaps %xmm0,%xmm1
mulss  0xe06(%rip),%xmm1
xorps  %xmm2,%xmm2
movss  0x4(%rsp),%xmm0
call   1040 <glVertex3f@plt>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    11c0 <display+0x40>
xor    %eax,%eax
call   1050 <glEnd@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1080 <glFlush@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_LINE_LOOP = global i32 0
define void @display() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = load i32, i32* @GL_COLOR_BUFFER_BIT
%8 = call i32 @glClear(i32 %7)
%9 = call i32 @glColor3f(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00)
%10 = load i32, i32* @GL_LINE_LOOP
%11 = call i32 @glBegin(i32 %10)
store i32 256, i32* %1
store float 0x3FD3333340000000, float* %2
store i32 0, i32* %3
br label %12
12: ; preds = %43, %0
%13 = load i32, i32* %3
%14 = load i32, i32* %1
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %46
16: ; preds = %12
%17 = load float, float* %2
%18 = load i32, i32* %3
%19 = sitofp i32 %18 to float
%20 = fpext float %19 to double
%21 = fmul double 0x401921FB544486E0, %20
%22 = load i32, i32* %1
%23 = sitofp i32 %22 to float
%24 = fpext float %23 to double
%25 = fdiv double %21, %24
%26 = call float @cos(double %25)
%27 = fmul float %17, %26
store float %27, float* %4
%28 = load float, float* %2
%29 = load i32, i32* %3
%30 = sitofp i32 %29 to float
%31 = fpext float %30 to double
%32 = fmul double 0x401921FB544486E0, %31
%33 = load i32, i32* %1
%34 = sitofp i32 %33 to float
%35 = fpext float %34 to double
%36 = fdiv double %32, %35
%37 = call float @sin(double %36)
%38 = fmul float %28, %37
store float %38, float* %5
store float 0.000000e+00, float* %6
%39 = load float, float* %4
%40 = load float, float* %5
%41 = load float, float* %6
%42 = call i32 @glVertex3f(float %39, float %40, float %41)
br label %43
43: ; preds = %16
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 1
store i32 %45, i32* %3
br label %12
46: ; preds = %12
%47 = call i32 (...) @glEnd()
%48 = call i32 (...) @glFlush()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_LINE_LOOP = 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_LINE_LOOP
%5 = tail call i32 @glBegin(i32 %4)
br label %9
6: ; preds = %9
%7 = tail call i32 (...) @glEnd()
%8 = tail call i32 (...) @glFlush()
ret void
9: ; preds = %0, %9
%10 = phi i32 [ 0, %0 ], [ %20, %9 ]
%11 = sitofp i32 %10 to float
%12 = fpext float %11 to double
%13 = fmul double %12, 0x401921FB544486E0
%14 = fmul double %13, 3.906250e-03
%15 = tail call float @cos(double %14)
%16 = fmul float %15, 0x3FD3333340000000
%17 = tail call float @sin(double %14)
%18 = fmul float %17, 0x3FD3333340000000
%19 = tail call i32 @glVertex3f(float %16, float %18, float 0.000000e+00)
%20 = add nuw nsw i32 %10, 1
%21 = icmp eq i32 %20, 256
br i1 %21, label %6, label %9
}