#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*/ abs_val(struct DynArr *);
int /*<<< orphan*/ add(struct DynArr *);
int /*<<< orphan*/ base_10_log(struct DynArr *);
struct DynArr *createDynArr(int);
int /*<<< orphan*/ cube(struct DynArr *);
int /*<<< orphan*/ deleteDynArr(struct DynArr *);
int /*<<< orphan*/ divide(struct DynArr *);
int /*<<< orphan*/ exit(int);
double exp(double);
int /*<<< orphan*/ exponential(struct DynArr *);
double getDynArr(struct DynArr *, int);
scalar_t__ isEmptyDynArr(struct DynArr *);
int isNumber(char *, double *);
int /*<<< orphan*/ multiply(struct DynArr *);
int /*<<< orphan*/ natural_log(struct DynArr *);
int /*<<< orphan*/ popDynArr(struct DynArr *);
int /*<<< orphan*/ power(struct DynArr *);
int /*<<< orphan*/ printInvalid(struct DynArr *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ pushDynArr(struct DynArr *, double);
int sizeDynArr(struct DynArr *);
int /*<<< orphan*/ square(struct DynArr *);
int /*<<< orphan*/ square_root(struct DynArr *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ subtract(struct DynArr *);
double topDynArr(struct DynArr *);
double calculate(int numInputTokens, char **inputString) {
  int i;
  double result = 0.0;
  char *s;
  struct DynArr *stack;
  stack = createDynArr(20);
  for (i = 1; i < numInputTokens; i++) {
    s = inputString[i];
    if (strcmp(s, "+") == 0) {
      if (isEmptyDynArr(stack) == 0 && sizeDynArr(stack) >= 2)
        add(stack);
      else
        printInvalid(stack, "+");
    } else if (strcmp(s, "-") == 0) {
      if (isEmptyDynArr(stack) == 0 && sizeDynArr(stack) >= 2)
        subtract(stack);
      else
        printInvalid(stack, "-");
    } else if (strcmp(s, "/") == 0) {
      if (isEmptyDynArr(stack) == 0 && sizeDynArr(stack) >= 2)
        divide(stack);
      else
        printInvalid(stack, "/");
    } else if (strcmp(s, "x") == 0) {
      if (isEmptyDynArr(stack) == 0 && sizeDynArr(stack) >= 2)
        multiply(stack);
      else
        printInvalid(stack, "x");
    } else if (strcmp(s, "^") == 0) {
      if (isEmptyDynArr(stack) == 0 && sizeDynArr(stack) >= 2)
        power(stack);
      else
        printInvalid(stack, "^");
    } else if (strcmp(s, "^2") == 0) {
      if (isEmptyDynArr(stack) == 0 && sizeDynArr(stack) >= 1)
        square(stack);
      else
        printInvalid(stack, "^2");
    } else if (strcmp(s, "^3") == 0) {
      if (isEmptyDynArr(stack) == 0 && sizeDynArr(stack) >= 1)
        cube(stack);
      else
        printInvalid(stack, "^3");
    } else if (strcmp(s, "abs") == 0) {
      if (isEmptyDynArr(stack) == 0 && sizeDynArr(stack) >= 1)
        abs_val(stack);
      else
        printInvalid(stack, "abs");
    } else if (strcmp(s, "sqrt") == 0) {
      if (isEmptyDynArr(stack) == 0 && sizeDynArr(stack) >= 1)
        square_root(stack);
      else
        printInvalid(stack, "sqrt");
    } else if (strcmp(s, "exp") == 0) {
      if (isEmptyDynArr(stack) == 0 && sizeDynArr(stack) >= 1)
        exponential(stack);
      else
        printInvalid(stack, "exp");
    } else if (strcmp(s, "ln") == 0) {
      if (isEmptyDynArr(stack) == 0 && sizeDynArr(stack) >= 1)
        natural_log(stack);
      else
        printInvalid(stack, "ln");
    } else if (strcmp(s, "log") == 0) {
      if (isEmptyDynArr(stack) == 0 && sizeDynArr(stack) >= 1)
        base_10_log(stack);
      else
        printInvalid(stack, "log");
    } else {
      if (strcmp(s, "pi") == 0) {
        pushDynArr(stack, 3.14159265358979323846);
      } else if (strcmp(s, "e") == 0) {
        pushDynArr(stack, exp(1.0));
      } else {
        double number;
        if (isNumber(s, &number) == 1) {
          pushDynArr(stack, number);
        } else {
          printf("Invalid number: %s\n", s);
          exit(1);
        }
      }
    }
  }
  result = topDynArr(stack);
  popDynArr(stack);
  int finalStackSize = sizeDynArr(stack);
  if (finalStackSize != 0) {
    printf("Error! The following items were left on calculation stack after "
           "popping assumed result: ");
    for (int i = 0; i < finalStackSize; i++)
      printf("%f ", getDynArr(stack, i));
    printf("\nDid you forget an operator?\n");
    deleteDynArr(stack);
    exit(1);
  }
  printf("The result is %f\n", result);
  deleteDynArr(stack);
  return result;
}


x86 assembly (clang, -O0):
<calculate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x14,%edi
call   1170 <createDynArr@plt>
mov    %rax,-0x30(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    188b <calculate+0x5eb>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xd1d(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    134a <calculate+0xaa>
mov    -0x30(%rbp),%rdi
call   1140 <isEmptyDynArr@plt>
cmp    $0x0,%rax
jne    1335 <calculate+0x95>
mov    -0x30(%rbp),%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x2,%eax
jl     1335 <calculate+0x95>
mov    -0x30(%rbp),%rdi
call   1040 <add@plt>
jmp    1345 <calculate+0xa5>
mov    -0x30(%rbp),%rdi
lea    0xcd0(%rip),%rsi
call   10d0 <printInvalid@plt>
jmp    1878 <calculate+0x5d8>
mov    -0x28(%rbp),%rdi
lea    0xcbd(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    13ac <calculate+0x10c>
mov    -0x30(%rbp),%rdi
call   1140 <isEmptyDynArr@plt>
cmp    $0x0,%rax
jne    1397 <calculate+0xf7>
mov    -0x30(%rbp),%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x2,%eax
jl     1397 <calculate+0xf7>
mov    -0x30(%rbp),%rdi
call   1160 <subtract@plt>
jmp    13a7 <calculate+0x107>
mov    -0x30(%rbp),%rdi
lea    0xc70(%rip),%rsi
call   10d0 <printInvalid@plt>
jmp    1873 <calculate+0x5d3>
mov    -0x28(%rbp),%rdi
lea    0xc5d(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    140e <calculate+0x16e>
mov    -0x30(%rbp),%rdi
call   1140 <isEmptyDynArr@plt>
cmp    $0x0,%rax
jne    13f9 <calculate+0x159>
mov    -0x30(%rbp),%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x2,%eax
jl     13f9 <calculate+0x159>
mov    -0x30(%rbp),%rdi
call   1090 <divide@plt>
jmp    1409 <calculate+0x169>
mov    -0x30(%rbp),%rdi
lea    0xc10(%rip),%rsi
call   10d0 <printInvalid@plt>
jmp    186e <calculate+0x5ce>
mov    -0x28(%rbp),%rdi
lea    0xbfd(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1470 <calculate+0x1d0>
mov    -0x30(%rbp),%rdi
call   1140 <isEmptyDynArr@plt>
cmp    $0x0,%rax
jne    145b <calculate+0x1bb>
mov    -0x30(%rbp),%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x2,%eax
jl     145b <calculate+0x1bb>
mov    -0x30(%rbp),%rdi
call   1060 <multiply@plt>
jmp    146b <calculate+0x1cb>
mov    -0x30(%rbp),%rdi
lea    0xbb0(%rip),%rsi
call   10d0 <printInvalid@plt>
jmp    1869 <calculate+0x5c9>
mov    -0x28(%rbp),%rdi
lea    0xb9d(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    14d2 <calculate+0x232>
mov    -0x30(%rbp),%rdi
call   1140 <isEmptyDynArr@plt>
cmp    $0x0,%rax
jne    14bd <calculate+0x21d>
mov    -0x30(%rbp),%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x2,%eax
jl     14bd <calculate+0x21d>
mov    -0x30(%rbp),%rdi
call   1050 <power@plt>
jmp    14cd <calculate+0x22d>
mov    -0x30(%rbp),%rdi
lea    0xb50(%rip),%rsi
call   10d0 <printInvalid@plt>
jmp    1864 <calculate+0x5c4>
mov    -0x28(%rbp),%rdi
lea    0xb3d(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1534 <calculate+0x294>
mov    -0x30(%rbp),%rdi
call   1140 <isEmptyDynArr@plt>
cmp    $0x0,%rax
jne    151f <calculate+0x27f>
mov    -0x30(%rbp),%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x1,%eax
jl     151f <calculate+0x27f>
mov    -0x30(%rbp),%rdi
call   10b0 <square@plt>
jmp    152f <calculate+0x28f>
mov    -0x30(%rbp),%rdi
lea    0xaf0(%rip),%rsi
call   10d0 <printInvalid@plt>
jmp    185f <calculate+0x5bf>
mov    -0x28(%rbp),%rdi
lea    0xade(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1596 <calculate+0x2f6>
mov    -0x30(%rbp),%rdi
call   1140 <isEmptyDynArr@plt>
cmp    $0x0,%rax
jne    1581 <calculate+0x2e1>
mov    -0x30(%rbp),%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x1,%eax
jl     1581 <calculate+0x2e1>
mov    -0x30(%rbp),%rdi
call   11c0 <cube@plt>
jmp    1591 <calculate+0x2f1>
mov    -0x30(%rbp),%rdi
lea    0xa91(%rip),%rsi
call   10d0 <printInvalid@plt>
jmp    185a <calculate+0x5ba>
mov    -0x28(%rbp),%rdi
lea    0xa7f(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    15f8 <calculate+0x358>
mov    -0x30(%rbp),%rdi
call   1140 <isEmptyDynArr@plt>
cmp    $0x0,%rax
jne    15e3 <calculate+0x343>
mov    -0x30(%rbp),%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x1,%eax
jl     15e3 <calculate+0x343>
mov    -0x30(%rbp),%rdi
call   10a0 <abs_val@plt>
jmp    15f3 <calculate+0x353>
mov    -0x30(%rbp),%rdi
lea    0xa32(%rip),%rsi
call   10d0 <printInvalid@plt>
jmp    1855 <calculate+0x5b5>
mov    -0x28(%rbp),%rdi
lea    0xa21(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    165a <calculate+0x3ba>
mov    -0x30(%rbp),%rdi
call   1140 <isEmptyDynArr@plt>
cmp    $0x0,%rax
jne    1645 <calculate+0x3a5>
mov    -0x30(%rbp),%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x1,%eax
jl     1645 <calculate+0x3a5>
mov    -0x30(%rbp),%rdi
call   11a0 <square_root@plt>
jmp    1655 <calculate+0x3b5>
mov    -0x30(%rbp),%rdi
lea    0x9d4(%rip),%rsi
call   10d0 <printInvalid@plt>
jmp    1850 <calculate+0x5b0>
mov    -0x28(%rbp),%rdi
lea    0x9c4(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    16bc <calculate+0x41c>
mov    -0x30(%rbp),%rdi
call   1140 <isEmptyDynArr@plt>
cmp    $0x0,%rax
jne    16a7 <calculate+0x407>
mov    -0x30(%rbp),%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x1,%eax
jl     16a7 <calculate+0x407>
mov    -0x30(%rbp),%rdi
call   1100 <exponential@plt>
jmp    16b7 <calculate+0x417>
mov    -0x30(%rbp),%rdi
lea    0x977(%rip),%rsi
call   10d0 <printInvalid@plt>
jmp    184b <calculate+0x5ab>
mov    -0x28(%rbp),%rdi
lea    0x966(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    171e <calculate+0x47e>
mov    -0x30(%rbp),%rdi
call   1140 <isEmptyDynArr@plt>
cmp    $0x0,%rax
jne    1709 <calculate+0x469>
mov    -0x30(%rbp),%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x1,%eax
jl     1709 <calculate+0x469>
mov    -0x30(%rbp),%rdi
call   1080 <natural_log@plt>
jmp    1719 <calculate+0x479>
mov    -0x30(%rbp),%rdi
lea    0x919(%rip),%rsi
call   10d0 <printInvalid@plt>
jmp    1846 <calculate+0x5a6>
mov    -0x28(%rbp),%rdi
lea    0x907(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1780 <calculate+0x4e0>
mov    -0x30(%rbp),%rdi
call   1140 <isEmptyDynArr@plt>
cmp    $0x0,%rax
jne    176b <calculate+0x4cb>
mov    -0x30(%rbp),%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x1,%eax
jl     176b <calculate+0x4cb>
mov    -0x30(%rbp),%rdi
call   11b0 <base_10_log@plt>
jmp    177b <calculate+0x4db>
mov    -0x30(%rbp),%rdi
lea    0x8ba(%rip),%rsi
call   10d0 <printInvalid@plt>
jmp    1841 <calculate+0x5a1>
mov    -0x28(%rbp),%rdi
lea    0x8a9(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    17b0 <calculate+0x510>
mov    -0x30(%rbp),%rdi
movsd  0x862(%rip),%xmm0
call   1190 <pushDynArr@plt>
jmp    183c <calculate+0x59c>
mov    -0x28(%rbp),%rdi
lea    0x87c(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    17ed <calculate+0x54d>
mov    -0x30(%rbp),%rax
mov    %rax,-0x48(%rbp)
movsd  0x826(%rip),%xmm0
call   1130 <exp@plt>
mov    -0x48(%rbp),%rdi
call   1190 <pushDynArr@plt>
jmp    1837 <calculate+0x597>
mov    -0x28(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1110 <isNumber@plt>
cmp    $0x1,%eax
jne    1816 <calculate+0x576>
mov    -0x30(%rbp),%rdi
movsd  -0x38(%rbp),%xmm0
call   1190 <pushDynArr@plt>
jmp    1832 <calculate+0x592>
mov    -0x28(%rbp),%rsi
lea    0x818(%rip),%rdi
mov    $0x0,%al
call   10c0 <printf@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
jmp    1837 <calculate+0x597>
jmp    183c <calculate+0x59c>
jmp    1841 <calculate+0x5a1>
jmp    1846 <calculate+0x5a6>
jmp    184b <calculate+0x5ab>
jmp    1850 <calculate+0x5b0>
jmp    1855 <calculate+0x5b5>
jmp    185a <calculate+0x5ba>
jmp    185f <calculate+0x5bf>
jmp    1864 <calculate+0x5c4>
jmp    1869 <calculate+0x5c9>
jmp    186e <calculate+0x5ce>
jmp    1873 <calculate+0x5d3>
jmp    1878 <calculate+0x5d8>
jmp    187d <calculate+0x5dd>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12cc <calculate+0x2c>
mov    -0x30(%rbp),%rdi
call   1030 <topDynArr@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x30(%rbp),%rdi
call   10f0 <popDynArr@plt>
mov    -0x30(%rbp),%rdi
call   1070 <sizeDynArr@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     1922 <calculate+0x682>
lea    0x78e(%rip),%rdi
mov    $0x0,%al
call   10c0 <printf@plt>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1901 <calculate+0x661>
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%esi
call   1150 <getDynArr@plt>
lea    0x7ba(%rip),%rdi
mov    $0x1,%al
call   10c0 <printf@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    18cd <calculate+0x62d>
lea    0x7a2(%rip),%rdi
mov    $0x0,%al
call   10c0 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1120 <deleteDynArr@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
movsd  -0x20(%rbp),%xmm0
lea    0x79a(%rip),%rdi
mov    $0x1,%al
call   10c0 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1120 <deleteDynArr@plt>
movsd  -0x20(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x14,%edi
call   1170 <createDynArr@plt>
mov    %rax,%rbx
cmp    $0x2,%ebp
jl     172f <calculate+0x48f>
mov    %ebp,%r13d
mov    $0x1,%r12d
lea    0xd37(%rip),%r15
jmp    1309 <calculate+0x69>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1140 <isEmptyDynArr@plt>
test   %rax,%rax
je     14dd <calculate+0x23d>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10e0 <printInvalid@plt>
add    $0x1,%r12
cmp    %r12,%r13
je     172f <calculate+0x48f>
mov    (%r14,%r12,8),%rbp
mov    %rbp,%rdi
mov    %r15,%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     12e0 <calculate+0x40>
mov    %rbp,%rdi
lea    0xceb(%rip),%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     1480 <calculate+0x1e0>
mov    %rbp,%rdi
lea    0xcd5(%rip),%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     14b6 <calculate+0x216>
mov    %rbp,%rdi
lea    0xcbf(%rip),%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     150a <calculate+0x26a>
mov    %rbp,%rdi
lea    0xca9(%rip),%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     1540 <calculate+0x2a0>
mov    %rbp,%rdi
lea    0xc93(%rip),%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     1576 <calculate+0x2d6>
mov    %rbp,%rdi
lea    0xc7e(%rip),%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     1592 <calculate+0x2f2>
mov    %rbp,%rdi
lea    0xc69(%rip),%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     15ae <calculate+0x30e>
mov    %rbp,%rdi
lea    0xc55(%rip),%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     15e7 <calculate+0x347>
mov    %rbp,%rdi
lea    0xc42(%rip),%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     1620 <calculate+0x380>
mov    %rbp,%rdi
lea    0xc2e(%rip),%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     165d <calculate+0x3bd>
mov    %rbp,%rdi
lea    0xc19(%rip),%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     1696 <calculate+0x3f6>
mov    %rbp,%rdi
lea    0xc05(%rip),%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     16cf <calculate+0x42f>
mov    %rbp,%rdi
lea    0xbf0(%rip),%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     1701 <calculate+0x461>
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
call   1120 <isNumber@plt>
cmp    $0x1,%eax
jne    17ea <calculate+0x54a>
movsd  0x10(%rsp),%xmm0
mov    %rbx,%rdi
call   1190 <pushDynArr@plt>
jmp    12fc <calculate+0x5c>
xchg   %ax,%ax
mov    %rbx,%rdi
call   1140 <isEmptyDynArr@plt>
test   %rax,%rax
jne    14a7 <calculate+0x207>
mov    %rbx,%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x2,%eax
jl     14a7 <calculate+0x207>
mov    %rbx,%rdi
call   1160 <subtract@plt>
jmp    12fc <calculate+0x5c>
mov    %rbx,%rdi
lea    0xb61(%rip),%rsi
jmp    12f7 <calculate+0x57>
mov    %rbx,%rdi
call   1140 <isEmptyDynArr@plt>
test   %rax,%rax
jne    14fb <calculate+0x25b>
mov    %rbx,%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x2,%eax
jl     14fb <calculate+0x25b>
mov    %rbx,%rdi
call   10a0 <divide@plt>
jmp    12fc <calculate+0x5c>
mov    %rbx,%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x2,%eax
jl     12f1 <calculate+0x51>
mov    %rbx,%rdi
call   1040 <add@plt>
jmp    12fc <calculate+0x5c>
mov    %rbx,%rdi
lea    0xb0f(%rip),%rsi
jmp    12f7 <calculate+0x57>
mov    %rbx,%rdi
call   1140 <isEmptyDynArr@plt>
test   %rax,%rax
jne    1531 <calculate+0x291>
mov    %rbx,%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x2,%eax
jl     1531 <calculate+0x291>
mov    %rbx,%rdi
call   1060 <multiply@plt>
jmp    12fc <calculate+0x5c>
mov    %rbx,%rdi
lea    0xadb(%rip),%rsi
jmp    12f7 <calculate+0x57>
mov    %rbx,%rdi
call   1140 <isEmptyDynArr@plt>
test   %rax,%rax
jne    1567 <calculate+0x2c7>
mov    %rbx,%rdi
call   1070 <sizeDynArr@plt>
cmp    $0x2,%eax
jl     1567 <calculate+0x2c7>
mov    %rbx,%rdi
call   1050 <power@plt>
jmp    12fc <calculate+0x5c>
mov    %rbx,%rdi
lea    0xaa7(%rip),%rsi
jmp    12f7 <calculate+0x57>
mov    %rbx,%rdi
call   1140 <isEmptyDynArr@plt>
test   %rax,%rax
je     15ce <calculate+0x32e>
mov    %rbx,%rdi
lea    0xa8d(%rip),%rsi
jmp    12f7 <calculate+0x57>
mov    %rbx,%rdi
call   1140 <isEmptyDynArr@plt>
test   %rax,%rax
je     1607 <calculate+0x367>
mov    %rbx,%rdi
lea    0xa74(%rip),%rsi
jmp    12f7 <calculate+0x57>
mov    %rbx,%rdi
call   1140 <isEmptyDynArr@plt>
test   %rax,%rax
je     1640 <calculate+0x3a0>
mov    %rbx,%rdi
lea    0xa57(%rip),%rsi
jmp    12f7 <calculate+0x57>
mov    %rbx,%rdi
call   1070 <sizeDynArr@plt>
test   %eax,%eax
jle    1583 <calculate+0x2e3>
mov    %rbx,%rdi
call   10c0 <square@plt>
jmp    12fc <calculate+0x5c>
mov    %rbx,%rdi
call   1140 <isEmptyDynArr@plt>
test   %rax,%rax
je     1679 <calculate+0x3d9>
mov    %rbx,%rdi
lea    0xa22(%rip),%rsi
jmp    12f7 <calculate+0x57>
mov    %rbx,%rdi
call   1070 <sizeDynArr@plt>
test   %eax,%eax
jle    159f <calculate+0x2ff>
mov    %rbx,%rdi
call   11c0 <cube@plt>
jmp    12fc <calculate+0x5c>
mov    %rbx,%rdi
call   1140 <isEmptyDynArr@plt>
test   %rax,%rax
je     16b2 <calculate+0x412>
mov    %rbx,%rdi
lea    0x9ee(%rip),%rsi
jmp    12f7 <calculate+0x57>
mov    %rbx,%rdi
call   1070 <sizeDynArr@plt>
test   %eax,%eax
jle    15bf <calculate+0x31f>
mov    %rbx,%rdi
call   10b0 <abs_val@plt>
jmp    12fc <calculate+0x5c>
mov    %rbx,%rdi
call   1140 <isEmptyDynArr@plt>
test   %rax,%rax
je     16e4 <calculate+0x444>
mov    %rbx,%rdi
lea    0x9b9(%rip),%rsi
jmp    12f7 <calculate+0x57>
mov    %rbx,%rdi
call   1070 <sizeDynArr@plt>
test   %eax,%eax
jle    15f8 <calculate+0x358>
mov    %rbx,%rdi
call   11a0 <square_root@plt>
jmp    12fc <calculate+0x5c>
mov    %rbx,%rdi
call   1140 <isEmptyDynArr@plt>
test   %rax,%rax
je     1716 <calculate+0x476>
mov    %rbx,%rdi
lea    0x983(%rip),%rsi
jmp    12f7 <calculate+0x57>
mov    %rbx,%rdi
call   1070 <sizeDynArr@plt>
test   %eax,%eax
jle    1631 <calculate+0x391>
mov    %rbx,%rdi
call   1110 <exponential@plt>
jmp    12fc <calculate+0x5c>
mov    %rbx,%rdi
movsd  0x92e(%rip),%xmm0
call   1190 <pushDynArr@plt>
jmp    12fc <calculate+0x5c>
mov    %rbx,%rdi
call   1070 <sizeDynArr@plt>
test   %eax,%eax
jle    166a <calculate+0x3ca>
mov    %rbx,%rdi
call   1090 <natural_log@plt>
jmp    12fc <calculate+0x5c>
mov    %rbx,%rdi
movsd  0x8f4(%rip),%xmm0
call   1190 <pushDynArr@plt>
jmp    12fc <calculate+0x5c>
mov    %rbx,%rdi
call   1070 <sizeDynArr@plt>
test   %eax,%eax
jle    16a3 <calculate+0x403>
mov    %rbx,%rdi
call   11b0 <base_10_log@plt>
jmp    12fc <calculate+0x5c>
mov    %rbx,%rdi
call   1030 <topDynArr@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1100 <popDynArr@plt>
mov    %rbx,%rdi
call   1070 <sizeDynArr@plt>
test   %eax,%eax
jne    1782 <calculate+0x4e2>
lea    0x952(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   10d0 <printf@plt>
mov    %rbx,%rdi
call   1130 <deleteDynArr@plt>
movsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%r14d
lea    0x8c1(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   10d0 <printf@plt>
test   %r14d,%r14d
jle    17cc <calculate+0x52c>
lea    0x905(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1150 <getDynArr@plt>
mov    %r15,%rdi
mov    $0x1,%al
call   10d0 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%r14d
jne    17b0 <calculate+0x510>
lea    0x8e9(%rip),%rdi
call   1080 <puts@plt>
mov    %rbx,%rdi
call   1130 <deleteDynArr@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
lea    0x848(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10d0 <printf@plt>
mov    $0x1,%edi
call   1180 <exit@plt>

LLVM IR (-O0):
%struct.DynArr = type { i32 }
@.str = [2 x i8] c"+\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [2 x i8] c"/\00"
@.str.3 = [2 x i8] c"x\00"
@.str.4 = [2 x i8] c"^\00"
@.str.5 = [3 x i8] c"^2\00"
@.str.6 = [3 x i8] c"^3\00"
@.str.7 = [4 x i8] c"abs\00"
@.str.8 = [5 x i8] c"sqrt\00"
@.str.9 = [4 x i8] c"exp\00"
@.str.10 = [3 x i8] c"ln\00"
@.str.11 = [4 x i8] c"log\00"
@.str.12 = [3 x i8] c"pi\00"
@.str.13 = [2 x i8] c"e\00"
@.str.14 = [20 x i8] c"Invalid number: %s\0A\00"
@.str.15 = [89 x i8] c"Error! The following items were left on calculation stack after popping assumed result: \00"
@.str.16 = [4 x i8] c"%f \00"
@.str.17 = [30 x i8] c"\0ADid you forget an operator?\0A\00"
@.str.18 = [18 x i8] c"The result is %f\0A\00"
define double @calculate(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca double
%7 = alloca i8*
%8 = alloca %struct.DynArr*
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store double 0.000000e+00, double* %6
%12 = call %struct.DynArr* @createDynArr(i32 20)
store %struct.DynArr* %12, %struct.DynArr** %8
store i32 1, i32* %5
br label %13
13: ; preds = %292, %2
%14 = load i32, i32* %5
%15 = load i32, i32* %3
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %295
17: ; preds = %13
%18 = load i8**, i8*** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
store i8* %22, i8** %7
%23 = load i8*, i8** %7
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %41
26: ; preds = %17
%27 = load %struct.DynArr*, %struct.DynArr** %8
%28 = call i64 @isEmptyDynArr(%struct.DynArr* %27)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %37
30: ; preds = %26
%31 = load %struct.DynArr*, %struct.DynArr** %8
%32 = call i32 @sizeDynArr(%struct.DynArr* %31)
%33 = icmp sge i32 %32, 2
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = load %struct.DynArr*, %struct.DynArr** %8
%36 = call i32 @add(%struct.DynArr* %35)
br label %40
37: ; preds = %30, %26
%38 = load %struct.DynArr*, %struct.DynArr** %8
%39 = call i32 @printInvalid(%struct.DynArr* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %40
40: ; preds = %37, %34
br label %291
41: ; preds = %17
%42 = load i8*, i8** %7
%43 = call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %60
45: ; preds = %41
%46 = load %struct.DynArr*, %struct.DynArr** %8
%47 = call i64 @isEmptyDynArr(%struct.DynArr* %46)
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %56
49: ; preds = %45
%50 = load %struct.DynArr*, %struct.DynArr** %8
%51 = call i32 @sizeDynArr(%struct.DynArr* %50)
%52 = icmp sge i32 %51, 2
br i1 %52, label %53, label %56
53: ; preds = %49
%54 = load %struct.DynArr*, %struct.DynArr** %8
%55 = call i32 @subtract(%struct.DynArr* %54)
br label %59
56: ; preds = %49, %45
%57 = load %struct.DynArr*, %struct.DynArr** %8
%58 = call i32 @printInvalid(%struct.DynArr* %57, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %59
59: ; preds = %56, %53
br label %290
60: ; preds = %41
%61 = load i8*, i8** %7
%62 = call i64 @strcmp(i8* %61, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %79
64: ; preds = %60
%65 = load %struct.DynArr*, %struct.DynArr** %8
%66 = call i64 @isEmptyDynArr(%struct.DynArr* %65)
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %75
68: ; preds = %64
%69 = load %struct.DynArr*, %struct.DynArr** %8
%70 = call i32 @sizeDynArr(%struct.DynArr* %69)
%71 = icmp sge i32 %70, 2
br i1 %71, label %72, label %75
72: ; preds = %68
%73 = load %struct.DynArr*, %struct.DynArr** %8
%74 = call i32 @divide(%struct.DynArr* %73)
br label %78
75: ; preds = %68, %64
%76 = load %struct.DynArr*, %struct.DynArr** %8
%77 = call i32 @printInvalid(%struct.DynArr* %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %78
78: ; preds = %75, %72
br label %289
79: ; preds = %60
%80 = load i8*, i8** %7
%81 = call i64 @strcmp(i8* %80, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %98
83: ; preds = %79
%84 = load %struct.DynArr*, %struct.DynArr** %8
%85 = call i64 @isEmptyDynArr(%struct.DynArr* %84)
%86 = icmp eq i64 %85, 0
br i1 %86, label %87, label %94
87: ; preds = %83
%88 = load %struct.DynArr*, %struct.DynArr** %8
%89 = call i32 @sizeDynArr(%struct.DynArr* %88)
%90 = icmp sge i32 %89, 2
br i1 %90, label %91, label %94
91: ; preds = %87
%92 = load %struct.DynArr*, %struct.DynArr** %8
%93 = call i32 @multiply(%struct.DynArr* %92)
br label %97
94: ; preds = %87, %83
%95 = load %struct.DynArr*, %struct.DynArr** %8
%96 = call i32 @printInvalid(%struct.DynArr* %95, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %97
97: ; preds = %94, %91
br label %288
98: ; preds = %79
%99 = load i8*, i8** %7
%100 = call i64 @strcmp(i8* %99, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %117
102: ; preds = %98
%103 = load %struct.DynArr*, %struct.DynArr** %8
%104 = call i64 @isEmptyDynArr(%struct.DynArr* %103)
%105 = icmp eq i64 %104, 0
br i1 %105, label %106, label %113
106: ; preds = %102
%107 = load %struct.DynArr*, %struct.DynArr** %8
%108 = call i32 @sizeDynArr(%struct.DynArr* %107)
%109 = icmp sge i32 %108, 2
br i1 %109, label %110, label %113
110: ; preds = %106
%111 = load %struct.DynArr*, %struct.DynArr** %8
%112 = call i32 @power(%struct.DynArr* %111)
br label %116
113: ; preds = %106, %102
%114 = load %struct.DynArr*, %struct.DynArr** %8
%115 = call i32 @printInvalid(%struct.DynArr* %114, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %116
116: ; preds = %113, %110
br label %287
117: ; preds = %98
%118 = load i8*, i8** %7
%119 = call i64 @strcmp(i8* %118, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%120 = icmp eq i64 %119, 0
br i1 %120, label %121, label %136
121: ; preds = %117
%122 = load %struct.DynArr*, %struct.DynArr** %8
%123 = call i64 @isEmptyDynArr(%struct.DynArr* %122)
%124 = icmp eq i64 %123, 0
br i1 %124, label %125, label %132
125: ; preds = %121
%126 = load %struct.DynArr*, %struct.DynArr** %8
%127 = call i32 @sizeDynArr(%struct.DynArr* %126)
%128 = icmp sge i32 %127, 1
br i1 %128, label %129, label %132
129: ; preds = %125
%130 = load %struct.DynArr*, %struct.DynArr** %8
%131 = call i32 @square(%struct.DynArr* %130)
br label %135
132: ; preds = %125, %121
%133 = load %struct.DynArr*, %struct.DynArr** %8
%134 = call i32 @printInvalid(%struct.DynArr* %133, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %135
135: ; preds = %132, %129
br label %286
136: ; preds = %117
%137 = load i8*, i8** %7
%138 = call i64 @strcmp(i8* %137, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%139 = icmp eq i64 %138, 0
br i1 %139, label %140, label %155
140: ; preds = %136
%141 = load %struct.DynArr*, %struct.DynArr** %8
%142 = call i64 @isEmptyDynArr(%struct.DynArr* %141)
%143 = icmp eq i64 %142, 0
br i1 %143, label %144, label %151
144: ; preds = %140
%145 = load %struct.DynArr*, %struct.DynArr** %8
%146 = call i32 @sizeDynArr(%struct.DynArr* %145)
%147 = icmp sge i32 %146, 1
br i1 %147, label %148, label %151
148: ; preds = %144
%149 = load %struct.DynArr*, %struct.DynArr** %8
%150 = call i32 @cube(%struct.DynArr* %149)
br label %154
151: ; preds = %144, %140
%152 = load %struct.DynArr*, %struct.DynArr** %8
%153 = call i32 @printInvalid(%struct.DynArr* %152, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %154
154: ; preds = %151, %148
br label %285
155: ; preds = %136
%156 = load i8*, i8** %7
%157 = call i64 @strcmp(i8* %156, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%158 = icmp eq i64 %157, 0
br i1 %158, label %159, label %174
159: ; preds = %155
%160 = load %struct.DynArr*, %struct.DynArr** %8
%161 = call i64 @isEmptyDynArr(%struct.DynArr* %160)
%162 = icmp eq i64 %161, 0
br i1 %162, label %163, label %170
163: ; preds = %159
%164 = load %struct.DynArr*, %struct.DynArr** %8
%165 = call i32 @sizeDynArr(%struct.DynArr* %164)
%166 = icmp sge i32 %165, 1
br i1 %166, label %167, label %170
167: ; preds = %163
%168 = load %struct.DynArr*, %struct.DynArr** %8
%169 = call i32 @abs_val(%struct.DynArr* %168)
br label %173
170: ; preds = %163, %159
%171 = load %struct.DynArr*, %struct.DynArr** %8
%172 = call i32 @printInvalid(%struct.DynArr* %171, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %173
173: ; preds = %170, %167
br label %284
174: ; preds = %155
%175 = load i8*, i8** %7
%176 = call i64 @strcmp(i8* %175, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%177 = icmp eq i64 %176, 0
br i1 %177, label %178, label %193
178: ; preds = %174
%179 = load %struct.DynArr*, %struct.DynArr** %8
%180 = call i64 @isEmptyDynArr(%struct.DynArr* %179)
%181 = icmp eq i64 %180, 0
br i1 %181, label %182, label %189
182: ; preds = %178
%183 = load %struct.DynArr*, %struct.DynArr** %8
%184 = call i32 @sizeDynArr(%struct.DynArr* %183)
%185 = icmp sge i32 %184, 1
br i1 %185, label %186, label %189
186: ; preds = %182
%187 = load %struct.DynArr*, %struct.DynArr** %8
%188 = call i32 @square_root(%struct.DynArr* %187)
br label %192
189: ; preds = %182, %178
%190 = load %struct.DynArr*, %struct.DynArr** %8
%191 = call i32 @printInvalid(%struct.DynArr* %190, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %192
192: ; preds = %189, %186
br label %283
193: ; preds = %174
%194 = load i8*, i8** %7
%195 = call i64 @strcmp(i8* %194, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%196 = icmp eq i64 %195, 0
br i1 %196, label %197, label %212
197: ; preds = %193
%198 = load %struct.DynArr*, %struct.DynArr** %8
%199 = call i64 @isEmptyDynArr(%struct.DynArr* %198)
%200 = icmp eq i64 %199, 0
br i1 %200, label %201, label %208
201: ; preds = %197
%202 = load %struct.DynArr*, %struct.DynArr** %8
%203 = call i32 @sizeDynArr(%struct.DynArr* %202)
%204 = icmp sge i32 %203, 1
br i1 %204, label %205, label %208
205: ; preds = %201
%206 = load %struct.DynArr*, %struct.DynArr** %8
%207 = call i32 @exponential(%struct.DynArr* %206)
br label %211
208: ; preds = %201, %197
%209 = load %struct.DynArr*, %struct.DynArr** %8
%210 = call i32 @printInvalid(%struct.DynArr* %209, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
br label %211
211: ; preds = %208, %205
br label %282
212: ; preds = %193
%213 = load i8*, i8** %7
%214 = call i64 @strcmp(i8* %213, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%215 = icmp eq i64 %214, 0
br i1 %215, label %216, label %231
216: ; preds = %212
%217 = load %struct.DynArr*, %struct.DynArr** %8
%218 = call i64 @isEmptyDynArr(%struct.DynArr* %217)
%219 = icmp eq i64 %218, 0
br i1 %219, label %220, label %227
220: ; preds = %216
%221 = load %struct.DynArr*, %struct.DynArr** %8
%222 = call i32 @sizeDynArr(%struct.DynArr* %221)
%223 = icmp sge i32 %222, 1
br i1 %223, label %224, label %227
224: ; preds = %220
%225 = load %struct.DynArr*, %struct.DynArr** %8
%226 = call i32 @natural_log(%struct.DynArr* %225)
br label %230
227: ; preds = %220, %216
%228 = load %struct.DynArr*, %struct.DynArr** %8
%229 = call i32 @printInvalid(%struct.DynArr* %228, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
br label %230
230: ; preds = %227, %224
br label %281
231: ; preds = %212
%232 = load i8*, i8** %7
%233 = call i64 @strcmp(i8* %232, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%234 = icmp eq i64 %233, 0
br i1 %234, label %235, label %250
235: ; preds = %231
%236 = load %struct.DynArr*, %struct.DynArr** %8
%237 = call i64 @isEmptyDynArr(%struct.DynArr* %236)
%238 = icmp eq i64 %237, 0
br i1 %238, label %239, label %246
239: ; preds = %235
%240 = load %struct.DynArr*, %struct.DynArr** %8
%241 = call i32 @sizeDynArr(%struct.DynArr* %240)
%242 = icmp sge i32 %241, 1
br i1 %242, label %243, label %246
243: ; preds = %239
%244 = load %struct.DynArr*, %struct.DynArr** %8
%245 = call i32 @base_10_log(%struct.DynArr* %244)
br label %249
246: ; preds = %239, %235
%247 = load %struct.DynArr*, %struct.DynArr** %8
%248 = call i32 @printInvalid(%struct.DynArr* %247, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
br label %249
249: ; preds = %246, %243
br label %280
250: ; preds = %231
%251 = load i8*, i8** %7
%252 = call i64 @strcmp(i8* %251, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
%253 = icmp eq i64 %252, 0
br i1 %253, label %254, label %257
254: ; preds = %250
%255 = load %struct.DynArr*, %struct.DynArr** %8
%256 = call i32 @pushDynArr(%struct.DynArr* %255, double 0x400921FB54442D18)
br label %279
257: ; preds = %250
%258 = load i8*, i8** %7
%259 = call i64 @strcmp(i8* %258, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
%260 = icmp eq i64 %259, 0
br i1 %260, label %261, label %265
261: ; preds = %257
%262 = load %struct.DynArr*, %struct.DynArr** %8
%263 = call double @exp(double 1.000000e+00)
%264 = call i32 @pushDynArr(%struct.DynArr* %262, double %263)
br label %278
265: ; preds = %257
%266 = load i8*, i8** %7
%267 = call i32 @isNumber(i8* %266, double* %9)
%268 = icmp eq i32 %267, 1
br i1 %268, label %269, label %273
269: ; preds = %265
%270 = load %struct.DynArr*, %struct.DynArr** %8
%271 = load double, double* %9
%272 = call i32 @pushDynArr(%struct.DynArr* %270, double %271)
br label %277
273: ; preds = %265
%274 = load i8*, i8** %7
%275 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i8* %274)
%276 = call i32 @exit(i32 1)
unreachable
277: ; preds = %269
br label %278
278: ; preds = %277, %261
br label %279
279: ; preds = %278, %254
br label %280
280: ; preds = %279, %249
br label %281
281: ; preds = %280, %230
br label %282
282: ; preds = %281, %211
br label %283
283: ; preds = %282, %192
br label %284
284: ; preds = %283, %173
br label %285
285: ; preds = %284, %154
br label %286
286: ; preds = %285, %135
br label %287
287: ; preds = %286, %116
br label %288
288: ; preds = %287, %97
br label %289
289: ; preds = %288, %78
br label %290
290: ; preds = %289, %59
br label %291
291: ; preds = %290, %40
br label %292
292: ; preds = %291
%293 = load i32, i32* %5
%294 = add nsw i32 %293, 1
store i32 %294, i32* %5
br label %13
295: ; preds = %13
%296 = load %struct.DynArr*, %struct.DynArr** %8
%297 = call double @topDynArr(%struct.DynArr* %296)
store double %297, double* %6
%298 = load %struct.DynArr*, %struct.DynArr** %8
%299 = call i32 @popDynArr(%struct.DynArr* %298)
%300 = load %struct.DynArr*, %struct.DynArr** %8
%301 = call i32 @sizeDynArr(%struct.DynArr* %300)
store i32 %301, i32* %10
%302 = load i32, i32* %10
%303 = icmp ne i32 %302, 0
br i1 %303, label %304, label %323
304: ; preds = %295
%305 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str.15, i64 0, i64 0))
store i32 0, i32* %11
br label %306
306: ; preds = %315, %304
%307 = load i32, i32* %11
%308 = load i32, i32* %10
%309 = icmp slt i32 %307, %308
br i1 %309, label %310, label %318
310: ; preds = %306
%311 = load %struct.DynArr*, %struct.DynArr** %8
%312 = load i32, i32* %11
%313 = call double @getDynArr(%struct.DynArr* %311, i32 %312)
%314 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), double %313)
br label %315
315: ; preds = %310
%316 = load i32, i32* %11
%317 = add nsw i32 %316, 1
store i32 %317, i32* %11
br label %306
318: ; preds = %306
%319 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.17, i64 0, i64 0))
%320 = load %struct.DynArr*, %struct.DynArr** %8
%321 = call i32 @deleteDynArr(%struct.DynArr* %320)
%322 = call i32 @exit(i32 1)
unreachable
323: ; preds = %295
%324 = load double, double* %6
%325 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0), double %324)
%326 = load %struct.DynArr*, %struct.DynArr** %8
%327 = call i32 @deleteDynArr(%struct.DynArr* %326)
%328 = load double, double* %6
ret double %328
}

LLVM IR (-O2):
%struct.DynArr = type { i32 }
@.str = [2 x i8] c"+\00"
@.str.1 = [2 x i8] c"-\00"
@.str.2 = [2 x i8] c"/\00"
@.str.3 = [2 x i8] c"x\00"
@.str.4 = [2 x i8] c"^\00"
@.str.5 = [3 x i8] c"^2\00"
@.str.6 = [3 x i8] c"^3\00"
@.str.7 = [4 x i8] c"abs\00"
@.str.8 = [5 x i8] c"sqrt\00"
@.str.9 = [4 x i8] c"exp\00"
@.str.10 = [3 x i8] c"ln\00"
@.str.11 = [4 x i8] c"log\00"
@.str.12 = [3 x i8] c"pi\00"
@.str.13 = [2 x i8] c"e\00"
@.str.14 = [20 x i8] c"Invalid number: %s\0A\00"
@.str.15 = [89 x i8] c"Error! The following items were left on calculation stack after popping assumed result: \00"
@.str.16 = [4 x i8] c"%f \00"
@.str.18 = [18 x i8] c"The result is %f\0A\00"
@str = [29 x i8] c"\0ADid you forget an operator?\00"
define double @calculate(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = tail call %struct.DynArr* @createDynArr(i32 20)
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %190
6: ; preds = %2
%7 = bitcast double* %3 to i8*
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %6, %187
%10 = phi i64 [ 1, %6 ], [ %188, %187 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %25
15: ; preds = %9
%16 = call i64 @isEmptyDynArr(%struct.DynArr* %4)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = call i32 @sizeDynArr(%struct.DynArr* %4)
%20 = icmp sgt i32 %19, 1
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 @add(%struct.DynArr* %4)
br label %187
23: ; preds = %18, %15
%24 = call i32 @printInvalid(%struct.DynArr* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %187
25: ; preds = %9
%26 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %38
28: ; preds = %25
%29 = call i64 @isEmptyDynArr(%struct.DynArr* %4)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = call i32 @sizeDynArr(%struct.DynArr* %4)
%33 = icmp sgt i32 %32, 1
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @subtract(%struct.DynArr* %4)
br label %187
36: ; preds = %31, %28
%37 = call i32 @printInvalid(%struct.DynArr* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %187
38: ; preds = %25
%39 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %51
41: ; preds = %38
%42 = call i64 @isEmptyDynArr(%struct.DynArr* %4)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %49
44: ; preds = %41
%45 = call i32 @sizeDynArr(%struct.DynArr* %4)
%46 = icmp sgt i32 %45, 1
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = call i32 @divide(%struct.DynArr* %4)
br label %187
49: ; preds = %44, %41
%50 = call i32 @printInvalid(%struct.DynArr* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %187
51: ; preds = %38
%52 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %64
54: ; preds = %51
%55 = call i64 @isEmptyDynArr(%struct.DynArr* %4)
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %62
57: ; preds = %54
%58 = call i32 @sizeDynArr(%struct.DynArr* %4)
%59 = icmp sgt i32 %58, 1
br i1 %59, label %60, label %62
60: ; preds = %57
%61 = call i32 @multiply(%struct.DynArr* %4)
br label %187
62: ; preds = %57, %54
%63 = call i32 @printInvalid(%struct.DynArr* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %187
64: ; preds = %51
%65 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %77
67: ; preds = %64
%68 = call i64 @isEmptyDynArr(%struct.DynArr* %4)
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %75
70: ; preds = %67
%71 = call i32 @sizeDynArr(%struct.DynArr* %4)
%72 = icmp sgt i32 %71, 1
br i1 %72, label %73, label %75
73: ; preds = %70
%74 = call i32 @power(%struct.DynArr* %4)
br label %187
75: ; preds = %70, %67
%76 = call i32 @printInvalid(%struct.DynArr* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %187
77: ; preds = %64
%78 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%79 = icmp eq i64 %78, 0
br i1 %79, label %80, label %90
80: ; preds = %77
%81 = call i64 @isEmptyDynArr(%struct.DynArr* %4)
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %88
83: ; preds = %80
%84 = call i32 @sizeDynArr(%struct.DynArr* %4)
%85 = icmp sgt i32 %84, 0
br i1 %85, label %86, label %88
86: ; preds = %83
%87 = call i32 @square(%struct.DynArr* %4)
br label %187
88: ; preds = %83, %80
%89 = call i32 @printInvalid(%struct.DynArr* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %187
90: ; preds = %77
%91 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%92 = icmp eq i64 %91, 0
br i1 %92, label %93, label %103
93: ; preds = %90
%94 = call i64 @isEmptyDynArr(%struct.DynArr* %4)
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %101
96: ; preds = %93
%97 = call i32 @sizeDynArr(%struct.DynArr* %4)
%98 = icmp sgt i32 %97, 0
br i1 %98, label %99, label %101
99: ; preds = %96
%100 = call i32 @cube(%struct.DynArr* %4)
br label %187
101: ; preds = %96, %93
%102 = call i32 @printInvalid(%struct.DynArr* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %187
103: ; preds = %90
%104 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%105 = icmp eq i64 %104, 0
br i1 %105, label %106, label %116
106: ; preds = %103
%107 = call i64 @isEmptyDynArr(%struct.DynArr* %4)
%108 = icmp eq i64 %107, 0
br i1 %108, label %109, label %114
109: ; preds = %106
%110 = call i32 @sizeDynArr(%struct.DynArr* %4)
%111 = icmp sgt i32 %110, 0
br i1 %111, label %112, label %114
112: ; preds = %109
%113 = call i32 @abs_val(%struct.DynArr* %4)
br label %187
114: ; preds = %109, %106
%115 = call i32 @printInvalid(%struct.DynArr* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %187
116: ; preds = %103
%117 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%118 = icmp eq i64 %117, 0
br i1 %118, label %119, label %129
119: ; preds = %116
%120 = call i64 @isEmptyDynArr(%struct.DynArr* %4)
%121 = icmp eq i64 %120, 0
br i1 %121, label %122, label %127
122: ; preds = %119
%123 = call i32 @sizeDynArr(%struct.DynArr* %4)
%124 = icmp sgt i32 %123, 0
br i1 %124, label %125, label %127
125: ; preds = %122
%126 = call i32 @square_root(%struct.DynArr* %4)
br label %187
127: ; preds = %122, %119
%128 = call i32 @printInvalid(%struct.DynArr* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %187
129: ; preds = %116
%130 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%131 = icmp eq i64 %130, 0
br i1 %131, label %132, label %142
132: ; preds = %129
%133 = call i64 @isEmptyDynArr(%struct.DynArr* %4)
%134 = icmp eq i64 %133, 0
br i1 %134, label %135, label %140
135: ; preds = %132
%136 = call i32 @sizeDynArr(%struct.DynArr* %4)
%137 = icmp sgt i32 %136, 0
br i1 %137, label %138, label %140
138: ; preds = %135
%139 = call i32 @exponential(%struct.DynArr* %4)
br label %187
140: ; preds = %135, %132
%141 = call i32 @printInvalid(%struct.DynArr* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
br label %187
142: ; preds = %129
%143 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%144 = icmp eq i64 %143, 0
br i1 %144, label %145, label %155
145: ; preds = %142
%146 = call i64 @isEmptyDynArr(%struct.DynArr* %4)
%147 = icmp eq i64 %146, 0
br i1 %147, label %148, label %153
148: ; preds = %145
%149 = call i32 @sizeDynArr(%struct.DynArr* %4)
%150 = icmp sgt i32 %149, 0
br i1 %150, label %151, label %153
151: ; preds = %148
%152 = call i32 @natural_log(%struct.DynArr* %4)
br label %187
153: ; preds = %148, %145
%154 = call i32 @printInvalid(%struct.DynArr* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
br label %187
155: ; preds = %142
%156 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%157 = icmp eq i64 %156, 0
br i1 %157, label %158, label %168
158: ; preds = %155
%159 = call i64 @isEmptyDynArr(%struct.DynArr* %4)
%160 = icmp eq i64 %159, 0
br i1 %160, label %161, label %166
161: ; preds = %158
%162 = call i32 @sizeDynArr(%struct.DynArr* %4)
%163 = icmp sgt i32 %162, 0
br i1 %163, label %164, label %166
164: ; preds = %161
%165 = call i32 @base_10_log(%struct.DynArr* %4)
br label %187
166: ; preds = %161, %158
%167 = call i32 @printInvalid(%struct.DynArr* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
br label %187
168: ; preds = %155
%169 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
%170 = icmp eq i64 %169, 0
br i1 %170, label %171, label %173
171: ; preds = %168
%172 = call i32 @pushDynArr(%struct.DynArr* %4, double 0x400921FB54442D18)
br label %187
173: ; preds = %168
%174 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
%175 = icmp eq i64 %174, 0
br i1 %175, label %176, label %178
176: ; preds = %173
%177 = call i32 @pushDynArr(%struct.DynArr* %4, double 0x4005BF0A8B145769)
br label %187
178: ; preds = %173
%179 = call i32 @isNumber(i8* %12, double* %3)
%180 = icmp eq i32 %179, 1
br i1 %180, label %181, label %184
181: ; preds = %178
%182 = load double, double* %3
%183 = call i32 @pushDynArr(%struct.DynArr* %4, double %182)
br label %187
184: ; preds = %178
%185 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i8* %12)
%186 = call i32 @exit(i32 1)
unreachable
187: ; preds = %23, %21, %49, %47, %75, %73, %101, %99, %127, %125, %153, %151, %171, %181, %176, %164, %166, %138, %140, %112, %114, %86, %88, %60, %62, %34, %36
%188 = add nuw nsw i64 %10, 1
%189 = icmp eq i64 %188, %8
br i1 %189, label %190, label %9
190: ; preds = %187, %2
%191 = call double @topDynArr(%struct.DynArr* %4)
%192 = call i32 @popDynArr(%struct.DynArr* %4)
%193 = call i32 @sizeDynArr(%struct.DynArr* %4)
%194 = icmp eq i32 %193, 0
br i1 %194, label %208, label %195
195: ; preds = %190
%196 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([89 x i8], [89 x i8]* @.str.15, i64 0, i64 0))
%197 = icmp sgt i32 %193, 0
br i1 %197, label %202, label %198
198: ; preds = %202, %195
%199 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%200 = call i32 @deleteDynArr(%struct.DynArr* %4)
%201 = call i32 @exit(i32 1)
unreachable
202: ; preds = %195, %202
%203 = phi i32 [ %206, %202 ], [ 0, %195 ]
%204 = call double @getDynArr(%struct.DynArr* %4, i32 %203)
%205 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), double %204)
%206 = add nuw nsw i32 %203, 1
%207 = icmp eq i32 %206, %193
br i1 %207, label %198, label %202
208: ; preds = %190
%209 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.18, i64 0, i64 0), double %191)
%210 = call i32 @deleteDynArr(%struct.DynArr* %4)
ret double %191
}