#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*/ glColor3ub(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, double, int, int);
int /*<<< orphan*/ *gluNewQuadric();
int /*<<< orphan*/ gluQuadricDrawStyle(int /*<<< orphan*/ *,
                                       int /*<<< orphan*/);
int /*<<< orphan*/ gluQuadricOrientation(int /*<<< orphan*/ *,
                                         int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void poledlist(int dlist) {
  GLUquadricObj *obj;
  obj = gluNewQuadric();
  if (obj == 0) {
    perror("can't alloc quadric");
    exit(1);
  }
  glNewList(dlist, GL_COMPILE);
  glPushMatrix();
  glColor3ub(67, 205, 128);
  gluQuadricDrawStyle(obj, GLU_FILL);
  gluQuadricOrientation(obj, GLU_OUTSIDE);
  gluCylinder(obj, 0.1, 0.1, 1.8, 12, 3);
  gluQuadricOrientation(obj, GLU_INSIDE);
  gluDisk(obj, 0.0, 0.1, 12, 3);
  gluQuadricOrientation(obj, GLU_OUTSIDE);
  glPushMatrix();
  glTranslatef(0.0, 0.0, 1.8);
  gluDisk(obj, 0.0, 0.1, 12, 3);
  glPopMatrix();
  glPopMatrix();
  glEndList();
}


x86 assembly (clang, -O0):
<poledlist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <gluNewQuadric@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1207 <poledlist+0x37>
lea    0xe18(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x4(%rbp),%edi
mov    0x2db7(%rip),%rax
mov    (%rax),%esi
call   1050 <glNewList@plt>
mov    $0x0,%al
call   1090 <glPushMatrix@plt>
mov    $0x43,%edi
mov    $0xcd,%esi
mov    $0x80,%edx
call   1060 <glColor3ub@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d92(%rip),%rax
mov    (%rax),%esi
call   1080 <gluQuadricDrawStyle@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d98(%rip),%rax
mov    (%rax),%esi
call   1030 <gluQuadricOrientation@plt>
mov    -0x10(%rbp),%rdi
movsd  0xd9d(%rip),%xmm1
movsd  0xd9d(%rip),%xmm2
mov    $0xc,%esi
mov    $0x3,%edx
movaps %xmm1,%xmm0
call   10a0 <gluCylinder@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d50(%rip),%rax
mov    (%rax),%esi
call   1030 <gluQuadricOrientation@plt>
mov    -0x10(%rbp),%rdi
xorps  %xmm0,%xmm0
movsd  0xd62(%rip),%xmm1
mov    $0xc,%esi
mov    $0x3,%edx
call   10b0 <gluDisk@plt>
mov    -0x10(%rbp),%rdi
mov    0x2d30(%rip),%rax
mov    (%rax),%esi
call   1030 <gluQuadricOrientation@plt>
mov    $0x0,%al
call   1090 <glPushMatrix@plt>
xorps  %xmm1,%xmm1
movsd  0xd37(%rip),%xmm2
movaps %xmm1,%xmm0
call   10d0 <glTranslatef@plt>
mov    -0x10(%rbp),%rdi
xorps  %xmm0,%xmm0
movsd  0xd18(%rip),%xmm1
mov    $0xc,%esi
mov    $0x3,%edx
call   10b0 <gluDisk@plt>
mov    $0x0,%al
call   1070 <glPopMatrix@plt>
mov    $0x0,%al
call   1070 <glPopMatrix@plt>
mov    $0x0,%al
call   10f0 <glEndList@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poledlist>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <gluNewQuadric@plt>
test   %rax,%rax
je     12e6 <poledlist+0x116>
mov    %rax,%rbx
mov    0x2dd9(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
call   1050 <glNewList@plt>
xor    %eax,%eax
call   1090 <glPushMatrix@plt>
mov    $0x43,%edi
mov    $0xcd,%esi
mov    $0x80,%edx
call   1060 <glColor3ub@plt>
mov    0x2db6(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1080 <gluQuadricDrawStyle@plt>
mov    0x2dbd(%rip),%rbp
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1030 <gluQuadricOrientation@plt>
movsd  0xdc2(%rip),%xmm0
movsd  0xdc2(%rip),%xmm2
mov    %rbx,%rdi
movaps %xmm0,%xmm1
mov    $0xc,%esi
mov    $0x3,%edx
call   10a0 <gluCylinder@plt>
mov    0x2d76(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1030 <gluQuadricOrientation@plt>
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
movsd  0xd86(%rip),%xmm1
mov    $0xc,%esi
mov    $0x3,%edx
call   10b0 <gluDisk@plt>
mov    0x0(%rbp),%esi
mov    %rbx,%rdi
call   1030 <gluQuadricOrientation@plt>
xor    %eax,%eax
call   1090 <glPushMatrix@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
movsd  0xd5f(%rip),%xmm2
call   10d0 <glTranslatef@plt>
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
movsd  0xd44(%rip),%xmm1
mov    $0xc,%esi
mov    $0x3,%edx
call   10b0 <gluDisk@plt>
xor    %eax,%eax
call   1070 <glPopMatrix@plt>
xor    %eax,%eax
call   1070 <glPopMatrix@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    10f0 <glEndList@plt>
lea    0xd23(%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 @poledlist(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = call i32* (...) @gluNewQuadric()
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %1
%11 = load i32, i32* %2
%12 = load i32, i32* @GL_COMPILE
%13 = call i32 @glNewList(i32 %11, i32 %12)
%14 = call i32 (...) @glPushMatrix()
%15 = call i32 @glColor3ub(i32 67, i32 205, i32 128)
%16 = load i32*, i32** %3
%17 = load i32, i32* @GLU_FILL
%18 = call i32 @gluQuadricDrawStyle(i32* %16, i32 %17)
%19 = load i32*, i32** %3
%20 = load i32, i32* @GLU_OUTSIDE
%21 = call i32 @gluQuadricOrientation(i32* %19, i32 %20)
%22 = load i32*, i32** %3
%23 = call i32 @gluCylinder(i32* %22, double 1.000000e-01, double 1.000000e-01, double 1.800000e+00, i32 12, i32 3)
%24 = load i32*, i32** %3
%25 = load i32, i32* @GLU_INSIDE
%26 = call i32 @gluQuadricOrientation(i32* %24, i32 %25)
%27 = load i32*, i32** %3
%28 = call i32 @gluDisk(i32* %27, double 0.000000e+00, double 1.000000e-01, i32 12, i32 3)
%29 = load i32*, i32** %3
%30 = load i32, i32* @GLU_OUTSIDE
%31 = call i32 @gluQuadricOrientation(i32* %29, i32 %30)
%32 = call i32 (...) @glPushMatrix()
%33 = call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, double 1.800000e+00)
%34 = load i32*, i32** %3
%35 = call i32 @gluDisk(i32* %34, double 0.000000e+00, double 1.000000e-01, i32 12, i32 3)
%36 = call i32 (...) @glPopMatrix()
%37 = call i32 (...) @glPopMatrix()
%38 = 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 @poledlist(i32 %0) {
%2 = tail call i32* (...) @gluNewQuadric()
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
%8 = load i32, i32* @GL_COMPILE
%9 = tail call i32 @glNewList(i32 %0, i32 %8)
%10 = tail call i32 (...) @glPushMatrix()
%11 = tail call i32 @glColor3ub(i32 67, i32 205, i32 128)
%12 = load i32, i32* @GLU_FILL
%13 = tail call i32 @gluQuadricDrawStyle(i32* %2, i32 %12)
%14 = load i32, i32* @GLU_OUTSIDE
%15 = tail call i32 @gluQuadricOrientation(i32* %2, i32 %14)
%16 = tail call i32 @gluCylinder(i32* %2, double 1.000000e-01, double 1.000000e-01, double 1.800000e+00, i32 12, i32 3)
%17 = load i32, i32* @GLU_INSIDE
%18 = tail call i32 @gluQuadricOrientation(i32* %2, i32 %17)
%19 = tail call i32 @gluDisk(i32* %2, double 0.000000e+00, double 1.000000e-01, i32 12, i32 3)
%20 = load i32, i32* @GLU_OUTSIDE
%21 = tail call i32 @gluQuadricOrientation(i32* %2, i32 %20)
%22 = tail call i32 (...) @glPushMatrix()
%23 = tail call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, double 1.800000e+00)
%24 = tail call i32 @gluDisk(i32* %2, double 0.000000e+00, double 1.000000e-01, i32 12, i32 3)
%25 = tail call i32 (...) @glPopMatrix()
%26 = tail call i32 (...) @glPopMatrix()
%27 = tail call i32 (...) @glEndList()
ret void
}