#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 /*<<< orphan*/ GLUquadricObj;

/* Variables and functions */
int /*<<< orphan*/ GLU_FILL;
int /*<<< orphan*/ GLU_INSIDE;
int /*<<< orphan*/ GLU_OUTSIDE;
int /*<<< orphan*/ GL_COMPILE;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ glColor4ub(int, int, int, int);
int /*<<< orphan*/ glEndList();
int /*<<< orphan*/ glNewList(int, int /*<<< orphan*/);
int /*<<< orphan*/ glPopMatrix();
int /*<<< orphan*/ glPushMatrix();
int /*<<< orphan*/ glTranslatef(double, double, double);
int /*<<< orphan*/ gluCylinder(int /*<<< orphan*/ *, double, double, double,
                               int, int);
int /*<<< orphan*/ gluDisk(int /*<<< orphan*/ *, double, float, int, int);
int /*<<< orphan*/ *gluNewQuadric();
int /*<<< orphan*/ gluQuadricDrawStyle(int /*<<< orphan*/ *,
                                       int /*<<< orphan*/);
int /*<<< orphan*/ gluQuadricOrientation(int /*<<< orphan*/ *,
                                         int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void diskdlist(int dlist, float orad) {
  GLUquadricObj *obj;
  obj = gluNewQuadric();
  if (obj == 0) {
    perror("can't alloc quadric");
    exit(1);
  }
  glNewList(dlist, GL_COMPILE);
  glPushMatrix();
  glColor4ub(205, 67, 100, 200);
  gluQuadricDrawStyle(obj, GLU_FILL);
  gluQuadricOrientation(obj, GLU_OUTSIDE);
  gluCylinder(obj, orad, orad, 0.2, 20, 4);
  gluQuadricOrientation(obj, GLU_INSIDE);
  gluCylinder(obj, 0.1, 0.1, 0.2, 20, 4);
  gluQuadricOrientation(obj, GLU_INSIDE);
  gluDisk(obj, 0.1, orad, 20, 4);
  gluQuadricOrientation(obj, GLU_OUTSIDE);
  glPushMatrix();
  glTranslatef(0.0, 0.0, 0.2);
  gluDisk(obj, 0.1, orad, 20, 4);
  glPopMatrix();
  glPopMatrix();
  glEndList();
}


x86 assembly (clang, -O0):
<diskdlist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <gluNewQuadric@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    120c <diskdlist+0x3c>
lea    0xe13(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x4(%rbp),%edi
mov    0x2db2(%rip),%rax
mov    (%rax),%esi
call   1050 <glNewList@plt>
mov    $0x0,%al
call   1080 <glPushMatrix@plt>
mov    $0xcd,%edi
mov    $0x43,%esi
mov    $0x64,%edx
mov    $0xc8,%ecx
call   1090 <glColor4ub@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d88(%rip),%rax
mov    (%rax),%esi
call   1070 <gluQuadricDrawStyle@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d8e(%rip),%rax
mov    (%rax),%esi
call   1030 <gluQuadricOrientation@plt>
mov    -0x10(%rbp),%rdi
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xd89(%rip),%xmm2
mov    $0x14,%esi
mov    $0x4,%edx
call   10a0 <gluCylinder@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d3f(%rip),%rax
mov    (%rax),%esi
call   1030 <gluQuadricOrientation@plt>
mov    -0x10(%rbp),%rdi
movsd  0xd54(%rip),%xmm1
movsd  0xd54(%rip),%xmm2
mov    $0x14,%esi
mov    $0x4,%edx
movaps %xmm1,%xmm0
call   10a0 <gluCylinder@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d07(%rip),%rax
mov    (%rax),%esi
call   1030 <gluQuadricOrientation@plt>
mov    -0x10(%rbp),%rdi
movss  -0x8(%rbp),%xmm1
movsd  0xd17(%rip),%xmm0
mov    $0x14,%esi
mov    $0x4,%edx
call   10b0 <gluDisk@plt>
mov    -0x10(%rbp),%rdi
mov    0x2ce5(%rip),%rax
mov    (%rax),%esi
call   1030 <gluQuadricOrientation@plt>
mov    $0x0,%al
call   1080 <glPushMatrix@plt>
xorps  %xmm1,%xmm1
movsd  0xcec(%rip),%xmm2
movaps %xmm1,%xmm0
call   10d0 <glTranslatef@plt>
mov    -0x10(%rbp),%rdi
movss  -0x8(%rbp),%xmm1
movsd  0xccb(%rip),%xmm0
mov    $0x14,%esi
mov    $0x4,%edx
call   10b0 <gluDisk@plt>
mov    $0x0,%al
call   1060 <glPopMatrix@plt>
mov    $0x0,%al
call   1060 <glPopMatrix@plt>
mov    $0x0,%al
call   10f0 <glEndList@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diskdlist>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <gluNewQuadric@plt>
test   %rax,%rax
je     1331 <diskdlist+0x161>
mov    %rax,%rbx
mov    0x2dce(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
call   1050 <glNewList@plt>
xor    %eax,%eax
call   1080 <glPushMatrix@plt>
mov    $0xcd,%edi
mov    $0x43,%esi
mov    $0x64,%edx
mov    $0xc8,%ecx
call   1090 <glColor4ub@plt>
mov    0x2da6(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1070 <gluQuadricDrawStyle@plt>
mov    0x2dad(%rip),%r14
mov    (%r14),%esi
mov    %rbx,%rdi
call   1030 <gluQuadricOrientation@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xda8(%rip),%xmm2
mov    %rbx,%rdi
movaps %xmm0,%xmm1
mov    $0x14,%esi
mov    $0x4,%edx
call   10a0 <gluCylinder@plt>
mov    0x2d64(%rip),%rbp
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1030 <gluQuadricOrientation@plt>
movsd  0xd81(%rip),%xmm0
mov    %rbx,%rdi
movaps %xmm0,%xmm1
movsd  0xd6b(%rip),%xmm2
mov    $0x14,%esi
mov    $0x4,%edx
call   10a0 <gluCylinder@plt>
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1030 <gluQuadricOrientation@plt>
mov    %rbx,%rdi
movsd  0xd4e(%rip),%xmm0
movss  0xc(%rsp),%xmm1
mov    $0x14,%esi
mov    $0x4,%edx
call   10b0 <gluDisk@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1030 <gluQuadricOrientation@plt>
xor    %eax,%eax
call   1080 <glPushMatrix@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
movsd  0xd11(%rip),%xmm2
call   10d0 <glTranslatef@plt>
mov    %rbx,%rdi
movsd  0xd09(%rip),%xmm0
movss  0xc(%rsp),%xmm1
mov    $0x14,%esi
mov    $0x4,%edx
call   10b0 <gluDisk@plt>
xor    %eax,%eax
call   1060 <glPopMatrix@plt>
xor    %eax,%eax
call   1060 <glPopMatrix@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    10f0 <glEndList@plt>
lea    0xcd8(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"can't alloc quadric\00"
@GL_COMPILE = global i32 0
@GLU_FILL = global i32 0
@GLU_OUTSIDE = global i32 0
@GLU_INSIDE = global i32 0
define void @diskdlist(i32 %0, float %1) {
%3 = alloca i32
%4 = alloca float
%5 = alloca i32*
store i32 %0, i32* %3
store float %1, float* %4
%6 = call i32* (...) @gluNewQuadric()
store i32* %6, i32** %5
%7 = load i32*, i32** %5
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = load i32, i32* %3
%14 = load i32, i32* @GL_COMPILE
%15 = call i32 @glNewList(i32 %13, i32 %14)
%16 = call i32 (...) @glPushMatrix()
%17 = call i32 @glColor4ub(i32 205, i32 67, i32 100, i32 200)
%18 = load i32*, i32** %5
%19 = load i32, i32* @GLU_FILL
%20 = call i32 @gluQuadricDrawStyle(i32* %18, i32 %19)
%21 = load i32*, i32** %5
%22 = load i32, i32* @GLU_OUTSIDE
%23 = call i32 @gluQuadricOrientation(i32* %21, i32 %22)
%24 = load i32*, i32** %5
%25 = load float, float* %4
%26 = fpext float %25 to double
%27 = load float, float* %4
%28 = fpext float %27 to double
%29 = call i32 @gluCylinder(i32* %24, double %26, double %28, double 2.000000e-01, i32 20, i32 4)
%30 = load i32*, i32** %5
%31 = load i32, i32* @GLU_INSIDE
%32 = call i32 @gluQuadricOrientation(i32* %30, i32 %31)
%33 = load i32*, i32** %5
%34 = call i32 @gluCylinder(i32* %33, double 1.000000e-01, double 1.000000e-01, double 2.000000e-01, i32 20, i32 4)
%35 = load i32*, i32** %5
%36 = load i32, i32* @GLU_INSIDE
%37 = call i32 @gluQuadricOrientation(i32* %35, i32 %36)
%38 = load i32*, i32** %5
%39 = load float, float* %4
%40 = call i32 @gluDisk(i32* %38, double 1.000000e-01, float %39, i32 20, i32 4)
%41 = load i32*, i32** %5
%42 = load i32, i32* @GLU_OUTSIDE
%43 = call i32 @gluQuadricOrientation(i32* %41, i32 %42)
%44 = call i32 (...) @glPushMatrix()
%45 = call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, double 2.000000e-01)
%46 = load i32*, i32** %5
%47 = load float, float* %4
%48 = call i32 @gluDisk(i32* %46, double 1.000000e-01, float %47, i32 20, i32 4)
%49 = call i32 (...) @glPopMatrix()
%50 = call i32 (...) @glPopMatrix()
%51 = call i32 (...) @glEndList()
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"can't alloc quadric\00"
@GL_COMPILE = global i32 0
@GLU_FILL = global i32 0
@GLU_OUTSIDE = global i32 0
@GLU_INSIDE = global i32 0
define void @diskdlist(i32 %0, float %1) {
%3 = tail call i32* (...) @gluNewQuadric()
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = load i32, i32* @GL_COMPILE
%10 = tail call i32 @glNewList(i32 %0, i32 %9)
%11 = tail call i32 (...) @glPushMatrix()
%12 = tail call i32 @glColor4ub(i32 205, i32 67, i32 100, i32 200)
%13 = load i32, i32* @GLU_FILL
%14 = tail call i32 @gluQuadricDrawStyle(i32* %3, i32 %13)
%15 = load i32, i32* @GLU_OUTSIDE
%16 = tail call i32 @gluQuadricOrientation(i32* %3, i32 %15)
%17 = fpext float %1 to double
%18 = tail call i32 @gluCylinder(i32* %3, double %17, double %17, double 2.000000e-01, i32 20, i32 4)
%19 = load i32, i32* @GLU_INSIDE
%20 = tail call i32 @gluQuadricOrientation(i32* %3, i32 %19)
%21 = tail call i32 @gluCylinder(i32* %3, double 1.000000e-01, double 1.000000e-01, double 2.000000e-01, i32 20, i32 4)
%22 = load i32, i32* @GLU_INSIDE
%23 = tail call i32 @gluQuadricOrientation(i32* %3, i32 %22)
%24 = tail call i32 @gluDisk(i32* %3, double 1.000000e-01, float %1, i32 20, i32 4)
%25 = load i32, i32* @GLU_OUTSIDE
%26 = tail call i32 @gluQuadricOrientation(i32* %3, i32 %25)
%27 = tail call i32 (...) @glPushMatrix()
%28 = tail call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, double 2.000000e-01)
%29 = tail call i32 @gluDisk(i32* %3, double 1.000000e-01, float %1, i32 20, i32 4)
%30 = tail call i32 (...) @glPopMatrix()
%31 = tail call i32 (...) @glPopMatrix()
%32 = tail call i32 (...) @glEndList()
ret void
}