#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double cos(double);
double exp(int /*<<< orphan*/);
double exppart(double *, double *, double *, double *, int);
int /*<<< orphan*/ normpart(double *, double *, double *, int);
double round(double);
double sin(double);
void finite_sum_without_derivatives(double *fsum_real, double *fsum_imag,
                                    double *X, double *Yinv, double *T,
                                    double *x, double *y, double *S, int g,
                                    int N) {
  int k, j;
  double shift[g];
  double intshift[g];
  double fracshift[g];
  double sum;
  for (k = 0; k < g; k++) {
    sum = 0;
    for (j = 0; j < g; j++)
      sum += Yinv[k * g + j] * y[j];
    shift[k] = sum;
  }
  for (k = 0; k < g; k++) {
    intshift[k] = round(shift[k]);
    fracshift[k] = shift[k] - intshift[k];
  }
  double real_total = 0, imag_total = 0;
  double ept, npt, cpt, spt;
  double *n;
  for (k = 0; k < N; k++) {
    n = S + k * g;
    ept = exppart(n, X, x, intshift, g);
    npt = exp(normpart(n, T, fracshift, g));
    cpt = npt * cos(ept);
    spt = npt * sin(ept);
    real_total += cpt;
    imag_total += spt;
  }
  fsum_real[0] = real_total;
  fsum_imag[0] = imag_total;
}


x86 assembly (clang, -O0):
<finite_sum_without_derivatives>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0x20(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    0x20(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x50(%rbp)
mov    0x20(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    0x20(%rbp),%eax
jge    1295 <finite_sum_without_derivatives+0x135>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    0x20(%rbp),%eax
jge    1272 <finite_sum_without_derivatives+0x112>
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   0x20(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1223 <finite_sum_without_derivatives+0xc3>
mov    -0xb0(%rbp),%rax
movsd  -0x60(%rbp),%xmm0
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1208 <finite_sum_without_derivatives+0xa8>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    0x20(%rbp),%eax
jge    1304 <finite_sum_without_derivatives+0x1a4>
mov    -0xb0(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1070 <round@plt>
mov    -0xb0(%rbp),%rdx
mov    -0xa8(%rbp),%rcx
mov    -0xa0(%rbp),%rax
movslq -0x34(%rbp),%rsi
movsd  %xmm0,(%rcx,%rsi,8)
movslq -0x34(%rbp),%rsi
movsd  (%rdx,%rsi,8),%xmm0
movslq -0x34(%rbp),%rdx
subsd  (%rcx,%rdx,8),%xmm0
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    129c <finite_sum_without_derivatives+0x13c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    0x28(%rbp),%eax
jge    141b <finite_sum_without_derivatives+0x2bb>
mov    -0xa8(%rbp),%rcx
mov    0x18(%rbp),%rax
mov    -0x34(%rbp),%edx
imul   0x20(%rbp),%edx
movslq %edx,%rdx
shl    $0x3,%rdx
add    %rdx,%rax
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    0x20(%rbp),%r8d
call   1030 <exppart@plt>
mov    -0xa0(%rbp),%rdx
movsd  %xmm0,-0x78(%rbp)
mov    -0x98(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    0x20(%rbp),%ecx
call   1080 <normpart@plt>
mov    %eax,%edi
call   1050 <exp@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    131b <finite_sum_without_derivatives+0x1bb>
movsd  -0x68(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x70(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<finite_sum_without_derivatives>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9,%r14
mov    %r8,-0x98(%rbp)
mov    %rdx,%r15
mov    %rsi,-0x90(%rbp)
mov    %rdi,-0x88(%rbp)
mov    0x20(%rbp),%edx
mov    %rsp,%r13
lea    0xf(,%rdx,8),%rsi
and    $0xfffffffffffffff0,%rsi
sub    %rsi,%r13
mov    %r13,%rsp
mov    %rsp,%rax
sub    %rsi,%rax
mov    %rax,%rsp
mov    %rsp,%rdi
sub    %rsi,%rdi
mov    %rdi,%rsp
test   %edx,%edx
mov    %rax,-0x48(%rbp)
mov    %r9,-0xa0(%rbp)
jle    1438 <finite_sum_without_derivatives+0x2d8>
mov    %rdi,-0x30(%rbp)
mov    0x10(%rbp),%rax
lea    -0x1(%rdx),%r8
mov    %edx,%r14d
and    $0x3,%r14d
mov    %edx,%r11d
and    $0xfffffffc,%r11d
lea    0x18(%rcx),%rbx
lea    0x0(,%rdx,8),%r9
xor    %r10d,%r10d
jmp    121d <finite_sum_without_derivatives+0xbd>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  %xmm0,0x0(%r13,%r10,8)
add    $0x1,%r10
add    %r9,%rbx
add    %r9,%rcx
mov    %r12,%rdx
cmp    %r12,%r10
je     12ac <finite_sum_without_derivatives+0x14c>
mov    %rdx,%r12
xorpd  %xmm0,%xmm0
xor    %edx,%edx
cmp    $0x3,%r8
jb     1277 <finite_sum_without_derivatives+0x117>
nopl   0x0(%rax)
movsd  -0x18(%rbx,%rdx,8),%xmm1
movsd  -0x10(%rbx,%rdx,8),%xmm2
mulsd  (%rax,%rdx,8),%xmm1
mulsd  0x8(%rax,%rdx,8),%xmm2
addsd  %xmm0,%xmm1
movsd  -0x8(%rbx,%rdx,8),%xmm3
mulsd  0x10(%rax,%rdx,8),%xmm3
addsd  %xmm1,%xmm2
movsd  (%rbx,%rdx,8),%xmm0
mulsd  0x18(%rax,%rdx,8),%xmm0
addsd  %xmm2,%xmm3
addsd  %xmm3,%xmm0
add    $0x4,%rdx
cmp    %rdx,%r11
jne    1230 <finite_sum_without_derivatives+0xd0>
test   %r14,%r14
je     1200 <finite_sum_without_derivatives+0xa0>
lea    (%rax,%rdx,8),%rdi
lea    (%rcx,%rdx,8),%rdx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
movsd  (%rdx,%rsi,8),%xmm1
mulsd  (%rdi,%rsi,8),%xmm1
addsd  %xmm1,%xmm0
add    $0x1,%rsi
cmp    %rsi,%r14
jne    1290 <finite_sum_without_derivatives+0x130>
jmp    1200 <finite_sum_without_derivatives+0xa0>
test   %edx,%edx
mov    -0x48(%rbp),%rax
mov    -0x30(%rbp),%rdi
jle    1438 <finite_sum_without_derivatives+0x2d8>
cmp    $0x1,%edx
jne    12c8 <finite_sum_without_derivatives+0x168>
xor    %ebx,%ebx
jmp    1400 <finite_sum_without_derivatives+0x2a0>
mov    %r15,-0x68(%rbp)
mov    %edx,%ebx
and    $0xfffffffe,%ebx
lea    -0x2(%rbx),%rcx
mov    %rcx,%r15
shr    %r15
add    $0x1,%r15
test   %rcx,%rcx
mov    %r15,-0x80(%rbp)
je     151d <finite_sum_without_derivatives+0x3bd>
and    $0xfffffffffffffffe,%r15
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movaps 0x0(%r13,%r14,8),%xmm0
movaps %xmm0,-0x40(%rbp)
call   1070 <round@plt>
movaps %xmm0,-0x60(%rbp)
movapd -0x40(%rbp),%xmm0
unpckhpd %xmm0,%xmm0
call   1070 <round@plt>
movapd -0x60(%rbp),%xmm1
unpcklpd %xmm0,%xmm1
mov    -0x48(%rbp),%rax
movapd %xmm1,(%rax,%r14,8)
movapd -0x40(%rbp),%xmm0
subpd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movapd %xmm0,(%rax,%r14,8)
movaps 0x10(%r13,%r14,8),%xmm0
movaps %xmm0,-0x40(%rbp)
call   1070 <round@plt>
movaps %xmm0,-0x60(%rbp)
movapd -0x40(%rbp),%xmm0
unpckhpd %xmm0,%xmm0
call   1070 <round@plt>
mov    -0x30(%rbp),%rdi
mov    -0x48(%rbp),%rax
movapd -0x60(%rbp),%xmm1
unpcklpd %xmm0,%xmm1
movapd %xmm1,0x10(%rax,%r14,8)
movapd -0x40(%rbp),%xmm0
subpd  %xmm1,%xmm0
movapd %xmm0,0x10(%rdi,%r14,8)
add    $0x4,%r14
add    $0xfffffffffffffffe,%r15
jne    1300 <finite_sum_without_derivatives+0x1a0>
testb  $0x1,-0x80(%rbp)
je     13eb <finite_sum_without_derivatives+0x28b>
movaps 0x0(%r13,%r14,8),%xmm0
movaps %xmm0,-0x40(%rbp)
call   1070 <round@plt>
movaps %xmm0,-0x60(%rbp)
movapd -0x40(%rbp),%xmm0
unpckhpd %xmm0,%xmm0
call   1070 <round@plt>
mov    -0x30(%rbp),%rdi
mov    -0x48(%rbp),%rax
movapd -0x60(%rbp),%xmm1
unpcklpd %xmm0,%xmm1
movapd %xmm1,(%rax,%r14,8)
movapd -0x40(%rbp),%xmm0
subpd  %xmm1,%xmm0
movapd %xmm0,(%rdi,%r14,8)
mov    %r12,%rdx
cmp    %r12,%rbx
mov    -0x68(%rbp),%r15
je     1438 <finite_sum_without_derivatives+0x2d8>
nopw   0x0(%rax,%rax,1)
movsd  0x0(%r13,%rbx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
call   1070 <round@plt>
mov    -0x30(%rbp),%rdi
mov    -0x48(%rbp),%rax
mov    %r12,%rdx
movsd  %xmm0,(%rax,%rbx,8)
movsd  -0x40(%rbp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rdi,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1400 <finite_sum_without_derivatives+0x2a0>
mov    0x28(%rbp),%ecx
test   %ecx,%ecx
jle    14f4 <finite_sum_without_derivatives+0x394>
mov    0x18(%rbp),%r13
mov    %r15,-0x68(%rbp)
movslq %edx,%r14
mov    %ecx,%ebx
shl    $0x3,%r14
xorpd  %xmm0,%xmm0
mov    %rdx,%r15
mov    %rdi,%r12
xchg   %ax,%ax
movapd %xmm0,-0x40(%rbp)
mov    %r13,%rdi
mov    -0x68(%rbp),%rsi
mov    -0xa0(%rbp),%rdx
mov    %rax,%rcx
mov    %r15d,%r8d
call   1030 <exppart@plt>
movsd  %xmm0,-0x30(%rbp)
mov    %r13,%rdi
mov    -0x98(%rbp),%rsi
mov    %r12,%rdx
mov    %r15d,%ecx
call   1080 <normpart@plt>
mov    %eax,%edi
call   1050 <exp@plt>
movapd %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,-0x80(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <sin@plt>
mov    -0x48(%rbp),%rax
movapd -0x60(%rbp),%xmm1
unpcklpd %xmm1,%xmm1
unpcklpd -0x80(%rbp),%xmm0
mulpd  %xmm1,%xmm0
movapd -0x40(%rbp),%xmm1
addpd  %xmm0,%xmm1
movapd %xmm1,-0x40(%rbp)
movapd -0x40(%rbp),%xmm0
add    %r14,%r13
add    $0xffffffffffffffff,%rbx
jne    1460 <finite_sum_without_derivatives+0x300>
jmp    14f8 <finite_sum_without_derivatives+0x398>
xorpd  %xmm0,%xmm0
mov    -0x88(%rbp),%rax
movhpd %xmm0,(%rax)
mov    -0x90(%rbp),%rax
movlpd %xmm0,(%rax)
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r14d,%r14d
testb  $0x1,-0x80(%rbp)
jne    13a4 <finite_sum_without_derivatives+0x244>
jmp    13eb <finite_sum_without_derivatives+0x28b>

LLVM IR (-O0):
define void @finite_sum_without_derivatives(double* %0, double* %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7, i32 %8, i32 %9) {
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i8*
%24 = alloca i64
%25 = alloca i64
%26 = alloca i64
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
%32 = alloca double
%33 = alloca double
%34 = alloca double*
store double* %0, double** %11
store double* %1, double** %12
store double* %2, double** %13
store double* %3, double** %14
store double* %4, double** %15
store double* %5, double** %16
store double* %6, double** %17
store double* %7, double** %18
store i32 %8, i32* %19
store i32 %9, i32* %20
%35 = load i32, i32* %19
%36 = zext i32 %35 to i64
%37 = call i8* @llvm.stacksave()
store i8* %37, i8** %23
%38 = alloca double, i64 %36
store i64 %36, i64* %24
%39 = load i32, i32* %19
%40 = zext i32 %39 to i64
%41 = alloca double, i64 %40
store i64 %40, i64* %25
%42 = load i32, i32* %19
%43 = zext i32 %42 to i64
%44 = alloca double, i64 %43
store i64 %43, i64* %26
store i32 0, i32* %21
br label %45
45: ; preds = %79, %10
%46 = load i32, i32* %21
%47 = load i32, i32* %19
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %82
49: ; preds = %45
store double 0.000000e+00, double* %27
store i32 0, i32* %22
br label %50
50: ; preds = %71, %49
%51 = load i32, i32* %22
%52 = load i32, i32* %19
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %74
54: ; preds = %50
%55 = load double*, double** %14
%56 = load i32, i32* %21
%57 = load i32, i32* %19
%58 = mul nsw i32 %56, %57
%59 = load i32, i32* %22
%60 = add nsw i32 %58, %59
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds double, double* %55, i64 %61
%63 = load double, double* %62
%64 = load double*, double** %17
%65 = load i32, i32* %22
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %64, i64 %66
%68 = load double, double* %67
%69 = load double, double* %27
%70 = call double @llvm.fmuladd.f64(double %63, double %68, double %69)
store double %70, double* %27
br label %71
71: ; preds = %54
%72 = load i32, i32* %22
%73 = add nsw i32 %72, 1
store i32 %73, i32* %22
br label %50
74: ; preds = %50
%75 = load double, double* %27
%76 = load i32, i32* %21
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds double, double* %38, i64 %77
store double %75, double* %78
br label %79
79: ; preds = %74
%80 = load i32, i32* %21
%81 = add nsw i32 %80, 1
store i32 %81, i32* %21
br label %45
82: ; preds = %45
store i32 0, i32* %21
br label %83
83: ; preds = %108, %82
%84 = load i32, i32* %21
%85 = load i32, i32* %19
%86 = icmp slt i32 %84, %85
br i1 %86, label %87, label %111
87: ; preds = %83
%88 = load i32, i32* %21
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds double, double* %38, i64 %89
%91 = load double, double* %90
%92 = call double @llvm.round.f64(double %91)
%93 = load i32, i32* %21
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds double, double* %41, i64 %94
store double %92, double* %95
%96 = load i32, i32* %21
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds double, double* %38, i64 %97
%99 = load double, double* %98
%100 = load i32, i32* %21
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double, double* %41, i64 %101
%103 = load double, double* %102
%104 = fsub double %99, %103
%105 = load i32, i32* %21
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %44, i64 %106
store double %104, double* %107
br label %108
108: ; preds = %87
%109 = load i32, i32* %21
%110 = add nsw i32 %109, 1
store i32 %110, i32* %21
br label %83
111: ; preds = %83
store double 0.000000e+00, double* %28
store double 0.000000e+00, double* %29
store i32 0, i32* %21
br label %112
112: ; preds = %147, %111
%113 = load i32, i32* %21
%114 = load i32, i32* %20
%115 = icmp slt i32 %113, %114
br i1 %115, label %116, label %150
116: ; preds = %112
%117 = load double*, double** %18
%118 = load i32, i32* %21
%119 = load i32, i32* %19
%120 = mul nsw i32 %118, %119
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds double, double* %117, i64 %121
store double* %122, double** %34
%123 = load double*, double** %34
%124 = load double*, double** %13
%125 = load double*, double** %16
%126 = load i32, i32* %19
%127 = call double @exppart(double* %123, double* %124, double* %125, double* %41, i32 %126)
store double %127, double* %30
%128 = load double*, double** %34
%129 = load double*, double** %15
%130 = load i32, i32* %19
%131 = call i32 @normpart(double* %128, double* %129, double* %44, i32 %130)
%132 = call double @exp(i32 %131)
store double %132, double* %31
%133 = load double, double* %31
%134 = load double, double* %30
%135 = call double @cos(double %134)
%136 = fmul double %133, %135
store double %136, double* %32
%137 = load double, double* %31
%138 = load double, double* %30
%139 = call double @sin(double %138)
%140 = fmul double %137, %139
store double %140, double* %33
%141 = load double, double* %32
%142 = load double, double* %28
%143 = fadd double %142, %141
store double %143, double* %28
%144 = load double, double* %33
%145 = load double, double* %29
%146 = fadd double %145, %144
store double %146, double* %29
br label %147
147: ; preds = %116
%148 = load i32, i32* %21
%149 = add nsw i32 %148, 1
store i32 %149, i32* %21
br label %112
150: ; preds = %112
%151 = load double, double* %28
%152 = load double*, double** %11
%153 = getelementptr inbounds double, double* %152, i64 0
store double %151, double* %153
%154 = load double, double* %29
%155 = load double*, double** %12
%156 = getelementptr inbounds double, double* %155, i64 0
store double %154, double* %156
%157 = load i8*, i8** %23
ret void
}

LLVM IR (-O2):
define void @finite_sum_without_derivatives(double* nocapture writeonly %0, double* nocapture writeonly %1, double* %2, double* nocapture %3, double* %4, double* %5, double* nocapture %6, double* %7, i32 %8, i32 %9) {
%11 = zext i32 %8 to i64
%12 = alloca double, i64 %11
%13 = alloca double, i64 %11
%14 = alloca double, i64 %11
%15 = icmp sgt i32 %8, 0
br i1 %15, label %16, label %136
16: ; preds = %10
%17 = zext i32 %8 to i64
%18 = add nsw i64 %11, -1
%19 = and i64 %11, 3
%20 = icmp ult i64 %18, 3
%21 = and i64 %11, 4294967292
%22 = icmp eq i64 %19, 0
br label %23
23: ; preds = %131, %16
%24 = phi i64 [ 0, %16 ], [ %134, %131 ]
%25 = mul nsw i64 %24, %17
br i1 %20, label %114, label %80
26: ; preds = %131
br i1 %15, label %27, label %136
27: ; preds = %26
%28 = icmp eq i32 %8, 1
br i1 %28, label %78, label %29
29: ; preds = %27
%30 = and i64 %11, 4294967294
%31 = add nsw i64 %30, -2
%32 = lshr exact i64 %31, 1
%33 = add nuw i64 %32, 1
%34 = and i64 %33, 1
%35 = icmp eq i64 %31, 0
br i1 %35, label %63, label %36
36: ; preds = %29
%37 = and i64 %33, -2
br label %38
38: ; preds = %38, %36
%39 = phi i64 [ 0, %36 ], [ %60, %38 ]
%40 = phi i64 [ 0, %36 ], [ %61, %38 ]
%41 = getelementptr inbounds double, double* %12, i64 %39
%42 = bitcast double* %41 to <2 x double>*
%43 = load <2 x double>, <2 x double>* %42
%44 = call <2 x double> @llvm.round.v2f64(<2 x double> %43)
%45 = getelementptr inbounds double, double* %13, i64 %39
%46 = bitcast double* %45 to <2 x double>*
store <2 x double> %44, <2 x double>* %46
%47 = fsub <2 x double> %43, %44
%48 = getelementptr inbounds double, double* %14, i64 %39
%49 = bitcast double* %48 to <2 x double>*
store <2 x double> %47, <2 x double>* %49
%50 = or i64 %39, 2
%51 = getelementptr inbounds double, double* %12, i64 %50
%52 = bitcast double* %51 to <2 x double>*
%53 = load <2 x double>, <2 x double>* %52
%54 = call <2 x double> @llvm.round.v2f64(<2 x double> %53)
%55 = getelementptr inbounds double, double* %13, i64 %50
%56 = bitcast double* %55 to <2 x double>*
store <2 x double> %54, <2 x double>* %56
%57 = fsub <2 x double> %53, %54
%58 = getelementptr inbounds double, double* %14, i64 %50
%59 = bitcast double* %58 to <2 x double>*
store <2 x double> %57, <2 x double>* %59
%60 = add nuw i64 %39, 4
%61 = add nuw i64 %40, 2
%62 = icmp eq i64 %61, %37
br i1 %62, label %63, label %38
63: ; preds = %38, %29
%64 = phi i64 [ 0, %29 ], [ %60, %38 ]
%65 = icmp eq i64 %34, 0
br i1 %65, label %76, label %66
66: ; preds = %63
%67 = getelementptr inbounds double, double* %12, i64 %64
%68 = bitcast double* %67 to <2 x double>*
%69 = load <2 x double>, <2 x double>* %68
%70 = call <2 x double> @llvm.round.v2f64(<2 x double> %69)
%71 = getelementptr inbounds double, double* %13, i64 %64
%72 = bitcast double* %71 to <2 x double>*
store <2 x double> %70, <2 x double>* %72
%73 = fsub <2 x double> %69, %70
%74 = getelementptr inbounds double, double* %14, i64 %64
%75 = bitcast double* %74 to <2 x double>*
store <2 x double> %73, <2 x double>* %75
br label %76
76: ; preds = %63, %66
%77 = icmp eq i64 %30, %11
br i1 %77, label %136, label %78
78: ; preds = %27, %76
%79 = phi i64 [ 0, %27 ], [ %30, %76 ]
br label %141
80: ; preds = %23, %80
%81 = phi i64 [ %111, %80 ], [ 0, %23 ]
%82 = phi double [ %110, %80 ], [ 0.000000e+00, %23 ]
%83 = phi i64 [ %112, %80 ], [ 0, %23 ]
%84 = add nuw nsw i64 %81, %25
%85 = getelementptr inbounds double, double* %3, i64 %84
%86 = load double, double* %85
%87 = getelementptr inbounds double, double* %6, i64 %81
%88 = load double, double* %87
%89 = tail call double @llvm.fmuladd.f64(double %86, double %88, double %82)
%90 = or i64 %81, 1
%91 = add nuw nsw i64 %90, %25
%92 = getelementptr inbounds double, double* %3, i64 %91
%93 = load double, double* %92
%94 = getelementptr inbounds double, double* %6, i64 %90
%95 = load double, double* %94
%96 = tail call double @llvm.fmuladd.f64(double %93, double %95, double %89)
%97 = or i64 %81, 2
%98 = add nuw nsw i64 %97, %25
%99 = getelementptr inbounds double, double* %3, i64 %98
%100 = load double, double* %99
%101 = getelementptr inbounds double, double* %6, i64 %97
%102 = load double, double* %101
%103 = tail call double @llvm.fmuladd.f64(double %100, double %102, double %96)
%104 = or i64 %81, 3
%105 = add nuw nsw i64 %104, %25
%106 = getelementptr inbounds double, double* %3, i64 %105
%107 = load double, double* %106
%108 = getelementptr inbounds double, double* %6, i64 %104
%109 = load double, double* %108
%110 = tail call double @llvm.fmuladd.f64(double %107, double %109, double %103)
%111 = add nuw nsw i64 %81, 4
%112 = add i64 %83, 4
%113 = icmp eq i64 %112, %21
br i1 %113, label %114, label %80
114: ; preds = %80, %23
%115 = phi double [ undef, %23 ], [ %110, %80 ]
%116 = phi i64 [ 0, %23 ], [ %111, %80 ]
%117 = phi double [ 0.000000e+00, %23 ], [ %110, %80 ]
br i1 %22, label %131, label %118
118: ; preds = %114, %118
%119 = phi i64 [ %128, %118 ], [ %116, %114 ]
%120 = phi double [ %127, %118 ], [ %117, %114 ]
%121 = phi i64 [ %129, %118 ], [ 0, %114 ]
%122 = add nuw nsw i64 %119, %25
%123 = getelementptr inbounds double, double* %3, i64 %122
%124 = load double, double* %123
%125 = getelementptr inbounds double, double* %6, i64 %119
%126 = load double, double* %125
%127 = tail call double @llvm.fmuladd.f64(double %124, double %126, double %120)
%128 = add nuw nsw i64 %119, 1
%129 = add i64 %121, 1
%130 = icmp eq i64 %129, %19
br i1 %130, label %131, label %118
131: ; preds = %118, %114
%132 = phi double [ %115, %114 ], [ %127, %118 ]
%133 = getelementptr inbounds double, double* %12, i64 %24
store double %132, double* %133
%134 = add nuw nsw i64 %24, 1
%135 = icmp eq i64 %134, %11
br i1 %135, label %26, label %23
136: ; preds = %141, %76, %10, %26
%137 = icmp sgt i32 %9, 0
br i1 %137, label %138, label %169
138: ; preds = %136
%139 = sext i32 %8 to i64
%140 = zext i32 %9 to i64
br label %151
141: ; preds = %78, %141
%142 = phi i64 [ %149, %141 ], [ %79, %78 ]
%143 = getelementptr inbounds double, double* %12, i64 %142
%144 = load double, double* %143
%145 = tail call double @llvm.round.f64(double %144)
%146 = getelementptr inbounds double, double* %13, i64 %142
store double %145, double* %146
%147 = fsub double %144, %145
%148 = getelementptr inbounds double, double* %14, i64 %142
store double %147, double* %148
%149 = add nuw nsw i64 %142, 1
%150 = icmp eq i64 %149, %11
br i1 %150, label %136, label %141
151: ; preds = %138, %151
%152 = phi i64 [ 0, %138 ], [ %167, %151 ]
%153 = phi <2 x double> [ zeroinitializer, %138 ], [ %166, %151 ]
%154 = mul nsw i64 %152, %139
%155 = getelementptr inbounds double, double* %7, i64 %154
%156 = call double @exppart(double* %155, double* %2, double* %5, double* %13, i32 %8)
%157 = call i32 @normpart(double* %155, double* %4, double* %14, i32 %8)
%158 = call double @exp(i32 %157)
%159 = call double @cos(double %156)
%160 = call double @sin(double %156)
%161 = insertelement <2 x double> poison, double %158, i64 0
%162 = shufflevector <2 x double> %161, <2 x double> poison, <2 x i32> zeroinitializer
%163 = insertelement <2 x double> poison, double %160, i64 0
%164 = insertelement <2 x double> %163, double %159, i64 1
%165 = fmul <2 x double> %162, %164
%166 = fadd <2 x double> %153, %165
%167 = add nuw nsw i64 %152, 1
%168 = icmp eq i64 %167, %140
br i1 %168, label %169, label %151
169: ; preds = %151, %136
%170 = phi <2 x double> [ zeroinitializer, %136 ], [ %166, %151 ]
%171 = extractelement <2 x double> %170, i64 1
store double %171, double* %0
%172 = extractelement <2 x double> %170, i64 0
store double %172, double* %1
ret void
}