#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_TRIANGLES;
double M_PI;
double cos(double);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glColor3d(double, double, double);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glFlush();
int /*<<< orphan*/ glVertex2d(double, double);
double sin(double);
void display(void) {
  glClear(GL_COLOR_BUFFER_BIT);
  glBegin(GL_TRIANGLES);
  glColor3d(1.0, 0.0, 0.0);
  glVertex2d(0.9 * cos(0.0), 0.9 * sin(0.0));
  glColor3d(0.0, 1.0, 0.0);
  glVertex2d(0.9 * cos(2.0 * M_PI / 3.0), 0.9 * sin(2.0 * M_PI / 3.0));
  glColor3d(0.0, 0.0, 1.0);
  glVertex2d(0.9 * cos(2.0 * M_PI * 2.0 / 3.0),
             0.9 * sin(2.0 * M_PI * 2.0 / 3.0));
  glEnd();
  glFlush();
  return;
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   10a0 <glBegin@plt>
movsd  0xe6c(%rip),%xmm0
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm1
call   1060 <glColor3d@plt>
xorps  %xmm0,%xmm0
call   1090 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xe36(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm2
movsd  -0x18(%rbp),%xmm0
movsd  0xe15(%rip),%xmm1
mulsd  %xmm2,%xmm1
call   1080 <glVertex2d@plt>
xorps  %xmm2,%xmm2
movsd  0xe19(%rip),%xmm1
movaps %xmm2,%xmm0
call   1060 <glColor3d@plt>
movsd  0xe01(%rip),%xmm0
mov    0x2dd2(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xde6(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1090 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xdca(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xdc9(%rip),%xmm0
mov    0x2d9a(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xdae(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm2
movsd  -0x10(%rbp),%xmm0
movsd  0xd8d(%rip),%xmm1
mulsd  %xmm2,%xmm1
call   1080 <glVertex2d@plt>
xorps  %xmm1,%xmm1
movsd  0xd91(%rip),%xmm2
movaps %xmm1,%xmm0
call   1060 <glColor3d@plt>
movsd  0xd79(%rip),%xmm0
mov    0x2d4a(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xd66(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd52(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1090 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xd36(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xd35(%rip),%xmm0
mov    0x2d06(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xd22(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd0e(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm2
movsd  -0x8(%rbp),%xmm0
movsd  0xced(%rip),%xmm1
mulsd  %xmm2,%xmm1
call   1080 <glVertex2d@plt>
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    0x2e44(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
call   10a0 <glBegin@plt>
movsd  0xe57(%rip),%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
call   1060 <glColor3d@plt>
movsd  0xe4c(%rip),%xmm0
xorps  %xmm1,%xmm1
call   1080 <glVertex2d@plt>
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
movsd  0xe2e(%rip),%xmm1
call   1060 <glColor3d@plt>
mov    0x2e0a(%rip),%rbx
movsd  (%rbx),%xmm0
addsd  %xmm0,%xmm0
divsd  0xe22(%rip),%xmm0
call   1090 <cos@plt>
mulsd  0xe0d(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rbx),%xmm0
addsd  %xmm0,%xmm0
divsd  0xdff(%rip),%xmm0
call   1050 <sin@plt>
movapd %xmm0,%xmm1
mulsd  0xde6(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
call   1080 <glVertex2d@plt>
xorps  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
movsd  0xdc4(%rip),%xmm2
call   1060 <glColor3d@plt>
movsd  (%rbx),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm0,%xmm0
divsd  0xdbb(%rip),%xmm0
call   1090 <cos@plt>
mulsd  0xda6(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rbx),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm0,%xmm0
divsd  0xd94(%rip),%xmm0
call   1050 <sin@plt>
movsd  0xd7f(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
call   1080 <glVertex2d@plt>
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_TRIANGLES = global i32 0
@M_PI = global double 0.000000e+00
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = call i32 @glClear(i32 %1)
%3 = load i32, i32* @GL_TRIANGLES
%4 = call i32 @glBegin(i32 %3)
%5 = call i32 @glColor3d(double 1.000000e+00, double 0.000000e+00, double 0.000000e+00)
%6 = call double @cos(double 0.000000e+00)
%7 = fmul double 9.000000e-01, %6
%8 = call double @sin(double 0.000000e+00)
%9 = fmul double 9.000000e-01, %8
%10 = call i32 @glVertex2d(double %7, double %9)
%11 = call i32 @glColor3d(double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%12 = load double, double* @M_PI
%13 = fmul double 2.000000e+00, %12
%14 = fdiv double %13, 3.000000e+00
%15 = call double @cos(double %14)
%16 = fmul double 9.000000e-01, %15
%17 = load double, double* @M_PI
%18 = fmul double 2.000000e+00, %17
%19 = fdiv double %18, 3.000000e+00
%20 = call double @sin(double %19)
%21 = fmul double 9.000000e-01, %20
%22 = call i32 @glVertex2d(double %16, double %21)
%23 = call i32 @glColor3d(double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
%24 = load double, double* @M_PI
%25 = fmul double 2.000000e+00, %24
%26 = fmul double %25, 2.000000e+00
%27 = fdiv double %26, 3.000000e+00
%28 = call double @cos(double %27)
%29 = fmul double 9.000000e-01, %28
%30 = load double, double* @M_PI
%31 = fmul double 2.000000e+00, %30
%32 = fmul double %31, 2.000000e+00
%33 = fdiv double %32, 3.000000e+00
%34 = call double @sin(double %33)
%35 = fmul double 9.000000e-01, %34
%36 = call i32 @glVertex2d(double %29, double %35)
%37 = call i32 (...) @glEnd()
%38 = call i32 (...) @glFlush()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_TRIANGLES = global i32 0
@M_PI = global double 0.000000e+00
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = tail call i32 @glClear(i32 %1)
%3 = load i32, i32* @GL_TRIANGLES
%4 = tail call i32 @glBegin(i32 %3)
%5 = tail call i32 @glColor3d(double 1.000000e+00, double 0.000000e+00, double 0.000000e+00)
%6 = tail call i32 @glVertex2d(double 9.000000e-01, double 0.000000e+00)
%7 = tail call i32 @glColor3d(double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%8 = load double, double* @M_PI
%9 = fmul double %8, 2.000000e+00
%10 = fdiv double %9, 3.000000e+00
%11 = tail call double @cos(double %10)
%12 = fmul double %11, 9.000000e-01
%13 = load double, double* @M_PI
%14 = fmul double %13, 2.000000e+00
%15 = fdiv double %14, 3.000000e+00
%16 = tail call double @sin(double %15)
%17 = fmul double %16, 9.000000e-01
%18 = tail call i32 @glVertex2d(double %12, double %17)
%19 = tail call i32 @glColor3d(double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
%20 = load double, double* @M_PI
%21 = fmul double %20, 2.000000e+00
%22 = fmul double %21, 2.000000e+00
%23 = fdiv double %22, 3.000000e+00
%24 = tail call double @cos(double %23)
%25 = fmul double %24, 9.000000e-01
%26 = load double, double* @M_PI
%27 = fmul double %26, 2.000000e+00
%28 = fmul double %27, 2.000000e+00
%29 = fdiv double %28, 3.000000e+00
%30 = tail call double @sin(double %29)
%31 = fmul double %30, 9.000000e-01
%32 = tail call i32 @glVertex2d(double %25, double %31)
%33 = tail call i32 (...) @glEnd()
%34 = tail call i32 (...) @glFlush()
ret void
}