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

/* Variables and functions */
int /*<<< orphan*/ GL_COMPILE_AND_EXECUTE;
int /*<<< orphan*/ GL_QUADS;
int /*<<< orphan*/ drawbox(int, int, int, int, int, int, int /*<<< orphan*/);
scalar_t__ findList(int, int *, int);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ glCallList(scalar_t__);
int /*<<< orphan*/ glEndList();
int /*<<< orphan*/ glNewList(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ makeModelPtr(int, int *, int);
scalar_t__ malloc(int);
void auxSolidBox(GLdouble width, GLdouble height, GLdouble depth) {
  GLdouble *sizeArray, *tmp;
  GLuint displayList;
  sizeArray = (GLdouble *)malloc(sizeof(GLdouble) * 3);
  tmp = sizeArray;
  *tmp++ = width;
  *tmp++ = height;
  *tmp++ = depth;
  displayList = findList(12, sizeArray, 3);
  if (displayList == 0) {
    glNewList(makeModelPtr(12, sizeArray, 3), GL_COMPILE_AND_EXECUTE);
    drawbox(-width / 2., width / 2., -height / 2., height / 2., -depth / 2.,
            depth / 2., GL_QUADS);
    glEndList();
  } else {
    glCallList(displayList);
    free(sizeArray);
  }
}


x86 assembly (clang, -O0):
<auxSolidBox>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0xc,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x20(%rbp)
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x20(%rbp)
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x20(%rbp)
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rsi
mov    $0xc,%edi
mov    $0x3,%edx
call   1090 <findList@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12d1 <auxSolidBox+0x151>
mov    -0x18(%rbp),%rsi
mov    $0xc,%edi
mov    $0x3,%edx
call   1050 <makeModelPtr@plt>
mov    %eax,%edi
mov    0x2db7(%rip),%rax
mov    (%rax),%esi
call   1040 <glNewList@plt>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xdc7(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xdb2(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
xor    %eax,%eax
sub    -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xd99(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xd84(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
xor    %eax,%eax
sub    -0xc(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xd6b(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%r8d
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xd55(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%r9d
mov    0x2d2d(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsp)
call   1080 <drawbox@plt>
mov    $0x0,%al
call   10a0 <glEndList@plt>
jmp    12e3 <auxSolidBox+0x163>
mov    -0x28(%rbp),%rdi
call   1060 <glCallList@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<auxSolidBox>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebx
mov    $0xc,%edi
call   1070 <malloc@plt>
mov    %rax,%rbp
mov    %ebx,(%rax)
mov    %r15d,0x4(%rax)
mov    %r14d,0x8(%rax)
mov    $0xc,%edi
mov    %rax,%rsi
mov    $0x3,%edx
call   1090 <findList@plt>
test   %rax,%rax
je     11d7 <auxSolidBox+0x57>
mov    %rax,%rdi
call   1060 <glCallList@plt>
mov    %rbp,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
mov    $0xc,%edi
mov    %rbp,%rsi
mov    $0x3,%edx
call   1050 <makeModelPtr@plt>
mov    0x2de8(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1040 <glNewList@plt>
cvtsi2sd %ebx,%xmm0
neg    %ebx
cvtsi2sd %ebx,%xmm1
movsd  0xdf5(%rip),%xmm2
mulsd  %xmm2,%xmm1
cvttsd2si %xmm1,%edi
mulsd  %xmm2,%xmm0
cvttsd2si %xmm0,%esi
xorps  %xmm0,%xmm0
cvtsi2sd %r15d,%xmm0
neg    %r15d
xorps  %xmm1,%xmm1
cvtsi2sd %r15d,%xmm1
mulsd  %xmm2,%xmm1
cvttsd2si %xmm1,%edx
mulsd  %xmm2,%xmm0
cvttsd2si %xmm0,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
neg    %r14d
xorps  %xmm1,%xmm1
cvtsi2sd %r14d,%xmm1
mulsd  %xmm2,%xmm1
cvttsd2si %xmm1,%r8d
mulsd  %xmm2,%xmm0
cvttsd2si %xmm0,%r9d
mov    0x2d7e(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsp)
call   1080 <drawbox@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    10a0 <glEndList@plt>

LLVM IR (-O0):
@GL_COMPILE_AND_EXECUTE = global i32 0
@GL_QUADS = global i32 0
define void @auxSolidBox(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i64
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = call i64 @malloc(i32 12)
%11 = inttoptr i64 %10 to i32*
store i32* %11, i32** %7
%12 = load i32*, i32** %7
store i32* %12, i32** %8
%13 = load i32, i32* %4
%14 = load i32*, i32** %8
%15 = getelementptr inbounds i32, i32* %14, i32 1
store i32* %15, i32** %8
store i32 %13, i32* %14
%16 = load i32, i32* %5
%17 = load i32*, i32** %8
%18 = getelementptr inbounds i32, i32* %17, i32 1
store i32* %18, i32** %8
store i32 %16, i32* %17
%19 = load i32, i32* %6
%20 = load i32*, i32** %8
%21 = getelementptr inbounds i32, i32* %20, i32 1
store i32* %21, i32** %8
store i32 %19, i32* %20
%22 = load i32*, i32** %7
%23 = call i64 @findList(i32 12, i32* %22, i32 3)
store i64 %23, i64* %9
%24 = load i64, i64* %9
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %61
26: ; preds = %3
%27 = load i32*, i32** %7
%28 = call i32 @makeModelPtr(i32 12, i32* %27, i32 3)
%29 = load i32, i32* @GL_COMPILE_AND_EXECUTE
%30 = call i32 @glNewList(i32 %28, i32 %29)
%31 = load i32, i32* %4
%32 = sub nsw i32 0, %31
%33 = sitofp i32 %32 to double
%34 = fdiv double %33, 2.000000e+00
%35 = fptosi double %34 to i32
%36 = load i32, i32* %4
%37 = sitofp i32 %36 to double
%38 = fdiv double %37, 2.000000e+00
%39 = fptosi double %38 to i32
%40 = load i32, i32* %5
%41 = sub nsw i32 0, %40
%42 = sitofp i32 %41 to double
%43 = fdiv double %42, 2.000000e+00
%44 = fptosi double %43 to i32
%45 = load i32, i32* %5
%46 = sitofp i32 %45 to double
%47 = fdiv double %46, 2.000000e+00
%48 = fptosi double %47 to i32
%49 = load i32, i32* %6
%50 = sub nsw i32 0, %49
%51 = sitofp i32 %50 to double
%52 = fdiv double %51, 2.000000e+00
%53 = fptosi double %52 to i32
%54 = load i32, i32* %6
%55 = sitofp i32 %54 to double
%56 = fdiv double %55, 2.000000e+00
%57 = fptosi double %56 to i32
%58 = load i32, i32* @GL_QUADS
%59 = call i32 @drawbox(i32 %35, i32 %39, i32 %44, i32 %48, i32 %53, i32 %57, i32 %58)
%60 = call i32 (...) @glEndList()
br label %66
61: ; preds = %3
%62 = load i64, i64* %9
%63 = call i32 @glCallList(i64 %62)
%64 = load i32*, i32** %7
%65 = call i32 @free(i32* %64)
br label %66
66: ; preds = %61, %26
ret void
}

LLVM IR (-O2):
@GL_COMPILE_AND_EXECUTE = global i32 0
@GL_QUADS = global i32 0
define void @auxSolidBox(i32 %0, i32 %1, i32 %2) {
%4 = tail call i64 @malloc(i32 12)
%5 = inttoptr i64 %4 to i32*
%6 = getelementptr inbounds i32, i32* %5, i64 1
store i32 %0, i32* %5
%7 = getelementptr inbounds i32, i32* %5, i64 2
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = tail call i64 @findList(i32 12, i32* %5, i32 3)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %38
10: ; preds = %3
%11 = tail call i32 @makeModelPtr(i32 12, i32* %5, i32 3)
%12 = load i32, i32* @GL_COMPILE_AND_EXECUTE
%13 = tail call i32 @glNewList(i32 %11, i32 %12)
%14 = sub nsw i32 0, %0
%15 = sitofp i32 %14 to double
%16 = fmul double %15, 5.000000e-01
%17 = fptosi double %16 to i32
%18 = sitofp i32 %0 to double
%19 = fmul double %18, 5.000000e-01
%20 = fptosi double %19 to i32
%21 = sub nsw i32 0, %1
%22 = sitofp i32 %21 to double
%23 = fmul double %22, 5.000000e-01
%24 = fptosi double %23 to i32
%25 = sitofp i32 %1 to double
%26 = fmul double %25, 5.000000e-01
%27 = fptosi double %26 to i32
%28 = sub nsw i32 0, %2
%29 = sitofp i32 %28 to double
%30 = fmul double %29, 5.000000e-01
%31 = fptosi double %30 to i32
%32 = sitofp i32 %2 to double
%33 = fmul double %32, 5.000000e-01
%34 = fptosi double %33 to i32
%35 = load i32, i32* @GL_QUADS
%36 = tail call i32 @drawbox(i32 %17, i32 %20, i32 %24, i32 %27, i32 %31, i32 %34, i32 %35)
%37 = tail call i32 (...) @glEndList()
br label %41
38: ; preds = %3
%39 = tail call i32 @glCallList(i64 %8)
%40 = tail call i32 @free(i32* %5)
br label %41
41: ; preds = %38, %10
ret void
}