#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double f_ana(double, double, int, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ free(double *);
double get_dx_from_bounds(double, double, int);
double lagrange_interp_1Dfo(double, int, double *, int, double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
void test_convergence_1d(int nx[4], int kx, int order) {
  FILE *fp;
  int i, j;
  int ky = 0;
  double y = 0;
  double dx;
  double *x[4];
  double *f[4];
  double *f_interp[3];
  double *f_error[3];
  printf("Testing 1D convergence\n");
  printf("Using frequency:\n\tk = %d\n", kx);
  printf("Using %d resolutions:\n", 3);
  printf("\tnx = [ ");
  for (i = 0; i < 3; i++) {
    printf("%d ", nx[i]);
  }
  printf("]\n");
  printf("And interpolating to a fine grid with:\n\tnx = %d\n", nx[4 - 1]);
  printf("Using convergence order:\n\tORDER = %d\n", order);
  printf("Generating grids\n");
  for (i = 0; i < 4; ++i) {
    x[i] = (double *)malloc(sizeof(double) * nx[i]);
    f[i] = (double *)malloc(sizeof(double) * nx[i]);
    dx = get_dx_from_bounds(-1.0 * 3.14159265358979323846,
                            3.14159265358979323846, nx[i]);
    for (int j = 0; j < nx[i]; ++j) {
      x[i][j] = -1.0 * 3.14159265358979323846 + j * dx;
      f[i][j] = f_ana(x[i][j], y, kx, ky);
    }
  }
  for (int i = 0; i < 3; i++) {
    f_interp[i] = (double *)malloc(sizeof(double) * nx[4 - 1]);
    f_error[i] = (double *)malloc(sizeof(double) * nx[4 - 1]);
  }
  printf("Interpolating and calculating error\n");
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < nx[4 - 1]; ++j) {
      f_interp[i][j] =
          lagrange_interp_1Dfo(x[4 - 1][j], order, x[i], nx[i], f[i]);
      f_error[i][j] = f_interp[i][j] - f[4 - 1][j];
    }
  }
  printf("Saving to text file\n");
  fp = fopen("convergence_slice.out", "w");
  fprintf(fp, "# X\tE(nx =");
  for (i = 0; i < 3; i++) {
    fprintf(fp, "\t%d", nx[i]);
  }
  fprintf(fp, " )\n");
  for (j = 0; j < nx[4 - 1]; j++) {
    fprintf(fp, "%lf", x[4 - 1][j]);
    for (i = 0; i < 3; ++i) {
      fprintf(fp, " %lf", f_error[i][j]);
    }
    fprintf(fp, "\n");
  }
  fclose(fp);
  printf("Cleaning up.\n");
  for (i = 0; i < 4; ++i) {
    free(x[i]);
    free(f[i]);
  }
  for (i = 0; i < 3; ++i) {
    free(f_interp[i]);
    free(f_error[i]);
  }
}


x86 assembly (clang, -O0):
<test_convergence_1d>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe68(%rip),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    122c <test_convergence_1d+0x9c>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11fb <test_convergence_1d+0x6b>
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%esi
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    139e <test_convergence_1d+0x20e>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movslq (%rax,%rcx,4),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,%rcx
movslq -0x1c(%rbp),%rax
mov    %rcx,-0x60(%rbp,%rax,8)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movslq (%rax,%rcx,4),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,%rcx
movslq -0x1c(%rbp),%rax
mov    %rcx,-0x80(%rbp,%rax,8)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
movsd  0xd28(%rip),%xmm0
movsd  0xd28(%rip),%xmm1
call   1030 <get_dx_from_bounds@plt>
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0xc4(%rbp)
mov    -0xc4(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    138b <test_convergence_1d+0x1fb>
cvtsi2sdl -0xc4(%rbp),%xmm0
ff
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xcdc(%rip),%xmm1
addsd  %xmm1,%xmm0
movslq -0x1c(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rax
movslq -0xc4(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movslq -0x1c(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rax
movslq -0xc4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x30(%rbp),%xmm1
mov    -0xc(%rbp),%edi
mov    -0x24(%rbp),%esi
call   10b0 <f_ana@plt>
movslq -0x1c(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rax
movslq -0xc4(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    12f4 <test_convergence_1d+0x164>
jmp    1390 <test_convergence_1d+0x200>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1275 <test_convergence_1d+0xe5>
movl   $0x0,-0xc8(%rbp)
cmpl   $0x3,-0xc8(%rbp)
jge    1413 <test_convergence_1d+0x283>
mov    -0x8(%rbp),%rax
movslq 0xc(%rax),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,%rcx
movslq -0xc8(%rbp),%rax
mov    %rcx,-0xa0(%rbp,%rax,8)
ff
mov    -0x8(%rbp),%rax
movslq 0xc(%rax),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,%rcx
movslq -0xc8(%rbp),%rax
mov    %rcx,-0xc0(%rbp,%rax,8)
ff
mov    -0xc8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc8(%rbp)
jmp    13a8 <test_convergence_1d+0x218>
lea    0xcb8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0xcc(%rbp)
cmpl   $0x3,-0xcc(%rbp)
jge    1521 <test_convergence_1d+0x391>
movl   $0x0,-0xd0(%rbp)
mov    -0xd0(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    0xc(%rcx),%eax
jge    1508 <test_convergence_1d+0x378>
mov    -0x48(%rbp),%rax
movslq -0xd0(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%edi
movslq -0xcc(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rsi
mov    -0x8(%rbp),%rax
movslq -0xcc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
movslq -0xcc(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rcx
call   10a0 <lagrange_interp_1Dfo@plt>
movslq -0xcc(%rbp),%rax
mov    -0xa0(%rbp,%rax,8),%rax
ff
movslq -0xd0(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movslq -0xcc(%rbp),%rax
mov    -0xa0(%rbp,%rax,8),%rax
ff
movslq -0xd0(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x68(%rbp),%rax
movslq -0xd0(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0xcc(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rax
ff
movslq -0xd0(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xd0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd0(%rbp)
jmp    1442 <test_convergence_1d+0x2b2>
jmp    150d <test_convergence_1d+0x37d>
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    142b <test_convergence_1d+0x29b>
lea    0xbcf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xbd6(%rip),%rdi
lea    0xbe5(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xbd3(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1594 <test_convergence_1d+0x404>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xbb0(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    155f <test_convergence_1d+0x3cf>
mov    -0x18(%rbp),%rdi
lea    0xb94(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    0xc(%rcx),%eax
jge    1642 <test_convergence_1d+0x4b2>
mov    -0x18(%rbp),%rdi
mov    -0x48(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xb63(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1622 <test_convergence_1d+0x492>
mov    -0x18(%rbp),%rdi
movslq -0x1c(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rax
ff
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xb2a(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    15e3 <test_convergence_1d+0x453>
mov    -0x18(%rbp),%rdi
lea    0xb08(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    15ad <test_convergence_1d+0x41d>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
lea    0xaea(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    1694 <test_convergence_1d+0x504>
movslq -0x1c(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rdi
call   1040 <free@plt>
movslq -0x1c(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rdi
call   1040 <free@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1660 <test_convergence_1d+0x4d0>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    16d5 <test_convergence_1d+0x545>
movslq -0x1c(%rbp),%rax
mov    -0xa0(%rbp,%rax,8),%rdi
ff
call   1040 <free@plt>
movslq -0x1c(%rbp),%rax
mov    -0xc0(%rbp,%rax,8),%rdi
ff
call   1040 <free@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    169b <test_convergence_1d+0x50b>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_convergence_1d>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %edx,%ebp
mov    %esi,%r14d
mov    %rdi,%r15
lea    0xef5(%rip),%rdi
call   1050 <puts@plt>
lea    0xe24(%rip),%rdi
xor    %r12d,%r12d
mov    %r14d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe2a(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe2e(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r15),%esi
lea    0xe26(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x4(%r15),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x8(%r15),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe9b(%rip),%rdi
call   1050 <puts@plt>
mov    0xc(%r15),%esi
lea    0xded(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe10(%rip),%rdi
mov    %ebp,0x2c(%rsp)
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe6b(%rip),%rdi
call   1050 <puts@plt>
jmp    129e <test_convergence_1d+0xde>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r12
cmp    $0x4,%r12
je     1346 <test_convergence_1d+0x186>
mov    (%r15,%r12,4),%edi
shl    $0x3,%edi
call   10a0 <malloc@plt>
mov    %rax,%r13
mov    %rax,0x80(%rsp,%r12,8)
mov    (%r15,%r12,4),%edi
shl    $0x3,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbp
mov    %rax,0x60(%rsp,%r12,8)
mov    (%r15,%r12,4),%edi
movsd  0xd2b(%rip),%xmm0
movsd  0xd2b(%rip),%xmm1
call   1030 <get_dx_from_bounds@plt>
cmpl   $0x0,(%r15,%r12,4)
jle    1290 <test_convergence_1d+0xd0>
movapd %xmm0,%xmm1
xor    %ebx,%ebx
movsd  %xmm0,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  %xmm1,%xmm0
addsd  0xced(%rip),%xmm0
movsd  %xmm0,0x0(%r13,%rbx,8)
xorpd  %xmm1,%xmm1
mov    %r14d,%edi
xor    %esi,%esi
call   10e0 <f_ana@plt>
movsd  0x8(%rsp),%xmm1
movsd  %xmm0,0x0(%rbp,%rbx,8)
add    $0x1,%rbx
movslq (%r15,%r12,4),%rax
cmp    %rax,%rbx
jl     1300 <test_convergence_1d+0x140>
jmp    1290 <test_convergence_1d+0xd0>
mov    0xc(%r15),%edi
shl    $0x3,%edi
call   10a0 <malloc@plt>
mov    %rax,0x50(%rsp)
mov    0xc(%r15),%edi
shl    $0x3,%edi
call   10a0 <malloc@plt>
mov    %rax,0x48(%rsp)
mov    0xc(%r15),%edi
shl    $0x3,%edi
call   10a0 <malloc@plt>
mov    %rax,0x40(%rsp)
mov    0xc(%r15),%edi
shl    $0x3,%edi
call   10a0 <malloc@plt>
mov    %rax,0x38(%rsp)
mov    0xc(%r15),%edi
shl    $0x3,%edi
call   10a0 <malloc@plt>
mov    %rax,%r14
mov    0xc(%r15),%edi
shl    $0x3,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
lea    0xd50(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdx
mov    0x98(%rsp),%rcx
mov    0x78(%rsp),%rax
mov    %rax,0x8(%rsp)
cmpl   $0x0,0xc(%r15)
mov    0x2c(%rsp),%ebx
mov    %r14,0x30(%rsp)
mov    %rdx,0x20(%rsp)
jle    1547 <test_convergence_1d+0x387>
mov    0x80(%rsp),%rax
mov    %rax,0x18(%rsp)
mov    0x60(%rsp),%rax
mov    %rax,0x10(%rsp)
xor    %r13d,%r13d
mov    0x48(%rsp),%r12
mov    0x50(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
movsd  (%rcx,%r13,8),%xmm0
mov    (%r15),%edx
mov    %rcx,%rbp
mov    %ebx,%edi
mov    0x18(%rsp),%rsi
mov    0x10(%rsp),%rcx
call   10c0 <lagrange_interp_1Dfo@plt>
mov    %rbp,%rcx
movsd  %xmm0,(%r14,%r13,8)
mov    0x8(%rsp),%rax
subsd  (%rax,%r13,8),%xmm0
movsd  %xmm0,(%r12,%r13,8)
add    $0x1,%r13
movslq 0xc(%r15),%rax
cmp    %rax,%r13
jl     1410 <test_convergence_1d+0x250>
test   %eax,%eax
jle    1547 <test_convergence_1d+0x387>
mov    %ebx,%esi
mov    0x88(%rsp),%rax
mov    %rax,0x18(%rsp)
mov    0x68(%rsp),%rax
mov    %rax,0x10(%rsp)
xor    %ebx,%ebx
mov    0x40(%rsp),%r14
mov    0x38(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rcx,%rbx,8),%xmm0
mov    0x4(%r15),%edx
mov    %esi,%r13d
mov    %esi,%edi
mov    0x18(%rsp),%rsi
mov    0x10(%rsp),%rcx
call   10c0 <lagrange_interp_1Dfo@plt>
mov    %r13d,%esi
mov    %rbp,%rcx
movsd  %xmm0,(%r14,%rbx,8)
mov    0x8(%rsp),%rax
subsd  (%rax,%rbx,8),%xmm0
movsd  %xmm0,(%r12,%rbx,8)
add    $0x1,%rbx
movslq 0xc(%r15),%rax
cmp    %rax,%rbx
jl     1490 <test_convergence_1d+0x2d0>
test   %eax,%eax
mov    0x30(%rsp),%r14
mov    0x20(%rsp),%rdx
jle    1547 <test_convergence_1d+0x387>
mov    0x90(%rsp),%rax
mov    %rax,0x18(%rsp)
mov    0x70(%rsp),%rax
mov    %rax,0x10(%rsp)
xor    %ebx,%ebx
nopl   (%rax)
movsd  (%rcx,%rbx,8),%xmm0
mov    %rdx,%r12
mov    0x8(%r15),%edx
mov    %r13d,%edi
mov    0x18(%rsp),%rsi
mov    0x10(%rsp),%rcx
call   10c0 <lagrange_interp_1Dfo@plt>
mov    %r12,%rdx
mov    %rbp,%rcx
movsd  %xmm0,(%r14,%rbx,8)
mov    0x8(%rsp),%rax
subsd  (%rax,%rbx,8),%xmm0
movsd  %xmm0,(%r12,%rbx,8)
add    $0x1,%rbx
movslq 0xc(%r15),%rax
cmp    %rax,%rbx
jl     1500 <test_convergence_1d+0x340>
mov    %rcx,0x58(%rsp)
lea    0xbd0(%rip),%rdi
call   1050 <puts@plt>
lea    0xb46(%rip),%rdi
lea    0xb55(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,%rbp
lea    0xb48(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   10d0 <fwrite@plt>
mov    (%r15),%edx
lea    0xb37(%rip),%rbx
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x4(%r15),%edx
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x8(%r15),%edx
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
lea    0xb05(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10d0 <fwrite@plt>
cmpl   $0x0,0xc(%r15)
mov    0x48(%rsp),%r14
mov    0x38(%rsp),%r12
jle    1674 <test_convergence_1d+0x4b4>
xor    %r13d,%r13d
lea    0xad8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    0x58(%rsp),%rax
movsd  (%rax,%r13,8),%xmm0
mov    %rbp,%rdi
lea    0xabc(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
movsd  (%r14,%r13,8),%xmm0
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
movsd  (%r12,%r13,8),%xmm0
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    0x20(%rsp),%rax
movsd  (%rax,%r13,8),%xmm0
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    $0xa,%edi
mov    %rbp,%rsi
call   1080 <fputc@plt>
add    $0x1,%r13
movslq 0xc(%r15),%rax
cmp    %rax,%r13
jl     1600 <test_convergence_1d+0x440>
mov    %rbp,%rdi
call   1060 <fclose@plt>
lea    0xab4(%rip),%rdi
call   1050 <puts@plt>
mov    0x80(%rsp),%rdi
call   1040 <free@plt>
mov    0x60(%rsp),%rdi
call   1040 <free@plt>
mov    0x88(%rsp),%rdi
call   1040 <free@plt>
mov    0x68(%rsp),%rdi
call   1040 <free@plt>
mov    0x90(%rsp),%rdi
call   1040 <free@plt>
mov    0x70(%rsp),%rdi
call   1040 <free@plt>
mov    0x58(%rsp),%rdi
call   1040 <free@plt>
mov    0x8(%rsp),%rdi
call   1040 <free@plt>
mov    0x50(%rsp),%rdi
call   1040 <free@plt>
mov    %r14,%rdi
call   1040 <free@plt>
mov    0x40(%rsp),%rdi
call   1040 <free@plt>
mov    %r12,%rdi
call   1040 <free@plt>
mov    0x30(%rsp),%rdi
call   1040 <free@plt>
mov    0x20(%rsp),%rdi
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <free@plt>

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

LLVM IR (-O2):
@.str.1 = [26 x i8] c"Using frequency:\0A\09k = %d\0A\00"
@.str.2 = [23 x i8] c"Using %d resolutions:\0A\00"
@.str.3 = [9 x i8] c"\09nx = [ \00"
@.str.4 = [4 x i8] c"%d \00"
@.str.6 = [49 x i8] c"And interpolating to a fine grid with:\0A\09nx = %d\0A\00"
@.str.7 = [38 x i8] c"Using convergence order:\0A\09ORDER = %d\0A\00"
@.str.11 = [22 x i8] c"convergence_slice.out\00"
@.str.12 = [2 x i8] c"w\00"
@.str.13 = [11 x i8] c"# X\09E(nx =\00"
@.str.14 = [4 x i8] c"\09%d\00"
@.str.15 = [4 x i8] c" )\0A\00"
@.str.16 = [4 x i8] c"%lf\00"
@.str.17 = [5 x i8] c" %lf\00"
@str = [23 x i8] c"Testing 1D convergence\00"
@str.20 = [2 x i8] c"]\00"
@str.21 = [17 x i8] c"Generating grids\00"
@str.22 = [36 x i8] c"Interpolating and calculating error\00"
@str.23 = [20 x i8] c"Saving to text file\00"
@str.24 = [13 x i8] c"Cleaning up.\00"
define void @test_convergence_1d(i32* nocapture %0, i32 %1, i32 %2) {
%4 = alloca [4 x double*]
%5 = alloca [4 x double*]
%6 = bitcast [4 x double*]* %4 to i8*
%7 = bitcast [4 x double*]* %5 to i8*
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 3)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%12 = load i32, i32* %0
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds i32, i32* %0, i64 1
%15 = load i32, i32* %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds i32, i32* %0, i64 2
%18 = load i32, i32* %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %18)
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.20, i64 0, i64 0))
%21 = getelementptr inbounds i32, i32* %0, i64 3
%22 = load i32, i32* %21
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0), i32 %22)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i32 %2)
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.21, i64 0, i64 0))
br label %26
26: ; preds = %3, %43
%27 = phi i64 [ 0, %3 ], [ %44, %43 ]
%28 = getelementptr inbounds i32, i32* %0, i64 %27
%29 = load i32, i32* %28
%30 = shl i32 %29, 3
%31 = tail call i64 @malloc(i32 %30)
%32 = inttoptr i64 %31 to double*
%33 = getelementptr inbounds [4 x double*], [4 x double*]* %4, i64 0, i64 %27
store double* %32, double** %33
%34 = load i32, i32* %28
%35 = shl i32 %34, 3
%36 = tail call i64 @malloc(i32 %35)
%37 = inttoptr i64 %36 to double*
%38 = getelementptr inbounds [4 x double*], [4 x double*]* %5, i64 0, i64 %27
store double* %37, double** %38
%39 = load i32, i32* %28
%40 = tail call double @get_dx_from_bounds(double 0xC00921FB54442D18, double 0x400921FB54442D18, i32 %39)
%41 = load i32, i32* %28
%42 = icmp sgt i32 %41, 0
br i1 %42, label %78, label %43
43: ; preds = %78, %26
%44 = add nuw nsw i64 %27, 1
%45 = icmp eq i64 %44, 4
br i1 %45, label %46, label %26
46: ; preds = %43
%47 = load i32, i32* %21
%48 = shl i32 %47, 3
%49 = tail call i64 @malloc(i32 %48)
%50 = inttoptr i64 %49 to double*
%51 = load i32, i32* %21
%52 = shl i32 %51, 3
%53 = tail call i64 @malloc(i32 %52)
%54 = inttoptr i64 %53 to double*
%55 = load i32, i32* %21
%56 = shl i32 %55, 3
%57 = tail call i64 @malloc(i32 %56)
%58 = inttoptr i64 %57 to double*
%59 = load i32, i32* %21
%60 = shl i32 %59, 3
%61 = tail call i64 @malloc(i32 %60)
%62 = inttoptr i64 %61 to double*
%63 = load i32, i32* %21
%64 = shl i32 %63, 3
%65 = tail call i64 @malloc(i32 %64)
%66 = inttoptr i64 %65 to double*
%67 = load i32, i32* %21
%68 = shl i32 %67, 3
%69 = tail call i64 @malloc(i32 %68)
%70 = inttoptr i64 %69 to double*
%71 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.22, i64 0, i64 0))
%72 = getelementptr inbounds [4 x double*], [4 x double*]* %4, i64 0, i64 3
%73 = load double*, double** %72
%74 = getelementptr inbounds [4 x double*], [4 x double*]* %5, i64 0, i64 3
%75 = load double*, double** %74
%76 = load i32, i32* %21
%77 = icmp sgt i32 %76, 0
br i1 %77, label %90, label %139
78: ; preds = %26, %78
%79 = phi i64 [ %86, %78 ], [ 0, %26 ]
%80 = trunc i64 %79 to i32
%81 = sitofp i32 %80 to double
%82 = tail call double @llvm.fmuladd.f64(double %81, double %40, double 0xC00921FB54442D18)
%83 = getelementptr inbounds double, double* %32, i64 %79
store double %82, double* %83
%84 = tail call double @f_ana(double %82, double 0.000000e+00, i32 %1, i32 0)
%85 = getelementptr inbounds double, double* %37, i64 %79
store double %84, double* %85
%86 = add nuw nsw i64 %79, 1
%87 = load i32, i32* %28
%88 = sext i32 %87 to i64
%89 = icmp slt i64 %86, %88
br i1 %89, label %78, label %43
90: ; preds = %46
%91 = getelementptr inbounds [4 x double*], [4 x double*]* %4, i64 0, i64 0
%92 = load double*, double** %91
%93 = getelementptr inbounds [4 x double*], [4 x double*]* %5, i64 0, i64 0
%94 = load double*, double** %93
br label %152
95: ; preds = %152
%96 = icmp sgt i32 %164, 0
br i1 %96, label %97, label %139
97: ; preds = %95
%98 = getelementptr inbounds [4 x double*], [4 x double*]* %4, i64 0, i64 1
%99 = load double*, double** %98
%100 = getelementptr inbounds [4 x double*], [4 x double*]* %5, i64 0, i64 1
%101 = load double*, double** %100
br label %102
102: ; preds = %102, %97
%103 = phi i64 [ 0, %97 ], [ %113, %102 ]
%104 = getelementptr inbounds double, double* %73, i64 %103
%105 = load double, double* %104
%106 = load i32, i32* %14
%107 = tail call double @lagrange_interp_1Dfo(double %105, i32 %2, double* %99, i32 %106, double* %101)
%108 = getelementptr inbounds double, double* %58, i64 %103
store double %107, double* %108
%109 = getelementptr inbounds double, double* %75, i64 %103
%110 = load double, double* %109
%111 = fsub double %107, %110
%112 = getelementptr inbounds double, double* %62, i64 %103
store double %111, double* %112
%113 = add nuw nsw i64 %103, 1
%114 = load i32, i32* %21
%115 = sext i32 %114 to i64
%116 = icmp slt i64 %113, %115
br i1 %116, label %102, label %117
117: ; preds = %102
%118 = icmp sgt i32 %114, 0
br i1 %118, label %119, label %139
119: ; preds = %117
%120 = getelementptr inbounds [4 x double*], [4 x double*]* %4, i64 0, i64 2
%121 = load double*, double** %120
%122 = getelementptr inbounds [4 x double*], [4 x double*]* %5, i64 0, i64 2
%123 = load double*, double** %122
br label %124
124: ; preds = %124, %119
%125 = phi i64 [ 0, %119 ], [ %135, %124 ]
%126 = getelementptr inbounds double, double* %73, i64 %125
%127 = load double, double* %126
%128 = load i32, i32* %17
%129 = tail call double @lagrange_interp_1Dfo(double %127, i32 %2, double* %121, i32 %128, double* %123)
%130 = getelementptr inbounds double, double* %66, i64 %125
store double %129, double* %130
%131 = getelementptr inbounds double, double* %75, i64 %125
%132 = load double, double* %131
%133 = fsub double %129, %132
%134 = getelementptr inbounds double, double* %70, i64 %125
store double %133, double* %134
%135 = add nuw nsw i64 %125, 1
%136 = load i32, i32* %21
%137 = sext i32 %136 to i64
%138 = icmp slt i64 %135, %137
br i1 %138, label %124, label %139
139: ; preds = %124, %46, %95, %117
%140 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.23, i64 0, i64 0))
%141 = tail call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%142 = tail call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i64 10, i64 1, i32* %141)
%143 = load i32, i32* %0
%144 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %141, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i32 %143)
%145 = load i32, i32* %14
%146 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %141, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i32 %145)
%147 = load i32, i32* %17
%148 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %141, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i32 %147)
%149 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i64 3, i64 1, i32* %141)
%150 = load i32, i32* %21
%151 = icmp sgt i32 %150, 0
br i1 %151, label %167, label %186
152: ; preds = %90, %152
%153 = phi i64 [ 0, %90 ], [ %163, %152 ]
%154 = getelementptr inbounds double, double* %73, i64 %153
%155 = load double, double* %154
%156 = load i32, i32* %0
%157 = tail call double @lagrange_interp_1Dfo(double %155, i32 %2, double* %92, i32 %156, double* %94)
%158 = getelementptr inbounds double, double* %50, i64 %153
store double %157, double* %158
%159 = getelementptr inbounds double, double* %75, i64 %153
%160 = load double, double* %159
%161 = fsub double %157, %160
%162 = getelementptr inbounds double, double* %54, i64 %153
store double %161, double* %162
%163 = add nuw nsw i64 %153, 1
%164 = load i32, i32* %21
%165 = sext i32 %164 to i64
%166 = icmp slt i64 %163, %165
br i1 %166, label %152, label %95
167: ; preds = %139, %167
%168 = phi i64 [ %182, %167 ], [ 0, %139 ]
%169 = getelementptr inbounds double, double* %73, i64 %168
%170 = load double, double* %169
%171 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %141, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), double %170)
%172 = getelementptr inbounds double, double* %54, i64 %168
%173 = load double, double* %172
%174 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %141, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), double %173)
%175 = getelementptr inbounds double, double* %62, i64 %168
%176 = load double, double* %175
%177 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %141, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), double %176)
%178 = getelementptr inbounds double, double* %70, i64 %168
%179 = load double, double* %178
%180 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %141, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0), double %179)
%181 = tail call i32 @fputc(i32 10, i32* %141)
%182 = add nuw nsw i64 %168, 1
%183 = load i32, i32* %21
%184 = sext i32 %183 to i64
%185 = icmp slt i64 %182, %184
br i1 %185, label %167, label %186
186: ; preds = %167, %139
%187 = tail call i32 @fclose(i32* %141)
%188 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.24, i64 0, i64 0))
%189 = getelementptr inbounds [4 x double*], [4 x double*]* %4, i64 0, i64 0
%190 = load double*, double** %189
%191 = tail call i32 @free(double* %190)
%192 = getelementptr inbounds [4 x double*], [4 x double*]* %5, i64 0, i64 0
%193 = load double*, double** %192
%194 = tail call i32 @free(double* %193)
%195 = getelementptr inbounds [4 x double*], [4 x double*]* %4, i64 0, i64 1
%196 = load double*, double** %195
%197 = tail call i32 @free(double* %196)
%198 = getelementptr inbounds [4 x double*], [4 x double*]* %5, i64 0, i64 1
%199 = load double*, double** %198
%200 = tail call i32 @free(double* %199)
%201 = getelementptr inbounds [4 x double*], [4 x double*]* %4, i64 0, i64 2
%202 = load double*, double** %201
%203 = tail call i32 @free(double* %202)
%204 = getelementptr inbounds [4 x double*], [4 x double*]* %5, i64 0, i64 2
%205 = load double*, double** %204
%206 = tail call i32 @free(double* %205)
%207 = tail call i32 @free(double* %73)
%208 = tail call i32 @free(double* %75)
%209 = tail call i32 @free(double* %50)
%210 = tail call i32 @free(double* %54)
%211 = tail call i32 @free(double* %58)
%212 = tail call i32 @free(double* %62)
%213 = tail call i32 @free(double* %66)
%214 = tail call i32 @free(double* %70)
ret void
}