void make_box2ind(double **x, int dim, int N, int comp1, int comp2, int bs,
                  int inveps, int *ind, int **box, int *lis) {
  int d, i, ix, iy, ixy;
  int ib = bs - 1;
  double **xx;
  xx = (double **)malloc(dim * sizeof(double *));
  for (d = 0; d < dim; d++) {
    xx[d] = (double *)malloc(N * sizeof(double));
    memcpy(xx[d], x[d], N * sizeof(double));
  }
  for (ix = 0; ix < bs; ix++)
    for (iy = 0; iy < bs; iy++)
      box[ix][iy] = -1;
  for (i = 0; i < N; i++) {
    ix = (int)(x[comp1][i] * inveps) & ib;
    iy = (int)(x[comp2][i] * inveps) & ib;
    lis[i] = box[ix][iy];
    box[ix][iy] = i;
  }
  i = -1;
  for (ix = 0; ix < bs; ix++)
    for (iy = 0; iy < bs; iy++) {
      ixy = box[ix][iy];
      while (ixy >= 0) {
        i++;
        for (d = 0; d < dim; d++)
          x[d][i] = xx[d][ixy];
        ind[ixy] = i;
        ixy = lis[ixy];
      }
      box[ix][iy] = -1;
    }
  for (i = 0; i < N; i++) {
    ix = (int)(x[comp1][i] * inveps) & ib;
    iy = (int)(x[comp2][i] * inveps) & ib;
    lis[i] = box[ix][iy];
    box[ix][iy] = i;
  }
  for (d = 0; d < dim; d++)
    free(xx[d]);
  free(xx);
}


x86 assembly (clang, -O0):
<make_box2ind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x34(%rbp)
movslq -0xc(%rbp),%rdi
shl    $0x3,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d8 <make_box2ind+0xa8>
movslq -0x10(%rbp),%rdi
shl    $0x3,%rdi
call   1050 <malloc@plt>
mov    %rax,%rdx
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
movslq -0x10(%rbp),%rdx
shl    $0x3,%rdx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    117d <make_box2ind+0x4d>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1236 <make_box2ind+0x106>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1223 <make_box2ind+0xf3>
mov    0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11f2 <make_box2ind+0xc2>
jmp    1228 <make_box2ind+0xf8>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11df <make_box2ind+0xaf>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    12db <make_box2ind+0x1ab>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
cvtsi2sdl 0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
and    -0x34(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
cvtsi2sdl 0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
and    -0x34(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    0x28(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%edx
mov    0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    123d <make_box2ind+0x10d>
movl   $0xffffffff,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    13d5 <make_box2ind+0x2a5>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    13c2 <make_box2ind+0x292>
mov    0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jl     139d <make_box2ind+0x26d>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    137c <make_box2ind+0x24c>
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1338 <make_box2ind+0x208>
mov    -0x24(%rbp),%edx
mov    0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x30(%rbp)
jmp    131e <make_box2ind+0x1ee>
mov    0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12fc <make_box2ind+0x1cc>
jmp    13c7 <make_box2ind+0x297>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12e9 <make_box2ind+0x1b9>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    147a <make_box2ind+0x34a>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
cvtsi2sdl 0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
and    -0x34(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
cvtsi2sdl 0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
and    -0x34(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    0x28(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%edx
mov    0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    13dc <make_box2ind+0x2ac>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    14ac <make_box2ind+0x37c>
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1481 <make_box2ind+0x351>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_box2ind>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9,0x40(%rsp)
mov    %r8d,0x8(%rsp)
mov    %ecx,0x38(%rsp)
mov    %edx,0xc(%rsp)
mov    %esi,%r14d
mov    %rdi,%rbp
mov    0xa8(%rsp),%r12
mov    0xa0(%rsp),%rax
mov    %rax,0x10(%rsp)
mov    0x98(%rsp),%r15
mov    0x90(%rsp),%eax
mov    %eax,0x30(%rsp)
movslq %esi,%r13
lea    0x0(,%r13,8),%rdi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %r14d,0x1c(%rsp)
mov    %r14d,%ecx
test   %r13d,%r13d
mov    %rcx,0x48(%rsp)
jle    11fa <make_box2ind+0xba>
movslq 0xc(%rsp),%rax
shl    $0x3,%rax
mov    %rax,(%rsp)
xor    %r13d,%r13d
mov    (%rsp),%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1060 <malloc@plt>
mov    %rax,(%rbx,%r13,8)
mov    0x0(%rbp,%r13,8),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1050 <memcpy@plt>
mov    0x48(%rsp),%rcx
add    $0x1,%r13
cmp    %r13,%rcx
jne    11d0 <make_box2ind+0x90>
mov    0x40(%rsp),%rcx
mov    %ecx,%eax
mov    %rax,0x50(%rsp)
test   %ecx,%ecx
jle    132d <make_box2ind+0x1ed>
mov    0x50(%rsp),%rcx
lea    0x0(,%rcx,4),%rax
mov    %rax,(%rsp)
lea    -0x1(%rcx),%rax
mov    %ecx,%edx
and    $0x7,%edx
mov    %rdx,0x28(%rsp)
cmp    $0x7,%rax
jae    123b <make_box2ind+0xfb>
xor    %r14d,%r14d
jmp    12f7 <make_box2ind+0x1b7>
and    $0xfffffff8,%ecx
mov    %rcx,0x20(%rsp)
xor    %r14d,%r14d
mov    0x10(%rsp),%r13
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13,%r14,8),%rdi
mov    $0xff,%esi
mov    (%rsp),%rdx
call   1040 <memset@plt>
mov    0x8(%r13,%r14,8),%rdi
mov    $0xff,%esi
mov    (%rsp),%rdx
call   1040 <memset@plt>
mov    0x10(%r13,%r14,8),%rdi
mov    $0xff,%esi
mov    (%rsp),%rdx
call   1040 <memset@plt>
mov    0x18(%r13,%r14,8),%rdi
mov    $0xff,%esi
mov    (%rsp),%rdx
call   1040 <memset@plt>
mov    0x20(%r13,%r14,8),%rdi
mov    $0xff,%esi
mov    (%rsp),%rdx
call   1040 <memset@plt>
mov    0x28(%r13,%r14,8),%rdi
mov    $0xff,%esi
mov    (%rsp),%rdx
call   1040 <memset@plt>
mov    0x30(%r13,%r14,8),%rdi
mov    $0xff,%esi
mov    (%rsp),%rdx
call   1040 <memset@plt>
mov    0x38(%r13,%r14,8),%rdi
mov    $0xff,%esi
mov    (%rsp),%rdx
call   1040 <memset@plt>
add    $0x8,%r14
cmp    %r14,0x20(%rsp)
jne    1250 <make_box2ind+0x110>
cmpq   $0x0,0x28(%rsp)
je     132d <make_box2ind+0x1ed>
mov    0x10(%rsp),%rax
lea    (%rax,%r14,8),%r14
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
mov    (%r14,%r13,8),%rdi
mov    $0xff,%esi
mov    (%rsp),%rdx
call   1040 <memset@plt>
add    $0x1,%r13
cmp    %r13,0x28(%rsp)
jne    1310 <make_box2ind+0x1d0>
mov    0x40(%rsp),%rax
lea    -0x1(%rax),%r11d
cvtsi2sdl 0x30(%rsp),%xmm0
movslq 0x38(%rsp),%rax
mov    %rax,0x20(%rsp)
movslq 0x8(%rsp),%r13
mov    0xc(%rsp),%eax
mov    %eax,%r14d
test   %eax,%eax
mov    %r12,%rdi
mov    0x10(%rsp),%r10
jle    13ae <make_box2ind+0x26e>
mov    0x20(%rsp),%rax
mov    0x0(%rbp,%rax,8),%r8
mov    0x0(%rbp,%r13,8),%r9
xor    %edx,%edx
nop
movsd  (%r8,%rdx,8),%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%esi
and    %r11d,%esi
movsd  (%r9,%rdx,8),%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%eax
and    %r11d,%eax
movslq %esi,%rsi
mov    (%r10,%rsi,8),%rsi
movslq %eax,%rcx
mov    (%rsi,%rcx,4),%eax
mov    %eax,(%rdi,%rdx,4)
mov    %edx,(%rsi,%rcx,4)
add    $0x1,%rdx
cmp    %rdx,%r14
jne    1370 <make_box2ind+0x230>
mov    %r13,0x30(%rsp)
mov    %r14,0x38(%rsp)
mov    %r11d,0x8(%rsp)
cmpl   $0x0,0x40(%rsp)
mov    0x50(%rsp),%rdx
jle    1521 <make_box2ind+0x3e1>
mov    0x48(%rsp),%r8
lea    -0x1(%r8),%r13
mov    %r8d,%r14d
and    $0x3,%r14d
and    $0xfffffffc,%r8d
mov    $0xffffffff,%ecx
xor    %esi,%esi
jmp    1402 <make_box2ind+0x2c2>
nopw   0x0(%rax,%rax,1)
mov    0x28(%rsp),%rsi
add    $0x1,%rsi
cmp    %rdx,%rsi
je     1521 <make_box2ind+0x3e1>
mov    0x10(%rsp),%rax
mov    %rsi,0x28(%rsp)
mov    (%rax,%rsi,8),%rsi
xor    %r9d,%r9d
mov    %rsi,(%rsp)
jmp    143d <make_box2ind+0x2fd>
nopl   0x0(%rax)
mov    %r12,%rdi
mov    0x50(%rsp),%rdx
mov    (%rsp),%rsi
movl   $0xffffffff,(%rsi,%r9,4)
ff
add    $0x1,%r9
cmp    %rdx,%r9
je     13f0 <make_box2ind+0x2b0>
mov    (%rsi,%r9,4),%eax
test   %eax,%eax
js     142c <make_box2ind+0x2ec>
movslq %ecx,%rcx
jmp    145c <make_box2ind+0x31c>
nopw   0x0(%rax,%rax,1)
mov    %ecx,(%r15,%r10,4)
mov    (%r12,%r10,4),%eax
test   %eax,%eax
js     1420 <make_box2ind+0x2e0>
add    $0x1,%rcx
mov    %eax,%r10d
cmpl   $0x0,0x1c(%rsp)
jle    1450 <make_box2ind+0x310>
xor    %r11d,%r11d
cmp    $0x3,%r13
jb     14dc <make_box2ind+0x39c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rbx,%r11,8),%rax
movsd  (%rax,%r10,8),%xmm1
mov    0x0(%rbp,%r11,8),%rax
movsd  %xmm1,(%rax,%rcx,8)
mov    0x8(%rbx,%r11,8),%rax
movsd  (%rax,%r10,8),%xmm1
mov    0x8(%rbp,%r11,8),%rax
movsd  %xmm1,(%rax,%rcx,8)
mov    0x10(%rbx,%r11,8),%rax
movsd  (%rax,%r10,8),%xmm1
mov    0x10(%rbp,%r11,8),%rax
movsd  %xmm1,(%rax,%rcx,8)
mov    0x18(%rbx,%r11,8),%rax
movsd  (%rax,%r10,8),%xmm1
mov    0x18(%rbp,%r11,8),%rax
movsd  %xmm1,(%rax,%rcx,8)
add    $0x4,%r11
cmp    %r11,%r8
jne    1480 <make_box2ind+0x340>
test   %r14,%r14
je     1450 <make_box2ind+0x310>
lea    0x0(,%r11,8),%rax
add    %rbp,%rax
lea    (%rbx,%r11,8),%rdi
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
mov    (%rdi,%rsi,8),%rdx
movsd  (%rdx,%r10,8),%xmm1
mov    (%rax,%rsi,8),%rdx
movsd  %xmm1,(%rdx,%rcx,8)
add    $0x1,%rsi
cmp    %rsi,%r14
jne    1500 <make_box2ind+0x3c0>
jmp    1450 <make_box2ind+0x310>
cmpl   $0x0,0xc(%rsp)
mov    0x10(%rsp),%r9
mov    0x8(%rsp),%ecx
mov    0x38(%rsp),%r11
jle    158c <make_box2ind+0x44c>
mov    0x20(%rsp),%rax
mov    0x0(%rbp,%rax,8),%r8
mov    0x30(%rsp),%rax
mov    0x0(%rbp,%rax,8),%r10
xor    %edx,%edx
nopl   0x0(%rax)
movsd  (%r8,%rdx,8),%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%esi
and    %ecx,%esi
movsd  (%r10,%rdx,8),%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%ebp
and    %ecx,%ebp
movslq %esi,%rsi
mov    (%r9,%rsi,8),%rsi
movslq %ebp,%rax
mov    (%rsi,%rax,4),%ebp
mov    %ebp,(%rdi,%rdx,4)
mov    %edx,(%rsi,%rax,4)
add    $0x1,%rdx
cmp    %rdx,%r11
jne    1550 <make_box2ind+0x410>
cmpl   $0x0,0x1c(%rsp)
mov    0x48(%rsp),%r14
jle    15b2 <make_box2ind+0x472>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    15a0 <make_box2ind+0x460>
mov    %rbx,%rdi
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

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

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