#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_NORMALIZE;
int /*<<< orphan*/ GL_POLYGON;
float cos(float);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glDisable(int /*<<< orphan*/);
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glNormal3f(double, double, double);
int /*<<< orphan*/ glPopMatrix();
int /*<<< orphan*/ glPushMatrix();
int /*<<< orphan*/ glVertex3f(float, float, float);
float sin(float);
void myDisc(float r, int n) {
  float x, y, z, dq;
  int i;
  glEnable(GL_NORMALIZE);
  dq = 2.0 * 3.1415926534 / (float)n;
  glPushMatrix();
  y = 0.0;
  glBegin(GL_POLYGON);
  glNormal3f(0.0, 1.0, 0.0);
  for (i = 0; i < n; i += 1) {
    x = r * cos(dq * (float)i);
    z = r * sin(dq * (float)i);
    glVertex3f(x, y, z);
  }
  glEnd();
  glPopMatrix();
  glDisable(GL_NORMALIZE);
}


x86 assembly (clang, -O0):
<myDisc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
call   1040 <glEnable@plt>
cvtsi2ssl -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe39(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1080 <glPushMatrix@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
call   10b0 <glBegin@plt>
xorps  %xmm2,%xmm2
movsd  0xdfc(%rip),%xmm1
movaps %xmm2,%xmm0
call   10c0 <glNormal3f@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    129d <myDisc+0xfd>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x18(%rbp),%xmm0
cvtsi2ssl -0x1c(%rbp),%xmm1
mulss  %xmm1,%xmm0
call   1090 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x18(%rbp),%xmm0
cvtsi2ssl -0x1c(%rbp),%xmm1
mulss  %xmm1,%xmm0
call   1070 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x20(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
call   1030 <glVertex3f@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1213 <myDisc+0x73>
mov    $0x0,%al
call   1050 <glEnd@plt>
mov    $0x0,%al
call   1060 <glPopMatrix@plt>
mov    0x2d26(%rip),%rax
mov    (%rax),%edi
call   10a0 <glDisable@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myDisc>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movss  %xmm0,(%rsp)
mov    0x2e22(%rip),%r14
mov    (%r14),%edi
call   1040 <glEnable@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1080 <glPushMatrix@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
call   10b0 <glBegin@plt>
movsd  0xe2b(%rip),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
call   10c0 <glNormal3f@plt>
test   %ebx,%ebx
jle    125b <myDisc+0xbb>
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe01(%rip),%xmm1
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
mulss  0x4(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
call   1090 <cos@plt>
mulss  (%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1070 <sin@plt>
movaps %xmm0,%xmm2
mulss  (%rsp),%xmm2
xorps  %xmm1,%xmm1
movss  0xc(%rsp),%xmm0
call   1030 <glVertex3f@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1210 <myDisc+0x70>
xor    %eax,%eax
call   1050 <glEnd@plt>
xor    %eax,%eax
call   1060 <glPopMatrix@plt>
mov    (%r14),%edi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    10a0 <glDisable@plt>

LLVM IR (-O0):
@GL_NORMALIZE = global i32 0
@GL_POLYGON = global i32 0
define void @myDisc(float %0, i32 %1) {
%3 = alloca float
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca i32
store float %0, float* %3
store i32 %1, i32* %4
%10 = load i32, i32* @GL_NORMALIZE
%11 = call i32 @glEnable(i32 %10)
%12 = load i32, i32* %4
%13 = sitofp i32 %12 to float
%14 = fpext float %13 to double
%15 = fdiv double 0x401921FB543DA7A8, %14
%16 = fptrunc double %15 to float
store float %16, float* %8
%17 = call i32 (...) @glPushMatrix()
store float 0.000000e+00, float* %6
%18 = load i32, i32* @GL_POLYGON
%19 = call i32 @glBegin(i32 %18)
%20 = call i32 @glNormal3f(double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
store i32 0, i32* %9
br label %21
21: ; preds = %44, %2
%22 = load i32, i32* %9
%23 = load i32, i32* %4
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %47
25: ; preds = %21
%26 = load float, float* %3
%27 = load float, float* %8
%28 = load i32, i32* %9
%29 = sitofp i32 %28 to float
%30 = fmul float %27, %29
%31 = call float @cos(float %30)
%32 = fmul float %26, %31
store float %32, float* %5
%33 = load float, float* %3
%34 = load float, float* %8
%35 = load i32, i32* %9
%36 = sitofp i32 %35 to float
%37 = fmul float %34, %36
%38 = call float @sin(float %37)
%39 = fmul float %33, %38
store float %39, float* %7
%40 = load float, float* %5
%41 = load float, float* %6
%42 = load float, float* %7
%43 = call i32 @glVertex3f(float %40, float %41, float %42)
br label %44
44: ; preds = %25
%45 = load i32, i32* %9
%46 = add nsw i32 %45, 1
store i32 %46, i32* %9
br label %21
47: ; preds = %21
%48 = call i32 (...) @glEnd()
%49 = call i32 (...) @glPopMatrix()
%50 = load i32, i32* @GL_NORMALIZE
%51 = call i32 @glDisable(i32 %50)
ret void
}

LLVM IR (-O2):
@GL_NORMALIZE = global i32 0
@GL_POLYGON = global i32 0
define void @myDisc(float %0, i32 %1) {
%3 = load i32, i32* @GL_NORMALIZE
%4 = tail call i32 @glEnable(i32 %3)
%5 = sitofp i32 %1 to float
%6 = fpext float %5 to double
%7 = fdiv double 0x401921FB543DA7A8, %6
%8 = fptrunc double %7 to float
%9 = tail call i32 (...) @glPushMatrix()
%10 = load i32, i32* @GL_POLYGON
%11 = tail call i32 @glBegin(i32 %10)
%12 = tail call i32 @glNormal3f(double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%13 = icmp sgt i32 %1, 0
br i1 %13, label %14, label %25
14: ; preds = %2, %14
%15 = phi i32 [ %23, %14 ], [ 0, %2 ]
%16 = sitofp i32 %15 to float
%17 = fmul float %8, %16
%18 = tail call float @cos(float %17)
%19 = fmul float %18, %0
%20 = tail call float @sin(float %17)
%21 = fmul float %20, %0
%22 = tail call i32 @glVertex3f(float %19, float 0.000000e+00, float %21)
%23 = add nuw nsw i32 %15, 1
%24 = icmp eq i32 %23, %1
br i1 %24, label %25, label %14
25: ; preds = %14, %2
%26 = tail call i32 (...) @glEnd()
%27 = tail call i32 (...) @glPopMatrix()
%28 = load i32, i32* @GL_NORMALIZE
%29 = tail call i32 @glDisable(i32 %28)
ret void
}