#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 scalar_t__ GLuint;
typedef void *GLdouble;
typedef int /*<<< orphan*/ GLUquadricObj;

/* Variables and functions */
int /*<<< orphan*/ GLU_LINE;
int /*<<< orphan*/ GL_COMPILE_AND_EXECUTE;
scalar_t__ findList(int, void **, int);
int /*<<< orphan*/ free(void **);
int /*<<< orphan*/ glCallList(scalar_t__);
int /*<<< orphan*/ glEndList();
int /*<<< orphan*/ glNewList(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ glPopMatrix();
int /*<<< orphan*/ glPushMatrix();
int /*<<< orphan*/ glRotatef(double, double, double, double);
int /*<<< orphan*/ glTranslatef(double, double, double);
int /*<<< orphan*/ gluCylinder(int /*<<< orphan*/ *, void *, void *, void *,
                               int, int);
int /*<<< orphan*/ *gluNewQuadric();
int /*<<< orphan*/ gluQuadricDrawStyle(int /*<<< orphan*/ *,
                                       int /*<<< orphan*/);
int /*<<< orphan*/ makeModelPtr(int, void **, int);
scalar_t__ malloc(int);
void auxWireCylinder(GLdouble radius, GLdouble height) {
  GLUquadricObj *quadObj;
  GLdouble *sizeArray, *tmp;
  GLuint displayList;
  sizeArray = (GLdouble *)malloc(sizeof(GLdouble) * 2);
  tmp = sizeArray;
  *tmp++ = radius;
  *tmp++ = height;
  displayList = findList(4, sizeArray, 2);
  if (displayList == 0) {
    glNewList(makeModelPtr(4, sizeArray, 2), GL_COMPILE_AND_EXECUTE);
    glPushMatrix();
    glRotatef(90.0, 1.0, 0.0, 0.0);
    glTranslatef(0.0, 0.0, -1.0);
    quadObj = gluNewQuadric();
    gluQuadricDrawStyle(quadObj, GLU_LINE);
    gluCylinder(quadObj, radius, radius, height, 12, 2);
    glPopMatrix();
    glEndList();
  } else {
    glCallList(displayList);
    free(sizeArray);
  }
}


x86 assembly (clang, -O0):
<auxWireCylinder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x10,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x28(%rbp)
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x28(%rbp)
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rsi
mov    $0x4,%edi
mov    $0x2,%edx
call   10e0 <findList@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12fd <auxWireCylinder+0x11d>
mov    -0x20(%rbp),%rsi
mov    $0x4,%edi
mov    $0x2,%edx
call   1070 <makeModelPtr@plt>
mov    %eax,%edi
mov    0x2d68(%rip),%rax
mov    (%rax),%esi
call   1050 <glNewList@plt>
mov    $0x0,%al
call   1090 <glPushMatrix@plt>
movsd  0xd82(%rip),%xmm0
movsd  0xd82(%rip),%xmm1
xorps  %xmm3,%xmm3
movaps %xmm3,%xmm2
call   10f0 <glRotatef@plt>
xorps  %xmm1,%xmm1
movsd  0xd5c(%rip),%xmm2
movaps %xmm1,%xmm0
call   10d0 <glTranslatef@plt>
mov    $0x0,%al
call   1040 <gluNewQuadric@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2d26(%rip),%rax
mov    (%rax),%esi
call   1080 <gluQuadricDrawStyle@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0xc,%r8d
mov    $0x2,%r9d
call   10c0 <gluCylinder@plt>
mov    $0x0,%al
call   1060 <glPopMatrix@plt>
mov    $0x0,%al
call   1100 <glEndList@plt>
jmp    130f <auxWireCylinder+0x12f>
mov    -0x30(%rbp),%rdi
call   10a0 <glCallList@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<auxWireCylinder>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x10,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbx
mov    %r15,(%rax)
mov    %r14,0x8(%rax)
mov    $0x4,%edi
mov    %rax,%rsi
mov    $0x2,%edx
call   10e0 <findList@plt>
test   %rax,%rax
je     122b <auxWireCylinder+0x4b>
mov    %rax,%rdi
call   10a0 <glCallList@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>
mov    $0x4,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1070 <makeModelPtr@plt>
mov    0x2d94(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1050 <glNewList@plt>
xor    %eax,%eax
call   1090 <glPushMatrix@plt>
movsd  0xda4(%rip),%xmm0
movsd  0xda4(%rip),%xmm1
xorps  %xmm2,%xmm2
xorps  %xmm3,%xmm3
call   10f0 <glRotatef@plt>
movsd  0xd99(%rip),%xmm2
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
call   10d0 <glTranslatef@plt>
xor    %eax,%eax
call   1040 <gluNewQuadric@plt>
mov    %rax,%rbx
mov    0x2d55(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1080 <gluQuadricDrawStyle@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
mov    $0xc,%r8d
mov    $0x2,%r9d
call   10c0 <gluCylinder@plt>
xor    %eax,%eax
call   1060 <glPopMatrix@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1100 <glEndList@plt>

LLVM IR (-O0):
@GL_COMPILE_AND_EXECUTE = global i32 0
@GLU_LINE = global i32 0
define void @auxWireCylinder(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = call i64 @malloc(i32 16)
%10 = inttoptr i64 %9 to i8**
store i8** %10, i8*** %6
%11 = load i8**, i8*** %6
store i8** %11, i8*** %7
%12 = load i8*, i8** %3
%13 = load i8**, i8*** %7
%14 = getelementptr inbounds i8*, i8** %13, i32 1
store i8** %14, i8*** %7
store i8* %12, i8** %13
%15 = load i8*, i8** %4
%16 = load i8**, i8*** %7
%17 = getelementptr inbounds i8*, i8** %16, i32 1
store i8** %17, i8*** %7
store i8* %15, i8** %16
%18 = load i8**, i8*** %6
%19 = call i64 @findList(i32 4, i8** %18, i32 2)
store i64 %19, i64* %8
%20 = load i64, i64* %8
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %41
22: ; preds = %2
%23 = load i8**, i8*** %6
%24 = call i32 @makeModelPtr(i32 4, i8** %23, i32 2)
%25 = load i32, i32* @GL_COMPILE_AND_EXECUTE
%26 = call i32 @glNewList(i32 %24, i32 %25)
%27 = call i32 (...) @glPushMatrix()
%28 = call i32 @glRotatef(double 9.000000e+01, double 1.000000e+00, double 0.000000e+00, double 0.000000e+00)
%29 = call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, double -1.000000e+00)
%30 = call i32* (...) @gluNewQuadric()
store i32* %30, i32** %5
%31 = load i32*, i32** %5
%32 = load i32, i32* @GLU_LINE
%33 = call i32 @gluQuadricDrawStyle(i32* %31, i32 %32)
%34 = load i32*, i32** %5
%35 = load i8*, i8** %3
%36 = load i8*, i8** %3
%37 = load i8*, i8** %4
%38 = call i32 @gluCylinder(i32* %34, i8* %35, i8* %36, i8* %37, i32 12, i32 2)
%39 = call i32 (...) @glPopMatrix()
%40 = call i32 (...) @glEndList()
br label %46
41: ; preds = %2
%42 = load i64, i64* %8
%43 = call i32 @glCallList(i64 %42)
%44 = load i8**, i8*** %6
%45 = call i32 @free(i8** %44)
br label %46
46: ; preds = %41, %22
ret void
}

LLVM IR (-O2):
@GL_COMPILE_AND_EXECUTE = global i32 0
@GLU_LINE = global i32 0
define void @auxWireCylinder(i8* %0, i8* %1) {
%3 = tail call i64 @malloc(i32 16)
%4 = inttoptr i64 %3 to i8**
%5 = getelementptr inbounds i8*, i8** %4, i64 1
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = tail call i64 @findList(i32 4, i8** %4, i32 2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %21
8: ; preds = %2
%9 = tail call i32 @makeModelPtr(i32 4, i8** %4, i32 2)
%10 = load i32, i32* @GL_COMPILE_AND_EXECUTE
%11 = tail call i32 @glNewList(i32 %9, i32 %10)
%12 = tail call i32 (...) @glPushMatrix()
%13 = tail call i32 @glRotatef(double 9.000000e+01, double 1.000000e+00, double 0.000000e+00, double 0.000000e+00)
%14 = tail call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, double -1.000000e+00)
%15 = tail call i32* (...) @gluNewQuadric()
%16 = load i32, i32* @GLU_LINE
%17 = tail call i32 @gluQuadricDrawStyle(i32* %15, i32 %16)
%18 = tail call i32 @gluCylinder(i32* %15, i8* %0, i8* %0, i8* %1, i32 12, i32 2)
%19 = tail call i32 (...) @glPopMatrix()
%20 = tail call i32 (...) @glEndList()
br label %24
21: ; preds = %2
%22 = tail call i32 @glCallList(i64 %6)
%23 = tail call i32 @free(i8** %4)
br label %24
24: ; preds = %21, %8
ret void
}