#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 M_PI;
scalar_t__ RAND_MAX;
int /*<<< orphan*/ csp3d_close(double **);
double csp3d_eval(double *, double **, int *, double *, double **, int *);
double **csp3d_open(double **, int *, double *);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int rand();
double sin(double);
int sqrt(double);
int testmain3d(void) {
  double *f;
  int nx, ny, nz, nf;
  int i, j, k;
  double xx, yy, zz;
  double *x, *y, *z;
  double r;
  double **splines;
  int interval[3];
  double *xv[3];
  int nv[3];
  double p[3];
  nx = 12;
  ny = 12;
  nz = 12;
  x = (double *)malloc(nx * sizeof(double));
  y = (double *)malloc(ny * sizeof(double));
  z = (double *)malloc(nz * sizeof(double));
  xv[0] = x;
  xv[1] = y;
  xv[2] = z;
  x[0] = 0.;
  y[0] = 0.;
  z[0] = 0.;
  x[1] = 0.1;
  y[1] = 0.1;
  z[1] = 0.1;
  for (i = 2; i < nx; i++) {
    x[i] = i - 1.;
    y[i] = i - 1.;
    z[i] = i - 1.;
  }
  nf = nx * ny * nz;
  nv[0] = nx;
  nv[1] = ny;
  nv[2] = nz;
  f = (double *)malloc(nf * sizeof(double));
  nf = 0;
  for (i = 0; i < nx; i++) {
    for (j = 0; j < ny; j++) {
      for (k = 0; k < nz; k++) {
        r = M_PI * sqrt(x[i] * x[i] + y[j] * y[j] + z[k] * z[k]) / 2.;
        yy = (r != 0.) ? sin(r) / r : 1.;
        int m = (i * ny + j) * nz + k;
        if (m != nf) {
          printf("Mismatch\n");
          return 1;
        }
        f[m] = yy;
        nf++;
      }
    }
  }
  splines = csp3d_open(xv, nv, f);
  for (i = 0; i < 3; i++)
    interval[i] = 0;
  for (i = 0; i < 1002; i++) {
    double e, spl;
    double ex[3];
    if (i == 0) {
      ex[0] = 1.;
      ex[1] = 0.;
      ex[2] = 0.;
    } else if (i == 1) {
      ex[0] = 1.;
      ex[1] = 1.;
      ex[2] = 1.;
    } else {
      for (j = 0; j < 3; j++) {
        ex[j] = rand() / (double)RAND_MAX;
      }
      ex[rand() % 3] = 1.;
    }
    for (j = 0; j < 101; j++) {
      xx = j * ex[0] / 10.;
      yy = j * ex[1] / 10.;
      zz = j * ex[2] / 10.;
      p[0] = xx;
      p[1] = yy;
      p[2] = zz;
      spl = csp3d_eval(p, xv, nv, f, splines, interval);
      r = M_PI * sqrt(xx * xx + yy * yy + zz * zz) / 2.;
      e = (r != 0.) ? sin(r) / r : 1.;
      printf("%8.5f %9.6f %9.6f\n", r, spl, e);
    }
  }
  free(f);
  csp3d_close(splines);
  return 0;
}


x86 assembly (clang, -O0):
<testmain3d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0xc,-0x14(%rbp)
movl   $0xc,-0x18(%rbp)
movl   $0xc,-0x1c(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x50(%rbp)
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x58(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x50(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x58(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x60(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x50(%rbp),%rax
movsd  0xdc9(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x58(%rbp),%rax
movsd  0xdb8(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x60(%rbp),%rax
movsd  0xda7(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
movl   $0x2,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12d9 <testmain3d+0x149>
cvtsi2sdl -0x24(%rbp),%xmm0
movsd  0xd8a(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
cvtsi2sdl -0x24(%rbp),%xmm0
movsd  0xd6c(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x58(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
cvtsi2sdl -0x24(%rbp),%xmm0
movsd  0xd4e(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x60(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1265 <testmain3d+0xd5>
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
imul   -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xac(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0xa8(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0xa4(%rbp)
movslq -0x20(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    14d4 <testmain3d+0x344>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    14c1 <testmain3d+0x331>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    14ae <testmain3d+0x31e>
mov    0x2c8c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x104(%rbp)
mov    -0x50(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x50(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x58(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x28(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x60(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   10a0 <sqrt@plt>
mov    %eax,%ecx
mov    -0x104(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0xc32(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1404 <testmain3d+0x274>
jp     1404 <testmain3d+0x274>
jmp    1420 <testmain3d+0x290>
movsd  -0x68(%rbp),%xmm0
call   1060 <sin@plt>
divsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
jmp    1435 <testmain3d+0x2a5>
movsd  0xbe0(%rip),%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
jmp    1435 <testmain3d+0x2a5>
movsd  -0x110(%rbp),%xmm0
ff
movsd  %xmm0,-0x40(%rbp)
mov    -0x24(%rbp),%eax
imul   -0x18(%rbp),%eax
add    -0x28(%rbp),%eax
imul   -0x1c(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0xd4(%rbp)
mov    -0xd4(%rbp),%eax
cmp    -0x20(%rbp),%eax
je     1482 <testmain3d+0x2f2>
lea    0xbb1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17ee <testmain3d+0x65e>
movsd  -0x40(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0xd4(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1349 <testmain3d+0x1b9>
jmp    14b3 <testmain3d+0x323>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1336 <testmain3d+0x1a6>
jmp    14c6 <testmain3d+0x336>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1323 <testmain3d+0x193>
lea    -0xa0(%rbp),%rdi
lea    -0xac(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <csp3d_open@plt>
mov    %rax,-0x70(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x3,-0x24(%rbp)
jge    151a <testmain3d+0x38a>
movslq -0x24(%rbp),%rax
movl   $0x0,-0x7c(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    14f6 <testmain3d+0x366>
movl   $0x0,-0x24(%rbp)
cmpl   $0x3ea,-0x24(%rbp)
jge    17d5 <testmain3d+0x645>
cmpl   $0x0,-0x24(%rbp)
jne    1563 <testmain3d+0x3d3>
movsd  0xac8(%rip),%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
jmp    1611 <testmain3d+0x481>
cmpl   $0x1,-0x24(%rbp)
jne    15a2 <testmain3d+0x412>
movsd  0xa93(%rip),%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movsd  0xa83(%rip),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  0xa73(%rip),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
jmp    160c <testmain3d+0x47c>
movl   $0x0,-0x28(%rbp)
cmpl   $0x3,-0x28(%rbp)
jge    15e9 <testmain3d+0x459>
mov    $0x0,%al
call   10b0 <rand@plt>
cvtsi2sd %eax,%xmm0
mov    0x2a1b(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movslq -0x28(%rbp),%rax
movsd  %xmm0,-0x100(%rbp,%rax,8)
ff ff
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    15a9 <testmain3d+0x419>
mov    $0x0,%al
call   10b0 <rand@plt>
mov    $0x3,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
movsd  0xa05(%rip),%xmm0
movsd  %xmm0,-0x100(%rbp,%rax,8)
ff ff
jmp    1611 <testmain3d+0x481>
movl   $0x0,-0x28(%rbp)
cmpl   $0x65,-0x28(%rbp)
jge    17c2 <testmain3d+0x632>
cvtsi2sdl -0x28(%rbp),%xmm0
mulsd  -0x100(%rbp),%xmm0
ff
movsd  0x9e1(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
cvtsi2sdl -0x28(%rbp),%xmm0
mulsd  -0xf8(%rbp),%xmm0
ff
movsd  0x9c3(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
cvtsi2sdl -0x28(%rbp),%xmm0
mulsd  -0xf0(%rbp),%xmm0
ff
movsd  0x9a5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
lea    -0xd0(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
lea    -0xac(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x70(%rbp),%r8
lea    -0x7c(%rbp),%r9
call   1090 <csp3d_eval@plt>
movsd  %xmm0,-0xe8(%rbp)
ff
mov    0x2910(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x114(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   10a0 <sqrt@plt>
mov    %eax,%ecx
mov    -0x114(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0x8e6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1750 <testmain3d+0x5c0>
jp     1750 <testmain3d+0x5c0>
jmp    176c <testmain3d+0x5dc>
movsd  -0x68(%rbp),%xmm0
call   1060 <sin@plt>
divsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
jmp    1781 <testmain3d+0x5f1>
movsd  0x894(%rip),%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
jmp    1781 <testmain3d+0x5f1>
movsd  -0x120(%rbp),%xmm0
ff
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
movsd  -0xe8(%rbp),%xmm1
ff
movsd  -0xe0(%rbp),%xmm2
ff
lea    0x87d(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1618 <testmain3d+0x488>
jmp    17c7 <testmain3d+0x637>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1521 <testmain3d+0x391>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x70(%rbp),%rdi
call   1080 <csp3d_close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testmain3d>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    $0x60,%edi
call   1080 <malloc@plt>
mov    %rax,%r14
mov    $0x60,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    $0x60,%edi
call   1080 <malloc@plt>
mov    %rax,%rbp
mov    %r14,0x90(%rsp)
mov    %rbx,0x98(%rsp)
mov    %rax,0xa0(%rsp)
movq   $0x0,(%r14)
movq   $0x0,(%rbx)
movq   $0x0,(%rax)
movabs $0x3fb999999999999a,%rax
99 b9 3f
mov    %rax,0x8(%r14)
mov    %rax,0x8(%rbx)
mov    %rax,0x8(%rbp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x10(%r14)
mov    %rax,0x10(%rbx)
mov    %rax,0x10(%rbp)
movabs $0x4000000000000000,%rax
mov    %rax,0x18(%r14)
mov    %rax,0x18(%rbx)
mov    %rax,0x18(%rbp)
movabs $0x4008000000000000,%rax
mov    %rax,0x20(%r14)
mov    %rax,0x20(%rbx)
mov    %rax,0x20(%rbp)
movabs $0x4010000000000000,%rax
mov    %rax,0x28(%r14)
mov    %rax,0x28(%rbx)
mov    %rax,0x28(%rbp)
movabs $0x4014000000000000,%rax
mov    %rax,0x30(%r14)
mov    %rax,0x30(%rbx)
mov    %rax,0x30(%rbp)
movabs $0x4018000000000000,%rax
mov    %rax,0x38(%r14)
mov    %rax,0x38(%rbx)
mov    %rax,0x38(%rbp)
movabs $0x401c000000000000,%rax
mov    %rax,0x40(%r14)
mov    %rax,0x40(%rbx)
mov    %rax,0x40(%rbp)
movabs $0x4020000000000000,%rax
mov    %rax,0x48(%r14)
mov    %rax,0x48(%rbx)
mov    %rax,0x48(%rbp)
movabs $0x4022000000000000,%rax
mov    %rax,0x50(%r14)
mov    %rax,0x50(%rbx)
mov    %rax,0x50(%rbp)
movabs $0x4024000000000000,%rax
mov    %r14,0x18(%rsp)
mov    %rax,0x58(%r14)
mov    %rbx,(%rsp)
mov    %rax,0x58(%rbx)
mov    %rax,0x58(%rbp)
movabs $0xc0000000c,%rax
mov    %rax,0x54(%rsp)
movl   $0xc,0x5c(%rsp)
mov    $0x3600,%edi
call   1080 <malloc@plt>
mov    %rax,0x10(%rsp)
xor    %r12d,%r12d
xor    %r13d,%r13d
mov    %r12,0x8(%rsp)
xor    %r15d,%r15d
mov    %r12,0x70(%rsp)
xor    %r14d,%r14d
nopl   0x0(%rax)
mov    0x2ca1(%rip),%rax
mov    (%rax),%ebx
mov    0x18(%rsp),%rax
movsd  (%rax,%r13,8),%xmm1
mov    (%rsp),%rax
movsd  (%rax,%r15,8),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x0(%rbp,%r14,8),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   10b0 <sqrt@plt>
imul   %ebx,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0xc70(%rip),%xmm1
ucomisd 0xc80(%rip),%xmm1
movsd  0xc68(%rip),%xmm0
jne    13a4 <testmain3d+0x204>
jnp    13b9 <testmain3d+0x219>
movapd %xmm1,%xmm0
movsd  %xmm1,0x20(%rsp)
call   1070 <sin@plt>
divsd  0x20(%rsp),%xmm0
mov    %r12,%rax
shr    $0x20,%rax
jne    1460 <testmain3d+0x2c0>
mov    0x10(%rsp),%rax
movsd  %xmm0,(%rax,%r12,8)
add    $0x1,%r14
add    $0x1,%r12
cmp    $0xc,%r14
jne    1340 <testmain3d+0x1a0>
add    $0x1,%r15
mov    0x70(%rsp),%r12
add    $0xc,%r12
cmp    $0xc,%r15
jne    1334 <testmain3d+0x194>
add    $0x1,%r13
mov    0x8(%rsp),%r12
add    $0x90,%r12
cmp    $0xc,%r13
jne    132c <testmain3d+0x18c>
lea    0x90(%rsp),%rdi
lea    0x54(%rsp),%rsi
mov    0x10(%rsp),%rdx
call   1050 <csp3d_open@plt>
mov    %rax,%r15
movq   $0x0,0x80(%rsp)
movl   $0x0,0x88(%rsp)
lea    0x80(%rsp),%r13
movsd  0xbb3(%rip),%xmm1
lea    0xbf4(%rip),%r14
xor    %eax,%eax
jmp    1494 <testmain3d+0x2f4>
lea    0xbfc(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r12d,%eax
add    $0x1,%eax
cmp    $0x3ea,%eax
je     16f1 <testmain3d+0x551>
test   %eax,%eax
je     14c5 <testmain3d+0x325>
mov    %eax,%r12d
cmp    $0x1,%eax
jne    1501 <testmain3d+0x361>
movapd 0xb78(%rip),%xmm0
movapd %xmm0,0x30(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x40(%rsp)
movsd  %xmm1,0x8(%rsp)
jmp    14f6 <testmain3d+0x356>
mov    %eax,%r12d
movabs $0x3ff0000000000000,%rax
mov    %rax,0x30(%rsp)
lea    0x38(%rsp),%rax
xorpd  %xmm0,%xmm0
movupd %xmm0,(%rax)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xb12(%rip),%xmm0
movapd %xmm0,0x60(%rsp)
jmp    15bb <testmain3d+0x41b>
xor    %eax,%eax
call   10c0 <rand@plt>
mov    %eax,%ebp
mov    0x2acf(%rip),%rbx
xorps  %xmm0,%xmm0
cvtsi2sdq (%rbx),%xmm0
movapd %xmm0,0x20(%rsp)
xor    %eax,%eax
call   10c0 <rand@plt>
movd   %ebp,%xmm0
movd   %eax,%xmm1
punpckldq %xmm1,%xmm0
cvtdq2pd %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%rbx),%xmm1
movapd 0x20(%rsp),%xmm2
unpcklpd %xmm1,%xmm2
divpd  %xmm2,%xmm0
movapd %xmm0,0x30(%rsp)
xor    %eax,%eax
call   10c0 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%rbx),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x40(%rsp)
xor    %eax,%eax
call   10c0 <rand@plt>
cltq
imul   $0x55555556,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
cltq
movabs $0x3ff0000000000000,%rcx
mov    %rcx,0x30(%rsp,%rax,8)
movaps 0x30(%rsp),%xmm0
movaps %xmm0,0x60(%rsp)
movsd  0x40(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
xorpd  %xmm0,%xmm0
mov    $0x65,%ebp
jmp    15fb <testmain3d+0x45b>
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
movsd  0x18(%rsp),%xmm1
mov    $0x3,%al
call   1060 <printf@plt>
movsd  0xa20(%rip),%xmm1
movapd 0x20(%rsp),%xmm0
addsd  %xmm1,%xmm0
add    $0xffffffff,%ebp
je     1483 <testmain3d+0x2e3>
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
mulpd  0x60(%rsp),%xmm2
divpd  0xa1f(%rip),%xmm2
movapd %xmm2,0x70(%rsp)
movsd  0x8(%rsp),%xmm1
movapd %xmm0,0x20(%rsp)
mulsd  %xmm0,%xmm1
divsd  0x9e1(%rip),%xmm1
movsd  %xmm1,(%rsp)
movapd %xmm2,0xb0(%rsp)
movsd  %xmm1,0xc0(%rsp)
lea    0xb0(%rsp),%rdi
lea    0x90(%rsp),%rsi
lea    0x54(%rsp),%rdx
mov    0x10(%rsp),%rcx
mov    %r15,%r8
mov    %r13,%r9
call   10a0 <csp3d_eval@plt>
movsd  %xmm0,0x18(%rsp)
mov    0x2970(%rip),%rax
mov    (%rax),%ebx
movapd 0x70(%rsp),%xmm1
movapd %xmm1,%xmm0
mulpd  %xmm1,%xmm0
unpckhpd %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   10b0 <sqrt@plt>
imul   %ebx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x948(%rip),%xmm0
ucomisd 0x958(%rip),%xmm0
movsd  0x940(%rip),%xmm2
jne    16d0 <testmain3d+0x530>
jnp    15d0 <testmain3d+0x430>
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
call   1070 <sin@plt>
movapd %xmm0,%xmm2
movsd  (%rsp),%xmm0
divsd  %xmm0,%xmm2
jmp    15d0 <testmain3d+0x430>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1090 <csp3d_close@plt>
xor    %eax,%eax
jmp    1471 <testmain3d+0x2d1>

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

LLVM IR (-O2):
@M_PI = global i32 0
@RAND_MAX = global i64 0
@.str.1 = [19 x i8] c"%8.5f %9.6f %9.6f\0A\00"
@str = [9 x i8] c"Mismatch\00"
define i32 @testmain3d() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = alloca [3 x double*]
%4 = alloca [3 x i32]
%5 = alloca [3 x double]
%6 = alloca [3 x double]
%7 = bitcast [3 x double*]* %3 to i8*
%8 = bitcast [3 x i32]* %4 to i8*
%9 = bitcast [3 x double]* %5 to i8*
%10 = tail call i64 @malloc(i32 96)
%11 = inttoptr i64 %10 to double*
%12 = tail call i64 @malloc(i32 96)
%13 = inttoptr i64 %12 to double*
%14 = tail call i64 @malloc(i32 96)
%15 = inttoptr i64 %14 to double*
%16 = getelementptr inbounds [3 x double*], [3 x double*]* %3, i64 0, i64 0
store double* %11, double** %16
%17 = getelementptr inbounds [3 x double*], [3 x double*]* %3, i64 0, i64 1
store double* %13, double** %17
%18 = getelementptr inbounds [3 x double*], [3 x double*]* %3, i64 0, i64 2
store double* %15, double** %18
store double 0.000000e+00, double* %11
store double 0.000000e+00, double* %13
store double 0.000000e+00, double* %15
%19 = getelementptr inbounds double, double* %11, i64 1
store double 1.000000e-01, double* %19
%20 = getelementptr inbounds double, double* %13, i64 1
store double 1.000000e-01, double* %20
%21 = getelementptr inbounds double, double* %15, i64 1
store double 1.000000e-01, double* %21
%22 = getelementptr inbounds double, double* %11, i64 2
store double 1.000000e+00, double* %22
%23 = getelementptr inbounds double, double* %13, i64 2
store double 1.000000e+00, double* %23
%24 = getelementptr inbounds double, double* %15, i64 2
store double 1.000000e+00, double* %24
%25 = getelementptr inbounds double, double* %11, i64 3
store double 2.000000e+00, double* %25
%26 = getelementptr inbounds double, double* %13, i64 3
store double 2.000000e+00, double* %26
%27 = getelementptr inbounds double, double* %15, i64 3
store double 2.000000e+00, double* %27
%28 = getelementptr inbounds double, double* %11, i64 4
store double 3.000000e+00, double* %28
%29 = getelementptr inbounds double, double* %13, i64 4
store double 3.000000e+00, double* %29
%30 = getelementptr inbounds double, double* %15, i64 4
store double 3.000000e+00, double* %30
%31 = getelementptr inbounds double, double* %11, i64 5
store double 4.000000e+00, double* %31
%32 = getelementptr inbounds double, double* %13, i64 5
store double 4.000000e+00, double* %32
%33 = getelementptr inbounds double, double* %15, i64 5
store double 4.000000e+00, double* %33
%34 = getelementptr inbounds double, double* %11, i64 6
store double 5.000000e+00, double* %34
%35 = getelementptr inbounds double, double* %13, i64 6
store double 5.000000e+00, double* %35
%36 = getelementptr inbounds double, double* %15, i64 6
store double 5.000000e+00, double* %36
%37 = getelementptr inbounds double, double* %11, i64 7
store double 6.000000e+00, double* %37
%38 = getelementptr inbounds double, double* %13, i64 7
store double 6.000000e+00, double* %38
%39 = getelementptr inbounds double, double* %15, i64 7
store double 6.000000e+00, double* %39
%40 = getelementptr inbounds double, double* %11, i64 8
store double 7.000000e+00, double* %40
%41 = getelementptr inbounds double, double* %13, i64 8
store double 7.000000e+00, double* %41
%42 = getelementptr inbounds double, double* %15, i64 8
store double 7.000000e+00, double* %42
%43 = getelementptr inbounds double, double* %11, i64 9
store double 8.000000e+00, double* %43
%44 = getelementptr inbounds double, double* %13, i64 9
store double 8.000000e+00, double* %44
%45 = getelementptr inbounds double, double* %15, i64 9
store double 8.000000e+00, double* %45
%46 = getelementptr inbounds double, double* %11, i64 10
store double 9.000000e+00, double* %46
%47 = getelementptr inbounds double, double* %13, i64 10
store double 9.000000e+00, double* %47
%48 = getelementptr inbounds double, double* %15, i64 10
store double 9.000000e+00, double* %48
%49 = getelementptr inbounds double, double* %11, i64 11
store double 1.000000e+01, double* %49
%50 = getelementptr inbounds double, double* %13, i64 11
store double 1.000000e+01, double* %50
%51 = getelementptr inbounds double, double* %15, i64 11
store double 1.000000e+01, double* %51
%52 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
store i32 12, i32* %52
%53 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 1
store i32 12, i32* %53
%54 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 2
store i32 12, i32* %54
%55 = tail call i64 @malloc(i32 13824)
%56 = inttoptr i64 %55 to double*
br label %57
57: ; preds = %0, %104
%58 = phi i64 [ 0, %0 ], [ %105, %104 ]
%59 = phi i32 [ 0, %0 ], [ %62, %104 ]
%60 = getelementptr inbounds double, double* %11, i64 %58
%61 = mul nuw nsw i64 %58, 12
%62 = add nuw nsw i32 %59, 144
br label %63
63: ; preds = %57, %101
%64 = phi i64 [ 0, %57 ], [ %102, %101 ]
%65 = phi i32 [ %59, %57 ], [ %69, %101 ]
%66 = getelementptr inbounds double, double* %13, i64 %64
%67 = add nuw nsw i64 %64, %61
%68 = mul nuw nsw i64 %67, 12
%69 = add i32 %65, 12
br label %70
70: ; preds = %63, %96
%71 = phi i64 [ 0, %63 ], [ %99, %96 ]
%72 = phi i32 [ %65, %63 ], [ %98, %96 ]
%73 = load i32, i32* @M_PI
%74 = load double, double* %60
%75 = load double, double* %66
%76 = fmul double %75, %75
%77 = tail call double @llvm.fmuladd.f64(double %74, double %74, double %76)
%78 = getelementptr inbounds double, double* %15, i64 %71
%79 = load double, double* %78
%80 = tail call double @llvm.fmuladd.f64(double %79, double %79, double %77)
%81 = tail call i32 @sqrt(double %80)
%82 = mul nsw i32 %81, %73
%83 = sitofp i32 %82 to double
%84 = fmul double %83, 5.000000e-01
%85 = fcmp une double %84, 0.000000e+00
br i1 %85, label %86, label %89
86: ; preds = %70
%87 = tail call double @sin(double %84)
%88 = fdiv double %87, %84
br label %89
89: ; preds = %70, %86
%90 = phi double [ %88, %86 ], [ 1.000000e+00, %70 ]
%91 = add nuw nsw i64 %71, %68
%92 = zext i32 %72 to i64
%93 = icmp eq i64 %91, %92
br i1 %93, label %96, label %94
94: ; preds = %89
%95 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %186
96: ; preds = %89
%97 = getelementptr inbounds double, double* %56, i64 %91
store double %90, double* %97
%98 = add nsw i32 %72, 1
%99 = add nuw nsw i64 %71, 1
%100 = icmp eq i64 %99, 12
br i1 %100, label %101, label %70
101: ; preds = %96
%102 = add nuw nsw i64 %64, 1
%103 = icmp eq i64 %102, 12
br i1 %103, label %104, label %63
104: ; preds = %101
%105 = add nuw nsw i64 %58, 1
%106 = icmp eq i64 %105, 12
br i1 %106, label %107, label %57
107: ; preds = %104
%108 = call double** @csp3d_open(double** %16, i32* %52, double* %56)
%109 = bitcast [3 x double]* %6 to i8*
%110 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%111 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
%112 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
%113 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%114 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 2
%115 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%116 = bitcast double* %111 to i8*
%117 = bitcast [3 x double]* %6 to <2 x double>*
%118 = bitcast [3 x double]* %6 to <2 x double>*
%119 = bitcast [3 x double]* %6 to <2 x double>*
%120 = bitcast [3 x double]* %5 to <2 x double>*
br label %121
121: ; preds = %107, %180
%122 = phi i32 [ 0, %107 ], [ %181, %180 ]
switch i32 %122, label %123 [
i32 0, label %146
i32 1, label %147
]
123: ; preds = %121
%124 = call i32 (...) @rand()
%125 = load i64, i64* @RAND_MAX
%126 = call i32 (...) @rand()
%127 = insertelement <2 x i32> poison, i32 %124, i64 0
%128 = insertelement <2 x i32> %127, i32 %126, i64 1
%129 = sitofp <2 x i32> %128 to <2 x double>
%130 = load i64, i64* @RAND_MAX
%131 = insertelement <2 x i64> poison, i64 %125, i64 0
%132 = insertelement <2 x i64> %131, i64 %130, i64 1
%133 = sitofp <2 x i64> %132 to <2 x double>
%134 = fdiv <2 x double> %129, %133
store <2 x double> %134, <2 x double>* %118
%135 = call i32 (...) @rand()
%136 = sitofp i32 %135 to double
%137 = load i64, i64* @RAND_MAX
%138 = sitofp i64 %137 to double
%139 = fdiv double %136, %138
store double %139, double* %112
%140 = call i32 (...) @rand()
%141 = srem i32 %140, 3
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 %142
store double 1.000000e+00, double* %143
%144 = load <2 x double>, <2 x double>* %119
%145 = load double, double* %112
br label %148
146: ; preds = %121
store double 1.000000e+00, double* %110
br label %148
147: ; preds = %121
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %117
store double 1.000000e+00, double* %112
br label %148
148: ; preds = %147, %123, %146
%149 = phi double [ 1.000000e+00, %147 ], [ %145, %123 ], [ 0.000000e+00, %146 ]
%150 = phi <2 x double> [ <double 1.000000e+00, double 1.000000e+00>, %147 ], [ %144, %123 ], [ <double 1.000000e+00, double 0.000000e+00>, %146 ]
br label %151
151: ; preds = %148, %175
%152 = phi i32 [ 0, %148 ], [ %178, %175 ]
%153 = sitofp i32 %152 to double
%154 = insertelement <2 x double> poison, double %153, i64 0
%155 = shufflevector <2 x double> %154, <2 x double> poison, <2 x i32> zeroinitializer
%156 = fmul <2 x double> %150, %155
%157 = fdiv <2 x double> %156, <double 1.000000e+01, double 1.000000e+01>
%158 = fmul double %149, %153
%159 = fdiv double %158, 1.000000e+01
store <2 x double> %157, <2 x double>* %120
store double %159, double* %114
%160 = call double @csp3d_eval(double* %113, double** %16, i32* %52, double* %56, double** %108, i32* %115)
%161 = load i32, i32* @M_PI
%162 = fmul <2 x double> %157, %157
%163 = extractelement <2 x double> %162, i64 1
%164 = extractelement <2 x double> %157, i64 0
%165 = call double @llvm.fmuladd.f64(double %164, double %164, double %163)
%166 = call double @llvm.fmuladd.f64(double %159, double %159, double %165)
%167 = call i32 @sqrt(double %166)
%168 = mul nsw i32 %167, %161
%169 = sitofp i32 %168 to double
%170 = fmul double %169, 5.000000e-01
%171 = fcmp une double %170, 0.000000e+00
br i1 %171, label %172, label %175
172: ; preds = %151
%173 = call double @sin(double %170)
%174 = fdiv double %173, %170
br label %175
175: ; preds = %151, %172
%176 = phi double [ %174, %172 ], [ 1.000000e+00, %151 ]
%177 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), double %170, double %160, double %176)
%178 = add nuw nsw i32 %152, 1
%179 = icmp eq i32 %178, 101
br i1 %179, label %180, label %151
180: ; preds = %175
%181 = add nuw nsw i32 %122, 1
%182 = icmp eq i32 %181, 1002
br i1 %182, label %183, label %121
183: ; preds = %180
%184 = call i32 @free(double* %56)
%185 = call i32 @csp3d_close(double** %108)
br label %186
186: ; preds = %94, %183
%187 = phi i32 [ 1, %94 ], [ 0, %183 ]
ret i32 %187
}