void gauss_legendre_tbl(int n, double *x, double *w) {
  const double pi = 3.141592653589793238462643383279502884197;
  const double eps = 3e-14;
  int m = (n + 1) >> 1;
  double t0 = 1 - (1 - 1. / n) / (8. * n * n);
  double t1 = 1. / (4. * n + 2.);
#pragma omp parallel
  {
    int i;
#pragma omp for schedule(dynamic, 100)
    for (i = 1; i <= m; ++i) {
      double x0 = cos(pi * ((i << 2) - 1) * t1) * t0;
      int dobreak = 0;
      int j = 0;
      double dpdx;
      while (1) {
        double P_1 = 1.0;
        double P0 = x0;
        double dx, x1;
        for (int k = 2; k <= n; k++) {
          double P_2 = P_1;
          P_1 = P0;
          P0 = x0 * P_1 + (k - 1.) / k * (x0 * P_1 - P_2);
        }
        dpdx = (P_1 - x0 * P0) * n / one_minus_x2(x0);
        x1 = x0 - P0 / dpdx;
        dx = x0 - x1;
        x0 = x1;
        if (dobreak)
          break;
        if (fabs(dx) <= eps)
          dobreak = 1;
        if (!(++j < 100))
          util_fail_(
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/astro-informatics/uber3d/refs/heads/"
              "master/src/cxx/libsharp/sharp_geomhelpers.c",
              148, __func__, "convergence problem");
      }
      x[i - 1] = -x0;
      x[n - i] = x0;
      w[i - 1] = w[n - i] = 2. / (one_minus_x2(x0) * dpdx * dpdx);
    }
  }
}


x86 assembly (clang, -O0):
<gauss_legendre_tbl>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  0xeda(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xec5(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
sar    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xe87(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  0xe7b(%rip),%xmm1
subsd  %xmm0,%xmm1
cvtsi2sdl -0x4(%rbp),%xmm2
movsd  0xe82(%rip),%xmm0
mulsd  %xmm2,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm2
mulsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  0xe51(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xe43(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe3f(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe23(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x1,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jg     1499 <gauss_legendre_tbl+0x369>
mov    -0x44(%rbp),%eax
shl    $0x2,%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe1a(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x40(%rbp),%xmm0
call   1040 <cos@plt>
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
movsd  0xdc4(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x2,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     12fb <gauss_legendre_tbl+0x1cb>
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm2
cvtsi2sdl -0x84(%rbp),%xmm1
ff
movsd  0xd6b(%rip),%xmm3
subsd  %xmm3,%xmm1
cvtsi2sdl -0x84(%rbp),%xmm3
ff
divsd  %xmm3,%xmm1
movsd  -0x50(%rbp),%xmm3
movsd  -0x68(%rbp),%xmm5
movsd  -0x90(%rbp),%xmm4
ff
movq   %xmm4,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm4
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1255 <gauss_legendre_tbl+0x125>
movsd  -0x68(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
mov    $0x1,%al
call   1050 <one_minus_x2@plt>
movsd  -0x98(%rbp),%xmm0
ff
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
divsd  -0x60(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x50(%rbp),%xmm0
subsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
cmpl   $0x0,-0x54(%rbp)
je     139b <gauss_legendre_tbl+0x26b>
jmp    13fc <gauss_legendre_tbl+0x2cc>
movsd  -0x78(%rbp),%xmm1
movaps 0xc89(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xc6d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     13c4 <gauss_legendre_tbl+0x294>
movl   $0x1,-0x54(%rbp)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
cmp    $0x64,%eax
jl     13f7 <gauss_legendre_tbl+0x2c7>
lea    0xc63(%rip),%rdi
mov    $0x94,%esi
lea    0xd01(%rip),%rdx
lea    0xd0d(%rip),%rcx
mov    $0x0,%al
call   1030 <util_fail_@plt>
jmp    1234 <gauss_legendre_tbl+0x104>
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    -0x44(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x50(%rbp),%xmm0
mov    $0x1,%al
call   1050 <one_minus_x2@plt>
cvtsi2sd %eax,%xmm1
mulsd  -0x60(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
movsd  0xbad(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    -0x44(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11ed <gauss_legendre_tbl+0xbd>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gauss_legendre_tbl>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rdx,0x40(%rsp)
mov    %rsi,0x38(%rsp)
test   %edi,%edi
jle    145b <gauss_legendre_tbl+0x32b>
mov    %edi,%ebx
cvtsi2sd %edi,%xmm1
movsd  0xea2(%rip),%xmm2
movapd %xmm2,%xmm0
divsd  %xmm1,%xmm0
movapd %xmm2,%xmm3
subsd  %xmm0,%xmm3
movsd  0xe92(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
divsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
movsd  %xmm3,0x30(%rsp)
movsd  0xe7c(%rip),%xmm0
movsd  %xmm1,0x50(%rsp)
mulsd  %xmm1,%xmm0
addsd  0xe72(%rip),%xmm0
divsd  %xmm0,%xmm2
movsd  %xmm2,0x28(%rsp)
lea    0x1(%rbx),%eax
sar    %eax
mov    %edi,%ecx
mov    %rcx,0x20(%rsp)
cmp    $0x2,%eax
mov    $0x1,%ecx
cmovge %eax,%ecx
add    $0x1,%ecx
mov    %rcx,0x18(%rsp)
lea    -0x1(%rbx),%r15d
mov    %r15d,%r14d
and    $0xfffffffe,%r14d
mov    $0x1,%ebp
jmp    126a <gauss_legendre_tbl+0x13a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movapd %xmm3,%xmm0
xorpd  0xe54(%rip),%xmm0
mov    0x38(%rsp),%rax
mov    0x48(%rsp),%rbp
movlpd %xmm0,-0x8(%rax,%rbp,8)
mov    0x20(%rsp),%r12
sub    %rbp,%r12
movsd  %xmm3,(%rax,%r12,8)
movapd %xmm3,%xmm0
mov    $0x1,%al
movsd  %xmm2,(%rsp)
call   1050 <one_minus_x2@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xdd2(%rip),%xmm1
divsd  %xmm0,%xmm1
mov    0x40(%rsp),%rax
movsd  %xmm1,(%rax,%r12,8)
movsd  %xmm1,-0x8(%rax,%rbp,8)
add    $0x1,%rbp
cmp    0x18(%rsp),%rbp
je     145b <gauss_legendre_tbl+0x32b>
mov    %rbp,0x48(%rsp)
lea    -0x1(,%rbp,4),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xd9b(%rip),%xmm0
mulsd  0x28(%rsp),%xmm0
call   1040 <cos@plt>
movapd %xmm0,%xmm4
mulsd  0x30(%rsp),%xmm4
xor    %ebp,%ebp
xor    %r13d,%r13d
nop
movsd  0xd58(%rip),%xmm5
movapd %xmm4,%xmm6
cmp    $0x1,%ebx
je     1398 <gauss_legendre_tbl+0x268>
mov    $0x2,%eax
movapd %xmm4,%xmm6
movsd  0xd3a(%rip),%xmm5
cmp    $0x2,%ebx
movsd  0xd57(%rip),%xmm3
je     135b <gauss_legendre_tbl+0x22b>
mov    $0x2,%eax
movapd %xmm4,%xmm6
movsd  0xd18(%rip),%xmm5
nopl   0x0(%rax,%rax,1)
mov    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd %xmm0,%xmm1
addsd  %xmm3,%xmm1
divsd  %xmm0,%xmm1
movapd %xmm4,%xmm0
mulsd  %xmm6,%xmm0
movapd %xmm0,%xmm2
subsd  %xmm5,%xmm2
mulsd  %xmm1,%xmm2
movapd %xmm2,%xmm5
addsd  %xmm0,%xmm5
lea    0x1(%rcx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd %xmm0,%xmm1
addsd  %xmm3,%xmm1
divsd  %xmm0,%xmm1
movapd %xmm4,%xmm0
mulsd  %xmm5,%xmm0
movapd %xmm0,%xmm2
subsd  %xmm6,%xmm2
mulsd  %xmm1,%xmm2
movapd %xmm2,%xmm6
addsd  %xmm0,%xmm6
lea    0x2(%rcx),%eax
cmp    %r14d,%ecx
jne    12f0 <gauss_legendre_tbl+0x1c0>
test   $0x1,%r15b
je     1398 <gauss_legendre_tbl+0x268>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd %xmm0,%xmm1
addsd  0xcb4(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm4,%xmm0
mulsd  %xmm6,%xmm0
movapd %xmm0,%xmm2
subsd  %xmm5,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movapd %xmm6,%xmm5
movapd %xmm2,%xmm6
movsd  %xmm6,0x58(%rsp)
movapd %xmm4,%xmm0
mulsd  %xmm6,%xmm0
subsd  %xmm0,%xmm5
mulsd  0x50(%rsp),%xmm5
movsd  %xmm5,(%rsp)
movapd %xmm4,%xmm0
mov    $0x1,%al
movapd %xmm4,0x60(%rsp)
call   1050 <one_minus_x2@plt>
movsd  (%rsp),%xmm2
movapd 0x60(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  %xmm0,%xmm2
movsd  0x58(%rsp),%xmm0
divsd  %xmm2,%xmm0
movapd %xmm1,%xmm3
subsd  %xmm0,%xmm3
test   $0x1,%r13b
jne    11f0 <gauss_legendre_tbl+0xc0>
subsd  %xmm3,%xmm1
andpd  0xc3c(%rip),%xmm1
movsd  0xc24(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %r13b
lea    0x1(%rbp),%r12d
movapd %xmm3,%xmm4
cmp    $0x63,%ebp
mov    %r12d,%ebp
jb     12a0 <gauss_legendre_tbl+0x170>
lea    0xc31(%rip),%rdi
mov    $0x94,%esi
lea    0xccf(%rip),%rdx
lea    0xcdb(%rip),%rcx
xor    %eax,%eax
movapd %xmm3,(%rsp)
call   1030 <util_fail_@plt>
mov    %r12d,%ebp
movapd (%rsp),%xmm4
jmp    12a0 <gauss_legendre_tbl+0x170>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [170 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/astro-informatics/uber3d/refs/heads/master/src/cxx/libsharp/sharp_geomhelpers.c\00"
@__func__.gauss_legendre_tbl = [19 x i8] c"gauss_legendre_tbl\00"
@.str.1 = [20 x i8] c"convergence problem\00"
define void @gauss_legendre_tbl(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca double
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca i32
%22 = alloca double
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
store double 0x400921FB54442D18, double* %7
store double 3.000000e-14, double* %8
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
%25 = ashr i32 %24, 1
store i32 %25, i32* %9
%26 = load i32, i32* %4
%27 = sitofp i32 %26 to double
%28 = fdiv double 1.000000e+00, %27
%29 = fsub double 1.000000e+00, %28
%30 = load i32, i32* %4
%31 = sitofp i32 %30 to double
%32 = fmul double 8.000000e+00, %31
%33 = load i32, i32* %4
%34 = sitofp i32 %33 to double
%35 = fmul double %32, %34
%36 = fdiv double %29, %35
%37 = fsub double 1.000000e+00, %36
store double %37, double* %10
%38 = load i32, i32* %4
%39 = sitofp i32 %38 to double
%40 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %39, double 2.000000e+00)
%41 = fdiv double 1.000000e+00, %40
store double %41, double* %11
store i32 1, i32* %12
br label %42
42: ; preds = %155, %3
%43 = load i32, i32* %12
%44 = load i32, i32* %9
%45 = icmp sle i32 %43, %44
br i1 %45, label %46, label %158
46: ; preds = %42
%47 = load i32, i32* %12
%48 = shl i32 %47, 2
%49 = sub nsw i32 %48, 1
%50 = sitofp i32 %49 to double
%51 = fmul double 0x400921FB54442D18, %50
%52 = load double, double* %11
%53 = fmul double %51, %52
%54 = call double @cos(double %53)
%55 = load double, double* %10
%56 = fmul double %54, %55
store double %56, double* %13
store i32 0, i32* %14
store i32 0, i32* %15
br label %57
57: ; preds = %46, %120
store double 1.000000e+00, double* %17
%58 = load double, double* %13
store double %58, double* %18
store i32 2, i32* %21
br label %59
59: ; preds = %81, %57
%60 = load i32, i32* %21
%61 = load i32, i32* %4
%62 = icmp sle i32 %60, %61
br i1 %62, label %63, label %84
63: ; preds = %59
%64 = load double, double* %17
store double %64, double* %22
%65 = load double, double* %18
store double %65, double* %17
%66 = load double, double* %13
%67 = load double, double* %17
%68 = load i32, i32* %21
%69 = sitofp i32 %68 to double
%70 = fsub double %69, 1.000000e+00
%71 = load i32, i32* %21
%72 = sitofp i32 %71 to double
%73 = fdiv double %70, %72
%74 = load double, double* %13
%75 = load double, double* %17
%76 = load double, double* %22
%77 = fneg double %76
%78 = call double @llvm.fmuladd.f64(double %74, double %75, double %77)
%79 = fmul double %73, %78
%80 = call double @llvm.fmuladd.f64(double %66, double %67, double %79)
store double %80, double* %18
br label %81
81: ; preds = %63
%82 = load i32, i32* %21
%83 = add nsw i32 %82, 1
store i32 %83, i32* %21
br label %59
84: ; preds = %59
%85 = load double, double* %17
%86 = load double, double* %13
%87 = load double, double* %18
%88 = fneg double %86
%89 = call double @llvm.fmuladd.f64(double %88, double %87, double %85)
%90 = load i32, i32* %4
%91 = sitofp i32 %90 to double
%92 = fmul double %89, %91
%93 = load double, double* %13
%94 = call i32 (double, ...) bitcast (i32 (...)* @one_minus_x2 to i32 (double, ...)*)(double %93)
%95 = sitofp i32 %94 to double
%96 = fdiv double %92, %95
store double %96, double* %16
%97 = load double, double* %13
%98 = load double, double* %18
%99 = load double, double* %16
%100 = fdiv double %98, %99
%101 = fsub double %97, %100
store double %101, double* %20
%102 = load double, double* %13
%103 = load double, double* %20
%104 = fsub double %102, %103
store double %104, double* %19
%105 = load double, double* %20
store double %105, double* %13
%106 = load i32, i32* %14
%107 = icmp ne i32 %106, 0
br i1 %107, label %108, label %109
108: ; preds = %84
br label %121
109: ; preds = %84
%110 = load double, double* %19
%111 = call double @llvm.fabs.f64(double %110)
%112 = fcmp ole double %111, 3.000000e-14
br i1 %112, label %113, label %114
113: ; preds = %109
store i32 1, i32* %14
br label %114
114: ; preds = %113, %109
%115 = load i32, i32* %15
%116 = add nsw i32 %115, 1
store i32 %116, i32* %15
%117 = icmp slt i32 %116, 100
br i1 %117, label %120, label %118
118: ; preds = %114
%119 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @util_fail_ to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str, i64 0, i64 0), i32 148, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__func__.gauss_legendre_tbl, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %120
120: ; preds = %118, %114
br label %57
121: ; preds = %108
%122 = load double, double* %13
%123 = fneg double %122
%124 = load double*, double** %5
%125 = load i32, i32* %12
%126 = sub nsw i32 %125, 1
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds double, double* %124, i64 %127
store double %123, double* %128
%129 = load double, double* %13
%130 = load double*, double** %5
%131 = load i32, i32* %4
%132 = load i32, i32* %12
%133 = sub nsw i32 %131, %132
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds double, double* %130, i64 %134
store double %129, double* %135
%136 = load double, double* %13
%137 = call i32 (double, ...) bitcast (i32 (...)* @one_minus_x2 to i32 (double, ...)*)(double %136)
%138 = sitofp i32 %137 to double
%139 = load double, double* %16
%140 = fmul double %138, %139
%141 = load double, double* %16
%142 = fmul double %140, %141
%143 = fdiv double 2.000000e+00, %142
%144 = load double*, double** %6
%145 = load i32, i32* %4
%146 = load i32, i32* %12
%147 = sub nsw i32 %145, %146
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds double, double* %144, i64 %148
store double %143, double* %149
%150 = load double*, double** %6
%151 = load i32, i32* %12
%152 = sub nsw i32 %151, 1
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds double, double* %150, i64 %153
store double %143, double* %154
br label %155
155: ; preds = %121
%156 = load i32, i32* %12
%157 = add nsw i32 %156, 1
store i32 %157, i32* %12
br label %42
158: ; preds = %42
ret void
}

LLVM IR (-O2):
@.str = [170 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/astro-informatics/uber3d/refs/heads/master/src/cxx/libsharp/sharp_geomhelpers.c\00"
@__func__.gauss_legendre_tbl = [19 x i8] c"gauss_legendre_tbl\00"
@.str.1 = [20 x i8] c"convergence problem\00"
define void @gauss_legendre_tbl(i32 %0, double* nocapture writeonly %1, double* nocapture writeonly %2) {
%4 = sitofp i32 %0 to double
%5 = fdiv double 1.000000e+00, %4
%6 = fsub double 1.000000e+00, %5
%7 = fmul double %4, 8.000000e+00
%8 = fmul double %7, %4
%9 = fdiv double %6, %8
%10 = fsub double 1.000000e+00, %9
%11 = tail call double @llvm.fmuladd.f64(double %4, double 4.000000e+00, double 2.000000e+00)
%12 = fdiv double 1.000000e+00, %11
%13 = icmp slt i32 %0, 1
br i1 %13, label %112, label %14
14: ; preds = %3
%15 = add nuw i32 %0, 1
%16 = ashr i32 %15, 1
%17 = zext i32 %0 to i64
%18 = call i32 @llvm.smax.i32(i32 %16, i32 1)
%19 = add nuw nsw i32 %18, 1
%20 = zext i32 %19 to i64
%21 = add i32 %0, -1
%22 = and i32 %21, 1
%23 = icmp eq i32 %0, 2
%24 = and i32 %21, -2
%25 = icmp eq i32 %22, 0
br label %26
26: ; preds = %14, %97
%27 = phi i64 [ 1, %14 ], [ %110, %97 ]
%28 = trunc i64 %27 to i32
%29 = shl i32 %28, 2
%30 = add i32 %29, -1
%31 = sitofp i32 %30 to double
%32 = fmul double %31, 0x400921FB54442D18
%33 = fmul double %12, %32
%34 = tail call double @cos(double %33)
%35 = fmul double %10, %34
br label %36
36: ; preds = %94, %26
%37 = phi i32 [ 0, %26 ], [ %92, %94 ]
%38 = phi i1 [ false, %26 ], [ %91, %94 ]
%39 = phi double [ %35, %26 ], [ %64, %94 ]
switch i32 %0, label %65 [
i32 1, label %54
i32 2, label %40
]
40: ; preds = %65, %36
%41 = phi double [ undef, %36 ], [ %76, %65 ]
%42 = phi double [ undef, %36 ], [ %84, %65 ]
%43 = phi i32 [ 2, %36 ], [ %85, %65 ]
%44 = phi double [ %39, %36 ], [ %84, %65 ]
%45 = phi double [ 1.000000e+00, %36 ], [ %76, %65 ]
br i1 %25, label %54, label %46
46: ; preds = %40
%47 = sitofp i32 %43 to double
%48 = fadd double %47, -1.000000e+00
%49 = fdiv double %48, %47
%50 = fneg double %45
%51 = tail call double @llvm.fmuladd.f64(double %39, double %44, double %50)
%52 = fmul double %51, %49
%53 = tail call double @llvm.fmuladd.f64(double %39, double %44, double %52)
br label %54
54: ; preds = %46, %40, %36
%55 = phi double [ 1.000000e+00, %36 ], [ %41, %40 ], [ %44, %46 ]
%56 = phi double [ %39, %36 ], [ %42, %40 ], [ %53, %46 ]
%57 = fneg double %39
%58 = tail call double @llvm.fmuladd.f64(double %57, double %56, double %55)
%59 = fmul double %58, %4
%60 = tail call i32 (double, ...) bitcast (i32 (...)* @one_minus_x2 to i32 (double, ...)*)(double %39)
%61 = sitofp i32 %60 to double
%62 = fdiv double %59, %61
%63 = fdiv double %56, %62
%64 = fsub double %39, %63
br i1 %38, label %97, label %88
65: ; preds = %36, %65
%66 = phi i32 [ %85, %65 ], [ 2, %36 ]
%67 = phi double [ %84, %65 ], [ %39, %36 ]
%68 = phi double [ %76, %65 ], [ 1.000000e+00, %36 ]
%69 = phi i32 [ %86, %65 ], [ 0, %36 ]
%70 = sitofp i32 %66 to double
%71 = fadd double %70, -1.000000e+00
%72 = fdiv double %71, %70
%73 = fneg double %68
%74 = tail call double @llvm.fmuladd.f64(double %39, double %67, double %73)
%75 = fmul double %74, %72
%76 = tail call double @llvm.fmuladd.f64(double %39, double %67, double %75)
%77 = or i32 %66, 1
%78 = sitofp i32 %77 to double
%79 = fadd double %78, -1.000000e+00
%80 = fdiv double %79, %78
%81 = fneg double %67
%82 = tail call double @llvm.fmuladd.f64(double %39, double %76, double %81)
%83 = fmul double %82, %80
%84 = tail call double @llvm.fmuladd.f64(double %39, double %76, double %83)
%85 = add nuw i32 %66, 2
%86 = add i32 %69, 2
%87 = icmp eq i32 %86, %24
br i1 %87, label %40, label %65
88: ; preds = %54
%89 = fsub double %39, %64
%90 = tail call double @llvm.fabs.f64(double %89)
%91 = fcmp ole double %90, 3.000000e-14
%92 = add nuw nsw i32 %37, 1
%93 = icmp ult i32 %37, 99
br i1 %93, label %94, label %95
94: ; preds = %88, %95
br label %36
95: ; preds = %88
%96 = tail call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @util_fail_ to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str, i64 0, i64 0), i32 148, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__func__.gauss_legendre_tbl, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %94
97: ; preds = %54
%98 = fneg double %64
%99 = add nsw i64 %27, -1
%100 = getelementptr inbounds double, double* %1, i64 %99
store double %98, double* %100
%101 = sub nsw i64 %17, %27
%102 = getelementptr inbounds double, double* %1, i64 %101
store double %64, double* %102
%103 = tail call i32 (double, ...) bitcast (i32 (...)* @one_minus_x2 to i32 (double, ...)*)(double %64)
%104 = sitofp i32 %103 to double
%105 = fmul double %62, %104
%106 = fmul double %62, %105
%107 = fdiv double 2.000000e+00, %106
%108 = getelementptr inbounds double, double* %2, i64 %101
store double %107, double* %108
%109 = getelementptr inbounds double, double* %2, i64 %99
store double %107, double* %109
%110 = add nuw nsw i64 %27, 1
%111 = icmp eq i64 %110, %20
br i1 %111, label %112, label %26
112: ; preds = %97, %3
ret void
}