#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 */
struct DynArr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ isEmptyDynArr(struct DynArr *);
int /*<<< orphan*/ popDynArr(struct DynArr *);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ pushDynArr(struct DynArr *, double);
double topDynArr(struct DynArr *);
void cube(struct DynArr *stack) {
  assert(!isEmptyDynArr(stack));
  double num1, sum;
  num1 = topDynArr(stack);
  popDynArr(stack);
  sum = num1 * num1 * num1;
  pushDynArr(stack, sum);
  printf("Solution: %f\n", sum);
}


x86 assembly (clang, -O0):
<cube>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <isEmptyDynArr@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1030 <topDynArr@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <popDynArr@plt>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
call   1080 <pushDynArr@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xe34(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cube>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1070 <isEmptyDynArr@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
call   1030 <topDynArr@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1050 <popDynArr@plt>
movsd  0x8(%rsp),%xmm1
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1080 <pushDynArr@plt>
lea    0xe49(%rip),%rdi
movsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
%struct.DynArr = type { i32 }
@.str = [14 x i8] c"Solution: %f\0A\00"
define void @cube(%struct.DynArr* %0) {
%2 = alloca %struct.DynArr*
%3 = alloca double
%4 = alloca double
store %struct.DynArr* %0, %struct.DynArr** %2
%5 = load %struct.DynArr*, %struct.DynArr** %2
%6 = call i32 @isEmptyDynArr(%struct.DynArr* %5)
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load %struct.DynArr*, %struct.DynArr** %2
%12 = call double @topDynArr(%struct.DynArr* %11)
store double %12, double* %3
%13 = load %struct.DynArr*, %struct.DynArr** %2
%14 = call i32 @popDynArr(%struct.DynArr* %13)
%15 = load double, double* %3
%16 = load double, double* %3
%17 = fmul double %15, %16
%18 = load double, double* %3
%19 = fmul double %17, %18
store double %19, double* %4
%20 = load %struct.DynArr*, %struct.DynArr** %2
%21 = load double, double* %4
%22 = call i32 @pushDynArr(%struct.DynArr* %20, double %21)
%23 = load double, double* %4
%24 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %23)
ret void
}

LLVM IR (-O2):
%struct.DynArr = type { i32 }
@.str = [14 x i8] c"Solution: %f\0A\00"
define void @cube(%struct.DynArr* %0) {
%2 = tail call i32 @isEmptyDynArr(%struct.DynArr* %0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call double @topDynArr(%struct.DynArr* %0)
%7 = tail call i32 @popDynArr(%struct.DynArr* %0)
%8 = fmul double %6, %6
%9 = fmul double %6, %8
%10 = tail call i32 @pushDynArr(%struct.DynArr* %0, double %9)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %9)
ret void
}