#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 double GLint;
typedef float GLfloat;
typedef float GLdouble;
typedef int /*<<< orphan*/ GLUquadricObj;

/* Variables and functions */
int /*<<< orphan*/ GL_QUAD_STRIP;
double M_PI;
float cos(float);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glNormal3f(double, double, double);
int /*<<< orphan*/ glTexCoord2f(double, double);
int /*<<< orphan*/ glVertex2f(float, float);
float sin(float);
void gluDisk(GLUquadricObj *qobj, GLdouble innerRadius, GLdouble outerRadius,
             GLint slices, GLint loops) {
  GLdouble a, da;
  GLfloat dr;
  GLfloat r1, r2, dtc;
  GLint s, l;
  GLfloat sa, ca;
  glNormal3f(0.0, 0.0, +1.0);
  da = 2.0 * M_PI / slices;
  dr = (outerRadius - innerRadius) / (GLfloat)loops;
  dtc = 2.0f * outerRadius;
  r1 = innerRadius;
  for (l = 0; l < loops; l++) {
    r2 = r1 + dr;
    glBegin(GL_QUAD_STRIP);
    for (s = 0; s <= slices; s++) {
      if (s == slices)
        a = 0.0;
      else
        a = s * da;
      sa = sin(a);
      ca = cos(a);
      glTexCoord2f(0.5 + sa * r2 / dtc, 0.5 + ca * r2 / dtc);
      glVertex2f(r2 * sa, r2 * ca);
      glTexCoord2f(0.5 + sa * r1 / dtc, 0.5 + ca * r1 / dtc);
      glVertex2f(r1 * sa, r1 * ca);
    }
    glEnd();
    r1 = r2;
  }
}


x86 assembly (clang, -O0):
<gluDisk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
xorps  %xmm1,%xmm1
movsd  0xe75(%rip),%xmm2
movaps %xmm1,%xmm0
call   1090 <glNormal3f@plt>
movsd  0xe5d(%rip),%xmm0
mov    0x2e36(%rip),%rax
mulsd  (%rax),%xmm0
divsd  -0x18(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x10(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
cvtsd2ss %xmm1,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  0xe18(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    13a4 <gluDisk+0x234>
movss  -0x30(%rbp),%xmm0
addss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
mov    0x2db2(%rip),%rax
mov    (%rax),%edi
call   1080 <glBegin@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     137c <gluDisk+0x20c>
movsd  -0x40(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    1274 <gluDisk+0x104>
jp     1274 <gluDisk+0x104>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    128f <gluDisk+0x11f>
movsd  -0x40(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
call   1040 <sin@plt>
movss  %xmm0,-0x4c(%rbp)
movss  -0x24(%rbp),%xmm0
call   1070 <cos@plt>
movss  %xmm0,-0x50(%rbp)
movss  -0x4c(%rbp),%xmm0
mulss  -0x34(%rbp),%xmm0
divss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd50(%rip),%xmm0
addsd  %xmm1,%xmm0
movss  -0x50(%rbp),%xmm1
mulss  -0x34(%rbp),%xmm1
divss  -0x38(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xd31(%rip),%xmm1
addsd  %xmm2,%xmm1
call   1060 <glTexCoord2f@plt>
movss  -0x34(%rbp),%xmm0
mulss  -0x4c(%rbp),%xmm0
movss  -0x34(%rbp),%xmm1
mulss  -0x50(%rbp),%xmm1
call   1050 <glVertex2f@plt>
movss  -0x4c(%rbp),%xmm0
mulss  -0x30(%rbp),%xmm0
divss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xcf4(%rip),%xmm0
addsd  %xmm1,%xmm0
movss  -0x50(%rbp),%xmm1
mulss  -0x30(%rbp),%xmm1
divss  -0x38(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xcd5(%rip),%xmm1
addsd  %xmm2,%xmm1
call   1060 <glTexCoord2f@plt>
movss  -0x30(%rbp),%xmm0
mulss  -0x4c(%rbp),%xmm0
movss  -0x30(%rbp),%xmm1
mulss  -0x50(%rbp),%xmm1
call   1050 <glVertex2f@plt>
movsd  0xca3(%rip),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    123d <gluDisk+0xcd>
mov    $0x0,%al
call   1030 <glEnd@plt>
movss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movsd  0xc7b(%rip),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1204 <gluDisk+0x94>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gluDisk>:
push   %rbx
sub    $0x50,%rsp
movsd  %xmm3,0x18(%rsp)
movsd  %xmm2,0x20(%rsp)
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
movsd  0xe6b(%rip),%xmm2
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
call   1090 <glNormal3f@plt>
movsd  0x18(%rsp),%xmm0
ucomisd 0xe62(%rip),%xmm0
jbe    13b2 <gluDisk+0x242>
movss  0xc(%rsp),%xmm1
movaps %xmm1,%xmm2
subss  0x8(%rsp),%xmm2
movsd  0x18(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
divss  %xmm0,%xmm2
movss  %xmm2,0x2c(%rsp)
addss  %xmm1,%xmm1
movss  %xmm1,0xc(%rsp)
mov    0x2e00(%rip),%rax
movsd  (%rax),%xmm0
addsd  %xmm0,%xmm0
divsd  0x20(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x40(%rsp)
mov    0x2dd5(%rip),%rbx
xorps  %xmm1,%xmm1
jmp    1241 <gluDisk+0xd1>
xor    %eax,%eax
call   1030 <glEnd@plt>
movsd  0x38(%rsp),%xmm1
addsd  0xddb(%rip),%xmm1
movsd  0x18(%rsp),%xmm0
ucomisd %xmm1,%xmm0
movss  0x14(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
jbe    13b2 <gluDisk+0x242>
movsd  %xmm1,0x38(%rsp)
mov    (%rbx),%edi
call   1080 <glBegin@plt>
movsd  0x20(%rsp),%xmm0
ucomisd 0xdb4(%rip),%xmm0
movss  0x2c(%rsp),%xmm1
addss  0x8(%rsp),%xmm1
movss  %xmm1,0x14(%rsp)
jb     1210 <gluDisk+0xa0>
xorps  %xmm1,%xmm1
jmp    1386 <gluDisk+0x216>
nopl   0x0(%rax,%rax,1)
movss  %xmm0,0x4(%rsp)
call   1040 <sin@plt>
movss  %xmm0,0x10(%rsp)
movss  0x4(%rsp),%xmm0
call   1070 <cos@plt>
movaps %xmm0,%xmm3
movss  %xmm0,0x4(%rsp)
movss  0x14(%rsp),%xmm2
movaps %xmm2,%xmm0
mulss  0x10(%rsp),%xmm0
movss  %xmm0,0x34(%rsp)
movss  0xc(%rsp),%xmm4
divss  %xmm4,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd38(%rip),%xmm5
addsd  %xmm5,%xmm0
movaps %xmm2,%xmm1
mulss  %xmm3,%xmm1
movss  %xmm1,0x30(%rsp)
divss  %xmm4,%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm5,%xmm1
call   1060 <glTexCoord2f@plt>
movss  0x34(%rsp),%xmm0
movss  0x30(%rsp),%xmm1
call   1050 <glVertex2f@plt>
movss  0x8(%rsp),%xmm1
movss  0x10(%rsp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm3
divss  %xmm3,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xcd9(%rip),%xmm4
addsd  %xmm4,%xmm0
movss  0x4(%rsp),%xmm2
mulss  %xmm1,%xmm2
movss  %xmm2,0x4(%rsp)
movaps %xmm2,%xmm1
divss  %xmm3,%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm4,%xmm1
call   1060 <glTexCoord2f@plt>
movss  0x10(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
call   1050 <glVertex2f@plt>
movsd  0x48(%rsp),%xmm1
addsd  0xc8a(%rip),%xmm1
movsd  0x20(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jb     1210 <gluDisk+0xa0>
ucomisd %xmm0,%xmm1
movapd %xmm1,%xmm0
mulsd  0x40(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  %xmm1,0x48(%rsp)
jne    1280 <gluDisk+0x110>
jp     1280 <gluDisk+0x110>
xorps  %xmm0,%xmm0
jmp    1280 <gluDisk+0x110>
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
@GL_QUAD_STRIP = global i32 0
define void @gluDisk(i32* %0, float %1, float %2, double %3, double %4) {
%6 = alloca i32*
%7 = alloca float
%8 = alloca float
%9 = alloca double
%10 = alloca double
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca double
%18 = alloca double
%19 = alloca float
%20 = alloca float
store i32* %0, i32** %6
store float %1, float* %7
store float %2, float* %8
store double %3, double* %9
store double %4, double* %10
%21 = call i32 @glNormal3f(double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
%22 = load double, double* @M_PI
%23 = fmul double 2.000000e+00, %22
%24 = load double, double* %9
%25 = fdiv double %23, %24
%26 = fptrunc double %25 to float
store float %26, float* %12
%27 = load float, float* %8
%28 = load float, float* %7
%29 = fsub float %27, %28
%30 = load double, double* %10
%31 = fptrunc double %30 to float
%32 = fdiv float %29, %31
store float %32, float* %13
%33 = load float, float* %8
%34 = fmul float 2.000000e+00, %33
store float %34, float* %16
%35 = load float, float* %7
store float %35, float* %14
store double 0.000000e+00, double* %18
br label %36
36: ; preds = %116, %5
%37 = load double, double* %18
%38 = load double, double* %10
%39 = fcmp olt double %37, %38
br i1 %39, label %40, label %119
40: ; preds = %36
%41 = load float, float* %14
%42 = load float, float* %13
%43 = fadd float %41, %42
store float %43, float* %15
%44 = load i32, i32* @GL_QUAD_STRIP
%45 = call i32 @glBegin(i32 %44)
store double 0.000000e+00, double* %17
br label %46
46: ; preds = %110, %40
%47 = load double, double* %17
%48 = load double, double* %9
%49 = fcmp ole double %47, %48
br i1 %49, label %50, label %113
50: ; preds = %46
%51 = load double, double* %17
%52 = load double, double* %9
%53 = fcmp oeq double %51, %52
br i1 %53, label %54, label %55
54: ; preds = %50
store float 0.000000e+00, float* %11
br label %61
55: ; preds = %50
%56 = load double, double* %17
%57 = load float, float* %12
%58 = fpext float %57 to double
%59 = fmul double %56, %58
%60 = fptrunc double %59 to float
store float %60, float* %11
br label %61
61: ; preds = %55, %54
%62 = load float, float* %11
%63 = call float @sin(float %62)
store float %63, float* %19
%64 = load float, float* %11
%65 = call float @cos(float %64)
store float %65, float* %20
%66 = load float, float* %19
%67 = load float, float* %15
%68 = fmul float %66, %67
%69 = load float, float* %16
%70 = fdiv float %68, %69
%71 = fpext float %70 to double
%72 = fadd double 5.000000e-01, %71
%73 = load float, float* %20
%74 = load float, float* %15
%75 = fmul float %73, %74
%76 = load float, float* %16
%77 = fdiv float %75, %76
%78 = fpext float %77 to double
%79 = fadd double 5.000000e-01, %78
%80 = call i32 @glTexCoord2f(double %72, double %79)
%81 = load float, float* %15
%82 = load float, float* %19
%83 = fmul float %81, %82
%84 = load float, float* %15
%85 = load float, float* %20
%86 = fmul float %84, %85
%87 = call i32 @glVertex2f(float %83, float %86)
%88 = load float, float* %19
%89 = load float, float* %14
%90 = fmul float %88, %89
%91 = load float, float* %16
%92 = fdiv float %90, %91
%93 = fpext float %92 to double
%94 = fadd double 5.000000e-01, %93
%95 = load float, float* %20
%96 = load float, float* %14
%97 = fmul float %95, %96
%98 = load float, float* %16
%99 = fdiv float %97, %98
%100 = fpext float %99 to double
%101 = fadd double 5.000000e-01, %100
%102 = call i32 @glTexCoord2f(double %94, double %101)
%103 = load float, float* %14
%104 = load float, float* %19
%105 = fmul float %103, %104
%106 = load float, float* %14
%107 = load float, float* %20
%108 = fmul float %106, %107
%109 = call i32 @glVertex2f(float %105, float %108)
br label %110
110: ; preds = %61
%111 = load double, double* %17
%112 = fadd double %111, 1.000000e+00
store double %112, double* %17
br label %46
113: ; preds = %46
%114 = call i32 (...) @glEnd()
%115 = load float, float* %15
store float %115, float* %14
br label %116
116: ; preds = %113
%117 = load double, double* %18
%118 = fadd double %117, 1.000000e+00
store double %118, double* %18
br label %36
119: ; preds = %36
ret void
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
@GL_QUAD_STRIP = global i32 0
define void @gluDisk(i32* nocapture readnone %0, float %1, float %2, double %3, double %4) {
%6 = tail call i32 @glNormal3f(double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
%7 = fsub float %2, %1
%8 = fptrunc double %4 to float
%9 = fdiv float %7, %8
%10 = fmul float %2, 2.000000e+00
%11 = fcmp ogt double %4, 0.000000e+00
br i1 %11, label %12, label %59
12: ; preds = %5
%13 = load double, double* @M_PI
%14 = fmul double %13, 2.000000e+00
%15 = fdiv double %14, %3
%16 = fptrunc double %15 to float
%17 = fcmp ult double %3, 0.000000e+00
%18 = fpext float %16 to double
br label %19
19: ; preds = %12, %55
%20 = phi float [ %1, %12 ], [ %22, %55 ]
%21 = phi double [ 0.000000e+00, %12 ], [ %57, %55 ]
%22 = fadd float %9, %20
%23 = load i32, i32* @GL_QUAD_STRIP
%24 = tail call i32 @glBegin(i32 %23)
br i1 %17, label %55, label %25
25: ; preds = %19, %25
%26 = phi double [ %53, %25 ], [ 0.000000e+00, %19 ]
%27 = fcmp oeq double %26, %3
%28 = fmul double %26, %18
%29 = fptrunc double %28 to float
%30 = select i1 %27, float 0.000000e+00, float %29
%31 = tail call float @sin(float %30)
%32 = tail call float @cos(float %30)
%33 = fmul float %22, %31
%34 = fdiv float %33, %10
%35 = fpext float %34 to double
%36 = fadd double %35, 5.000000e-01
%37 = fmul float %22, %32
%38 = fdiv float %37, %10
%39 = fpext float %38 to double
%40 = fadd double %39, 5.000000e-01
%41 = tail call i32 @glTexCoord2f(double %36, double %40)
%42 = tail call i32 @glVertex2f(float %33, float %37)
%43 = fmul float %20, %31
%44 = fdiv float %43, %10
%45 = fpext float %44 to double
%46 = fadd double %45, 5.000000e-01
%47 = fmul float %20, %32
%48 = fdiv float %47, %10
%49 = fpext float %48 to double
%50 = fadd double %49, 5.000000e-01
%51 = tail call i32 @glTexCoord2f(double %46, double %50)
%52 = tail call i32 @glVertex2f(float %43, float %47)
%53 = fadd double %26, 1.000000e+00
%54 = fcmp ugt double %53, %3
br i1 %54, label %55, label %25
55: ; preds = %25, %19
%56 = tail call i32 (...) @glEnd()
%57 = fadd double %21, 1.000000e+00
%58 = fcmp olt double %57, %4
br i1 %58, label %19, label %59
59: ; preds = %55, %5
ret void
}