#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 multiply(struct DynArr *stack) {
  assert(!isEmptyDynArr(stack));
  double num1, num2, sum;
  num1 = topDynArr(stack);
  popDynArr(stack);
  num2 = topDynArr(stack);
  popDynArr(stack);
  sum = num1 * num2;
  pushDynArr(stack, sum);
  printf("Solution: %f\n", sum);
}


x86 assembly (clang, -O0):
<multiply>:
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>
mov    -0x8(%rbp),%rdi
call   1030 <topDynArr@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <popDynArr@plt>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1080 <pushDynArr@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xe22(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiply>:
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>
mov    %rbx,%rdi
call   1030 <topDynArr@plt>
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
call   1050 <popDynArr@plt>
movsd  (%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
call   1080 <pushDynArr@plt>
lea    0xe3c(%rip),%rdi
movsd  (%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 @multiply(%struct.DynArr* %0) {
%2 = alloca %struct.DynArr*
%3 = alloca double
%4 = alloca double
%5 = alloca double
store %struct.DynArr* %0, %struct.DynArr** %2
%6 = load %struct.DynArr*, %struct.DynArr** %2
%7 = call i32 @isEmptyDynArr(%struct.DynArr* %6)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load %struct.DynArr*, %struct.DynArr** %2
%13 = call double @topDynArr(%struct.DynArr* %12)
store double %13, double* %3
%14 = load %struct.DynArr*, %struct.DynArr** %2
%15 = call i32 @popDynArr(%struct.DynArr* %14)
%16 = load %struct.DynArr*, %struct.DynArr** %2
%17 = call double @topDynArr(%struct.DynArr* %16)
store double %17, double* %4
%18 = load %struct.DynArr*, %struct.DynArr** %2
%19 = call i32 @popDynArr(%struct.DynArr* %18)
%20 = load double, double* %3
%21 = load double, double* %4
%22 = fmul double %20, %21
store double %22, double* %5
%23 = load %struct.DynArr*, %struct.DynArr** %2
%24 = load double, double* %5
%25 = call i32 @pushDynArr(%struct.DynArr* %23, double %24)
%26 = load double, double* %5
%27 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %26)
ret void
}

LLVM IR (-O2):
%struct.DynArr = type { i32 }
@.str = [14 x i8] c"Solution: %f\0A\00"
define void @multiply(%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 = tail call double @topDynArr(%struct.DynArr* %0)
%9 = tail call i32 @popDynArr(%struct.DynArr* %0)
%10 = fmul double %6, %8
%11 = tail call i32 @pushDynArr(%struct.DynArr* %0, double %10)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %10)
ret void
}