#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 sin(double);
void seriesfour(double f[], int n, double a[], double b[]) {
  int i, j;
  double t, cost, sint, c1, s1, u1, u2, u0;
  t = 2 * 3.1415926 / (2.0 * n + 1.0);
  cost = cos(t);
  sint = sin(t);
  t = 2.0 / (2.0 * n + 1.0);
  for (i = 0, c1 = 1.0, s1 = 0.0; i <= n; i++) {
    for (j = 2 * n, u1 = u2 = 0.0; j > 0; j--) {
      u0 = f[j] + 2.0 * c1 * u1 - u2;
      u2 = u1;
      u1 = u0;
    }
    a[i] = t * (f[0] + u1 * c1 - u2);
    b[i] = t * u1 * s1;
    u0 = cost * c1 - sint * s1;
    s1 = cost * s1 + sint * c1;
    c1 = u0;
  }
}


x86 assembly (clang, -O0):
<seriesfour>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xeb8(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xebc(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x40(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xe74(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe70(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
movsd  0xe50(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1301 <seriesfour+0x1e1>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
cmpl   $0x0,-0x28(%rbp)
jle    123f <seriesfour+0x11f>
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  0xe07(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    11e2 <seriesfour+0xc2>
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x58(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
subsd  -0x60(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x38(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11bd <seriesfour+0x9d>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seriesfour>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,%r12d
mov    %rdi,%rbx
cvtsi2sd %esi,%xmm1
addsd  %xmm1,%xmm1
addsd  0xeb9(%rip),%xmm1
movsd  0xeb9(%rip),%xmm0
movsd  %xmm1,(%rsp)
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
call   1040 <cos@plt>
movapd %xmm0,0x10(%rsp)
movq   0x8(%rsp),%xmm0
call   1030 <sin@plt>
movapd 0x10(%rsp),%xmm9
test   %r12d,%r12d
js     127a <seriesfour+0x15a>
movsd  0xe84(%rip),%xmm1
divsd  (%rsp),%xmm1
movdqa %xmm0,%xmm3
pxor   0xe83(%rip),%xmm3
lea    (%r12,%r12,1),%eax
lea    0x1(%r12),%ecx
unpcklpd %xmm9,%xmm9
xorpd  %xmm2,%xmm2
movhpd 0xe49(%rip),%xmm2
pshufd $0x44,%xmm3,%xmm8
xor    %edx,%edx
jmp    1223 <seriesfour+0x103>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xorpd  %xmm5,%xmm5
pxor   %xmm3,%xmm3
mulsd  %xmm5,%xmm4
addsd  (%rbx),%xmm4
subsd  %xmm3,%xmm4
mulsd  %xmm1,%xmm4
movsd  %xmm4,(%r15,%rdx,8)
mulsd  %xmm1,%xmm5
mulsd  %xmm2,%xmm5
movsd  %xmm5,(%r14,%rdx,8)
movdqa %xmm0,%xmm3
punpcklqdq %xmm2,%xmm3
movapd %xmm9,%xmm4
mulpd  %xmm2,%xmm4
punpckhqdq %xmm8,%xmm2
mulpd  %xmm3,%xmm2
addpd  %xmm4,%xmm2
add    $0x1,%rdx
cmp    %rcx,%rdx
je     127a <seriesfour+0x15a>
movapd %xmm2,%xmm4
unpckhpd %xmm2,%xmm4
test   %r12d,%r12d
je     11d0 <seriesfour+0xb0>
movapd %xmm4,%xmm7
addsd  %xmm4,%xmm7
xorpd  %xmm6,%xmm6
mov    %rax,%rsi
xorpd  %xmm5,%xmm5
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movapd %xmm5,%xmm3
movapd %xmm7,%xmm5
mulsd  %xmm3,%xmm5
addsd  (%rbx,%rsi,8),%xmm5
subsd  %xmm6,%xmm5
add    $0xffffffffffffffff,%rsi
lea    0x1(%rsi),%edi
movapd %xmm3,%xmm6
cmp    $0x1,%edi
jg     1250 <seriesfour+0x130>
jmp    11d8 <seriesfour+0xb8>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @seriesfour(double* %0, i32 %1, double* %2, double* %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
store double* %0, double** %5
store i32 %1, i32* %6
store double* %2, double** %7
store double* %3, double** %8
%19 = load i32, i32* %6
%20 = sitofp i32 %19 to double
%21 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %20, double 1.000000e+00)
%22 = fdiv double 0x401921FB4D12D84A, %21
store double %22, double* %11
%23 = load double, double* %11
%24 = call double @cos(double %23)
store double %24, double* %12
%25 = load double, double* %11
%26 = call double @sin(double %25)
store double %26, double* %13
%27 = load i32, i32* %6
%28 = sitofp i32 %27 to double
%29 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %28, double 1.000000e+00)
%30 = fdiv double 2.000000e+00, %29
store double %30, double* %11
store i32 0, i32* %9
store double 1.000000e+00, double* %14
store double 0.000000e+00, double* %15
br label %31
31: ; preds = %96, %4
%32 = load i32, i32* %9
%33 = load i32, i32* %6
%34 = icmp sle i32 %32, %33
br i1 %34, label %35, label %99
35: ; preds = %31
%36 = load i32, i32* %6
%37 = mul nsw i32 2, %36
store i32 %37, i32* %10
store double 0.000000e+00, double* %17
store double 0.000000e+00, double* %16
br label %38
38: ; preds = %55, %35
%39 = load i32, i32* %10
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %58
41: ; preds = %38
%42 = load double*, double** %5
%43 = load i32, i32* %10
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
%46 = load double, double* %45
%47 = load double, double* %14
%48 = fmul double 2.000000e+00, %47
%49 = load double, double* %16
%50 = call double @llvm.fmuladd.f64(double %48, double %49, double %46)
%51 = load double, double* %17
%52 = fsub double %50, %51
store double %52, double* %18
%53 = load double, double* %16
store double %53, double* %17
%54 = load double, double* %18
store double %54, double* %16
br label %55
55: ; preds = %41
%56 = load i32, i32* %10
%57 = add nsw i32 %56, -1
store i32 %57, i32* %10
br label %38
58: ; preds = %38
%59 = load double, double* %11
%60 = load double*, double** %5
%61 = getelementptr inbounds double, double* %60, i64 0
%62 = load double, double* %61
%63 = load double, double* %16
%64 = load double, double* %14
%65 = call double @llvm.fmuladd.f64(double %63, double %64, double %62)
%66 = load double, double* %17
%67 = fsub double %65, %66
%68 = fmul double %59, %67
%69 = load double*, double** %7
%70 = load i32, i32* %9
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %69, i64 %71
store double %68, double* %72
%73 = load double, double* %11
%74 = load double, double* %16
%75 = fmul double %73, %74
%76 = load double, double* %15
%77 = fmul double %75, %76
%78 = load double*, double** %8
%79 = load i32, i32* %9
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds double, double* %78, i64 %80
store double %77, double* %81
%82 = load double, double* %12
%83 = load double, double* %14
%84 = load double, double* %13
%85 = load double, double* %15
%86 = fmul double %84, %85
%87 = fneg double %86
%88 = call double @llvm.fmuladd.f64(double %82, double %83, double %87)
store double %88, double* %18
%89 = load double, double* %12
%90 = load double, double* %15
%91 = load double, double* %13
%92 = load double, double* %14
%93 = fmul double %91, %92
%94 = call double @llvm.fmuladd.f64(double %89, double %90, double %93)
store double %94, double* %15
%95 = load double, double* %18
store double %95, double* %14
br label %96
96: ; preds = %58
%97 = load i32, i32* %9
%98 = add nsw i32 %97, 1
store i32 %98, i32* %9
br label %31
99: ; preds = %31
ret void
}

LLVM IR (-O2):
define void @seriesfour(double* nocapture %0, i32 %1, double* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = sitofp i32 %1 to double
%6 = tail call double @llvm.fmuladd.f64(double %5, double 2.000000e+00, double 1.000000e+00)
%7 = fdiv double 0x401921FB4D12D84A, %6
%8 = tail call double @cos(double %7)
%9 = tail call double @sin(double %7)
%10 = fdiv double 2.000000e+00, %6
%11 = icmp slt i32 %1, 0
br i1 %11, label %59, label %12
12: ; preds = %4
%13 = shl nuw i32 %1, 1
%14 = icmp eq i32 %1, 0
%15 = fneg double %9
%16 = zext i32 %13 to i64
%17 = add nuw i32 %1, 1
%18 = zext i32 %17 to i64
%19 = insertelement <2 x double> poison, double %8, i64 0
%20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
%21 = insertelement <2 x double> poison, double %9, i64 0
%22 = insertelement <2 x double> poison, double %15, i64 1
br label %23
23: ; preds = %12, %40
%24 = phi i64 [ 0, %12 ], [ %57, %40 ]
%25 = phi <2 x double> [ <double 0.000000e+00, double 1.000000e+00>, %12 ], [ %56, %40 ]
br i1 %14, label %40, label %26
26: ; preds = %23
%27 = extractelement <2 x double> %25, i64 1
%28 = fmul double %27, 2.000000e+00
br label %29
29: ; preds = %26, %29
%30 = phi i64 [ %16, %26 ], [ %37, %29 ]
%31 = phi double [ 0.000000e+00, %26 ], [ %32, %29 ]
%32 = phi double [ 0.000000e+00, %26 ], [ %36, %29 ]
%33 = getelementptr inbounds double, double* %0, i64 %30
%34 = load double, double* %33
%35 = tail call double @llvm.fmuladd.f64(double %28, double %32, double %34)
%36 = fsub double %35, %31
%37 = add nsw i64 %30, -1
%38 = trunc i64 %30 to i32
%39 = icmp sgt i32 %38, 1
br i1 %39, label %29, label %40
40: ; preds = %29, %23
%41 = phi double [ 0.000000e+00, %23 ], [ %36, %29 ]
%42 = phi double [ 0.000000e+00, %23 ], [ %32, %29 ]
%43 = load double, double* %0
%44 = extractelement <2 x double> %25, i64 1
%45 = tail call double @llvm.fmuladd.f64(double %41, double %44, double %43)
%46 = fsub double %45, %42
%47 = fmul double %10, %46
%48 = getelementptr inbounds double, double* %2, i64 %24
store double %47, double* %48
%49 = fmul double %10, %41
%50 = extractelement <2 x double> %25, i64 0
%51 = fmul double %50, %49
%52 = getelementptr inbounds double, double* %3, i64 %24
store double %51, double* %52
%53 = shufflevector <2 x double> %21, <2 x double> %25, <2 x i32> <i32 0, i32 2>
%54 = shufflevector <2 x double> %22, <2 x double> %25, <2 x i32> <i32 3, i32 1>
%55 = fmul <2 x double> %53, %54
%56 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %20, <2 x double> %25, <2 x double> %55)
%57 = add nuw nsw i64 %24, 1
%58 = icmp eq i64 %57, %18
br i1 %58, label %59, label %23
59: ; preds = %40, %4
ret void
}