#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 */
double *calloc(int, int);
int /*<<< orphan*/ cmco_h2b(int const, double *, double const **,
                            double const **, double **, double **);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
double sqrt(double);
int /*<<< orphan*/ stderr;
double *cmxx_jac(double jcen[3], const int nbod, const int nbig, double *m,
                 const double **restrict xh, const double **restrict vh) {
  int itmp[8] = {0};
  double x[2000][3];
  double v[2000][3];
  double *x_ptr[3];
  for (int i = 0; i < 3; i++) {
    x_ptr[i] = x[i];
  }
  double *v_ptr[3];
  for (int i = 0; i < 3; i++) {
    v_ptr[i] = v[i];
  }
  double temp = 0.0, dx = 0.0, dy = 0.0, dz = 0.0;
  double r = 0.0, d = 0.0, a2 = 0.0, n = 0.0;
  double tmp2[2000][4];
  double *jac = calloc(2000, sizeof(double));
  if (jac == NULL) {
    fputs("cmxx_jac: Unable to allocate jac array\n", stderr);
    return NULL;
  }
  cmco_h2b(nbod, m, xh, vh, x_ptr, v_ptr);
  dx = x[1][0] - x[0][0];
  dy = x[1][1] - x[0][1];
  dz = x[1][2] - x[0][2];
  a2 = dx * dx + dy * dy + dz * dz;
  n = sqrt((m[0] + m[1]) / (a2 * sqrt(a2)));
  for (int j = nbig; j <= nbod; j++) {
    dx = x[j][0] - x[0][0];
    dy = x[j][1] - x[0][1];
    dz = x[j][2] - x[0][2];
    r = sqrt(dx * dx + dy * dy + dz * dz);
    dx = x[j][0] - x[2][1];
    dy = x[j][1] - x[1][1];
    dz = x[j][2] - x[1][2];
    d = sqrt(dx * dx + dy * dy + dz * dz);
    jac[j] = .50 * (v[j][0] * v[j][0] + v[j][1] * v[j][1] + v[j][2] * v[j][2]) -
             m[0] / r - m[1] / d - n * (x[j][0] * v[j][1] - x[j][1] * v[j][0]);
  }
  return jac;
}


x86 assembly (clang, -O0):
<cmxx_jac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x27200,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
movl   $0x0,-0x17774(%rbp)
cmpl   $0x3,-0x17774(%rbp)
jge    11d0 <cmxx_jac+0x80>
movslq -0x17774(%rbp),%rax
lea    -0xbbd0(%rbp),%rcx
imul   $0x18,%rax,%rax
add    %rax,%rcx
movslq -0x17774(%rbp),%rax
mov    %rcx,-0x17770(%rbp,%rax,8)
ff
mov    -0x17774(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x17774(%rbp)
jmp    118b <cmxx_jac+0x3b>
movl   $0x0,-0x17794(%rbp)
cmpl   $0x3,-0x17794(%rbp)
jge    121f <cmxx_jac+0xcf>
movslq -0x17794(%rbp),%rax
lea    -0x17750(%rbp),%rcx
imul   $0x18,%rax,%rax
add    %rax,%rcx
movslq -0x17794(%rbp),%rax
mov    %rcx,-0x17790(%rbp,%rax,8)
ff
mov    -0x17794(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x17794(%rbp)
jmp    11da <cmxx_jac+0x8a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x177a0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x177a8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x177b0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x177b8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x177c0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x177c8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x177d0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x177d8(%rbp)
ff
mov    $0x7d0,%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x271e8(%rbp)
cmpq   $0x0,-0x271e8(%rbp)
jne    12bd <cmxx_jac+0x16d>
mov    0x2d3e(%rip),%rax
mov    (%rax),%esi
lea    0xd5d(%rip),%rdi
call   1030 <fputs@plt>
movq   $0x0,-0x8(%rbp)
jmp    174d <cmxx_jac+0x5fd>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
lea    -0x17770(%rbp),%r8
lea    -0x17790(%rbp),%r9
call   1060 <cmco_h2b@plt>
movsd  -0xbbb8(%rbp),%xmm0
ff
subsd  -0xbbd0(%rbp),%xmm0
ff
movsd  %xmm0,-0x177a8(%rbp)
ff
movsd  -0xbbb0(%rbp),%xmm0
ff
subsd  -0xbbc8(%rbp),%xmm0
ff
movsd  %xmm0,-0x177b0(%rbp)
ff
movsd  -0xbba8(%rbp),%xmm0
ff
subsd  -0xbbc0(%rbp),%xmm0
ff
movsd  %xmm0,-0x177b8(%rbp)
ff
movsd  -0x177a8(%rbp),%xmm1
ff
movsd  -0x177a8(%rbp),%xmm2
ff
movsd  -0x177b0(%rbp),%xmm0
ff
mulsd  -0x177b0(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x177b8(%rbp),%xmm0
ff
movsd  -0x177b8(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x177d0(%rbp)
ff
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
addsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x271f8(%rbp)
ff
movsd  -0x177d0(%rbp),%xmm0
ff
movsd  %xmm0,-0x27200(%rbp)
ff
movsd  -0x177d0(%rbp),%xmm0
ff
call   1070 <sqrt@plt>
movsd  -0x27200(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x271f8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x177d8(%rbp)
ff
mov    -0x18(%rbp),%eax
mov    %eax,-0x271ec(%rbp)
mov    -0x271ec(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1742 <cmxx_jac+0x5f2>
movslq -0x271ec(%rbp),%rcx
lea    -0xbbd0(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
subsd  -0xbbd0(%rbp),%xmm0
ff
movsd  %xmm0,-0x177a8(%rbp)
ff
movslq -0x271ec(%rbp),%rcx
lea    -0xbbd0(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
subsd  -0xbbc8(%rbp),%xmm0
ff
movsd  %xmm0,-0x177b0(%rbp)
ff
movslq -0x271ec(%rbp),%rcx
lea    -0xbbd0(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm0
subsd  -0xbbc0(%rbp),%xmm0
ff
movsd  %xmm0,-0x177b8(%rbp)
ff
movsd  -0x177a8(%rbp),%xmm1
ff
movsd  -0x177a8(%rbp),%xmm2
ff
movsd  -0x177b0(%rbp),%xmm0
ff
mulsd  -0x177b0(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x177b8(%rbp),%xmm0
ff
movsd  -0x177b8(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x177c0(%rbp)
ff
movslq -0x271ec(%rbp),%rcx
lea    -0xbbd0(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
subsd  -0xbb98(%rbp),%xmm0
ff
movsd  %xmm0,-0x177a8(%rbp)
ff
movslq -0x271ec(%rbp),%rcx
lea    -0xbbd0(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
subsd  -0xbbb0(%rbp),%xmm0
ff
movsd  %xmm0,-0x177b0(%rbp)
ff
movslq -0x271ec(%rbp),%rcx
lea    -0xbbd0(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm0
subsd  -0xbba8(%rbp),%xmm0
ff
movsd  %xmm0,-0x177b8(%rbp)
ff
movsd  -0x177a8(%rbp),%xmm1
ff
movsd  -0x177a8(%rbp),%xmm2
ff
movsd  -0x177b0(%rbp),%xmm0
ff
mulsd  -0x177b0(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x177b8(%rbp),%xmm0
ff
movsd  -0x177b8(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x177c8(%rbp)
ff
movslq -0x271ec(%rbp),%rcx
lea    -0x17750(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
movslq -0x271ec(%rbp),%rcx
lea    -0x17750(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm2
movslq -0x271ec(%rbp),%rcx
lea    -0x17750(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm1
movslq -0x271ec(%rbp),%rcx
lea    -0x17750(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x271ec(%rbp),%rcx
lea    -0x17750(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm1
movslq -0x271ec(%rbp),%rcx
lea    -0x17750(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x177c0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0x9ae(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
divsd  -0x177c8(%rbp),%xmm0
ff
subsd  %xmm0,%xmm1
movsd  -0x177d8(%rbp),%xmm0
ff
movslq -0x271ec(%rbp),%rcx
lea    -0xbbd0(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm2
movslq -0x271ec(%rbp),%rcx
lea    -0x17750(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm4
movslq -0x271ec(%rbp),%rcx
lea    -0xbbd0(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm3
movslq -0x271ec(%rbp),%rcx
lea    -0x17750(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mulsd  (%rax),%xmm3
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x271e8(%rbp),%rax
movslq -0x271ec(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x271ec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x271ec(%rbp)
jmp    13d6 <cmxx_jac+0x286>
mov    -0x271e8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x27200,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmxx_jac>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x17778,%rsp
mov    %r9,%r13
mov    %r8,%rbp
mov    %rcx,%r15
mov    %edx,%r12d
mov    %esi,%r14d
lea    0x70(%rsp),%rax
mov    %rax,0x50(%rsp)
lea    0x88(%rsp),%rax
mov    %rax,0x58(%rsp)
lea    0xa0(%rsp),%rax
mov    %rax,0x60(%rsp)
lea    0xbbf0(%rsp),%rax
mov    %rax,0x30(%rsp)
lea    0xbc08(%rsp),%rax
mov    %rax,0x38(%rsp)
lea    0xbc20(%rsp),%rax
mov    %rax,0x40(%rsp)
mov    $0x7d0,%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,0x28(%rsp)
test   %rax,%rax
je     1241 <cmxx_jac+0x101>
lea    0x50(%rsp),%r8
lea    0x30(%rsp),%r9
mov    %r14d,%edi
mov    %r15,%rsi
mov    %rbp,%rdx
mov    %r13,%rcx
call   1050 <cmco_h2b@plt>
movsd  0x88(%rsp),%xmm0
movsd  0x90(%rsp),%xmm1
subsd  0x70(%rsp),%xmm0
subsd  0x78(%rsp),%xmm1
movsd  0x98(%rsp),%xmm2
subsd  0x80(%rsp),%xmm2
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm2
movsd  (%r15),%xmm1
addsd  0x8(%r15),%xmm1
addsd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm2
jb     1258 <cmxx_jac+0x118>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    127d <cmxx_jac+0x13d>
mov    0x2d98(%rip),%rax
mov    (%rax),%esi
lea    0xdc7(%rip),%rdi
call   1030 <fputs@plt>
jmp    12a8 <cmxx_jac+0x168>
movapd %xmm2,%xmm0
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
call   1060 <sqrt@plt>
xorpd  %xmm3,%xmm3
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
mulsd  %xmm0,%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm3,%xmm1
jb     1294 <cmxx_jac+0x154>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    129d <cmxx_jac+0x15d>
movapd %xmm1,%xmm0
call   1060 <sqrt@plt>
movapd %xmm0,0x10(%rsp)
cmp    %r14d,%r12d
jle    12bf <cmxx_jac+0x17f>
mov    0x28(%rsp),%rax
add    $0x17778,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movapd 0x10(%rsp),%xmm0
xorpd  0xd33(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
movslq %r12d,%rax
mov    0x28(%rsp),%rcx
lea    (%rcx,%rax,8),%r13
shl    $0x3,%rax
lea    (%rax,%rax,2),%rbp
sub    %r12d,%r14d
add    $0x1,%r14d
xor    %ebx,%ebx
xorpd  %xmm6,%xmm6
jmp    13a1 <cmxx_jac+0x261>
nopl   0x0(%rax)
movsd  %xmm5,0x8(%rsp)
call   1060 <sqrt@plt>
movsd  0x8(%rsp),%xmm5
xorpd  %xmm6,%xmm6
movsd  0xbbf0(%rsp,%rbp,1),%xmm2
movsd  0xbbf8(%rsp,%rbp,1),%xmm1
movapd %xmm1,%xmm3
mulsd  %xmm1,%xmm3
movapd %xmm2,%xmm4
mulsd  %xmm2,%xmm4
addsd  %xmm3,%xmm4
movsd  0xbc00(%rsp,%rbp,1),%xmm3
mulsd  %xmm3,%xmm3
addsd  %xmm4,%xmm3
movsd  (%r15),%xmm4
divsd  %xmm5,%xmm4
movsd  0x8(%r15),%xmm5
divsd  %xmm0,%xmm5
mulsd  0xca9(%rip),%xmm3
subsd  %xmm4,%xmm3
mulsd  0x78(%rsp,%rbp,1),%xmm2
mulsd  0x70(%rsp,%rbp,1),%xmm1
subsd  %xmm5,%xmm3
subsd  %xmm2,%xmm1
mulsd  0x10(%rsp),%xmm1
addsd  %xmm3,%xmm1
movsd  %xmm1,0x0(%r13,%rbx,8)
add    $0x1,%rbx
add    $0x18,%rbp
cmp    %ebx,%r14d
je     12a8 <cmxx_jac+0x168>
movsd  0x70(%rsp,%rbp,1),%xmm1
movsd  0x78(%rsp,%rbp,1),%xmm2
subsd  0x70(%rsp),%xmm1
subsd  0x78(%rsp),%xmm2
movsd  0x80(%rsp,%rbp,1),%xmm0
subsd  0x80(%rsp),%xmm0
mulsd  %xmm2,%xmm2
mulsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm6,%xmm0
jb     13f0 <cmxx_jac+0x2b0>
xorps  %xmm5,%xmm5
sqrtsd %xmm0,%xmm5
jmp    13fd <cmxx_jac+0x2bd>
xchg   %ax,%ax
call   1060 <sqrt@plt>
xorpd  %xmm6,%xmm6
movapd %xmm0,%xmm5
movsd  0x70(%rsp,%rbp,1),%xmm1
movsd  0x78(%rsp,%rbp,1),%xmm2
subsd  0xa8(%rsp),%xmm1
subsd  0x90(%rsp),%xmm2
movsd  0x80(%rsp,%rbp,1),%xmm0
subsd  0x98(%rsp),%xmm0
mulsd  %xmm2,%xmm2
mulsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm6,%xmm0
jb     1300 <cmxx_jac+0x1c0>
sqrtsd %xmm0,%xmm0
jmp    1315 <cmxx_jac+0x1d5>

LLVM IR (-O0):
@.str = [40 x i8] c"cmxx_jac: Unable to allocate jac array\0A\00"
@stderr = global i32 0
define double* @cmxx_jac(double* %0, i32 %1, i32 %2, double* %3, double** noalias %4, double** noalias %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
%11 = alloca double*
%12 = alloca double**
%13 = alloca double**
%14 = alloca [8 x i32]
%15 = alloca [2000 x [3 x double]]
%16 = alloca [2000 x [3 x double]]
%17 = alloca [3 x double*]
%18 = alloca i32
%19 = alloca [3 x double*]
%20 = alloca i32
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca [2000 x [4 x double]]
%30 = alloca double*
%31 = alloca i32
store double* %0, double** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store double* %3, double** %11
store double** %4, double*** %12
store double** %5, double*** %13
%32 = bitcast [8 x i32]* %14 to i8*
store i32 0, i32* %18
br label %33
33: ; preds = %44, %6
%34 = load i32, i32* %18
%35 = icmp slt i32 %34, 3
br i1 %35, label %36, label %47
36: ; preds = %33
%37 = load i32, i32* %18
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 %38
%40 = getelementptr inbounds [3 x double], [3 x double]* %39, i64 0, i64 0
%41 = load i32, i32* %18
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [3 x double*], [3 x double*]* %17, i64 0, i64 %42
store double* %40, double** %43
br label %44
44: ; preds = %36
%45 = load i32, i32* %18
%46 = add nsw i32 %45, 1
store i32 %46, i32* %18
br label %33
47: ; preds = %33
store i32 0, i32* %20
br label %48
48: ; preds = %59, %47
%49 = load i32, i32* %20
%50 = icmp slt i32 %49, 3
br i1 %50, label %51, label %62
51: ; preds = %48
%52 = load i32, i32* %20
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %16, i64 0, i64 %53
%55 = getelementptr inbounds [3 x double], [3 x double]* %54, i64 0, i64 0
%56 = load i32, i32* %20
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [3 x double*], [3 x double*]* %19, i64 0, i64 %57
store double* %55, double** %58
br label %59
59: ; preds = %51
%60 = load i32, i32* %20
%61 = add nsw i32 %60, 1
store i32 %61, i32* %20
br label %48
62: ; preds = %48
store double 0.000000e+00, double* %21
store double 0.000000e+00, double* %22
store double 0.000000e+00, double* %23
store double 0.000000e+00, double* %24
store double 0.000000e+00, double* %25
store double 0.000000e+00, double* %26
store double 0.000000e+00, double* %27
store double 0.000000e+00, double* %28
%63 = call double* @calloc(i32 2000, i32 8)
store double* %63, double** %30
%64 = load double*, double** %30
%65 = icmp eq double* %64, null
br i1 %65, label %66, label %69
66: ; preds = %62
%67 = load i32, i32* @stderr
%68 = call i32 @fputs(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %67)
store double* null, double** %7
br label %281
69: ; preds = %62
%70 = load i32, i32* %9
%71 = load double*, double** %11
%72 = load double**, double*** %12
%73 = load double**, double*** %13
%74 = getelementptr inbounds [3 x double*], [3 x double*]* %17, i64 0, i64 0
%75 = getelementptr inbounds [3 x double*], [3 x double*]* %19, i64 0, i64 0
%76 = call i32 @cmco_h2b(i32 %70, double* %71, double** %72, double** %73, double** %74, double** %75)
%77 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 1
%78 = getelementptr inbounds [3 x double], [3 x double]* %77, i64 0, i64 0
%79 = load double, double* %78
%80 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 0
%81 = getelementptr inbounds [3 x double], [3 x double]* %80, i64 0, i64 0
%82 = load double, double* %81
%83 = fsub double %79, %82
store double %83, double* %22
%84 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 1
%85 = getelementptr inbounds [3 x double], [3 x double]* %84, i64 0, i64 1
%86 = load double, double* %85
%87 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 0
%88 = getelementptr inbounds [3 x double], [3 x double]* %87, i64 0, i64 1
%89 = load double, double* %88
%90 = fsub double %86, %89
store double %90, double* %23
%91 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 1
%92 = getelementptr inbounds [3 x double], [3 x double]* %91, i64 0, i64 2
%93 = load double, double* %92
%94 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 0
%95 = getelementptr inbounds [3 x double], [3 x double]* %94, i64 0, i64 2
%96 = load double, double* %95
%97 = fsub double %93, %96
store double %97, double* %24
%98 = load double, double* %22
%99 = load double, double* %22
%100 = load double, double* %23
%101 = load double, double* %23
%102 = fmul double %100, %101
%103 = call double @llvm.fmuladd.f64(double %98, double %99, double %102)
%104 = load double, double* %24
%105 = load double, double* %24
%106 = call double @llvm.fmuladd.f64(double %104, double %105, double %103)
store double %106, double* %27
%107 = load double*, double** %11
%108 = getelementptr inbounds double, double* %107, i64 0
%109 = load double, double* %108
%110 = load double*, double** %11
%111 = getelementptr inbounds double, double* %110, i64 1
%112 = load double, double* %111
%113 = fadd double %109, %112
%114 = load double, double* %27
%115 = load double, double* %27
%116 = call double @sqrt(double %115)
%117 = fmul double %114, %116
%118 = fdiv double %113, %117
%119 = call double @sqrt(double %118)
store double %119, double* %28
%120 = load i32, i32* %10
store i32 %120, i32* %31
br label %121
121: ; preds = %276, %69
%122 = load i32, i32* %31
%123 = load i32, i32* %9
%124 = icmp sle i32 %122, %123
br i1 %124, label %125, label %279
125: ; preds = %121
%126 = load i32, i32* %31
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 %127
%129 = getelementptr inbounds [3 x double], [3 x double]* %128, i64 0, i64 0
%130 = load double, double* %129
%131 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 0
%132 = getelementptr inbounds [3 x double], [3 x double]* %131, i64 0, i64 0
%133 = load double, double* %132
%134 = fsub double %130, %133
store double %134, double* %22
%135 = load i32, i32* %31
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 %136
%138 = getelementptr inbounds [3 x double], [3 x double]* %137, i64 0, i64 1
%139 = load double, double* %138
%140 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 0
%141 = getelementptr inbounds [3 x double], [3 x double]* %140, i64 0, i64 1
%142 = load double, double* %141
%143 = fsub double %139, %142
store double %143, double* %23
%144 = load i32, i32* %31
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 %145
%147 = getelementptr inbounds [3 x double], [3 x double]* %146, i64 0, i64 2
%148 = load double, double* %147
%149 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 0
%150 = getelementptr inbounds [3 x double], [3 x double]* %149, i64 0, i64 2
%151 = load double, double* %150
%152 = fsub double %148, %151
store double %152, double* %24
%153 = load double, double* %22
%154 = load double, double* %22
%155 = load double, double* %23
%156 = load double, double* %23
%157 = fmul double %155, %156
%158 = call double @llvm.fmuladd.f64(double %153, double %154, double %157)
%159 = load double, double* %24
%160 = load double, double* %24
%161 = call double @llvm.fmuladd.f64(double %159, double %160, double %158)
%162 = call double @sqrt(double %161)
store double %162, double* %25
%163 = load i32, i32* %31
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 %164
%166 = getelementptr inbounds [3 x double], [3 x double]* %165, i64 0, i64 0
%167 = load double, double* %166
%168 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 2
%169 = getelementptr inbounds [3 x double], [3 x double]* %168, i64 0, i64 1
%170 = load double, double* %169
%171 = fsub double %167, %170
store double %171, double* %22
%172 = load i32, i32* %31
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 %173
%175 = getelementptr inbounds [3 x double], [3 x double]* %174, i64 0, i64 1
%176 = load double, double* %175
%177 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 1
%178 = getelementptr inbounds [3 x double], [3 x double]* %177, i64 0, i64 1
%179 = load double, double* %178
%180 = fsub double %176, %179
store double %180, double* %23
%181 = load i32, i32* %31
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 %182
%184 = getelementptr inbounds [3 x double], [3 x double]* %183, i64 0, i64 2
%185 = load double, double* %184
%186 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 1
%187 = getelementptr inbounds [3 x double], [3 x double]* %186, i64 0, i64 2
%188 = load double, double* %187
%189 = fsub double %185, %188
store double %189, double* %24
%190 = load double, double* %22
%191 = load double, double* %22
%192 = load double, double* %23
%193 = load double, double* %23
%194 = fmul double %192, %193
%195 = call double @llvm.fmuladd.f64(double %190, double %191, double %194)
%196 = load double, double* %24
%197 = load double, double* %24
%198 = call double @llvm.fmuladd.f64(double %196, double %197, double %195)
%199 = call double @sqrt(double %198)
store double %199, double* %26
%200 = load i32, i32* %31
%201 = sext i32 %200 to i64
%202 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %16, i64 0, i64 %201
%203 = getelementptr inbounds [3 x double], [3 x double]* %202, i64 0, i64 0
%204 = load double, double* %203
%205 = load i32, i32* %31
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %16, i64 0, i64 %206
%208 = getelementptr inbounds [3 x double], [3 x double]* %207, i64 0, i64 0
%209 = load double, double* %208
%210 = load i32, i32* %31
%211 = sext i32 %210 to i64
%212 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %16, i64 0, i64 %211
%213 = getelementptr inbounds [3 x double], [3 x double]* %212, i64 0, i64 1
%214 = load double, double* %213
%215 = load i32, i32* %31
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %16, i64 0, i64 %216
%218 = getelementptr inbounds [3 x double], [3 x double]* %217, i64 0, i64 1
%219 = load double, double* %218
%220 = fmul double %214, %219
%221 = call double @llvm.fmuladd.f64(double %204, double %209, double %220)
%222 = load i32, i32* %31
%223 = sext i32 %222 to i64
%224 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %16, i64 0, i64 %223
%225 = getelementptr inbounds [3 x double], [3 x double]* %224, i64 0, i64 2
%226 = load double, double* %225
%227 = load i32, i32* %31
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %16, i64 0, i64 %228
%230 = getelementptr inbounds [3 x double], [3 x double]* %229, i64 0, i64 2
%231 = load double, double* %230
%232 = call double @llvm.fmuladd.f64(double %226, double %231, double %221)
%233 = load double*, double** %11
%234 = getelementptr inbounds double, double* %233, i64 0
%235 = load double, double* %234
%236 = load double, double* %25
%237 = fdiv double %235, %236
%238 = fneg double %237
%239 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %232, double %238)
%240 = load double*, double** %11
%241 = getelementptr inbounds double, double* %240, i64 1
%242 = load double, double* %241
%243 = load double, double* %26
%244 = fdiv double %242, %243
%245 = fsub double %239, %244
%246 = load double, double* %28
%247 = load i32, i32* %31
%248 = sext i32 %247 to i64
%249 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 %248
%250 = getelementptr inbounds [3 x double], [3 x double]* %249, i64 0, i64 0
%251 = load double, double* %250
%252 = load i32, i32* %31
%253 = sext i32 %252 to i64
%254 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %16, i64 0, i64 %253
%255 = getelementptr inbounds [3 x double], [3 x double]* %254, i64 0, i64 1
%256 = load double, double* %255
%257 = load i32, i32* %31
%258 = sext i32 %257 to i64
%259 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %15, i64 0, i64 %258
%260 = getelementptr inbounds [3 x double], [3 x double]* %259, i64 0, i64 1
%261 = load double, double* %260
%262 = load i32, i32* %31
%263 = sext i32 %262 to i64
%264 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %16, i64 0, i64 %263
%265 = getelementptr inbounds [3 x double], [3 x double]* %264, i64 0, i64 0
%266 = load double, double* %265
%267 = fmul double %261, %266
%268 = fneg double %267
%269 = call double @llvm.fmuladd.f64(double %251, double %256, double %268)
%270 = fneg double %246
%271 = call double @llvm.fmuladd.f64(double %270, double %269, double %245)
%272 = load double*, double** %30
%273 = load i32, i32* %31
%274 = sext i32 %273 to i64
%275 = getelementptr inbounds double, double* %272, i64 %274
store double %271, double* %275
br label %276
276: ; preds = %125
%277 = load i32, i32* %31
%278 = add nsw i32 %277, 1
store i32 %278, i32* %31
br label %121
279: ; preds = %121
%280 = load double*, double** %30
store double* %280, double** %7
br label %281
281: ; preds = %279, %66
%282 = load double*, double** %7
ret double* %282
}

LLVM IR (-O2):
@.str = [40 x i8] c"cmxx_jac: Unable to allocate jac array\0A\00"
@stderr = global i32 0
define noalias double* @cmxx_jac(double* nocapture readnone %0, i32 %1, i32 %2, double* %3, double** noalias %4, double** noalias %5) {
%7 = alloca [2000 x [3 x double]]
%8 = alloca [2000 x [3 x double]]
%9 = alloca [3 x double*]
%10 = alloca [3 x double*]
%11 = bitcast [2000 x [3 x double]]* %7 to i8*
%12 = bitcast [2000 x [3 x double]]* %8 to i8*
%13 = bitcast [3 x double*]* %9 to i8*
%14 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %7, i64 0, i64 0, i64 0
%15 = getelementptr inbounds [3 x double*], [3 x double*]* %9, i64 0, i64 0
store double* %14, double** %15
%16 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %7, i64 0, i64 1, i64 0
%17 = getelementptr inbounds [3 x double*], [3 x double*]* %9, i64 0, i64 1
store double* %16, double** %17
%18 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %7, i64 0, i64 2, i64 0
%19 = getelementptr inbounds [3 x double*], [3 x double*]* %9, i64 0, i64 2
store double* %18, double** %19
%20 = bitcast [3 x double*]* %10 to i8*
%21 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %8, i64 0, i64 0, i64 0
%22 = getelementptr inbounds [3 x double*], [3 x double*]* %10, i64 0, i64 0
store double* %21, double** %22
%23 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %8, i64 0, i64 1, i64 0
%24 = getelementptr inbounds [3 x double*], [3 x double*]* %10, i64 0, i64 1
store double* %23, double** %24
%25 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %8, i64 0, i64 2, i64 0
%26 = getelementptr inbounds [3 x double*], [3 x double*]* %10, i64 0, i64 2
store double* %25, double** %26
%27 = call double* @calloc(i32 2000, i32 8)
%28 = icmp eq double* %27, null
br i1 %28, label %29, label %32
29: ; preds = %6
%30 = load i32, i32* @stderr
%31 = call i32 @fputs(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %30)
br label %121
32: ; preds = %6
%33 = call i32 @cmco_h2b(i32 %1, double* %3, double** %4, double** %5, double** %15, double** %22)
%34 = load double, double* %16
%35 = load double, double* %14
%36 = fsub double %34, %35
%37 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %7, i64 0, i64 1, i64 1
%38 = load double, double* %37
%39 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %7, i64 0, i64 0, i64 1
%40 = load double, double* %39
%41 = fsub double %38, %40
%42 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %7, i64 0, i64 1, i64 2
%43 = load double, double* %42
%44 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %7, i64 0, i64 0, i64 2
%45 = load double, double* %44
%46 = fsub double %43, %45
%47 = fmul double %41, %41
%48 = call double @llvm.fmuladd.f64(double %36, double %36, double %47)
%49 = call double @llvm.fmuladd.f64(double %46, double %46, double %48)
%50 = load double, double* %3
%51 = getelementptr inbounds double, double* %3, i64 1
%52 = load double, double* %51
%53 = fadd double %50, %52
%54 = call double @sqrt(double %49)
%55 = fmul double %49, %54
%56 = fdiv double %53, %55
%57 = call double @sqrt(double %56)
%58 = icmp sgt i32 %2, %1
br i1 %58, label %121, label %59
59: ; preds = %32
%60 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %7, i64 0, i64 2, i64 1
%61 = fneg double %57
%62 = sext i32 %2 to i64
%63 = add i32 %1, 1
br label %64
64: ; preds = %59, %64
%65 = phi i64 [ %62, %59 ], [ %118, %64 ]
%66 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %7, i64 0, i64 %65, i64 0
%67 = load double, double* %66
%68 = load double, double* %14
%69 = fsub double %67, %68
%70 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %7, i64 0, i64 %65, i64 1
%71 = load double, double* %70
%72 = load double, double* %39
%73 = fsub double %71, %72
%74 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %7, i64 0, i64 %65, i64 2
%75 = load double, double* %74
%76 = load double, double* %44
%77 = fsub double %75, %76
%78 = fmul double %73, %73
%79 = call double @llvm.fmuladd.f64(double %69, double %69, double %78)
%80 = call double @llvm.fmuladd.f64(double %77, double %77, double %79)
%81 = call double @sqrt(double %80)
%82 = load double, double* %66
%83 = load double, double* %60
%84 = fsub double %82, %83
%85 = load double, double* %70
%86 = load double, double* %37
%87 = fsub double %85, %86
%88 = load double, double* %74
%89 = load double, double* %42
%90 = fsub double %88, %89
%91 = fmul double %87, %87
%92 = call double @llvm.fmuladd.f64(double %84, double %84, double %91)
%93 = call double @llvm.fmuladd.f64(double %90, double %90, double %92)
%94 = call double @sqrt(double %93)
%95 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %8, i64 0, i64 %65, i64 0
%96 = load double, double* %95
%97 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %8, i64 0, i64 %65, i64 1
%98 = load double, double* %97
%99 = fmul double %98, %98
%100 = call double @llvm.fmuladd.f64(double %96, double %96, double %99)
%101 = getelementptr inbounds [2000 x [3 x double]], [2000 x [3 x double]]* %8, i64 0, i64 %65, i64 2
%102 = load double, double* %101
%103 = call double @llvm.fmuladd.f64(double %102, double %102, double %100)
%104 = load double, double* %3
%105 = fneg double %104
%106 = fdiv double %105, %81
%107 = call double @llvm.fmuladd.f64(double %103, double 5.000000e-01, double %106)
%108 = load double, double* %51
%109 = fdiv double %108, %94
%110 = fsub double %107, %109
%111 = load double, double* %66
%112 = load double, double* %70
%113 = fneg double %112
%114 = fmul double %96, %113
%115 = call double @llvm.fmuladd.f64(double %111, double %98, double %114)
%116 = call double @llvm.fmuladd.f64(double %61, double %115, double %110)
%117 = getelementptr inbounds double, double* %27, i64 %65
store double %116, double* %117
%118 = add nsw i64 %65, 1
%119 = trunc i64 %118 to i32
%120 = icmp eq i32 %63, %119
br i1 %120, label %121, label %64
121: ; preds = %64, %32, %29
ret double* %27
}