#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;
double cos(int);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glClearColor(double, double, double, double);
int /*<<< orphan*/ glColor3f(double, double, double);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glFlush();
int /*<<< orphan*/ glVertex3d(double, double, int /*<<< orphan*/);
int /*<<< orphan*/ glutSwapBuffers();
double sin(int);
void Display() {
  glClearColor(1.0, 1.0, 1.0, 1.0);
  glClear(GL_COLOR_BUFFER_BIT);
  glColor3f(1.0, 0.0, 0.0);
  glBegin(GL_LINE_LOOP);
  int n = 3, k = n - 1;
  double PI = 3.14, fi, x, y;
  fi = 2 * PI / n;
  for (int i = 0; i < n; i++) {
    x = cos(i * fi);
    y = sin(i * fi);
    glVertex3d(x, y, 0);
  }
  glEnd();
  glFlush();
  glutSwapBuffers();
}


x86 assembly (clang, -O0):
<Display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  0xe60(%rip),%xmm3
movaps %xmm3,%xmm0
movaps %xmm3,%xmm1
movaps %xmm3,%xmm2
call   1070 <glClearColor@plt>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
movsd  0xe3c(%rip),%xmm0
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm1
call   1090 <glColor3f@plt>
mov    0x2e02(%rip),%rax
mov    (%rax),%edi
call   10c0 <glBegin@plt>
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
movsd  0xe03(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xdee(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1287 <Display+0xe7>
cvtsi2sdl -0x2c(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   10b0 <cos@plt>
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x2c(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1080 <sin@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
xor    %edi,%edi
call   1040 <glVertex3d@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    122c <Display+0x8c>
mov    $0x0,%al
call   1060 <glEnd@plt>
mov    $0x0,%al
call   10a0 <glFlush@plt>
mov    $0x0,%al
call   1050 <glutSwapBuffers@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Display>:
push   %rax
movsd  0xe57(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
movaps %xmm0,%xmm3
call   1070 <glClearColor@plt>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
movsd  0xe2d(%rip),%xmm0
call   1090 <glColor3f@plt>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
call   10c0 <glBegin@plt>
xor    %edi,%edi
call   10b0 <cos@plt>
movsd  %xmm0,(%rsp)
xor    %edi,%edi
call   1080 <sin@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
xor    %edi,%edi
call   1040 <glVertex3d@plt>
mov    $0x2,%edi
call   10b0 <cos@plt>
movsd  %xmm0,(%rsp)
mov    $0x2,%edi
call   1080 <sin@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
xor    %edi,%edi
call   1040 <glVertex3d@plt>
mov    $0x4,%edi
call   10b0 <cos@plt>
movsd  %xmm0,(%rsp)
mov    $0x4,%edi
call   1080 <sin@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
xor    %edi,%edi
call   1040 <glVertex3d@plt>
xor    %eax,%eax
call   1060 <glEnd@plt>
xor    %eax,%eax
call   10a0 <glFlush@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <glutSwapBuffers@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 i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = call i32 @glClearColor(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00)
%9 = load i32, i32* @GL_COLOR_BUFFER_BIT
%10 = call i32 @glClear(i32 %9)
%11 = call i32 @glColor3f(double 1.000000e+00, double 0.000000e+00, double 0.000000e+00)
%12 = load i32, i32* @GL_LINE_LOOP
%13 = call i32 @glBegin(i32 %12)
store i32 3, i32* %1
%14 = load i32, i32* %1
%15 = sub nsw i32 %14, 1
store i32 %15, i32* %2
store double 3.140000e+00, double* %3
%16 = load double, double* %3
%17 = fmul double 2.000000e+00, %16
%18 = load i32, i32* %1
%19 = sitofp i32 %18 to double
%20 = fdiv double %17, %19
store double %20, double* %4
store i32 0, i32* %7
br label %21
21: ; preds = %41, %0
%22 = load i32, i32* %7
%23 = load i32, i32* %1
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %44
25: ; preds = %21
%26 = load i32, i32* %7
%27 = sitofp i32 %26 to double
%28 = load double, double* %4
%29 = fmul double %27, %28
%30 = fptosi double %29 to i32
%31 = call double @cos(i32 %30)
store double %31, double* %5
%32 = load i32, i32* %7
%33 = sitofp i32 %32 to double
%34 = load double, double* %4
%35 = fmul double %33, %34
%36 = fptosi double %35 to i32
%37 = call double @sin(i32 %36)
store double %37, double* %6
%38 = load double, double* %5
%39 = load double, double* %6
%40 = call i32 @glVertex3d(double %38, double %39, i32 0)
br label %41
41: ; preds = %25
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
br label %21
44: ; preds = %21
%45 = call i32 (...) @glEnd()
%46 = call i32 (...) @glFlush()
%47 = call i32 (...) @glutSwapBuffers()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_LINE_LOOP = global i32 0
define void @Display() {
%1 = tail call i32 @glClearColor(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00)
%2 = load i32, i32* @GL_COLOR_BUFFER_BIT
%3 = tail call i32 @glClear(i32 %2)
%4 = tail call i32 @glColor3f(double 1.000000e+00, double 0.000000e+00, double 0.000000e+00)
%5 = load i32, i32* @GL_LINE_LOOP
%6 = tail call i32 @glBegin(i32 %5)
%7 = tail call double @cos(i32 0)
%8 = tail call double @sin(i32 0)
%9 = tail call i32 @glVertex3d(double %7, double %8, i32 0)
%10 = tail call double @cos(i32 2)
%11 = tail call double @sin(i32 2)
%12 = tail call i32 @glVertex3d(double %10, double %11, i32 0)
%13 = tail call double @cos(i32 4)
%14 = tail call double @sin(i32 4)
%15 = tail call i32 @glVertex3d(double %13, double %14, i32 0)
%16 = tail call i32 (...) @glEnd()
%17 = tail call i32 (...) @glFlush()
%18 = tail call i32 (...) @glutSwapBuffers()
ret void
}