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

/* Variables and functions */
int /*<<< orphan*/ GL_COLOR_BUFFER_BIT;
int /*<<< orphan*/ GL_LINE_LOOP;
int cos(int);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glFlush();
int /*<<< orphan*/ glVertex2fv(int *);
int sin(int);
void star_display(void) {
  const GLfloat Pi = 3.1415926536f;
  GLfloat a = 1 / (2 - 2 * cos(72 * Pi / 180));
  GLfloat bx = a * cos(18 * Pi / 180);
  GLfloat by = a * sin(18 * Pi / 180);
  GLfloat cy = -a * cos(18 * Pi / 180);
  GLfloat PointA[2] = {0, a}, PointB[2] = {bx, by}, PointC[2] = {0.5, cy},
          PointD[2] = {-0.5, cy}, PointE[2] = {-bx, by};
  glClear(GL_COLOR_BUFFER_BIT);
  glBegin(GL_LINE_LOOP);
  glVertex2fv(PointA);
  glVertex2fv(PointC);
  glVertex2fv(PointE);
  glVertex2fv(PointB);
  glVertex2fv(PointD);
  glEnd();
  glFlush();
}


x86 assembly (clang, -O0):
<star_display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x3,-0x4(%rbp)
mov    $0x1,%edi
call   1080 <cos@plt>
shl    $0x1,%eax
mov    $0x2,%ecx
sub    %eax,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x48(%rbp)
xor    %edi,%edi
call   1080 <cos@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x44(%rbp)
xor    %edi,%edi
call   1050 <sin@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x40(%rbp)
xor    %edi,%edi
call   1080 <cos@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x30(%rbp)
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
call   1090 <glBegin@plt>
lea    -0x1c(%rbp),%rdi
call   1070 <glVertex2fv@plt>
lea    -0x2c(%rbp),%rdi
call   1070 <glVertex2fv@plt>
lea    -0x3c(%rbp),%rdi
call   1070 <glVertex2fv@plt>
lea    -0x24(%rbp),%rdi
call   1070 <glVertex2fv@plt>
lea    -0x34(%rbp),%rdi
call   1070 <glVertex2fv@plt>
mov    $0x0,%al
call   1040 <glEnd@plt>
mov    $0x0,%al
call   1060 <glFlush@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<star_display>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    $0x1,%edi
call   1080 <cos@plt>
add    %eax,%eax
mov    $0x2,%ebp
sub    %eax,%ebp
neg    %eax
xor    %ecx,%ecx
cmp    $0xfffffffd,%eax
cmovb  %ecx,%ebp
xor    %edi,%edi
call   1080 <cos@plt>
mov    %eax,%ebx
imul   %ebp,%ebx
xor    %edi,%edi
call   1050 <sin@plt>
mov    %eax,%r14d
imul   %ebp,%r14d
xor    %edi,%edi
call   1080 <cos@plt>
imul   %ebp,%eax
neg    %eax
movl   $0x0,0x28(%rsp)
mov    %ebp,0x2c(%rsp)
mov    %ebx,0x20(%rsp)
mov    %r14d,0x24(%rsp)
movl   $0x0,0x18(%rsp)
mov    %eax,0x1c(%rsp)
movl   $0x0,0x10(%rsp)
mov    %eax,0x14(%rsp)
neg    %ebx
mov    %ebx,0x8(%rsp)
mov    %r14d,0xc(%rsp)
mov    0x2dde(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
mov    0x2de0(%rip),%rax
mov    (%rax),%edi
call   1090 <glBegin@plt>
lea    0x28(%rsp),%rdi
call   1070 <glVertex2fv@plt>
lea    0x18(%rsp),%rdi
call   1070 <glVertex2fv@plt>
lea    0x8(%rsp),%rdi
call   1070 <glVertex2fv@plt>
lea    0x20(%rsp),%rdi
call   1070 <glVertex2fv@plt>
lea    0x10(%rsp),%rdi
call   1070 <glVertex2fv@plt>
xor    %eax,%eax
call   1040 <glEnd@plt>
xor    %eax,%eax
call   1060 <glFlush@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_LINE_LOOP = global i32 0
define void @star_display() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [2 x i32]
%7 = alloca [2 x i32]
%8 = alloca [2 x i32]
%9 = alloca [2 x i32]
%10 = alloca [2 x i32]
store i32 3, i32* %1
%11 = call i32 @cos(i32 1)
%12 = mul nsw i32 2, %11
%13 = sub nsw i32 2, %12
%14 = sdiv i32 1, %13
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = call i32 @cos(i32 0)
%17 = mul nsw i32 %15, %16
store i32 %17, i32* %3
%18 = load i32, i32* %2
%19 = call i32 @sin(i32 0)
%20 = mul nsw i32 %18, %19
store i32 %20, i32* %4
%21 = load i32, i32* %2
%22 = sub nsw i32 0, %21
%23 = call i32 @cos(i32 0)
%24 = mul nsw i32 %22, %23
store i32 %24, i32* %5
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
store i32 0, i32* %25
%26 = getelementptr inbounds i32, i32* %25, i64 1
%27 = load i32, i32* %2
store i32 %27, i32* %26
%28 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%29 = load i32, i32* %3
store i32 %29, i32* %28
%30 = getelementptr inbounds i32, i32* %28, i64 1
%31 = load i32, i32* %4
store i32 %31, i32* %30
%32 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
store i32 0, i32* %32
%33 = getelementptr inbounds i32, i32* %32, i64 1
%34 = load i32, i32* %5
store i32 %34, i32* %33
%35 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
store i32 0, i32* %35
%36 = getelementptr inbounds i32, i32* %35, i64 1
%37 = load i32, i32* %5
store i32 %37, i32* %36
%38 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
%39 = load i32, i32* %3
%40 = sub nsw i32 0, %39
store i32 %40, i32* %38
%41 = getelementptr inbounds i32, i32* %38, i64 1
%42 = load i32, i32* %4
store i32 %42, i32* %41
%43 = load i32, i32* @GL_COLOR_BUFFER_BIT
%44 = call i32 @glClear(i32 %43)
%45 = load i32, i32* @GL_LINE_LOOP
%46 = call i32 @glBegin(i32 %45)
%47 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%48 = call i32 @glVertex2fv(i32* %47)
%49 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%50 = call i32 @glVertex2fv(i32* %49)
%51 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
%52 = call i32 @glVertex2fv(i32* %51)
%53 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%54 = call i32 @glVertex2fv(i32* %53)
%55 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%56 = call i32 @glVertex2fv(i32* %55)
%57 = call i32 (...) @glEnd()
%58 = call i32 (...) @glFlush()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_LINE_LOOP = global i32 0
define void @star_display() {
%1 = alloca [2 x i32]
%2 = alloca [2 x i32]
%3 = alloca [2 x i32]
%4 = alloca [2 x i32]
%5 = alloca [2 x i32]
%6 = tail call i32 @cos(i32 1)
%7 = mul i32 %6, -2
%8 = add i32 %7, 2
%9 = icmp ugt i32 %7, -4
%10 = select i1 %9, i32 %8, i32 0
%11 = tail call i32 @cos(i32 0)
%12 = mul nsw i32 %10, %11
%13 = tail call i32 @sin(i32 0)
%14 = mul nsw i32 %10, %13
%15 = tail call i32 @cos(i32 0)
%16 = mul i32 %15, %10
%17 = sub i32 0, %16
%18 = bitcast [2 x i32]* %1 to i8*
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
store i32 0, i32* %19
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
store i32 %10, i32* %20
%21 = bitcast [2 x i32]* %2 to i8*
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
store i32 %12, i32* %22
%23 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
store i32 %14, i32* %23
%24 = bitcast [2 x i32]* %3 to i8*
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
store i32 0, i32* %25
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
store i32 %17, i32* %26
%27 = bitcast [2 x i32]* %4 to i8*
%28 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
store i32 0, i32* %28
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
store i32 %17, i32* %29
%30 = bitcast [2 x i32]* %5 to i8*
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%32 = sub nsw i32 0, %12
store i32 %32, i32* %31
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
store i32 %14, i32* %33
%34 = load i32, i32* @GL_COLOR_BUFFER_BIT
%35 = tail call i32 @glClear(i32 %34)
%36 = load i32, i32* @GL_LINE_LOOP
%37 = tail call i32 @glBegin(i32 %36)
%38 = call i32 @glVertex2fv(i32* %19)
%39 = call i32 @glVertex2fv(i32* %25)
%40 = call i32 @glVertex2fv(i32* %31)
%41 = call i32 @glVertex2fv(i32* %22)
%42 = call i32 @glVertex2fv(i32* %28)
%43 = call i32 (...) @glEnd()
%44 = call i32 (...) @glFlush()
ret void
}