#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;

/* Variables and functions */
int /*<<< orphan*/ GL_COMPILE_AND_EXECUTE;
int /*<<< orphan*/ GL_QUADS;
int /*<<< orphan*/ doughnut(void *, void *, int, int, int /*<<< orphan*/);
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*/ makeModelPtr(int, void **, int);
scalar_t__ malloc(int);
void auxSolidTorus(GLdouble innerRadius, GLdouble outerRadius) {
  GLdouble *sizeArray, *tmp;
  GLuint displayList;
  sizeArray = (GLdouble *)malloc(sizeof(GLdouble) * 2);
  tmp = sizeArray;
  *tmp++ = innerRadius;
  *tmp++ = outerRadius;
  displayList = findList(13, sizeArray, 2);
  if (displayList == 0) {
    glNewList(makeModelPtr(13, sizeArray, 2), GL_COMPILE_AND_EXECUTE);
    doughnut(innerRadius, outerRadius, 8, 15, GL_QUADS);
    glEndList();
  } else {
    glCallList(displayList);
    free(sizeArray);
  }
}


x86 assembly (clang, -O0):
<auxSolidTorus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x10,%edi
call   1080 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x20(%rbp)
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rsi
mov    $0xd,%edi
mov    $0x2,%edx
call   1090 <findList@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1244 <auxSolidTorus+0xc4>
mov    -0x18(%rbp),%rsi
mov    $0xd,%edi
mov    $0x2,%edx
call   1050 <makeModelPtr@plt>
mov    %eax,%edi
mov    0x2dc8(%rip),%rax
mov    (%rax),%esi
call   1040 <glNewList@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2dc2(%rip),%rax
mov    (%rax),%r8d
mov    $0x8,%edx
mov    $0xf,%ecx
call   1060 <doughnut@plt>
mov    $0x0,%al
call   10a0 <glEndList@plt>
jmp    1256 <auxSolidTorus+0xd6>
mov    -0x28(%rbp),%rdi
call   1070 <glCallList@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<auxSolidTorus>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x10,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    %r15,(%rax)
mov    %r14,0x8(%rax)
mov    $0xd,%edi
mov    %rax,%rsi
mov    $0x2,%edx
call   1090 <findList@plt>
test   %rax,%rax
je     11cb <auxSolidTorus+0x4b>
mov    %rax,%rdi
call   1070 <glCallList@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>
mov    $0xd,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1050 <makeModelPtr@plt>
mov    0x2df4(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1040 <glNewList@plt>
mov    0x2df4(%rip),%rax
mov    (%rax),%r8d
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x8,%edx
mov    $0xf,%ecx
call   1060 <doughnut@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    10a0 <glEndList@plt>

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

LLVM IR (-O2):
@GL_COMPILE_AND_EXECUTE = global i32 0
@GL_QUADS = global i32 0
define void @auxSolidTorus(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 13, i8** %4, i32 2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = tail call i32 @makeModelPtr(i32 13, i8** %4, i32 2)
%10 = load i32, i32* @GL_COMPILE_AND_EXECUTE
%11 = tail call i32 @glNewList(i32 %9, i32 %10)
%12 = load i32, i32* @GL_QUADS
%13 = tail call i32 @doughnut(i8* %0, i8* %1, i32 8, i32 15, i32 %12)
%14 = tail call i32 (...) @glEndList()
br label %18
15: ; preds = %2
%16 = tail call i32 @glCallList(i64 %6)
%17 = tail call i32 @free(i8** %4)
br label %18
18: ; preds = %15, %8
ret void
}