#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 double complex;

/* Variables and functions */
double M_PI;
double _Complex_I;
int cabs(double);
scalar_t__ calloc(int, int);
scalar_t__ carg(double);
int cimag(double);
double cos(double);
int creal(double);
int /*<<< orphan*/ free(double *);
double sin(double);
double tan(double);
int lpbu2sos(double fc, double dt, int n, double *g, double *b1, double *b2,
             double *a1, double *a2) {
  double ang, wc, gain;
  int j, k;
  complex pole, cone, swp, *p;
  p = (complex *)calloc(n, sizeof(complex));
  cone = 1.;
  wc = tan(fc * dt * M_PI);
  for (j = 0; j < n; j++) {
    ang = (double)(2 * j + 1) * M_PI / (double)(2 * n);
    pole = wc * (-sin(ang) + cos(ang) * _Complex_I);
    p[j] = (cone + pole) / (cone - pole);
  }
  for (j = 0; j < n; j++)
    for (k = 0; k < n; k++)
      if (carg(p[j]) < carg(p[k])) {
        swp = p[j];
        p[j] = p[k];
        p[k] = swp;
      }
  for (j = 0; j < n / 2; j++) {
    b1[j] = 2.;
    b2[j] = 1.;
    a1[j] = -2. * creal(p[j]);
    a2[j] = creal(p[j]) * creal(p[j]) + cimag(p[j]) * cimag(p[j]);
  }
  gain = 1.;
  for (k = 0; k < n; k++)
    gain /= cabs(cone - p[k]) / 2.;
  *g = 1. / gain;
  free(p);
  return n / 2;
}


x86 assembly (clang, -O0):
<lpbu2sos>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x80(%rbp)
movsd  0xe2b(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mov    0x2dfd(%rip),%rax
mulsd  (%rax),%xmm0
call   10a0 <tan@plt>
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12d9 <lpbu2sos+0x149>
mov    -0x5c(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
mov    0x2dc8(%rip),%rax
mulsd  (%rax),%xmm0
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1080 <sin@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   10b0 <cos@plt>
movsd  -0x90(%rbp),%xmm2
ff
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
mov    0x2d47(%rip),%rax
movsd  (%rax),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x70(%rbp),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
subsd  -0x68(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x80(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1200 <lpbu2sos+0x70>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13a1 <lpbu2sos+0x211>
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    138e <lpbu2sos+0x1fe>
mov    -0x80(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1050 <carg@plt>
mov    %rax,-0x98(%rbp)
mov    -0x80(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1050 <carg@plt>
mov    %rax,%rcx
mov    -0x98(%rbp),%rax
cmp    %rcx,%rax
jge    137b <lpbu2sos+0x1eb>
mov    -0x80(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x80(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x80(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x78(%rbp),%xmm0
mov    -0x80(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1380 <lpbu2sos+0x1f0>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    12f3 <lpbu2sos+0x163>
jmp    1393 <lpbu2sos+0x203>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    12e0 <lpbu2sos+0x150>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x9c(%rbp),%eax
cmp    %ecx,%eax
jge    14bc <lpbu2sos+0x32c>
mov    -0x28(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  0xc2c(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  0xc0f(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x80(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1060 <creal@plt>
cvtsi2sd %eax,%xmm1
movsd  0xbfc(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x80(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1060 <creal@plt>
mov    %eax,-0xa8(%rbp)
mov    -0x80(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1060 <creal@plt>
mov    %eax,%ecx
mov    -0xa8(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0xa0(%rbp)
mov    -0x80(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1090 <cimag@plt>
mov    %eax,-0xa4(%rbp)
mov    -0x80(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1090 <cimag@plt>
mov    -0xa4(%rbp),%ecx
mov    %eax,%edx
mov    -0xa0(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
mov    -0x40(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    13a8 <lpbu2sos+0x218>
movsd  0xb3c(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    151f <lpbu2sos+0x38f>
movsd  -0x70(%rbp),%xmm0
mov    -0x80(%rbp),%rax
movslq -0x60(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
call   1040 <cabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xb09(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    14d0 <lpbu2sos+0x340>
movsd  0xad9(%rip),%xmm0
divsd  -0x58(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lpbu2sos>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9,0x40(%rsp)
mov    %r8,0x30(%rsp)
mov    %rcx,0x28(%rsp)
mov    %rdx,0x20(%rsp)
mov    %rsi,0x38(%rsp)
mov    %edi,%r15d
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,%r14
movsd  0x8(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
mov    0x2e02(%rip),%rbx
mulsd  (%rbx),%xmm0
call   10a0 <tan@plt>
test   %r15d,%r15d
jle    1301 <lpbu2sos+0x171>
movapd %xmm0,%xmm3
lea    (%r15,%r15,1),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x48(%rsp)
mov    %r15,0x18(%rsp)
mov    %r15d,%r13d
mov    %r13,%r15
add    %r13,%r15
xor    %ebp,%ebp
mov    0x2db4(%rip),%r12
movsd  %xmm3,0x50(%rsp)
nopw   0x0(%rax,%rax,1)
lea    0x1(%rbp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rbx),%xmm0
divsd  0x48(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
call   1080 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   10b0 <cos@plt>
movsd  0x50(%rsp),%xmm3
movsd  0xd92(%rip),%xmm2
mulsd  (%r12),%xmm0
subsd  0x10(%rsp),%xmm0
mulsd  %xmm3,%xmm0
movapd %xmm2,%xmm1
subsd  %xmm0,%xmm1
addsd  %xmm2,%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%r14,%rbp,4)
add    $0x2,%rbp
cmp    %rbp,%r15
jne    1230 <lpbu2sos+0xa0>
mov    0x18(%rsp),%r15
test   %r15d,%r15d
jle    1301 <lpbu2sos+0x171>
xor    %ebp,%ebp
jmp    12b9 <lpbu2sos+0x129>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %r13,%rbp
je     131a <lpbu2sos+0x18a>
xor    %ebx,%ebx
jmp    12c9 <lpbu2sos+0x139>
nopl   (%rax)
add    $0x1,%rbx
cmp    %rbx,%r13
je     12b0 <lpbu2sos+0x120>
movsd  (%r14,%rbp,8),%xmm0
call   1050 <carg@plt>
mov    %rax,%r12
movsd  (%r14,%rbx,8),%xmm0
call   1050 <carg@plt>
cmp    %rax,%r12
jge    12c0 <lpbu2sos+0x130>
movsd  (%r14,%rbp,8),%xmm0
movsd  (%r14,%rbx,8),%xmm1
movsd  %xmm1,(%r14,%rbp,8)
movsd  %xmm0,(%r14,%rbx,8)
jmp    12c0 <lpbu2sos+0x130>
neg    %r15d
shr    %r15d
neg    %r15d
movsd  0xcee(%rip),%xmm1
mov    %r15d,%ebx
jmp    1459 <lpbu2sos+0x2c9>
mov    %r15d,%eax
shr    $0x1f,%eax
add    %r15d,%eax
sar    %eax
mov    %eax,0x8(%rsp)
cmp    $0x2,%r15d
mov    0x30(%rsp),%rbx
mov    0x28(%rsp),%rcx
mov    0x20(%rsp),%rdx
jl     13f5 <lpbu2sos+0x265>
mov    0x8(%rsp),%esi
mov    %rsi,0x10(%rsp)
xor    %r15d,%r15d
xchg   %ax,%ax
movabs $0x4000000000000000,%rax
mov    %rax,(%rdx,%r15,8)
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rcx,%r15,8)
movsd  (%r14,%r15,8),%xmm0
call   1060 <creal@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xc82(%rip),%xmm0
movsd  %xmm0,(%rbx,%r15,8)
movsd  (%r14,%r15,8),%xmm0
call   1060 <creal@plt>
mov    %eax,%r12d
movsd  (%r14,%r15,8),%xmm0
call   1060 <creal@plt>
mov    %eax,%ebp
imul   %r12d,%ebp
movsd  (%r14,%r15,8),%xmm0
call   1090 <cimag@plt>
mov    %eax,%r12d
movsd  (%r14,%r15,8),%xmm0
call   1090 <cimag@plt>
mov    0x20(%rsp),%rdx
mov    0x28(%rsp),%rcx
imul   %r12d,%eax
add    %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    0x40(%rsp),%rax
movsd  %xmm0,(%rax,%r15,8)
add    $0x1,%r15
cmp    %r15,0x10(%rsp)
jne    1350 <lpbu2sos+0x1c0>
cmpl   $0x0,0x18(%rsp)
jle    144d <lpbu2sos+0x2bd>
movsd  0xbfc(%rip),%xmm1
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm1,0x10(%rsp)
movsd  0xbe2(%rip),%xmm0
subsd  (%r14,%rbx,8),%xmm0
call   1040 <cabs@plt>
movsd  0x10(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xbd2(%rip),%xmm0
divsd  %xmm0,%xmm1
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1410 <lpbu2sos+0x280>
jmp    1455 <lpbu2sos+0x2c5>
movsd  0xbab(%rip),%xmm1
mov    0x8(%rsp),%ebx
movsd  0xb9f(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    0x38(%rsp),%rax
movsd  %xmm0,(%rax)
mov    %r14,%rdi
call   1030 <free@plt>
mov    %ebx,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
@_Complex_I = global double 0.000000e+00
define i32 @lpbu2sos(double %0, double %1, i32 %2, double* %3, double* %4, double* %5, double* %6, double* %7) {
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca i32
%21 = alloca i32
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double*
store double %0, double* %9
store double %1, double* %10
store i32 %2, i32* %11
store double* %3, double** %12
store double* %4, double** %13
store double* %5, double** %14
store double* %6, double** %15
store double* %7, double** %16
%26 = load i32, i32* %11
%27 = call i64 @calloc(i32 %26, i32 8)
%28 = inttoptr i64 %27 to double*
store double* %28, double** %25
store double 1.000000e+00, double* %23
%29 = load double, double* %9
%30 = load double, double* %10
%31 = fmul double %29, %30
%32 = load double, double* @M_PI
%33 = fmul double %31, %32
%34 = call double @tan(double %33)
store double %34, double* %18
store i32 0, i32* %20
br label %35
35: ; preds = %70, %8
%36 = load i32, i32* %20
%37 = load i32, i32* %11
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %73
39: ; preds = %35
%40 = load i32, i32* %20
%41 = mul nsw i32 2, %40
%42 = add nsw i32 %41, 1
%43 = sitofp i32 %42 to double
%44 = load double, double* @M_PI
%45 = fmul double %43, %44
%46 = load i32, i32* %11
%47 = mul nsw i32 2, %46
%48 = sitofp i32 %47 to double
%49 = fdiv double %45, %48
store double %49, double* %17
%50 = load double, double* %18
%51 = load double, double* %17
%52 = call double @sin(double %51)
%53 = fneg double %52
%54 = load double, double* %17
%55 = call double @cos(double %54)
%56 = load double, double* @_Complex_I
%57 = call double @llvm.fmuladd.f64(double %55, double %56, double %53)
%58 = fmul double %50, %57
store double %58, double* %22
%59 = load double, double* %23
%60 = load double, double* %22
%61 = fadd double %59, %60
%62 = load double, double* %23
%63 = load double, double* %22
%64 = fsub double %62, %63
%65 = fdiv double %61, %64
%66 = load double*, double** %25
%67 = load i32, i32* %20
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %66, i64 %68
store double %65, double* %69
br label %70
70: ; preds = %39
%71 = load i32, i32* %20
%72 = add nsw i32 %71, 1
store i32 %72, i32* %20
br label %35
73: ; preds = %35
store i32 0, i32* %20
br label %74
74: ; preds = %122, %73
%75 = load i32, i32* %20
%76 = load i32, i32* %11
%77 = icmp slt i32 %75, %76
br i1 %77, label %78, label %125
78: ; preds = %74
store i32 0, i32* %21
br label %79
79: ; preds = %118, %78
%80 = load i32, i32* %21
%81 = load i32, i32* %11
%82 = icmp slt i32 %80, %81
br i1 %82, label %83, label %121
83: ; preds = %79
%84 = load double*, double** %25
%85 = load i32, i32* %20
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %84, i64 %86
%88 = load double, double* %87
%89 = call i64 @carg(double %88)
%90 = load double*, double** %25
%91 = load i32, i32* %21
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds double, double* %90, i64 %92
%94 = load double, double* %93
%95 = call i64 @carg(double %94)
%96 = icmp slt i64 %89, %95
br i1 %96, label %97, label %117
97: ; preds = %83
%98 = load double*, double** %25
%99 = load i32, i32* %20
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds double, double* %98, i64 %100
%102 = load double, double* %101
store double %102, double* %24
%103 = load double*, double** %25
%104 = load i32, i32* %21
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds double, double* %103, i64 %105
%107 = load double, double* %106
%108 = load double*, double** %25
%109 = load i32, i32* %20
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds double, double* %108, i64 %110
store double %107, double* %111
%112 = load double, double* %24
%113 = load double*, double** %25
%114 = load i32, i32* %21
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds double, double* %113, i64 %115
store double %112, double* %116
br label %117
117: ; preds = %97, %83
br label %118
118: ; preds = %117
%119 = load i32, i32* %21
%120 = add nsw i32 %119, 1
store i32 %120, i32* %21
br label %79
121: ; preds = %79
br label %122
122: ; preds = %121
%123 = load i32, i32* %20
%124 = add nsw i32 %123, 1
store i32 %124, i32* %20
br label %74
125: ; preds = %74
store i32 0, i32* %20
br label %126
126: ; preds = %184, %125
%127 = load i32, i32* %20
%128 = load i32, i32* %11
%129 = sdiv i32 %128, 2
%130 = icmp slt i32 %127, %129
br i1 %130, label %131, label %187
131: ; preds = %126
%132 = load double*, double** %13
%133 = load i32, i32* %20
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds double, double* %132, i64 %134
store double 2.000000e+00, double* %135
%136 = load double*, double** %14
%137 = load i32, i32* %20
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds double, double* %136, i64 %138
store double 1.000000e+00, double* %139
%140 = load double*, double** %25
%141 = load i32, i32* %20
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds double, double* %140, i64 %142
%144 = load double, double* %143
%145 = call i32 @creal(double %144)
%146 = sitofp i32 %145 to double
%147 = fmul double -2.000000e+00, %146
%148 = load double*, double** %15
%149 = load i32, i32* %20
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds double, double* %148, i64 %150
store double %147, double* %151
%152 = load double*, double** %25
%153 = load i32, i32* %20
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds double, double* %152, i64 %154
%156 = load double, double* %155
%157 = call i32 @creal(double %156)
%158 = load double*, double** %25
%159 = load i32, i32* %20
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds double, double* %158, i64 %160
%162 = load double, double* %161
%163 = call i32 @creal(double %162)
%164 = mul nsw i32 %157, %163
%165 = load double*, double** %25
%166 = load i32, i32* %20
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds double, double* %165, i64 %167
%169 = load double, double* %168
%170 = call i32 @cimag(double %169)
%171 = load double*, double** %25
%172 = load i32, i32* %20
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds double, double* %171, i64 %173
%175 = load double, double* %174
%176 = call i32 @cimag(double %175)
%177 = mul nsw i32 %170, %176
%178 = add nsw i32 %164, %177
%179 = sitofp i32 %178 to double
%180 = load double*, double** %16
%181 = load i32, i32* %20
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds double, double* %180, i64 %182
store double %179, double* %183
br label %184
184: ; preds = %131
%185 = load i32, i32* %20
%186 = add nsw i32 %185, 1
store i32 %186, i32* %20
br label %126
187: ; preds = %126
store double 1.000000e+00, double* %19
store i32 0, i32* %21
br label %188
188: ; preds = %205, %187
%189 = load i32, i32* %21
%190 = load i32, i32* %11
%191 = icmp slt i32 %189, %190
br i1 %191, label %192, label %208
192: ; preds = %188
%193 = load double, double* %23
%194 = load double*, double** %25
%195 = load i32, i32* %21
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds double, double* %194, i64 %196
%198 = load double, double* %197
%199 = fsub double %193, %198
%200 = call i32 @cabs(double %199)
%201 = sitofp i32 %200 to double
%202 = fdiv double %201, 2.000000e+00
%203 = load double, double* %19
%204 = fdiv double %203, %202
store double %204, double* %19
br label %205
205: ; preds = %192
%206 = load i32, i32* %21
%207 = add nsw i32 %206, 1
store i32 %207, i32* %21
br label %188
208: ; preds = %188
%209 = load double, double* %19
%210 = fdiv double 1.000000e+00, %209
%211 = load double*, double** %12
store double %210, double* %211
%212 = load double*, double** %25
%213 = call i32 @free(double* %212)
%214 = load i32, i32* %11
%215 = sdiv i32 %214, 2
ret i32 %215
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
@_Complex_I = global double 0.000000e+00
define i32 @lpbu2sos(double %0, double %1, i32 %2, double* nocapture writeonly %3, double* nocapture writeonly %4, double* nocapture writeonly %5, double* nocapture writeonly %6, double* nocapture writeonly %7) {
%9 = tail call i64 @calloc(i32 %2, i32 8)
%10 = inttoptr i64 %9 to double*
%11 = fmul double %0, %1
%12 = load double, double* @M_PI
%13 = fmul double %11, %12
%14 = tail call double @tan(double %13)
%15 = icmp sgt i32 %2, 0
br i1 %15, label %16, label %47
16: ; preds = %8
%17 = shl nuw nsw i32 %2, 1
%18 = sitofp i32 %17 to double
%19 = zext i32 %2 to i64
br label %23
20: ; preds = %23
br i1 %15, label %21, label %47
21: ; preds = %20
%22 = zext i32 %2 to i64
br label %44
23: ; preds = %16, %23
%24 = phi i64 [ 0, %16 ], [ %42, %23 ]
%25 = trunc i64 %24 to i32
%26 = shl i32 %25, 1
%27 = or i32 %26, 1
%28 = sitofp i32 %27 to double
%29 = load double, double* @M_PI
%30 = fmul double %29, %28
%31 = fdiv double %30, %18
%32 = tail call double @sin(double %31)
%33 = fneg double %32
%34 = tail call double @cos(double %31)
%35 = load double, double* @_Complex_I
%36 = tail call double @llvm.fmuladd.f64(double %34, double %35, double %33)
%37 = fmul double %14, %36
%38 = fadd double %37, 1.000000e+00
%39 = fsub double 1.000000e+00, %37
%40 = fdiv double %38, %39
%41 = getelementptr inbounds double, double* %10, i64 %24
store double %40, double* %41
%42 = add nuw nsw i64 %24, 1
%43 = icmp eq i64 %42, %19
br i1 %43, label %20, label %23
44: ; preds = %70, %21
%45 = phi i64 [ 0, %21 ], [ %71, %70 ]
%46 = getelementptr inbounds double, double* %10, i64 %45
br label %56
47: ; preds = %8, %20
%48 = sub i32 0, %2
%49 = lshr i32 %48, 1
%50 = sub nsw i32 0, %49
br label %113
51: ; preds = %70
%52 = sdiv i32 %2, 2
%53 = icmp sgt i32 %2, 1
br i1 %53, label %54, label %73
54: ; preds = %51
%55 = zext i32 %52 to i64
br label %76
56: ; preds = %44, %67
%57 = phi i64 [ 0, %44 ], [ %68, %67 ]
%58 = load double, double* %46
%59 = tail call i64 @carg(double %58)
%60 = getelementptr inbounds double, double* %10, i64 %57
%61 = load double, double* %60
%62 = tail call i64 @carg(double %61)
%63 = icmp slt i64 %59, %62
br i1 %63, label %64, label %67
64: ; preds = %56
%65 = load double, double* %46
%66 = load double, double* %60
store double %66, double* %46
store double %65, double* %60
br label %67
67: ; preds = %56, %64
%68 = add nuw nsw i64 %57, 1
%69 = icmp eq i64 %68, %22
br i1 %69, label %70, label %56
70: ; preds = %67
%71 = add nuw nsw i64 %45, 1
%72 = icmp eq i64 %71, %22
br i1 %72, label %51, label %44
73: ; preds = %76, %51
br i1 %15, label %74, label %113
74: ; preds = %73
%75 = zext i32 %2 to i64
br label %101
76: ; preds = %54, %76
%77 = phi i64 [ 0, %54 ], [ %99, %76 ]
%78 = getelementptr inbounds double, double* %4, i64 %77
store double 2.000000e+00, double* %78
%79 = getelementptr inbounds double, double* %5, i64 %77
store double 1.000000e+00, double* %79
%80 = getelementptr inbounds double, double* %10, i64 %77
%81 = load double, double* %80
%82 = tail call i32 @creal(double %81)
%83 = sitofp i32 %82 to double
%84 = fmul double %83, -2.000000e+00
%85 = getelementptr inbounds double, double* %6, i64 %77
store double %84, double* %85
%86 = load double, double* %80
%87 = tail call i32 @creal(double %86)
%88 = load double, double* %80
%89 = tail call i32 @creal(double %88)
%90 = mul nsw i32 %89, %87
%91 = load double, double* %80
%92 = tail call i32 @cimag(double %91)
%93 = load double, double* %80
%94 = tail call i32 @cimag(double %93)
%95 = mul nsw i32 %94, %92
%96 = add nsw i32 %95, %90
%97 = sitofp i32 %96 to double
%98 = getelementptr inbounds double, double* %7, i64 %77
store double %97, double* %98
%99 = add nuw nsw i64 %77, 1
%100 = icmp eq i64 %99, %55
br i1 %100, label %73, label %76
101: ; preds = %74, %101
%102 = phi i64 [ 0, %74 ], [ %111, %101 ]
%103 = phi double [ 1.000000e+00, %74 ], [ %110, %101 ]
%104 = getelementptr inbounds double, double* %10, i64 %102
%105 = load double, double* %104
%106 = fsub double 1.000000e+00, %105
%107 = tail call i32 @cabs(double %106)
%108 = sitofp i32 %107 to double
%109 = fmul double %108, 5.000000e-01
%110 = fdiv double %103, %109
%111 = add nuw nsw i64 %102, 1
%112 = icmp eq i64 %111, %75
br i1 %112, label %113, label %101
113: ; preds = %101, %47, %73
%114 = phi i32 [ %52, %73 ], [ %50, %47 ], [ %52, %101 ]
%115 = phi double [ 1.000000e+00, %73 ], [ 1.000000e+00, %47 ], [ %110, %101 ]
%116 = fdiv double 1.000000e+00, %115
store double %116, double* %3
%117 = tail call i32 @free(double* %10)
ret i32 %114
}