#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 */

/* Variables and functions */
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
double pow(double, double);
void hessian_fd(double (*funcpt)(double *, int), double *x, int N, double *f) {
  int i, j;
  double stepi, stepj, fd;
  double *xi, *xj, *xij;
  fd = pow((double)1e-15, 1.0 / 3.0);
  xi = (double *)malloc(sizeof(double) * N);
  xj = (double *)malloc(sizeof(double) * N);
  xij = (double *)malloc(sizeof(double) * N);
  for (i = 0; i < N; ++i) {
    stepi = fd * x[i];
    for (j = 0; j < N; ++j) {
      xi[j] = x[j];
      xj[j] = x[j];
      xij[j] = x[j];
    }
    xi[i] += stepi;
    xij[i] += stepi;
    for (j = 0; j < N; ++j) {
      stepj = fd * x[j];
      xj[j] += stepj;
      xij[j] += stepj;
      f[i * N + j] =
          ((funcpt(xij, N) - funcpt(xi, N)) - (funcpt(xj, N) - funcpt(x, N))) /
          (stepi * stepj);
      xj[j] -= stepj;
      xij[j] -= stepj;
    }
  }
  free(xi);
  free(xj);
  free(xij);
}


x86 assembly (clang, -O0):
<hessian_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
movsd  0xeb1(%rip),%xmm0
movsd  0xeb1(%rip),%xmm1
call   1050 <pow@plt>
movsd  %xmm0,-0x40(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x48(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x50(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1398 <hessian_fd+0x268>
movsd  -0x40(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1233 <hessian_fd+0x103>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x50(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11cb <hessian_fd+0x9b>
movsd  -0x30(%rbp),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x24(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x30(%rbp),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x24(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1385 <hessian_fd+0x255>
movsd  -0x40(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x50(%rbp),%rax
movslq -0x28(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x28(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x58(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   *%rax
movsd  %xmm0,-0x70(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x48(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   *%rax
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x50(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   *%rax
movsd  %xmm0,-0x68(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   *%rax
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
subsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x14(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm1
mov    -0x50(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm1
mov    -0x58(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1268 <hessian_fd+0x138>
jmp    138a <hessian_fd+0x25a>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a1 <hessian_fd+0x71>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hessian_fd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rcx,0x18(%rsp)
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0x0(,%r15,8),%r14d
mov    %r14d,%edi
call   1040 <malloc@plt>
mov    %rax,%r12
mov    %r14d,%edi
call   1040 <malloc@plt>
mov    %rax,%r13
mov    %r14d,%edi
call   1040 <malloc@plt>
mov    %rbp,%r11
mov    %r13,%r14
mov    0x18(%rsp),%rbp
mov    %rax,%rdx
test   %r15d,%r15d
jle    15ae <hessian_fd+0x48e>
mov    %r15d,%edi
lea    (%r12,%rdi,8),%r9
lea    (%r14,%rdi,8),%rcx
mov    %rcx,0x10(%rsp)
lea    (%rdx,%rdi,8),%r10
lea    (%rbx,%rdi,8),%r13
mov    %edi,%eax
and    $0xfffffffc,%eax
mov    %rax,0x50(%rsp)
lea    -0x4(%rax),%r8
mov    %r8,0x48(%rsp)
shr    $0x2,%r8
add    $0x1,%r8
cmp    %rcx,%r12
setb   %al
cmp    %r9,%r14
setb   %cl
and    %al,%cl
cmp    %r10,%r12
setb   %sil
cmp    %r9,%rdx
setb   %al
and    %sil,%al
or     %cl,%al
mov    %r13,%rsi
cmp    %r13,%r12
setb   %r13b
cmp    %rbx,%r9
seta   %cl
and    %r13b,%cl
or     %al,%cl
cmp    %r10,%r14
mov    %r10,%r9
setb   %r13b
mov    0x10(%rsp),%rax
cmp    %rax,%rdx
setb   %r10b
and    %r13b,%r10b
cmp    %rsi,%r14
mov    %rsi,%r13
setb   %sil
cmp    %rbx,%rax
seta   %al
and    %sil,%al
mov    %rdi,%rsi
or     %r10b,%al
or     %cl,%al
cmp    %r13,%rdx
setb   %dil
cmp    %rbx,%r9
seta   %cl
and    %dil,%cl
or     %al,%cl
mov    %cl,0xf(%rsp)
mov    %r8,%rax
mov    %r8,0x40(%rsp)
and    $0xfffffffffffffffe,%r8
mov    %r8,0x38(%rsp)
mov    %rsi,%rax
neg    %rax
mov    %rax,0x58(%rsp)
lea    0x0(,%rsi,8),%rax
mov    %rax,0x60(%rsp)
xor    %edi,%edi
movsd  0xd9f(%rip),%xmm2
mov    %rbx,0x30(%rsp)
mov    %r12,0x28(%rsp)
mov    %rsi,0x78(%rsp)
mov    %r15,0x20(%rsp)
mov    %r11,0x70(%rsp)
nopw   0x0(%rax,%rax,1)
cmp    $0x4,%r15d
setb   %al
movsd  (%rbx,%rdi,8),%xmm3
mulsd  %xmm2,%xmm3
or     0xf(%rsp),%al
test   $0x1,%al
je     12a0 <hessian_fd+0x180>
xor    %ecx,%ecx
jmp    13a2 <hessian_fd+0x282>
nop
cmpq   $0x0,0x48(%rsp)
je     159c <hessian_fd+0x47c>
mov    0x38(%rsp),%rcx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups (%rbx,%rax,8),%xmm0
movups 0x10(%rbx,%rax,8),%xmm1
movups %xmm0,(%r12,%rax,8)
movups %xmm1,0x10(%r12,%rax,8)
movups (%rbx,%rax,8),%xmm0
movups 0x10(%rbx,%rax,8),%xmm1
movups %xmm0,(%r14,%rax,8)
movups %xmm1,0x10(%r14,%rax,8)
movups (%rbx,%rax,8),%xmm0
movups 0x10(%rbx,%rax,8),%xmm1
movups %xmm0,(%rdx,%rax,8)
movups %xmm1,0x10(%rdx,%rax,8)
movups 0x20(%rbx,%rax,8),%xmm0
movups 0x30(%rbx,%rax,8),%xmm1
movups %xmm0,0x20(%r12,%rax,8)
movups %xmm1,0x30(%r12,%rax,8)
movups 0x20(%rbx,%rax,8),%xmm0
movups 0x30(%rbx,%rax,8),%xmm1
movups %xmm0,0x20(%r14,%rax,8)
movups %xmm1,0x30(%r14,%rax,8)
movupd 0x20(%rbx,%rax,8),%xmm0
movupd 0x30(%rbx,%rax,8),%xmm1
movupd %xmm0,0x20(%rdx,%rax,8)
movupd %xmm1,0x30(%rdx,%rax,8)
add    $0x8,%rax
add    $0xfffffffffffffffe,%rcx
jne    12c0 <hessian_fd+0x1a0>
testb  $0x1,0x40(%rsp)
je     1391 <hessian_fd+0x271>
movups (%rbx,%rax,8),%xmm0
movups 0x10(%rbx,%rax,8),%xmm1
movups %xmm0,(%r12,%rax,8)
movups %xmm1,0x10(%r12,%rax,8)
movups (%rbx,%rax,8),%xmm0
movups 0x10(%rbx,%rax,8),%xmm1
movups %xmm0,(%r14,%rax,8)
movups %xmm1,0x10(%r14,%rax,8)
movupd (%rbx,%rax,8),%xmm0
movupd 0x10(%rbx,%rax,8),%xmm1
movupd %xmm0,(%rdx,%rax,8)
movupd %xmm1,0x10(%rdx,%rax,8)
mov    0x50(%rsp),%rax
mov    %rax,%rcx
cmp    %rsi,%rax
je     142f <hessian_fd+0x30f>
mov    %rcx,%rax
test   $0x1,%sil
je     13d2 <hessian_fd+0x2b2>
movsd  (%rbx,%rcx,8),%xmm0
movsd  %xmm0,(%r12,%rcx,8)
movsd  (%rbx,%rcx,8),%xmm0
movsd  %xmm0,(%r14,%rcx,8)
movsd  (%rbx,%rcx,8),%xmm0
movsd  %xmm0,(%rdx,%rcx,8)
mov    %rcx,%rax
or     $0x1,%rax
not    %rcx
cmp    0x58(%rsp),%rcx
je     142f <hessian_fd+0x30f>
nopl   0x0(%rax)
movsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,(%r12,%rax,8)
movsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,(%r14,%rax,8)
movsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,(%rdx,%rax,8)
movsd  0x8(%rbx,%rax,8),%xmm0
movsd  %xmm0,0x8(%r12,%rax,8)
movsd  0x8(%rbx,%rax,8),%xmm0
movsd  %xmm0,0x8(%r14,%rax,8)
movsd  0x8(%rbx,%rax,8),%xmm0
movsd  %xmm0,0x8(%rdx,%rax,8)
add    $0x2,%rax
cmp    %rax,%rsi
jne    13e0 <hessian_fd+0x2c0>
movsd  (%r12,%rdi,8),%xmm0
addsd  %xmm3,%xmm0
movsd  %xmm0,(%r12,%rdi,8)
movsd  (%rdx,%rdi,8),%xmm0
addsd  %xmm3,%xmm0
mov    %rdi,0x68(%rsp)
movsd  %xmm0,(%rdx,%rdi,8)
xor    %r13d,%r13d
movsd  %xmm3,0x80(%rsp)
mov    %rbp,0x18(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x30(%rsp),%r15
movsd  (%r15,%r13,8),%xmm1
mulsd  %xmm2,%xmm1
movsd  %xmm1,0x90(%rsp)
movsd  (%r14,%r13,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r14,%r13,8)
movsd  (%rdx,%r13,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rdx,%r13,8)
mov    %rdx,%rdi
mov    0x20(%rsp),%rbp
mov    %ebp,%esi
mov    %rdx,%rbx
mov    0x70(%rsp),%r12
call   *%r12
movsd  %xmm0,0x10(%rsp)
mov    0x28(%rsp),%rdi
mov    %ebp,%esi
call   *%r12
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
mov    %r14,%rdi
mov    %ebp,%esi
call   *%r12
movsd  %xmm0,0x88(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
call   *%r12
movsd  0x80(%rsp),%xmm3
movsd  0xaf9(%rip),%xmm2
mov    0x78(%rsp),%rsi
mov    %rbx,%rdx
mov    0x18(%rsp),%rbp
movsd  0x88(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm4
subsd  %xmm1,%xmm4
movapd %xmm3,%xmm0
movsd  0x90(%rsp),%xmm1
mulsd  %xmm1,%xmm0
divsd  %xmm0,%xmm4
movsd  %xmm4,0x0(%rbp,%r13,8)
movsd  (%r14,%r13,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%r14,%r13,8)
movsd  (%rbx,%r13,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx,%r13,8)
add    $0x1,%r13
cmp    %r13,%rsi
jne    1470 <hessian_fd+0x350>
mov    0x68(%rsp),%rdi
add    $0x1,%rdi
add    0x60(%rsp),%rbp
cmp    %rsi,%rdi
mov    0x20(%rsp),%r15
mov    0x28(%rsp),%r12
mov    0x30(%rsp),%rbx
jne    1280 <hessian_fd+0x160>
jmp    15ae <hessian_fd+0x48e>
xor    %eax,%eax
testb  $0x1,0x40(%rsp)
jne    1353 <hessian_fd+0x233>
jmp    1391 <hessian_fd+0x271>
mov    %r12,%rdi
mov    %rdx,%rbp
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @hessian_fd(double (double*, i32)* %0, double* %1, i32 %2, double* %3) {
%5 = alloca double (double*, i32)*
%6 = alloca double*
%7 = alloca i32
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
store double (double*, i32)* %0, double (double*, i32)** %5
store double* %1, double** %6
store i32 %2, i32* %7
store double* %3, double** %8
%17 = call double @pow(double 1.000000e-15, double 0x3FD5555555555555)
store double %17, double* %13
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = mul i64 8, %19
%21 = trunc i64 %20 to i32
%22 = call i64 @malloc(i32 %21)
%23 = inttoptr i64 %22 to double*
store double* %23, double** %14
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = mul i64 8, %25
%27 = trunc i64 %26 to i32
%28 = call i64 @malloc(i32 %27)
%29 = inttoptr i64 %28 to double*
store double* %29, double** %15
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = mul i64 8, %31
%33 = trunc i64 %32 to i32
%34 = call i64 @malloc(i32 %33)
%35 = inttoptr i64 %34 to double*
store double* %35, double** %16
store i32 0, i32* %9
br label %36
36: ; preds = %173, %4
%37 = load i32, i32* %9
%38 = load i32, i32* %7
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %176
40: ; preds = %36
%41 = load double, double* %13
%42 = load double*, double** %6
%43 = load i32, i32* %9
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
%46 = load double, double* %45
%47 = fmul double %41, %46
store double %47, double* %11
store i32 0, i32* %10
br label %48
48: ; preds = %80, %40
%49 = load i32, i32* %10
%50 = load i32, i32* %7
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %83
52: ; preds = %48
%53 = load double*, double** %6
%54 = load i32, i32* %10
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %53, i64 %55
%57 = load double, double* %56
%58 = load double*, double** %14
%59 = load i32, i32* %10
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds double, double* %58, i64 %60
store double %57, double* %61
%62 = load double*, double** %6
%63 = load i32, i32* %10
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double, double* %62, i64 %64
%66 = load double, double* %65
%67 = load double*, double** %15
%68 = load i32, i32* %10
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds double, double* %67, i64 %69
store double %66, double* %70
%71 = load double*, double** %6
%72 = load i32, i32* %10
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %71, i64 %73
%75 = load double, double* %74
%76 = load double*, double** %16
%77 = load i32, i32* %10
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %76, i64 %78
store double %75, double* %79
br label %80
80: ; preds = %52
%81 = load i32, i32* %10
%82 = add nsw i32 %81, 1
store i32 %82, i32* %10
br label %48
83: ; preds = %48
%84 = load double, double* %11
%85 = load double*, double** %14
%86 = load i32, i32* %9
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds double, double* %85, i64 %87
%89 = load double, double* %88
%90 = fadd double %89, %84
store double %90, double* %88
%91 = load double, double* %11
%92 = load double*, double** %16
%93 = load i32, i32* %9
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds double, double* %92, i64 %94
%96 = load double, double* %95
%97 = fadd double %96, %91
store double %97, double* %95
store i32 0, i32* %10
br label %98
98: ; preds = %169, %83
%99 = load i32, i32* %10
%100 = load i32, i32* %7
%101 = icmp slt i32 %99, %100
br i1 %101, label %102, label %172
102: ; preds = %98
%103 = load double, double* %13
%104 = load double*, double** %6
%105 = load i32, i32* %10
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %104, i64 %106
%108 = load double, double* %107
%109 = fmul double %103, %108
store double %109, double* %12
%110 = load double, double* %12
%111 = load double*, double** %15
%112 = load i32, i32* %10
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %111, i64 %113
%115 = load double, double* %114
%116 = fadd double %115, %110
store double %116, double* %114
%117 = load double, double* %12
%118 = load double*, double** %16
%119 = load i32, i32* %10
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds double, double* %118, i64 %120
%122 = load double, double* %121
%123 = fadd double %122, %117
store double %123, double* %121
%124 = load double (double*, i32)*, double (double*, i32)** %5
%125 = load double*, double** %16
%126 = load i32, i32* %7
%127 = call double %124(double* %125, i32 %126)
%128 = load double (double*, i32)*, double (double*, i32)** %5
%129 = load double*, double** %14
%130 = load i32, i32* %7
%131 = call double %128(double* %129, i32 %130)
%132 = fsub double %127, %131
%133 = load double (double*, i32)*, double (double*, i32)** %5
%134 = load double*, double** %15
%135 = load i32, i32* %7
%136 = call double %133(double* %134, i32 %135)
%137 = load double (double*, i32)*, double (double*, i32)** %5
%138 = load double*, double** %6
%139 = load i32, i32* %7
%140 = call double %137(double* %138, i32 %139)
%141 = fsub double %136, %140
%142 = fsub double %132, %141
%143 = load double, double* %11
%144 = load double, double* %12
%145 = fmul double %143, %144
%146 = fdiv double %142, %145
%147 = load double*, double** %8
%148 = load i32, i32* %9
%149 = load i32, i32* %7
%150 = mul nsw i32 %148, %149
%151 = load i32, i32* %10
%152 = add nsw i32 %150, %151
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds double, double* %147, i64 %153
store double %146, double* %154
%155 = load double, double* %12
%156 = load double*, double** %15
%157 = load i32, i32* %10
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds double, double* %156, i64 %158
%160 = load double, double* %159
%161 = fsub double %160, %155
store double %161, double* %159
%162 = load double, double* %12
%163 = load double*, double** %16
%164 = load i32, i32* %10
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds double, double* %163, i64 %165
%167 = load double, double* %166
%168 = fsub double %167, %162
store double %168, double* %166
br label %169
169: ; preds = %102
%170 = load i32, i32* %10
%171 = add nsw i32 %170, 1
store i32 %171, i32* %10
br label %98
172: ; preds = %98
br label %173
173: ; preds = %172
%174 = load i32, i32* %9
%175 = add nsw i32 %174, 1
store i32 %175, i32* %9
br label %36
176: ; preds = %36
%177 = load double*, double** %14
%178 = call i32 @free(double* %177)
%179 = load double*, double** %15
%180 = call i32 @free(double* %179)
%181 = load double*, double** %16
%182 = call i32 @free(double* %181)
ret void
}

LLVM IR (-O2):
define void @hessian_fd(double (double*, i32)* nocapture %0, double* %1, i32 %2, double* nocapture writeonly %3) {
%5 = shl i32 %2, 3
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to double*
%8 = inttoptr i64 %6 to i8*
%9 = tail call i64 @malloc(i32 %5)
%10 = inttoptr i64 %9 to double*
%11 = inttoptr i64 %9 to i8*
%12 = tail call i64 @malloc(i32 %5)
%13 = inttoptr i64 %12 to double*
%14 = inttoptr i64 %12 to i8*
%15 = icmp sgt i32 %2, 0
br i1 %15, label %16, label %233
16: ; preds = %4
%17 = zext i32 %2 to i64
%18 = zext i32 %2 to i64
%19 = getelementptr double, double* %7, i64 %18
%20 = bitcast double* %19 to i8*
%21 = getelementptr double, double* %10, i64 %18
%22 = bitcast double* %21 to i8*
%23 = getelementptr double, double* %13, i64 %18
%24 = bitcast double* %23 to i8*
%25 = getelementptr double, double* %1, i64 %18
%26 = bitcast double* %25 to i8*
%27 = and i64 %18, 4294967292
%28 = add nsw i64 %27, -4
%29 = lshr exact i64 %28, 2
%30 = add nuw nsw i64 %29, 1
%31 = icmp ult i32 %2, 4
%32 = icmp ult i8* %8, %22
%33 = icmp ult i8* %11, %20
%34 = and i1 %32, %33
%35 = icmp ult i8* %8, %24
%36 = icmp ult i8* %14, %20
%37 = and i1 %35, %36
%38 = or i1 %34, %37
%39 = icmp ult i8* %8, %26
%40 = icmp ugt double* %19, %1
%41 = and i1 %39, %40
%42 = or i1 %38, %41
%43 = icmp ult i8* %11, %24
%44 = icmp ult i8* %14, %22
%45 = and i1 %43, %44
%46 = or i1 %42, %45
%47 = icmp ult i8* %11, %26
%48 = icmp ugt double* %21, %1
%49 = and i1 %47, %48
%50 = or i1 %46, %49
%51 = icmp ult i8* %14, %26
%52 = icmp ugt double* %23, %1
%53 = and i1 %51, %52
%54 = or i1 %50, %53
%55 = and i64 %18, 4294967292
%56 = and i64 %30, 1
%57 = icmp eq i64 %28, 0
%58 = and i64 %30, 9223372036854775806
%59 = icmp eq i64 %56, 0
%60 = icmp eq i64 %55, %18
%61 = and i64 %18, 1
%62 = icmp eq i64 %61, 0
%63 = sub nsw i64 0, %18
br label %64
64: ; preds = %230, %16
%65 = phi i64 [ 0, %16 ], [ %231, %230 ]
%66 = getelementptr inbounds double, double* %1, i64 %65
%67 = load double, double* %66
%68 = fmul double %67, 0x3EE4F8B588E368F4
%69 = select i1 %31, i1 true, i1 %54
br i1 %69, label %160, label %70
70: ; preds = %64
br i1 %57, label %130, label %71
71: ; preds = %70, %71
%72 = phi i64 [ %127, %71 ], [ 0, %70 ]
%73 = phi i64 [ %128, %71 ], [ 0, %70 ]
%74 = getelementptr inbounds double, double* %1, i64 %72
%75 = bitcast double* %74 to <2 x double>*
%76 = load <2 x double>, <2 x double>* %75
%77 = getelementptr inbounds double, double* %74, i64 2
%78 = bitcast double* %77 to <2 x double>*
%79 = load <2 x double>, <2 x double>* %78
%80 = getelementptr inbounds double, double* %7, i64 %72
%81 = bitcast double* %80 to <2 x double>*
store <2 x double> %76, <2 x double>* %81
%82 = getelementptr inbounds double, double* %80, i64 2
%83 = bitcast double* %82 to <2 x double>*
store <2 x double> %79, <2 x double>* %83
%84 = bitcast double* %74 to <2 x double>*
%85 = load <2 x double>, <2 x double>* %84
%86 = bitcast double* %77 to <2 x double>*
%87 = load <2 x double>, <2 x double>* %86
%88 = getelementptr inbounds double, double* %10, i64 %72
%89 = bitcast double* %88 to <2 x double>*
store <2 x double> %85, <2 x double>* %89
%90 = getelementptr inbounds double, double* %88, i64 2
%91 = bitcast double* %90 to <2 x double>*
store <2 x double> %87, <2 x double>* %91
%92 = bitcast double* %74 to <2 x double>*
%93 = load <2 x double>, <2 x double>* %92
%94 = bitcast double* %77 to <2 x double>*
%95 = load <2 x double>, <2 x double>* %94
%96 = getelementptr inbounds double, double* %13, i64 %72
%97 = bitcast double* %96 to <2 x double>*
store <2 x double> %93, <2 x double>* %97
%98 = getelementptr inbounds double, double* %96, i64 2
%99 = bitcast double* %98 to <2 x double>*
store <2 x double> %95, <2 x double>* %99
%100 = or i64 %72, 4
%101 = getelementptr inbounds double, double* %1, i64 %100
%102 = bitcast double* %101 to <2 x double>*
%103 = load <2 x double>, <2 x double>* %102
%104 = getelementptr inbounds double, double* %101, i64 2
%105 = bitcast double* %104 to <2 x double>*
%106 = load <2 x double>, <2 x double>* %105
%107 = getelementptr inbounds double, double* %7, i64 %100
%108 = bitcast double* %107 to <2 x double>*
store <2 x double> %103, <2 x double>* %108
%109 = getelementptr inbounds double, double* %107, i64 2
%110 = bitcast double* %109 to <2 x double>*
store <2 x double> %106, <2 x double>* %110
%111 = bitcast double* %101 to <2 x double>*
%112 = load <2 x double>, <2 x double>* %111
%113 = bitcast double* %104 to <2 x double>*
%114 = load <2 x double>, <2 x double>* %113
%115 = getelementptr inbounds double, double* %10, i64 %100
%116 = bitcast double* %115 to <2 x double>*
store <2 x double> %112, <2 x double>* %116
%117 = getelementptr inbounds double, double* %115, i64 2
%118 = bitcast double* %117 to <2 x double>*
store <2 x double> %114, <2 x double>* %118
%119 = bitcast double* %101 to <2 x double>*
%120 = load <2 x double>, <2 x double>* %119
%121 = bitcast double* %104 to <2 x double>*
%122 = load <2 x double>, <2 x double>* %121
%123 = getelementptr inbounds double, double* %13, i64 %100
%124 = bitcast double* %123 to <2 x double>*
store <2 x double> %120, <2 x double>* %124
%125 = getelementptr inbounds double, double* %123, i64 2
%126 = bitcast double* %125 to <2 x double>*
store <2 x double> %122, <2 x double>* %126
%127 = add nuw i64 %72, 8
%128 = add i64 %73, 2
%129 = icmp eq i64 %128, %58
br i1 %129, label %130, label %71
130: ; preds = %71, %70
%131 = phi i64 [ 0, %70 ], [ %127, %71 ]
br i1 %59, label %159, label %132
132: ; preds = %130
%133 = getelementptr inbounds double, double* %1, i64 %131
%134 = bitcast double* %133 to <2 x double>*
%135 = load <2 x double>, <2 x double>* %134
%136 = getelementptr inbounds double, double* %133, i64 2
%137 = bitcast double* %136 to <2 x double>*
%138 = load <2 x double>, <2 x double>* %137
%139 = getelementptr inbounds double, double* %7, i64 %131
%140 = bitcast double* %139 to <2 x double>*
store <2 x double> %135, <2 x double>* %140
%141 = getelementptr inbounds double, double* %139, i64 2
%142 = bitcast double* %141 to <2 x double>*
store <2 x double> %138, <2 x double>* %142
%143 = bitcast double* %133 to <2 x double>*
%144 = load <2 x double>, <2 x double>* %143
%145 = bitcast double* %136 to <2 x double>*
%146 = load <2 x double>, <2 x double>* %145
%147 = getelementptr inbounds double, double* %10, i64 %131
%148 = bitcast double* %147 to <2 x double>*
store <2 x double> %144, <2 x double>* %148
%149 = getelementptr inbounds double, double* %147, i64 2
%150 = bitcast double* %149 to <2 x double>*
store <2 x double> %146, <2 x double>* %150
%151 = bitcast double* %133 to <2 x double>*
%152 = load <2 x double>, <2 x double>* %151
%153 = bitcast double* %136 to <2 x double>*
%154 = load <2 x double>, <2 x double>* %153
%155 = getelementptr inbounds double, double* %13, i64 %131
%156 = bitcast double* %155 to <2 x double>*
store <2 x double> %152, <2 x double>* %156
%157 = getelementptr inbounds double, double* %155, i64 2
%158 = bitcast double* %157 to <2 x double>*
store <2 x double> %154, <2 x double>* %158
br label %159
159: ; preds = %130, %132
br i1 %60, label %194, label %160
160: ; preds = %64, %159
%161 = phi i64 [ 0, %64 ], [ %55, %159 ]
%162 = xor i64 %161, -1
br i1 %62, label %172, label %163
163: ; preds = %160
%164 = getelementptr inbounds double, double* %1, i64 %161
%165 = load double, double* %164
%166 = getelementptr inbounds double, double* %7, i64 %161
store double %165, double* %166
%167 = load double, double* %164
%168 = getelementptr inbounds double, double* %10, i64 %161
store double %167, double* %168
%169 = load double, double* %164
%170 = getelementptr inbounds double, double* %13, i64 %161
store double %169, double* %170
%171 = or i64 %161, 1
br label %172
172: ; preds = %163, %160
%173 = phi i64 [ %161, %160 ], [ %171, %163 ]
%174 = icmp eq i64 %162, %63
br i1 %174, label %194, label %175
175: ; preds = %172, %175
%176 = phi i64 [ %192, %175 ], [ %173, %172 ]
%177 = getelementptr inbounds double, double* %1, i64 %176
%178 = load double, double* %177
%179 = getelementptr inbounds double, double* %7, i64 %176
store double %178, double* %179
%180 = load double, double* %177
%181 = getelementptr inbounds double, double* %10, i64 %176
store double %180, double* %181
%182 = load double, double* %177
%183 = getelementptr inbounds double, double* %13, i64 %176
store double %182, double* %183
%184 = add nuw nsw i64 %176, 1
%185 = getelementptr inbounds double, double* %1, i64 %184
%186 = load double, double* %185
%187 = getelementptr inbounds double, double* %7, i64 %184
store double %186, double* %187
%188 = load double, double* %185
%189 = getelementptr inbounds double, double* %10, i64 %184
store double %188, double* %189
%190 = load double, double* %185
%191 = getelementptr inbounds double, double* %13, i64 %184
store double %190, double* %191
%192 = add nuw nsw i64 %176, 2
%193 = icmp eq i64 %192, %18
br i1 %193, label %194, label %175
194: ; preds = %172, %175, %159
%195 = getelementptr inbounds double, double* %7, i64 %65
%196 = load double, double* %195
%197 = fadd double %68, %196
store double %197, double* %195
%198 = getelementptr inbounds double, double* %13, i64 %65
%199 = load double, double* %198
%200 = fadd double %68, %199
store double %200, double* %198
%201 = mul nsw i64 %65, %17
br label %202
202: ; preds = %194, %202
%203 = phi i64 [ 0, %194 ], [ %228, %202 ]
%204 = getelementptr inbounds double, double* %1, i64 %203
%205 = load double, double* %204
%206 = fmul double %205, 0x3EE4F8B588E368F4
%207 = getelementptr inbounds double, double* %10, i64 %203
%208 = load double, double* %207
%209 = fadd double %208, %206
store double %209, double* %207
%210 = getelementptr inbounds double, double* %13, i64 %203
%211 = load double, double* %210
%212 = fadd double %206, %211
store double %212, double* %210
%213 = tail call double %0(double* %13, i32 %2)
%214 = tail call double %0(double* %7, i32 %2)
%215 = fsub double %213, %214
%216 = tail call double %0(double* %10, i32 %2)
%217 = tail call double %0(double* %1, i32 %2)
%218 = fsub double %216, %217
%219 = fsub double %215, %218
%220 = fmul double %68, %206
%221 = fdiv double %219, %220
%222 = add nuw nsw i64 %203, %201
%223 = getelementptr inbounds double, double* %3, i64 %222
store double %221, double* %223
%224 = load double, double* %207
%225 = fsub double %224, %206
store double %225, double* %207
%226 = load double, double* %210
%227 = fsub double %226, %206
store double %227, double* %210
%228 = add nuw nsw i64 %203, 1
%229 = icmp eq i64 %228, %18
br i1 %229, label %230, label %202
230: ; preds = %202
%231 = add nuw nsw i64 %65, 1
%232 = icmp eq i64 %231, %18
br i1 %232, label %233, label %64
233: ; preds = %230, %4
%234 = tail call i32 @free(double* %7)
%235 = tail call i32 @free(double* %10)
%236 = tail call i32 @free(double* %13)
ret void
}