void test() {
  int num_points = 5;
  int dim_points = 2;
  float **points = malloc(num_points * sizeof(float *));
  for (int i = 0; i < num_points; i++) {
    points[i] = malloc(dim_points * sizeof(float));
  }
  points[0][0] = 1;
  points[0][1] = 2;
  points[1][0] = 2;
  points[1][1] = 7;
  points[2][0] = 4;
  points[2][1] = 7;
  points[3][0] = 6;
  points[3][1] = 9;
  points[4][0] = 10;
  points[4][1] = 11;
  float totalTime = 15;
  float timeStep = .1;
  float **sPath =
      smoothPath(num_points, dim_points, points, totalTime, timeStep);
  for (int i = 1; i < sPath[0][0]; i++) {
    for (int j = 0; j < dim_points; j++) {
    }
  }
  for (int i = 0; i < num_points; i++) {
    free(points[i]);
  }
  free(points);
  for (int i = 0; i < sPath[0][0]; i++) {
    free(sPath[i]);
  }
  free(sPath);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x5,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movslq -0x4(%rbp),%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1194 <test+0x64>
movslq -0x8(%rbp),%rdi
shl    $0x2,%rdi
call   1040 <malloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115e <test+0x2e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movss  0xe81(%rip),%xmm0
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movss  0xe6a(%rip),%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movss  0xe55(%rip),%xmm0
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movss  0xe39(%rip),%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movss  0xe28(%rip),%xmm0
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movss  0xe10(%rip),%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
movss  0xdf7(%rip),%xmm0
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
movss  0xddf(%rip),%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
movss  0xdc6(%rip),%xmm0
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
movss  0xdae(%rip),%xmm0
movss  %xmm0,0x4(%rax)
movss  0xd9d(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xd8c(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mov    $0x2,%al
call   1050 <smoothPath@plt>
cltq
mov    %rax,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
cvtsi2ssl -0x2c(%rbp),%xmm1
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
movss  (%rax),%xmm0
ucomiss %xmm1,%xmm0
jbe    12fb <test+0x1cb>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12e8 <test+0x1b8>
jmp    12da <test+0x1aa>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    12c9 <test+0x199>
jmp    12ed <test+0x1bd>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12a9 <test+0x179>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    132d <test+0x1fd>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1302 <test+0x1d2>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x38(%rbp)
cvtsi2ssl -0x38(%rbp),%xmm1
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
movss  (%rax),%xmm0
ucomiss %xmm1,%xmm0
jbe    1375 <test+0x245>
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    133d <test+0x20d>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    $0x28,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,%r15
mov    %rax,(%r14)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,%r12
mov    %rax,0x8(%r14)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,%r13
mov    %rax,0x10(%r14)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,0x18(%r14)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,0x20(%r14)
movabs $0x400000003f800000,%rcx
mov    %rcx,(%r15)
movabs $0x40e0000040000000,%rcx
mov    %rcx,(%r12)
movabs $0x40e0000040800000,%rcx
mov    %rcx,0x0(%r13)
movabs $0x4110000040c00000,%rcx
mov    %rcx,(%rbx)
movabs $0x4130000041200000,%rcx
mov    %rcx,(%rax)
movsd  0xe1e(%rip),%xmm0
movsd  0xe1e(%rip),%xmm1
mov    $0x5,%edi
mov    $0x2,%esi
mov    %r14,%rdx
mov    $0x2,%al
call   1050 <smoothPath@plt>
movslq %eax,%r15
mov    (%r14),%rdi
call   1030 <free@plt>
mov    0x8(%r14),%rdi
call   1030 <free@plt>
mov    0x10(%r14),%rdi
call   1030 <free@plt>
mov    0x18(%r14),%rdi
call   1030 <free@plt>
mov    0x20(%r14),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    (%r15),%rax
movss  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1270 <test+0x140>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
mov    (%r15),%rax
movss  (%rax),%xmm1
ucomiss %xmm0,%xmm1
ja     1250 <test+0x120>
mov    %r15,%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float**
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca float**
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 5, i32* %1
store i32 2, i32* %2
%12 = load i32, i32* %1
%13 = sext i32 %12 to i64
%14 = mul i64 %13, 8
%15 = call i8* @malloc(i64 %14)
%16 = bitcast i8* %15 to float**
store float** %16, float*** %3
store i32 0, i32* %4
br label %17
17: ; preds = %31, %0
%18 = load i32, i32* %4
%19 = load i32, i32* %1
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %34
21: ; preds = %17
%22 = load i32, i32* %2
%23 = sext i32 %22 to i64
%24 = mul i64 %23, 4
%25 = call i8* @malloc(i64 %24)
%26 = bitcast i8* %25 to float*
%27 = load float**, float*** %3
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds float*, float** %27, i64 %29
store float* %26, float** %30
br label %31
31: ; preds = %21
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %17
34: ; preds = %17
%35 = load float**, float*** %3
%36 = getelementptr inbounds float*, float** %35, i64 0
%37 = load float*, float** %36
%38 = getelementptr inbounds float, float* %37, i64 0
store float 1.000000e+00, float* %38
%39 = load float**, float*** %3
%40 = getelementptr inbounds float*, float** %39, i64 0
%41 = load float*, float** %40
%42 = getelementptr inbounds float, float* %41, i64 1
store float 2.000000e+00, float* %42
%43 = load float**, float*** %3
%44 = getelementptr inbounds float*, float** %43, i64 1
%45 = load float*, float** %44
%46 = getelementptr inbounds float, float* %45, i64 0
store float 2.000000e+00, float* %46
%47 = load float**, float*** %3
%48 = getelementptr inbounds float*, float** %47, i64 1
%49 = load float*, float** %48
%50 = getelementptr inbounds float, float* %49, i64 1
store float 7.000000e+00, float* %50
%51 = load float**, float*** %3
%52 = getelementptr inbounds float*, float** %51, i64 2
%53 = load float*, float** %52
%54 = getelementptr inbounds float, float* %53, i64 0
store float 4.000000e+00, float* %54
%55 = load float**, float*** %3
%56 = getelementptr inbounds float*, float** %55, i64 2
%57 = load float*, float** %56
%58 = getelementptr inbounds float, float* %57, i64 1
store float 7.000000e+00, float* %58
%59 = load float**, float*** %3
%60 = getelementptr inbounds float*, float** %59, i64 3
%61 = load float*, float** %60
%62 = getelementptr inbounds float, float* %61, i64 0
store float 6.000000e+00, float* %62
%63 = load float**, float*** %3
%64 = getelementptr inbounds float*, float** %63, i64 3
%65 = load float*, float** %64
%66 = getelementptr inbounds float, float* %65, i64 1
store float 9.000000e+00, float* %66
%67 = load float**, float*** %3
%68 = getelementptr inbounds float*, float** %67, i64 4
%69 = load float*, float** %68
%70 = getelementptr inbounds float, float* %69, i64 0
store float 1.000000e+01, float* %70
%71 = load float**, float*** %3
%72 = getelementptr inbounds float*, float** %71, i64 4
%73 = load float*, float** %72
%74 = getelementptr inbounds float, float* %73, i64 1
store float 1.100000e+01, float* %74
store float 1.500000e+01, float* %5
store float 0x3FB99999A0000000, float* %6
%75 = load i32, i32* %1
%76 = load i32, i32* %2
%77 = load float**, float*** %3
%78 = load float, float* %5
%79 = fpext float %78 to double
%80 = load float, float* %6
%81 = fpext float %80 to double
%82 = call i32 (i32, i32, float**, double, double, ...) bitcast (i32 (...)* @smoothPath to i32 (i32, i32, float**, double, double, ...)*)(i32 %75, i32 %76, float** %77, double %79, double %81)
%83 = sext i32 %82 to i64
%84 = inttoptr i64 %83 to float**
store float** %84, float*** %7
store i32 1, i32* %8
br label %85
85: ; preds = %104, %34
%86 = load i32, i32* %8
%87 = sitofp i32 %86 to float
%88 = load float**, float*** %7
%89 = getelementptr inbounds float*, float** %88, i64 0
%90 = load float*, float** %89
%91 = getelementptr inbounds float, float* %90, i64 0
%92 = load float, float* %91
%93 = fcmp olt float %87, %92
br i1 %93, label %94, label %107
94: ; preds = %85
store i32 0, i32* %9
br label %95
95: ; preds = %100, %94
%96 = load i32, i32* %9
%97 = load i32, i32* %2
%98 = icmp slt i32 %96, %97
br i1 %98, label %99, label %103
99: ; preds = %95
br label %100
100: ; preds = %99
%101 = load i32, i32* %9
%102 = add nsw i32 %101, 1
store i32 %102, i32* %9
br label %95
103: ; preds = %95
br label %104
104: ; preds = %103
%105 = load i32, i32* %8
%106 = add nsw i32 %105, 1
store i32 %106, i32* %8
br label %85
107: ; preds = %85
store i32 0, i32* %10
br label %108
108: ; preds = %119, %107
%109 = load i32, i32* %10
%110 = load i32, i32* %1
%111 = icmp slt i32 %109, %110
br i1 %111, label %112, label %122
112: ; preds = %108
%113 = load float**, float*** %3
%114 = load i32, i32* %10
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds float*, float** %113, i64 %115
%117 = load float*, float** %116
%118 = bitcast float* %117 to i8*
br label %119
119: ; preds = %112
%120 = load i32, i32* %10
%121 = add nsw i32 %120, 1
store i32 %121, i32* %10
br label %108
122: ; preds = %108
%123 = load float**, float*** %3
%124 = bitcast float** %123 to i8*
store i32 0, i32* %11
br label %125
125: ; preds = %141, %122
%126 = load i32, i32* %11
%127 = sitofp i32 %126 to float
%128 = load float**, float*** %7
%129 = getelementptr inbounds float*, float** %128, i64 0
%130 = load float*, float** %129
%131 = getelementptr inbounds float, float* %130, i64 0
%132 = load float, float* %131
%133 = fcmp olt float %127, %132
br i1 %133, label %134, label %144
134: ; preds = %125
%135 = load float**, float*** %7
%136 = load i32, i32* %11
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds float*, float** %135, i64 %137
%139 = load float*, float** %138
%140 = bitcast float* %139 to i8*
br label %141
141: ; preds = %134
%142 = load i32, i32* %11
%143 = add nsw i32 %142, 1
store i32 %143, i32* %11
br label %125
144: ; preds = %125
%145 = load float**, float*** %7
%146 = bitcast float** %145 to i8*
ret void
}

LLVM IR (-O2):
define void @test() {
%1 = tail call dereferenceable_or_null(40) i8* @malloc(i64 40)
%2 = bitcast i8* %1 to float**
%3 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
%4 = bitcast i8* %1 to i8**
store i8* %3, i8** %4
%5 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
%6 = getelementptr inbounds float*, float** %2, i64 1
%7 = bitcast float** %6 to i8**
store i8* %5, i8** %7
%8 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
%9 = getelementptr inbounds float*, float** %2, i64 2
%10 = bitcast float** %9 to i8**
store i8* %8, i8** %10
%11 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
%12 = getelementptr inbounds float*, float** %2, i64 3
%13 = bitcast float** %12 to i8**
store i8* %11, i8** %13
%14 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
%15 = getelementptr inbounds float*, float** %2, i64 4
%16 = bitcast float** %15 to i8**
store i8* %14, i8** %16
%17 = bitcast i8* %3 to float*
store float 1.000000e+00, float* %17
%18 = getelementptr inbounds float, float* %17, i64 1
store float 2.000000e+00, float* %18
%19 = bitcast i8* %5 to float*
store float 2.000000e+00, float* %19
%20 = getelementptr inbounds float, float* %19, i64 1
store float 7.000000e+00, float* %20
%21 = bitcast i8* %8 to float*
store float 4.000000e+00, float* %21
%22 = getelementptr inbounds float, float* %21, i64 1
store float 7.000000e+00, float* %22
%23 = bitcast i8* %11 to float*
store float 6.000000e+00, float* %23
%24 = getelementptr inbounds float, float* %23, i64 1
store float 9.000000e+00, float* %24
%25 = bitcast i8* %14 to float*
store float 1.000000e+01, float* %25
%26 = getelementptr inbounds float, float* %25, i64 1
store float 1.100000e+01, float* %26
%27 = tail call i32 (i32, i32, float**, double, double, ...) bitcast (i32 (...)* @smoothPath to i32 (i32, i32, float**, double, double, ...)*)(i32 5, i32 2, float** %2, double 1.500000e+01, double 0x3FB99999A0000000)
%28 = sext i32 %27 to i64
%29 = inttoptr i64 %28 to float**
%30 = load i8*, i8** %4
tail call void @free(i8* %30)
%31 = load i8*, i8** %7
tail call void @free(i8* %31)
%32 = load i8*, i8** %10
tail call void @free(i8* %32)
%33 = load i8*, i8** %13
tail call void @free(i8* %33)
%34 = load i8*, i8** %16
tail call void @free(i8* %34)
tail call void @free(i8* %1)
%35 = load float*, float** %29
%36 = load float, float* %35
%37 = fcmp ogt float %36, 0.000000e+00
br i1 %37, label %40, label %38
38: ; preds = %40, %0
%39 = inttoptr i64 %28 to i8*
tail call void @free(i8* %39)
ret void
40: ; preds = %0, %40
%41 = phi i64 [ %45, %40 ], [ 0, %0 ]
%42 = getelementptr inbounds float*, float** %29, i64 %41
%43 = bitcast float** %42 to i8**
%44 = load i8*, i8** %43
tail call void @free(i8* %44)
%45 = add nuw i64 %41, 1
%46 = trunc i64 %45 to i32
%47 = sitofp i32 %46 to float
%48 = load float*, float** %29
%49 = load float, float* %48
%50 = fcmp ogt float %49, %47
br i1 %50, label %40, label %38
}