#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_FILL;
int /*<<< orphan*/ GLU_SMOOTH;
int /*<<< orphan*/ GL_COMPILE_AND_EXECUTE;
scalar_t__ findList(int, 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*/ gluQuadricNormals(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ gluSphere(int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                             int);
int /*<<< orphan*/ makeModelPtr(int, int /*<<< orphan*/ *, int);
scalar_t__ malloc(int);
void auxSolidSphere(GLdouble radius) {
  GLUquadricObj *quadObj;
  GLdouble *sizeArray;
  GLuint displayList;
  sizeArray = (GLdouble *)malloc(sizeof(GLdouble) * 1);
  *sizeArray = radius;
  displayList = findList(10, sizeArray, 1);
  if (displayList == 0) {
    glNewList(makeModelPtr(10, sizeArray, 1), GL_COMPILE_AND_EXECUTE);
    quadObj = gluNewQuadric();
    gluQuadricDrawStyle(quadObj, GLU_FILL);
    gluQuadricNormals(quadObj, GLU_SMOOTH);
    gluSphere(quadObj, radius, 16, 16);
    glEndList();
  } else {
    glCallList(displayList);
    free(sizeArray);
  }
}


x86 assembly (clang, -O0):
<auxSolidSphere>:
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
mov    $0xa,%edi
mov    $0x1,%edx
call   10c0 <findList@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1265 <auxSolidSphere+0xb5>
mov    -0x18(%rbp),%rsi
mov    $0xa,%edi
mov    $0x1,%edx
call   1070 <makeModelPtr@plt>
mov    %eax,%edi
mov    0x2dc0(%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    0x2dab(%rip),%rax
mov    (%rax),%esi
call   1080 <gluQuadricDrawStyle@plt>
mov    -0x10(%rbp),%rdi
mov    0x2da9(%rip),%rax
mov    (%rax),%esi
call   10b0 <gluQuadricNormals@plt>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    $0x10,%ecx
mov    %ecx,%edx
call   1060 <gluSphere@plt>
mov    $0x0,%al
call   10d0 <glEndList@plt>
jmp    1277 <auxSolidSphere+0xc7>
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):
<auxSolidSphere>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x4,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    %ebp,(%rax)
mov    $0xa,%edi
mov    %rax,%rsi
mov    $0x1,%edx
call   10c0 <findList@plt>
test   %rax,%rax
je     11f1 <auxSolidSphere+0x41>
mov    %rax,%rdi
call   1090 <glCallList@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <free@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1070 <makeModelPtr@plt>
mov    0x2dc6(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1050 <glNewList@plt>
xor    %eax,%eax
call   1040 <gluNewQuadric@plt>
mov    %rax,%rbx
mov    0x2db4(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1080 <gluQuadricDrawStyle@plt>
mov    0x2db3(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   10b0 <gluQuadricNormals@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    10d0 <glEndList@plt>

LLVM IR (-O0):
@GL_COMPILE_AND_EXECUTE = global i32 0
@GLU_FILL = global i32 0
@GLU_SMOOTH = global i32 0
define void @auxSolidSphere(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 10, 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 %30
14: ; preds = %1
%15 = load i32*, i32** %4
%16 = call i32 @makeModelPtr(i32 10, 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_FILL
%22 = call i32 @gluQuadricDrawStyle(i32* %20, i32 %21)
%23 = load i32*, i32** %3
%24 = load i32, i32* @GLU_SMOOTH
%25 = call i32 @gluQuadricNormals(i32* %23, i32 %24)
%26 = load i32*, i32** %3
%27 = load i32, i32* %2
%28 = call i32 @gluSphere(i32* %26, i32 %27, i32 16, i32 16)
%29 = call i32 (...) @glEndList()
br label %35
30: ; preds = %1
%31 = load i64, i64* %5
%32 = call i32 @glCallList(i64 %31)
%33 = load i32*, i32** %4
%34 = call i32 @free(i32* %33)
br label %35
35: ; preds = %30, %14
ret void
}

LLVM IR (-O2):
@GL_COMPILE_AND_EXECUTE = global i32 0
@GLU_FILL = global i32 0
@GLU_SMOOTH = global i32 0
define void @auxSolidSphere(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 10, i32* %3, i32 1)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %17
6: ; preds = %1
%7 = tail call i32 @makeModelPtr(i32 10, 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_FILL
%12 = tail call i32 @gluQuadricDrawStyle(i32* %10, i32 %11)
%13 = load i32, i32* @GLU_SMOOTH
%14 = tail call i32 @gluQuadricNormals(i32* %10, i32 %13)
%15 = tail call i32 @gluSphere(i32* %10, i32 %0, i32 16, i32 16)
%16 = tail call i32 (...) @glEndList()
br label %20
17: ; preds = %1
%18 = tail call i32 @glCallList(i64 %4)
%19 = tail call i32 @free(i32* %3)
br label %20
20: ; preds = %17, %6
ret void
}