#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_LINE_LOOP;
int /*<<< orphan*/ GL_QUADS;
int /*<<< orphan*/ GL_TRIANGLES;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glNormal3f(double, double, double);
int /*<<< orphan*/ glRotatef(double, double, double, double);
int /*<<< orphan*/ glTranslatef(float, double, double);
int /*<<< orphan*/ glVertex3f(float, float, float);
float sin(double);
void Octagon(float side, float height, char solid) {
  char j;
  float x = sin(0.785398163) * side, y = side / 2.0, z = height / 2.0, c;
  c = x + y;
  for (j = 0; j < 8; j++) {
    glTranslatef(-c, 0.0, 0.0);
    if (!solid)
      glBegin(GL_LINE_LOOP);
    else
      glBegin(GL_QUADS);
    glNormal3f(-1.0, 0.0, 0.0);
    glVertex3f(0.0, -y, z);
    glVertex3f(0.0, y, z);
    glVertex3f(0.0, y, -z);
    glVertex3f(0.0, -y, -z);
    glEnd();
    glTranslatef(c, 0.0, 0.0);
    if (solid) {
      glBegin(GL_TRIANGLES);
      glNormal3f(0.0, 0.0, 1.0);
      glVertex3f(0.0, 0.0, z);
      glVertex3f(-c, -y, z);
      glVertex3f(-c, y, z);
      glNormal3f(0.0, 0.0, -1.0);
      glVertex3f(0.0, 0.0, -z);
      glVertex3f(-c, y, -z);
      glVertex3f(-c, -y, -z);
      glEnd();
    }
    glRotatef(45.0, 0.0, 0.0, 1.0);
  }
}


x86 assembly (clang, -O0):
<Octagon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsd  0xe78(%rip),%xmm0
call   1050 <sin@plt>
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe50(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe32(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movb   $0x0,-0xa(%rbp)
movsbl -0xa(%rbp),%eax
cmp    $0x8,%eax
jge    143b <Octagon+0x2cb>
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm1
call   1060 <glTranslatef@plt>
cmpb   $0x0,-0x9(%rbp)
jne    1235 <Octagon+0xc5>
mov    0x2dbf(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
jmp    1243 <Octagon+0xd3>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
movsd  0xdc5(%rip),%xmm0
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm1
call   1090 <glNormal3f@plt>
movss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  -0x18(%rbp),%xmm2
xorps  %xmm0,%xmm0
call   1030 <glVertex3f@plt>
movss  -0x14(%rbp),%xmm1
movss  -0x18(%rbp),%xmm2
xorps  %xmm0,%xmm0
call   1030 <glVertex3f@plt>
movss  -0x14(%rbp),%xmm1
movss  -0x18(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
xorps  %xmm0,%xmm0
call   1030 <glVertex3f@plt>
movss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  -0x18(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
xorps  %xmm0,%xmm0
call   1030 <glVertex3f@plt>
mov    $0x0,%al
call   1040 <glEnd@plt>
movss  -0x1c(%rbp),%xmm0
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm1
call   1060 <glTranslatef@plt>
cmpb   $0x0,-0x9(%rbp)
je     1413 <Octagon+0x2a3>
mov    0x2cd6(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
xorps  %xmm1,%xmm1
movsd  0xd0c(%rip),%xmm2
movaps %xmm1,%xmm0
call   1090 <glNormal3f@plt>
movss  -0x18(%rbp),%xmm2
xorps  %xmm1,%xmm1
movaps %xmm1,%xmm0
call   1030 <glVertex3f@plt>
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x14(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  -0x18(%rbp),%xmm2
call   1030 <glVertex3f@plt>
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x14(%rbp),%xmm1
movss  -0x18(%rbp),%xmm2
call   1030 <glVertex3f@plt>
xorps  %xmm1,%xmm1
movsd  0xc92(%rip),%xmm2
movaps %xmm1,%xmm0
call   1090 <glNormal3f@plt>
movss  -0x18(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
xorps  %xmm1,%xmm1
movaps %xmm1,%xmm0
call   1030 <glVertex3f@plt>
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x14(%rbp),%xmm1
movss  -0x18(%rbp),%xmm2
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
call   1030 <glVertex3f@plt>
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x14(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  -0x18(%rbp),%xmm2
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
call   1030 <glVertex3f@plt>
mov    $0x0,%al
call   1040 <glEnd@plt>
movsd  0xc05(%rip),%xmm0
xorps  %xmm2,%xmm2
movsd  0xbf2(%rip),%xmm3
movaps %xmm2,%xmm1
call   1080 <glRotatef@plt>
mov    -0xa(%rbp),%al
add    $0x1,%al
mov    %al,-0xa(%rbp)
jmp    11ee <Octagon+0x7e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Octagon>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x60,%rsp
mov    %edi,%ebp
movaps %xmm1,(%rsp)
movaps %xmm0,0x10(%rsp)
movsd  0xe71(%rip),%xmm0
call   1050 <sin@plt>
movaps 0x10(%rsp),%xmm3
mulss  %xmm3,%xmm0
movss  0xe7b(%rip),%xmm1
mulss  %xmm1,%xmm3
movaps (%rsp),%xmm2
mulss  %xmm1,%xmm2
addss  %xmm3,%xmm0
movaps 0xe74(%rip),%xmm1
movaps %xmm0,0x50(%rsp)
xorps  %xmm1,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm3,0x10(%rsp)
movaps %xmm3,%xmm0
xorps  %xmm1,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm2,(%rsp)
xorps  %xmm2,%xmm1
movaps %xmm1,0x30(%rsp)
mov    $0x8,%bl
mov    0x2df2(%rip),%r14
mov    0x2df3(%rip),%r15
mov    0x2dd4(%rip),%r12
jmp    121c <Octagon+0xac>
xchg   %ax,%ax
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
movsd  0xe0a(%rip),%xmm0
call   1080 <glRotatef@plt>
add    $0xff,%bl
je     136f <Octagon+0x1ff>
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
movaps 0x20(%rsp),%xmm0
call   1060 <glTranslatef@plt>
mov    %r14,%rax
test   %bpl,%bpl
jne    1237 <Octagon+0xc7>
mov    %r15,%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
movsd  0xdbc(%rip),%xmm0
call   1090 <glNormal3f@plt>
xorps  %xmm0,%xmm0
movaps 0x40(%rsp),%xmm1
movaps (%rsp),%xmm2
call   1030 <glVertex3f@plt>
xorps  %xmm0,%xmm0
movaps 0x10(%rsp),%xmm1
movaps (%rsp),%xmm2
call   1030 <glVertex3f@plt>
xorps  %xmm0,%xmm0
movaps 0x10(%rsp),%xmm1
movaps 0x30(%rsp),%xmm2
call   1030 <glVertex3f@plt>
xorps  %xmm0,%xmm0
movaps 0x40(%rsp),%xmm1
movaps 0x30(%rsp),%xmm2
call   1030 <glVertex3f@plt>
xor    %eax,%eax
call   1040 <glEnd@plt>
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
movaps 0x50(%rsp),%xmm0
call   1060 <glTranslatef@plt>
test   %bpl,%bpl
movsd  0xd57(%rip),%xmm3
je     1200 <Octagon+0x90>
mov    (%r12),%edi
call   1070 <glBegin@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
movsd  0xd3a(%rip),%xmm2
call   1090 <glNormal3f@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
movaps (%rsp),%xmm2
call   1030 <glVertex3f@plt>
movaps 0x20(%rsp),%xmm0
movaps 0x40(%rsp),%xmm1
movaps (%rsp),%xmm2
call   1030 <glVertex3f@plt>
movaps 0x20(%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
movaps (%rsp),%xmm2
call   1030 <glVertex3f@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
movsd  0xcea(%rip),%xmm2
call   1090 <glNormal3f@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
movaps 0x30(%rsp),%xmm2
call   1030 <glVertex3f@plt>
movaps 0x20(%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
movaps 0x30(%rsp),%xmm2
call   1030 <glVertex3f@plt>
movaps 0x20(%rsp),%xmm0
movaps 0x40(%rsp),%xmm1
movaps 0x30(%rsp),%xmm2
call   1030 <glVertex3f@plt>
xor    %eax,%eax
call   1040 <glEnd@plt>
movsd  0xca6(%rip),%xmm3
jmp    1200 <Octagon+0x90>
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@GL_LINE_LOOP = global i32 0
@GL_QUADS = global i32 0
@GL_TRIANGLES = global i32 0
define void @Octagon(float %0, float %1, i8 signext %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca i8
%7 = alloca i8
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
store float %0, float* %4
store float %1, float* %5
store i8 %2, i8* %6
%12 = call float @sin(double 0x3FE921FB540D8D20)
%13 = load float, float* %4
%14 = fmul float %12, %13
store float %14, float* %8
%15 = load float, float* %4
%16 = fpext float %15 to double
%17 = fdiv double %16, 2.000000e+00
%18 = fptrunc double %17 to float
store float %18, float* %9
%19 = load float, float* %5
%20 = fpext float %19 to double
%21 = fdiv double %20, 2.000000e+00
%22 = fptrunc double %21 to float
store float %22, float* %10
%23 = load float, float* %8
%24 = load float, float* %9
%25 = fadd float %23, %24
store float %25, float* %11
store i8 0, i8* %7
br label %26
26: ; preds = %102, %3
%27 = load i8, i8* %7
%28 = sext i8 %27 to i32
%29 = icmp slt i32 %28, 8
br i1 %29, label %30, label %105
30: ; preds = %26
%31 = load float, float* %11
%32 = fneg float %31
%33 = call i32 @glTranslatef(float %32, double 0.000000e+00, double 0.000000e+00)
%34 = load i8, i8* %6
%35 = icmp ne i8 %34, 0
br i1 %35, label %39, label %36
36: ; preds = %30
%37 = load i32, i32* @GL_LINE_LOOP
%38 = call i32 @glBegin(i32 %37)
br label %42
39: ; preds = %30
%40 = load i32, i32* @GL_QUADS
%41 = call i32 @glBegin(i32 %40)
br label %42
42: ; preds = %39, %36
%43 = call i32 @glNormal3f(double -1.000000e+00, double 0.000000e+00, double 0.000000e+00)
%44 = load float, float* %9
%45 = fneg float %44
%46 = load float, float* %10
%47 = call i32 @glVertex3f(float 0.000000e+00, float %45, float %46)
%48 = load float, float* %9
%49 = load float, float* %10
%50 = call i32 @glVertex3f(float 0.000000e+00, float %48, float %49)
%51 = load float, float* %9
%52 = load float, float* %10
%53 = fneg float %52
%54 = call i32 @glVertex3f(float 0.000000e+00, float %51, float %53)
%55 = load float, float* %9
%56 = fneg float %55
%57 = load float, float* %10
%58 = fneg float %57
%59 = call i32 @glVertex3f(float 0.000000e+00, float %56, float %58)
%60 = call i32 (...) @glEnd()
%61 = load float, float* %11
%62 = call i32 @glTranslatef(float %61, double 0.000000e+00, double 0.000000e+00)
%63 = load i8, i8* %6
%64 = icmp ne i8 %63, 0
br i1 %64, label %65, label %100
65: ; preds = %42
%66 = load i32, i32* @GL_TRIANGLES
%67 = call i32 @glBegin(i32 %66)
%68 = call i32 @glNormal3f(double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
%69 = load float, float* %10
%70 = call i32 @glVertex3f(float 0.000000e+00, float 0.000000e+00, float %69)
%71 = load float, float* %11
%72 = fneg float %71
%73 = load float, float* %9
%74 = fneg float %73
%75 = load float, float* %10
%76 = call i32 @glVertex3f(float %72, float %74, float %75)
%77 = load float, float* %11
%78 = fneg float %77
%79 = load float, float* %9
%80 = load float, float* %10
%81 = call i32 @glVertex3f(float %78, float %79, float %80)
%82 = call i32 @glNormal3f(double 0.000000e+00, double 0.000000e+00, double -1.000000e+00)
%83 = load float, float* %10
%84 = fneg float %83
%85 = call i32 @glVertex3f(float 0.000000e+00, float 0.000000e+00, float %84)
%86 = load float, float* %11
%87 = fneg float %86
%88 = load float, float* %9
%89 = load float, float* %10
%90 = fneg float %89
%91 = call i32 @glVertex3f(float %87, float %88, float %90)
%92 = load float, float* %11
%93 = fneg float %92
%94 = load float, float* %9
%95 = fneg float %94
%96 = load float, float* %10
%97 = fneg float %96
%98 = call i32 @glVertex3f(float %93, float %95, float %97)
%99 = call i32 (...) @glEnd()
br label %100
100: ; preds = %65, %42
%101 = call i32 @glRotatef(double 4.500000e+01, double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
br label %102
102: ; preds = %100
%103 = load i8, i8* %7
%104 = add i8 %103, 1
store i8 %104, i8* %7
br label %26
105: ; preds = %26
ret void
}

LLVM IR (-O2):
@GL_LINE_LOOP = global i32 0
@GL_QUADS = global i32 0
@GL_TRIANGLES = global i32 0
define void @Octagon(float %0, float %1, i8 signext %2) {
%4 = tail call float @sin(double 0x3FE921FB540D8D20)
%5 = fmul float %4, %0
%6 = fmul float %0, 5.000000e-01
%7 = fmul float %1, 5.000000e-01
%8 = fadd float %6, %5
%9 = fneg float %8
%10 = icmp eq i8 %2, 0
%11 = fneg float %6
%12 = fneg float %7
br label %13
13: ; preds = %3, %39
%14 = phi i8 [ 0, %3 ], [ %41, %39 ]
%15 = tail call i32 @glTranslatef(float %9, double 0.000000e+00, double 0.000000e+00)
%16 = load i32, i32* @GL_LINE_LOOP
%17 = load i32, i32* @GL_QUADS
%18 = select i1 %10, i32 %16, i32 %17
%19 = tail call i32 @glBegin(i32 %18)
%20 = tail call i32 @glNormal3f(double -1.000000e+00, double 0.000000e+00, double 0.000000e+00)
%21 = tail call i32 @glVertex3f(float 0.000000e+00, float %11, float %7)
%22 = tail call i32 @glVertex3f(float 0.000000e+00, float %6, float %7)
%23 = tail call i32 @glVertex3f(float 0.000000e+00, float %6, float %12)
%24 = tail call i32 @glVertex3f(float 0.000000e+00, float %11, float %12)
%25 = tail call i32 (...) @glEnd()
%26 = tail call i32 @glTranslatef(float %8, double 0.000000e+00, double 0.000000e+00)
br i1 %10, label %39, label %27
27: ; preds = %13
%28 = load i32, i32* @GL_TRIANGLES
%29 = tail call i32 @glBegin(i32 %28)
%30 = tail call i32 @glNormal3f(double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
%31 = tail call i32 @glVertex3f(float 0.000000e+00, float 0.000000e+00, float %7)
%32 = tail call i32 @glVertex3f(float %9, float %11, float %7)
%33 = tail call i32 @glVertex3f(float %9, float %6, float %7)
%34 = tail call i32 @glNormal3f(double 0.000000e+00, double 0.000000e+00, double -1.000000e+00)
%35 = tail call i32 @glVertex3f(float 0.000000e+00, float 0.000000e+00, float %12)
%36 = tail call i32 @glVertex3f(float %9, float %6, float %12)
%37 = tail call i32 @glVertex3f(float %9, float %11, float %12)
%38 = tail call i32 (...) @glEnd()
br label %39
39: ; preds = %27, %13
%40 = tail call i32 @glRotatef(double 4.500000e+01, double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
%41 = add nuw nsw i8 %14, 1
%42 = icmp eq i8 %41, 8
br i1 %42, label %43, label %13
43: ; preds = %39
ret void
}