#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_TRIANGLES;
float cos(double);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glColor3f(float, float, float);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glRotatef(float, float, float, float);
int /*<<< orphan*/ glVertex3f(float, float, float);
float sin(double);
void drawTri() {
  int i = 0;
  for (i = 0; i < 8; i++) {
    glBegin(GL_TRIANGLES);
    glColor3f(0.62f, 0.37f, 0.62f);
    glVertex3f(0.08f * cos(22.5 * 3.14 / 180), 0.08f * sin(22.5 * 3.14 / 180),
               -5.0f);
    glColor3f(0.69f, 0.19f, 0.38f);
    glVertex3f(0.08f * cos(67.5 * 3.14 / 180), 0.08f * sin(67.5 * 3.14 / 180),
               -5.0f);
    glColor3f(0.0f, 0.38f, 0.0f);
    glVertex3f(0.42f * 0.707f, 0.42f * 0.707f, -5.0f);
    glEnd();
    glRotatef(45.0f, 0.0f, 0.0f, 1.0f);
  }
}


x86 assembly (clang, -O0):
<drawTri>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
jge    12cc <drawTri+0x15c>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
call   1080 <glBegin@plt>
movss  0xe7a(%rip),%xmm2
movss  0xe76(%rip),%xmm1
movaps %xmm2,%xmm0
call   1060 <glColor3f@plt>
movsd  0xe72(%rip),%xmm0
call   1070 <cos@plt>
movaps %xmm0,%xmm1
movss  0xe46(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movsd  0xe51(%rip),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm2
movss  -0xc(%rbp),%xmm0
movss  0xe20(%rip),%xmm1
mulss  %xmm2,%xmm1
movss  0xe0c(%rip),%xmm2
call   1030 <glVertex3f@plt>
movss  0xe0b(%rip),%xmm0
movss  0xe07(%rip),%xmm1
movss  0xdf3(%rip),%xmm2
call   1060 <glColor3f@plt>
movsd  0xdfe(%rip),%xmm0
call   1070 <cos@plt>
movaps %xmm0,%xmm1
movss  0xdda(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movsd  0xddd(%rip),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm2
movss  -0x8(%rbp),%xmm0
movss  0xdb4(%rip),%xmm1
mulss  %xmm2,%xmm1
movss  0xda0(%rip),%xmm2
call   1030 <glVertex3f@plt>
xorps  %xmm2,%xmm2
movss  0xd94(%rip),%xmm1
movaps %xmm2,%xmm0
call   1060 <glColor3f@plt>
movss  0xd7c(%rip),%xmm1
movss  0xd78(%rip),%xmm2
movaps %xmm1,%xmm0
call   1030 <glVertex3f@plt>
mov    $0x0,%al
call   1040 <glEnd@plt>
movss  0xd55(%rip),%xmm0
xorps  %xmm2,%xmm2
movss  0xd4e(%rip),%xmm3
movaps %xmm2,%xmm1
call   1090 <glRotatef@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1186 <drawTri+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawTri>:
push   %r14
push   %rbx
push   %rax
mov    $0x8,%ebx
mov    0x2e60(%rip),%r14
mov    (%r14),%edi
call   1080 <glBegin@plt>
movss  0xe74(%rip),%xmm0
movss  0xe68(%rip),%xmm1
movaps %xmm0,%xmm2
call   1060 <glColor3f@plt>
movsd  0xe80(%rip),%xmm0
call   1070 <cos@plt>
movaps %xmm0,%xmm1
movss  0xe50(%rip),%xmm0
mulss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movsd  0xe5e(%rip),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
mulss  0xe2e(%rip),%xmm1
movss  0x4(%rsp),%xmm0
movss  0xe24(%rip),%xmm2
call   1030 <glVertex3f@plt>
movss  0xe1b(%rip),%xmm0
movss  0xe17(%rip),%xmm1
movss  0xe13(%rip),%xmm2
call   1060 <glColor3f@plt>
movsd  0xe1e(%rip),%xmm0
call   1070 <cos@plt>
mulss  0xde9(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
movsd  0xe03(%rip),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
mulss  0xdcb(%rip),%xmm1
movss  0x4(%rsp),%xmm0
movss  0xdc1(%rip),%xmm2
call   1030 <glVertex3f@plt>
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
movss  0xdba(%rip),%xmm1
call   1060 <glColor3f@plt>
movss  0xdb1(%rip),%xmm0
movaps %xmm0,%xmm1
movss  0xd96(%rip),%xmm2
call   1030 <glVertex3f@plt>
xor    %eax,%eax
call   1040 <glEnd@plt>
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
movss  0xd90(%rip),%xmm0
movss  0xd8c(%rip),%xmm3
call   1090 <glRotatef@plt>
add    $0xffffffff,%ebx
jne    1180 <drawTri+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@GL_TRIANGLES = global i32 0
define void @drawTri() {
%1 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %1
br label %2
2: ; preds = %24, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 8
br i1 %4, label %5, label %27
5: ; preds = %2
%6 = load i32, i32* @GL_TRIANGLES
%7 = call i32 @glBegin(i32 %6)
%8 = call i32 @glColor3f(float 0x3FE3D70A40000000, float 0x3FD7AE1480000000, float 0x3FE3D70A40000000)
%9 = call float @cos(double 3.925000e-01)
%10 = fmul float 0x3FB47AE140000000, %9
%11 = call float @sin(double 3.925000e-01)
%12 = fmul float 0x3FB47AE140000000, %11
%13 = call i32 @glVertex3f(float %10, float %12, float -5.000000e+00)
%14 = call i32 @glColor3f(float 0x3FE6147AE0000000, float 0x3FC851EB80000000, float 0x3FD851EB80000000)
%15 = call float @cos(double 1.177500e+00)
%16 = fmul float 0x3FB47AE140000000, %15
%17 = call float @sin(double 1.177500e+00)
%18 = fmul float 0x3FB47AE140000000, %17
%19 = call i32 @glVertex3f(float %16, float %18, float -5.000000e+00)
%20 = call i32 @glColor3f(float 0.000000e+00, float 0x3FD851EB80000000, float 0.000000e+00)
%21 = call i32 @glVertex3f(float 0x3FD30110A0000000, float 0x3FD30110A0000000, float -5.000000e+00)
%22 = call i32 (...) @glEnd()
%23 = call i32 @glRotatef(float 4.500000e+01, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00)
br label %24
24: ; preds = %5
%25 = load i32, i32* %1
%26 = add nsw i32 %25, 1
store i32 %26, i32* %1
br label %2
27: ; preds = %2
ret void
}

LLVM IR (-O2):
@GL_TRIANGLES = global i32 0
define void @drawTri() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %21, %1 ]
%3 = load i32, i32* @GL_TRIANGLES
%4 = tail call i32 @glBegin(i32 %3)
%5 = tail call i32 @glColor3f(float 0x3FE3D70A40000000, float 0x3FD7AE1480000000, float 0x3FE3D70A40000000)
%6 = tail call float @cos(double 3.925000e-01)
%7 = fmul float %6, 0x3FB47AE140000000
%8 = tail call float @sin(double 3.925000e-01)
%9 = fmul float %8, 0x3FB47AE140000000
%10 = tail call i32 @glVertex3f(float %7, float %9, float -5.000000e+00)
%11 = tail call i32 @glColor3f(float 0x3FE6147AE0000000, float 0x3FC851EB80000000, float 0x3FD851EB80000000)
%12 = tail call float @cos(double 1.177500e+00)
%13 = fmul float %12, 0x3FB47AE140000000
%14 = tail call float @sin(double 1.177500e+00)
%15 = fmul float %14, 0x3FB47AE140000000
%16 = tail call i32 @glVertex3f(float %13, float %15, float -5.000000e+00)
%17 = tail call i32 @glColor3f(float 0.000000e+00, float 0x3FD851EB80000000, float 0.000000e+00)
%18 = tail call i32 @glVertex3f(float 0x3FD30110A0000000, float 0x3FD30110A0000000, float -5.000000e+00)
%19 = tail call i32 (...) @glEnd()
%20 = tail call i32 @glRotatef(float 4.500000e+01, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00)
%21 = add nuw nsw i32 %2, 1
%22 = icmp eq i32 %21, 8
br i1 %22, label %23, label %1
23: ; preds = %1
ret void
}