void printInvalid(struct DynArr *stack, char *op) {
  int size;
  if (isEmptyDynArr(stack) == 0)
    size = sizeDynArr(stack);
  else
    size = 0;
  printf("Invalid calculation string: ");
  for (int i = 0; i < size; i++) {
    printf("%f ", getDynArr(stack, i));
  }
  printf("%s\n", op);
  deleteDynArr(stack);
  exit(1);
}


x86 assembly (clang, -O0):
<printInvalid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1060 <isEmptyDynArr@plt>
cmp    $0x0,%eax
jne    1197 <printInvalid+0x37>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <sizeDynArr@plt>
mov    %eax,-0x14(%rbp)
jmp    119e <printInvalid+0x3e>
movl   $0x0,-0x14(%rbp)
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11eb <printInvalid+0x8b>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    $0x0,%al
call   1070 <getDynArr@plt>
mov    %eax,%esi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b3 <printInvalid+0x53>
mov    -0x10(%rbp),%rsi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <deleteDynArr@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<printInvalid>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r12
xor    %eax,%eax
call   1070 <isEmptyDynArr@plt>
test   %eax,%eax
jne    11d1 <printInvalid+0x61>
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <sizeDynArr@plt>
mov    %eax,%ebp
lea    0xe64(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %ebp,%ebp
jle    11df <printInvalid+0x6f>
lea    0xe6f(%rip),%r15
xor    %ebx,%ebx
mov    %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1080 <getDynArr@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    11b0 <printInvalid+0x40>
jmp    11df <printInvalid+0x6f>
lea    0xe28(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <deleteDynArr@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
%struct.DynArr = type opaque
@.str = [29 x i8] c"Invalid calculation string: \00"
@.str.1 = [4 x i8] c"%f \00"
@.str.2 = [4 x i8] c"%s\0A\00"
define void @printInvalid(%struct.DynArr* %0, i8* %1) {
%3 = alloca %struct.DynArr*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store %struct.DynArr* %0, %struct.DynArr** %3
store i8* %1, i8** %4
%7 = load %struct.DynArr*, %struct.DynArr** %3
%8 = call i32 (%struct.DynArr*, ...) bitcast (i32 (...)* @isEmptyDynArr to i32 (%struct.DynArr*, ...)*)(%struct.DynArr* %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load %struct.DynArr*, %struct.DynArr** %3
%12 = call i32 (%struct.DynArr*, ...) bitcast (i32 (...)* @sizeDynArr to i32 (%struct.DynArr*, ...)*)(%struct.DynArr* %11)
store i32 %12, i32* %5
br label %14
13: ; preds = %2
store i32 0, i32* %5
br label %14
14: ; preds = %13, %10
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %16
16: ; preds = %25, %14
%17 = load i32, i32* %6
%18 = load i32, i32* %5
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %28
20: ; preds = %16
%21 = load %struct.DynArr*, %struct.DynArr** %3
%22 = load i32, i32* %6
%23 = call i32 (%struct.DynArr*, i32, ...) bitcast (i32 (...)* @getDynArr to i32 (%struct.DynArr*, i32, ...)*)(%struct.DynArr* %21, i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %20
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %16
28: ; preds = %16
%29 = load i8*, i8** %4
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%31 = load %struct.DynArr*, %struct.DynArr** %3
%32 = call i32 (%struct.DynArr*, ...) bitcast (i32 (...)* @deleteDynArr to i32 (%struct.DynArr*, ...)*)(%struct.DynArr* %31)
unreachable
}

LLVM IR (-O2):
%struct.DynArr = type opaque
@.str = [29 x i8] c"Invalid calculation string: \00"
@.str.1 = [4 x i8] c"%f \00"
define void @printInvalid(%struct.DynArr* %0, i8* nocapture %1) {
%3 = tail call i32 (%struct.DynArr*, ...) bitcast (i32 (...)* @isEmptyDynArr to i32 (%struct.DynArr*, ...)*)(%struct.DynArr* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %11
7: ; preds = %2
%8 = tail call i32 (%struct.DynArr*, ...) bitcast (i32 (...)* @sizeDynArr to i32 (%struct.DynArr*, ...)*)(%struct.DynArr* %0)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%10 = icmp sgt i32 %8, 0
br i1 %10, label %14, label %11
11: ; preds = %14, %5, %7
%12 = tail call i32 @puts(i8* dereferenceable(1) %1)
%13 = tail call i32 (%struct.DynArr*, ...) bitcast (i32 (...)* @deleteDynArr to i32 (%struct.DynArr*, ...)*)(%struct.DynArr* %0)
tail call void @exit(i32 1)
unreachable
14: ; preds = %7, %14
%15 = phi i32 [ %18, %14 ], [ 0, %7 ]
%16 = tail call i32 (%struct.DynArr*, i32, ...) bitcast (i32 (...)* @getDynArr to i32 (%struct.DynArr*, i32, ...)*)(%struct.DynArr* %0, i32 %15)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = add nuw nsw i32 %15, 1
%19 = icmp eq i32 %18, %8
br i1 %19, label %11, label %14
}