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

/* Variables and functions */
int /*<<< orphan*/ GLU_LINE;
int /*<<< orphan*/ GL_COMPILE_AND_EXECUTE;
scalar_t__ findList(int /*<<< orphan*/, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
int /*<<< orphan*/ glCallList(scalar_t__);
int /*<<< orphan*/ glEndList();
int /*<<< orphan*/ glNewList(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ *gluNewQuadric();
int /*<<< orphan*/ gluQuadricDrawStyle(int /*<<< orphan*/ *,
                                       int /*<<< orphan*/);
int /*<<< orphan*/ gluSphere(int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                             int);
int /*<<< orphan*/ makeModelPtr(int /*<<< orphan*/, int /*<<< orphan*/ *, int);
scalar_t__ malloc(int);
void auxWireSphere(GLdouble radius) {
  GLUquadricObj *quadObj;
  GLdouble *sizeArray;
  GLuint displayList;
  sizeArray = (GLdouble *)malloc(sizeof(GLdouble) * 1);
  *sizeArray = radius;
  displayList = findList(0, sizeArray, 1);
  if (displayList == 0) {
    glNewList(makeModelPtr(0, sizeArray, 1), GL_COMPILE_AND_EXECUTE);
    quadObj = gluNewQuadric();
    gluQuadricDrawStyle(quadObj, GLU_LINE);
    gluSphere(quadObj, radius, 16, 16);
    glEndList();
  } else {
    glCallList(displayList);
    free(sizeArray);
  }
}


x86 assembly (clang, -O0):
<auxWireSphere>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x4,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   10b0 <findList@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    123d <auxWireSphere+0x9d>
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1070 <makeModelPtr@plt>
mov    %eax,%edi
mov    0x2dde(%rip),%rax
mov    (%rax),%esi
call   1050 <glNewList@plt>
mov    $0x0,%al
call   1040 <gluNewQuadric@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2dd1(%rip),%rax
mov    (%rax),%esi
call   1080 <gluQuadricDrawStyle@plt>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    $0x10,%ecx
mov    %ecx,%edx
call   1060 <gluSphere@plt>
mov    $0x0,%al
call   10c0 <glEndList@plt>
jmp    124f <auxWireSphere+0xaf>
mov    -0x20(%rbp),%rdi
call   1090 <glCallList@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<auxWireSphere>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x4,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    %ebp,(%rax)
xor    %edi,%edi
mov    %rax,%rsi
mov    $0x1,%edx
call   10b0 <findList@plt>
test   %rax,%rax
je     11de <auxWireSphere+0x3e>
mov    %rax,%rdi
call   1090 <glCallList@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <free@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1070 <makeModelPtr@plt>
mov    0x2de4(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1050 <glNewList@plt>
xor    %eax,%eax
call   1040 <gluNewQuadric@plt>
mov    %rax,%rbx
mov    0x2dda(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1080 <gluQuadricDrawStyle@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x10,%edx
mov    $0x10,%ecx
call   1060 <gluSphere@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    10c0 <glEndList@plt>

LLVM IR (-O0):
@GL_COMPILE_AND_EXECUTE = global i32 0
@GLU_LINE = global i32 0
define void @auxWireSphere(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i64
store i32 %0, i32* %2
%6 = call i64 @malloc(i32 4)
%7 = inttoptr i64 %6 to i32*
store i32* %7, i32** %4
%8 = load i32, i32* %2
%9 = load i32*, i32** %4
store i32 %8, i32* %9
%10 = load i32*, i32** %4
%11 = call i64 @findList(i32 0, i32* %10, i32 1)
store i64 %11, i64* %5
%12 = load i64, i64* %5
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %27
14: ; preds = %1
%15 = load i32*, i32** %4
%16 = call i32 @makeModelPtr(i32 0, i32* %15, i32 1)
%17 = load i32, i32* @GL_COMPILE_AND_EXECUTE
%18 = call i32 @glNewList(i32 %16, i32 %17)
%19 = call i32* (...) @gluNewQuadric()
store i32* %19, i32** %3
%20 = load i32*, i32** %3
%21 = load i32, i32* @GLU_LINE
%22 = call i32 @gluQuadricDrawStyle(i32* %20, i32 %21)
%23 = load i32*, i32** %3
%24 = load i32, i32* %2
%25 = call i32 @gluSphere(i32* %23, i32 %24, i32 16, i32 16)
%26 = call i32 (...) @glEndList()
br label %32
27: ; preds = %1
%28 = load i64, i64* %5
%29 = call i32 @glCallList(i64 %28)
%30 = load i32*, i32** %4
%31 = call i32 @free(i32* %30)
br label %32
32: ; preds = %27, %14
ret void
}

LLVM IR (-O2):
@GL_COMPILE_AND_EXECUTE = global i32 0
@GLU_LINE = global i32 0
define void @auxWireSphere(i32 %0) {
%2 = tail call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32 %0, i32* %3
%4 = tail call i64 @findList(i32 0, i32* %3, i32 1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = tail call i32 @makeModelPtr(i32 0, i32* %3, i32 1)
%8 = load i32, i32* @GL_COMPILE_AND_EXECUTE
%9 = tail call i32 @glNewList(i32 %7, i32 %8)
%10 = tail call i32* (...) @gluNewQuadric()
%11 = load i32, i32* @GLU_LINE
%12 = tail call i32 @gluQuadricDrawStyle(i32* %10, i32 %11)
%13 = tail call i32 @gluSphere(i32* %10, i32 %0, i32 16, i32 16)
%14 = tail call i32 (...) @glEndList()
br label %18
15: ; preds = %1
%16 = tail call i32 @glCallList(i64 %4)
%17 = tail call i32 @free(i32* %3)
br label %18
18: ; preds = %15, %6
ret void
}