#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*/ absolut(struct DynArr *);
int /*<<< orphan*/ add(struct DynArr *);
struct DynArr *createDynArr(int);
int /*<<< orphan*/ cube(struct DynArr *);
int /*<<< orphan*/ divide(struct DynArr *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ expon(struct DynArr *);
int isNumber(char *, double *);
int /*<<< orphan*/ logBaseTen(struct DynArr *);
int /*<<< orphan*/ multiply(struct DynArr *);
int /*<<< orphan*/ nattyLog(struct DynArr *);
int /*<<< orphan*/ power(struct DynArr *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ pushDynArr(struct DynArr *, double);
int /*<<< orphan*/ square(struct DynArr *);
int /*<<< orphan*/ squareRoot(struct DynArr *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ subtract(struct DynArr *);
double calculate(int numInputTokens, char **inputString) {
  int i, count = 0;
  double result = 0.0, num1 = 0.0, num2 = 0.0;
  char *s;
  struct DynArr *stack;
  stack = createDynArr(20);
  for (i = 1; i < numInputTokens; i++) {
    s = inputString[i];
    if (numInputTokens >= 4) {
      if (isNumber(inputString[1], &num1) == 1 &&
          isNumber(inputString[2], &num2) == 1) {
        pushDynArr(stack, num1);
        pushDynArr(stack, num2);
        if (strcmp(s, "+") == 0)
          add(stack);
        else if (strcmp(s, "-") == 0)
          subtract(stack);
        else if (strcmp(s, "/") == 0)
          divide(stack);
        else if (strcmp(s, "x") == 0)
          multiply(stack);
        else if (strcmp(s, "^") == 0)
          power(stack);
      } else {
        printf("\e[1;31mYou done goofed!\e[0m");
      }
    } else if (numInputTokens <= 3) {
      if (isNumber(inputString[1], &num1) == 1) {
        pushDynArr(stack, num1);
        if (strcmp(s, "^2") == 0)
          square(stack);
        else if (strcmp(s, "^3") == 0)
          cube(stack);
        else if (strcmp(s, "abs") == 0)
          absolut(stack);
        else if (strcmp(s, "sqrt") == 0)
          squareRoot(stack);
        else if (strcmp(s, "exp") == 0)
          expon(stack);
        else if (strcmp(s, "ln") == 0)
          nattyLog(stack);
        else if (strcmp(s, "log") == 0)
          logBaseTen(stack);
      } else {
        printf("\e[1;31mYou done goofed!\e[0m\n");
      }
    } else {
      count = count + 1;
      if (count = numInputTokens - 1) {
        printf("\e[1;31mYou done goofed! Please try again\e[0m\n");
        exit(1);
      }
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<calculate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    $0x14,%edi
call   1100 <createDynArr@plt>
mov    %rax,-0x40(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    158d <calculate+0x36d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
cmpl   $0x4,-0x4(%rbp)
jl     13c6 <calculate+0x1a6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x28(%rbp),%rsi
call   10d0 <isNumber@plt>
cmp    $0x1,%eax
jne    13b5 <calculate+0x195>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x30(%rbp),%rsi
call   10d0 <isNumber@plt>
cmp    $0x1,%eax
jne    13b5 <calculate+0x195>
mov    -0x40(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
call   1130 <pushDynArr@plt>
mov    -0x40(%rbp),%rdi
movsd  -0x30(%rbp),%xmm0
call   1130 <pushDynArr@plt>
mov    -0x38(%rbp),%rdi
lea    0xd1c(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    1301 <calculate+0xe1>
mov    -0x40(%rbp),%rdi
call   1030 <add@plt>
jmp    13b0 <calculate+0x190>
mov    -0x38(%rbp),%rdi
lea    0xcf6(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    1329 <calculate+0x109>
mov    -0x40(%rbp),%rdi
call   10e0 <subtract@plt>
jmp    13ab <calculate+0x18b>
mov    -0x38(%rbp),%rdi
lea    0xcd0(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    1351 <calculate+0x131>
mov    -0x40(%rbp),%rdi
call   1060 <divide@plt>
jmp    13a6 <calculate+0x186>
mov    -0x38(%rbp),%rdi
lea    0xcaa(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    1379 <calculate+0x159>
mov    -0x40(%rbp),%rdi
call   1050 <multiply@plt>
jmp    13a1 <calculate+0x181>
mov    -0x38(%rbp),%rdi
lea    0xc84(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    139c <calculate+0x17c>
mov    -0x40(%rbp),%rdi
call   1040 <power@plt>
jmp    13a1 <calculate+0x181>
jmp    13a6 <calculate+0x186>
jmp    13ab <calculate+0x18b>
jmp    13b0 <calculate+0x190>
jmp    13c1 <calculate+0x1a1>
lea    0xc4e(%rip),%rdi
call   1080 <printf@plt>
jmp    157a <calculate+0x35a>
cmpl   $0x3,-0x4(%rbp)
jg     153f <calculate+0x31f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x28(%rbp),%rsi
call   10d0 <isNumber@plt>
cmp    $0x1,%eax
jne    152e <calculate+0x30e>
mov    -0x40(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
call   1130 <pushDynArr@plt>
mov    -0x38(%rbp),%rdi
lea    0xc23(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    1420 <calculate+0x200>
mov    -0x40(%rbp),%rdi
call   1070 <square@plt>
jmp    1529 <calculate+0x309>
mov    -0x38(%rbp),%rdi
lea    0xbfe(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    1448 <calculate+0x228>
mov    -0x40(%rbp),%rdi
call   1140 <cube@plt>
jmp    1524 <calculate+0x304>
mov    -0x38(%rbp),%rdi
lea    0xbd9(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    1470 <calculate+0x250>
mov    -0x40(%rbp),%rdi
call   10b0 <absolut@plt>
jmp    151f <calculate+0x2ff>
mov    -0x38(%rbp),%rdi
lea    0xbb5(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    1498 <calculate+0x278>
mov    -0x40(%rbp),%rdi
call   1110 <squareRoot@plt>
jmp    151a <calculate+0x2fa>
mov    -0x38(%rbp),%rdi
lea    0xb92(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    14c0 <calculate+0x2a0>
mov    -0x40(%rbp),%rdi
call   10f0 <expon@plt>
jmp    1515 <calculate+0x2f5>
mov    -0x38(%rbp),%rdi
lea    0xb6e(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    14e8 <calculate+0x2c8>
mov    -0x40(%rbp),%rdi
call   10a0 <nattyLog@plt>
jmp    1510 <calculate+0x2f0>
mov    -0x38(%rbp),%rdi
lea    0xb49(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    150b <calculate+0x2eb>
mov    -0x40(%rbp),%rdi
call   1090 <logBaseTen@plt>
jmp    1510 <calculate+0x2f0>
jmp    1515 <calculate+0x2f5>
jmp    151a <calculate+0x2fa>
jmp    151f <calculate+0x2ff>
jmp    1524 <calculate+0x304>
jmp    1529 <calculate+0x309>
jmp    153a <calculate+0x31a>
lea    0xb0b(%rip),%rdi
call   1080 <printf@plt>
jmp    1575 <calculate+0x355>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
je     1570 <calculate+0x350>
lea    0xafc(%rip),%rdi
call   1080 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
jmp    1575 <calculate+0x355>
jmp    157a <calculate+0x35a>
jmp    157f <calculate+0x35f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1263 <calculate+0x43>
movsd  -0x20(%rbp),%xmm0
add    $0x40,%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,%rbx
mov    %edi,%ebp
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
mov    $0x14,%edi
call   1110 <createDynArr@plt>
cmp    $0x2,%ebp
jl     14c3 <calculate+0x2a3>
mov    %rax,%r14
mov    %ebp,%r13d
mov    $0x1,%r15d
jmp    1289 <calculate+0x69>
cs nopw 0x0(%rax,%rax,1)
lea    0xdad(%rip),%rdi
call   1090 <printf@plt>
add    $0x1,%r15
cmp    %r15,%r13
je     14c3 <calculate+0x2a3>
mov    (%rbx,%r15,8),%r12
mov    0x8(%rbx),%rdi
lea    0x8(%rsp),%rsi
call   10e0 <isNumber@plt>
cmp    $0x4,%ebp
jb     1360 <calculate+0x140>
cmp    $0x1,%eax
jne    1270 <calculate+0x50>
mov    0x10(%rbx),%rdi
lea    0x10(%rsp),%rsi
call   10e0 <isNumber@plt>
cmp    $0x1,%eax
jne    1270 <calculate+0x50>
movsd  0x8(%rsp),%xmm0
mov    %r14,%rdi
call   1130 <pushDynArr@plt>
movsd  0x10(%rsp),%xmm0
mov    %r14,%rdi
call   1130 <pushDynArr@plt>
mov    %r12,%rdi
lea    0xd1e(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     145b <calculate+0x23b>
mov    %r12,%rdi
lea    0xd08(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     1475 <calculate+0x255>
mov    %r12,%rdi
lea    0xcf2(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     148f <calculate+0x26f>
mov    %r12,%rdi
lea    0xcdc(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     14a9 <calculate+0x289>
mov    %r12,%rdi
lea    0xcc6(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
jne    127c <calculate+0x5c>
mov    %r14,%rdi
call   1040 <power@plt>
jmp    127c <calculate+0x5c>
nopl   (%rax)
cmp    $0x1,%eax
jne    1430 <calculate+0x210>
movsd  0x8(%rsp),%xmm0
mov    %r14,%rdi
call   1130 <pushDynArr@plt>
mov    %r12,%rdi
lea    0xc89(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     1441 <calculate+0x221>
mov    %r12,%rdi
lea    0xc74(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     144e <calculate+0x22e>
mov    %r12,%rdi
lea    0xc5f(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     1468 <calculate+0x248>
mov    %r12,%rdi
lea    0xc4b(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     1482 <calculate+0x262>
mov    %r12,%rdi
lea    0xc38(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     149c <calculate+0x27c>
mov    %r12,%rdi
lea    0xc24(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     14b6 <calculate+0x296>
mov    %r12,%rdi
lea    0xc0f(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
jne    127c <calculate+0x5c>
mov    %r14,%rdi
call   10a0 <logBaseTen@plt>
jmp    127c <calculate+0x5c>
nopl   0x0(%rax)
lea    0xbed(%rip),%rdi
call   1060 <puts@plt>
jmp    127c <calculate+0x5c>
mov    %r14,%rdi
call   1080 <square@plt>
jmp    127c <calculate+0x5c>
mov    %r14,%rdi
call   1140 <cube@plt>
jmp    127c <calculate+0x5c>
mov    %r14,%rdi
call   1030 <add@plt>
jmp    127c <calculate+0x5c>
mov    %r14,%rdi
call   10c0 <absolut@plt>
jmp    127c <calculate+0x5c>
mov    %r14,%rdi
call   10f0 <subtract@plt>
jmp    127c <calculate+0x5c>
mov    %r14,%rdi
call   1120 <squareRoot@plt>
jmp    127c <calculate+0x5c>
mov    %r14,%rdi
call   1070 <divide@plt>
jmp    127c <calculate+0x5c>
mov    %r14,%rdi
call   1100 <expon@plt>
jmp    127c <calculate+0x5c>
mov    %r14,%rdi
call   1050 <multiply@plt>
jmp    127c <calculate+0x5c>
mov    %r14,%rdi
call   10b0 <nattyLog@plt>
jmp    127c <calculate+0x5c>
xorps  %xmm0,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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 = [28 x i8] c"\1B[1;31mYou done goofed!\1B[0m\00"
@.str.6 = [3 x i8] c"^2\00"
@.str.7 = [3 x i8] c"^3\00"
@.str.8 = [4 x i8] c"abs\00"
@.str.9 = [5 x i8] c"sqrt\00"
@.str.10 = [4 x i8] c"exp\00"
@.str.11 = [3 x i8] c"ln\00"
@.str.12 = [4 x i8] c"log\00"
@.str.13 = [29 x i8] c"\1B[1;31mYou done goofed!\1B[0m\0A\00"
@.str.14 = [46 x i8] c"\1B[1;31mYou done goofed! Please try again\1B[0m\0A\00"
define double @calculate(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i8*
%11 = alloca %struct.DynArr*
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %6
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
store double 0.000000e+00, double* %9
%12 = call %struct.DynArr* @createDynArr(i32 20)
store %struct.DynArr* %12, %struct.DynArr** %11
store i32 1, i32* %5
br label %13
13: ; preds = %169, %2
%14 = load i32, i32* %5
%15 = load i32, i32* %3
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %172
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** %10
%23 = load i32, i32* %3
%24 = icmp sge i32 %23, 4
br i1 %24, label %25, label %86
25: ; preds = %17
%26 = load i8**, i8*** %4
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @isNumber(i8* %28, double* %8)
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %83
31: ; preds = %25
%32 = load i8**, i8*** %4
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
%35 = call i32 @isNumber(i8* %34, double* %9)
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %83
37: ; preds = %31
%38 = load %struct.DynArr*, %struct.DynArr** %11
%39 = load double, double* %8
%40 = call i32 @pushDynArr(%struct.DynArr* %38, double %39)
%41 = load %struct.DynArr*, %struct.DynArr** %11
%42 = load double, double* %9
%43 = call i32 @pushDynArr(%struct.DynArr* %41, double %42)
%44 = load i8*, i8** %10
%45 = call i64 @strcmp(i8* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %37
%48 = load %struct.DynArr*, %struct.DynArr** %11
%49 = call i32 @add(%struct.DynArr* %48)
br label %82
50: ; preds = %37
%51 = load i8*, i8** %10
%52 = call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %50
%55 = load %struct.DynArr*, %struct.DynArr** %11
%56 = call i32 @subtract(%struct.DynArr* %55)
br label %81
57: ; preds = %50
%58 = load i8*, i8** %10
%59 = call i64 @strcmp(i8* %58, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %57
%62 = load %struct.DynArr*, %struct.DynArr** %11
%63 = call i32 @divide(%struct.DynArr* %62)
br label %80
64: ; preds = %57
%65 = load i8*, i8** %10
%66 = call i64 @strcmp(i8* %65, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %64
%69 = load %struct.DynArr*, %struct.DynArr** %11
%70 = call i32 @multiply(%struct.DynArr* %69)
br label %79
71: ; preds = %64
%72 = load i8*, i8** %10
%73 = call i64 @strcmp(i8* %72, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %71
%76 = load %struct.DynArr*, %struct.DynArr** %11
%77 = call i32 @power(%struct.DynArr* %76)
br label %78
78: ; preds = %75, %71
br label %79
79: ; preds = %78, %68
br label %80
80: ; preds = %79, %61
br label %81
81: ; preds = %80, %54
br label %82
82: ; preds = %81, %47
br label %85
83: ; preds = %31, %25
%84 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0))
br label %85
85: ; preds = %83, %82
br label %168
86: ; preds = %17
%87 = load i32, i32* %3
%88 = icmp sle i32 %87, 3
br i1 %88, label %89, label %157
89: ; preds = %86
%90 = load i8**, i8*** %4
%91 = getelementptr inbounds i8*, i8** %90, i64 1
%92 = load i8*, i8** %91
%93 = call i32 @isNumber(i8* %92, double* %8)
%94 = icmp eq i32 %93, 1
br i1 %94, label %95, label %154
95: ; preds = %89
%96 = load %struct.DynArr*, %struct.DynArr** %11
%97 = load double, double* %8
%98 = call i32 @pushDynArr(%struct.DynArr* %96, double %97)
%99 = load i8*, i8** %10
%100 = call i64 @strcmp(i8* %99, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %105
102: ; preds = %95
%103 = load %struct.DynArr*, %struct.DynArr** %11
%104 = call i32 @square(%struct.DynArr* %103)
br label %153
105: ; preds = %95
%106 = load i8*, i8** %10
%107 = call i64 @strcmp(i8* %106, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%108 = icmp eq i64 %107, 0
br i1 %108, label %109, label %112
109: ; preds = %105
%110 = load %struct.DynArr*, %struct.DynArr** %11
%111 = call i32 @cube(%struct.DynArr* %110)
br label %152
112: ; preds = %105
%113 = load i8*, i8** %10
%114 = call i64 @strcmp(i8* %113, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%115 = icmp eq i64 %114, 0
br i1 %115, label %116, label %119
116: ; preds = %112
%117 = load %struct.DynArr*, %struct.DynArr** %11
%118 = call i32 @absolut(%struct.DynArr* %117)
br label %151
119: ; preds = %112
%120 = load i8*, i8** %10
%121 = call i64 @strcmp(i8* %120, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%122 = icmp eq i64 %121, 0
br i1 %122, label %123, label %126
123: ; preds = %119
%124 = load %struct.DynArr*, %struct.DynArr** %11
%125 = call i32 @squareRoot(%struct.DynArr* %124)
br label %150
126: ; preds = %119
%127 = load i8*, i8** %10
%128 = call i64 @strcmp(i8* %127, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%129 = icmp eq i64 %128, 0
br i1 %129, label %130, label %133
130: ; preds = %126
%131 = load %struct.DynArr*, %struct.DynArr** %11
%132 = call i32 @expon(%struct.DynArr* %131)
br label %149
133: ; preds = %126
%134 = load i8*, i8** %10
%135 = call i64 @strcmp(i8* %134, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%136 = icmp eq i64 %135, 0
br i1 %136, label %137, label %140
137: ; preds = %133
%138 = load %struct.DynArr*, %struct.DynArr** %11
%139 = call i32 @nattyLog(%struct.DynArr* %138)
br label %148
140: ; preds = %133
%141 = load i8*, i8** %10
%142 = call i64 @strcmp(i8* %141, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%143 = icmp eq i64 %142, 0
br i1 %143, label %144, label %147
144: ; preds = %140
%145 = load %struct.DynArr*, %struct.DynArr** %11
%146 = call i32 @logBaseTen(%struct.DynArr* %145)
br label %147
147: ; preds = %144, %140
br label %148
148: ; preds = %147, %137
br label %149
149: ; preds = %148, %130
br label %150
150: ; preds = %149, %123
br label %151
151: ; preds = %150, %116
br label %152
152: ; preds = %151, %109
br label %153
153: ; preds = %152, %102
br label %156
154: ; preds = %89
%155 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.13, i64 0, i64 0))
br label %156
156: ; preds = %154, %153
br label %167
157: ; preds = %86
%158 = load i32, i32* %6
%159 = add nsw i32 %158, 1
store i32 %159, i32* %6
%160 = load i32, i32* %3
%161 = sub nsw i32 %160, 1
store i32 %161, i32* %6
%162 = icmp ne i32 %161, 0
br i1 %162, label %163, label %166
163: ; preds = %157
%164 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.14, i64 0, i64 0))
%165 = call i32 @exit(i32 1)
unreachable
166: ; preds = %157
br label %167
167: ; preds = %166, %156
br label %168
168: ; preds = %167, %85
br label %169
169: ; preds = %168
%170 = load i32, i32* %5
%171 = add nsw i32 %170, 1
store i32 %171, i32* %5
br label %13
172: ; preds = %13
%173 = load double, double* %7
ret double %173
}

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.6 = [3 x i8] c"^2\00"
@.str.7 = [3 x i8] c"^3\00"
@.str.8 = [4 x i8] c"abs\00"
@.str.9 = [5 x i8] c"sqrt\00"
@.str.10 = [4 x i8] c"exp\00"
@.str.11 = [3 x i8] c"ln\00"
@.str.12 = [4 x i8] c"log\00"
@str = [28 x i8] c"\1B[1;31mYou done goofed!\1B[0m\00"
define double @calculate(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = alloca double
%5 = bitcast double* %3 to i8*
store double 0.000000e+00, double* %3
%6 = bitcast double* %4 to i8*
store double 0.000000e+00, double* %4
%7 = tail call %struct.DynArr* @createDynArr(i32 20)
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %100
9: ; preds = %2
%10 = icmp ugt i32 %0, 3
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = zext i32 %0 to i64
br label %14
14: ; preds = %9, %97
%15 = phi i64 [ 1, %9 ], [ %98, %97 ]
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = load i8*, i8** %11
%19 = call i32 @isNumber(i8* %18, double* %3)
%20 = icmp eq i32 %19, 1
br i1 %10, label %21, label %57
21: ; preds = %14
br i1 %20, label %22, label %55
22: ; preds = %21
%23 = load i8*, i8** %12
%24 = call i32 @isNumber(i8* %23, double* %4)
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %55
26: ; preds = %22
%27 = load double, double* %3
%28 = call i32 @pushDynArr(%struct.DynArr* %7, double %27)
%29 = load double, double* %4
%30 = call i32 @pushDynArr(%struct.DynArr* %7, double %29)
%31 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %26
%34 = call i32 @add(%struct.DynArr* %7)
br label %97
35: ; preds = %26
%36 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 @subtract(%struct.DynArr* %7)
br label %97
40: ; preds = %35
%41 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 @divide(%struct.DynArr* %7)
br label %97
45: ; preds = %40
%46 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = call i32 @multiply(%struct.DynArr* %7)
br label %97
50: ; preds = %45
%51 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %97
53: ; preds = %50
%54 = call i32 @power(%struct.DynArr* %7)
br label %97
55: ; preds = %22, %21
%56 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %97
57: ; preds = %14
br i1 %20, label %58, label %95
58: ; preds = %57
%59 = load double, double* %3
%60 = call i32 @pushDynArr(%struct.DynArr* %7, double %59)
%61 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %58
%64 = call i32 @square(%struct.DynArr* %7)
br label %97
65: ; preds = %58
%66 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %65
%69 = call i32 @cube(%struct.DynArr* %7)
br label %97
70: ; preds = %65
%71 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %70
%74 = call i32 @absolut(%struct.DynArr* %7)
br label %97
75: ; preds = %70
%76 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %75
%79 = call i32 @squareRoot(%struct.DynArr* %7)
br label %97
80: ; preds = %75
%81 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %85
83: ; preds = %80
%84 = call i32 @expon(%struct.DynArr* %7)
br label %97
85: ; preds = %80
%86 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%87 = icmp eq i64 %86, 0
br i1 %87, label %88, label %90
88: ; preds = %85
%89 = call i32 @nattyLog(%struct.DynArr* %7)
br label %97
90: ; preds = %85
%91 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%92 = icmp eq i64 %91, 0
br i1 %92, label %93, label %97
93: ; preds = %90
%94 = call i32 @logBaseTen(%struct.DynArr* %7)
br label %97
95: ; preds = %57
%96 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %97
97: ; preds = %33, %43, %50, %53, %48, %38, %55, %95, %68, %78, %88, %93, %90, %83, %73, %63
%98 = add nuw nsw i64 %15, 1
%99 = icmp eq i64 %98, %13
br i1 %99, label %100, label %14
100: ; preds = %97, %2
ret double 0.000000e+00
}