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


x86 assembly (clang, -O0):
<expon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <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
call   1070 <exp@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
call   1090 <pushDynArr@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xe29(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expon>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1080 <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),%xmm0
call   1070 <exp@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1090 <pushDynArr@plt>
lea    0xe40(%rip),%rdi
movsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
%struct.DynArr = type { i32 }
@.str = [25 x i8] c"Solution for base e: %f\0A\00"
define void @expon(%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 = call double @exp(double %15)
store double %16, double* %4
%17 = load %struct.DynArr*, %struct.DynArr** %2
%18 = load double, double* %4
%19 = call i32 @pushDynArr(%struct.DynArr* %17, double %18)
%20 = load double, double* %4
%21 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), double %20)
ret void
}

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