#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 */
int atan(double);
int cos(int);
double dfs(double const, double *, int, double *, int, double *, int *);
double exp(double);
double df2(const double x, const double sf, const double f0p, const double wbp,
           const double f0z, const double wbz, const int fp, const int fz,
           double *buf, int *bufp) {
  double a[3], b[3];
  double p, e;
  p = 4 * atan(1.0) / sf;
  e = exp(-p * wbz);
  a[0] = 1.0;
  if (fz) {
    a[1] = -2 * e * cos(2 * p * f0z);
    a[2] = e * e;
  } else {
    a[1] = 0;
    a[2] = 0;
  }
  e = exp(-p * wbp);
  b[0] = 1.0;
  if (fp) {
    b[1] = -2 * e * cos(2 * p * f0p);
    b[2] = e * e;
  } else {
    b[1] = 0;
    b[2] = 0;
  }
  return (dfs(x, b, 2, a, 2, buf, bufp));
}


x86 assembly (clang, -O0):
<df2>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
mov    %edi,-0x34(%rbp)
mov    %esi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
movsd  0xe81(%rip),%xmm0
call   1030 <atan@plt>
shl    $0x2,%eax
cvtsi2sd %eax,%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x30(%rbp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xe2f(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
cmpl   $0x0,-0x38(%rbp)
je     1245 <df2+0x105>
movsd  0xe28(%rip),%xmm0
mulsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xe08(%rip),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x28(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <cos@plt>
movsd  -0x98(%rbp),%xmm0
ff
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
mulsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x50(%rbp)
jmp    1255 <df2+0x115>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xd72(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     1302 <df2+0x1c2>
movsd  0xd6b(%rip),%xmm0
mulsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xd4b(%rip),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <cos@plt>
movsd  -0xa0(%rbp),%xmm0
ff
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
mulsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x70(%rbp)
jmp    1312 <df2+0x1d2>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x80(%rbp),%rdi
lea    -0x60(%rbp),%rdx
mov    -0x40(%rbp),%r8
mov    -0x48(%rbp),%r9
mov    $0x2,%ecx
mov    %ecx,%esi
call   1060 <dfs@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<df2>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xa0,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,%ebx
mov    %edi,%r12d
movsd  %xmm5,0x20(%rsp)
movsd  %xmm4,0x10(%rsp)
movsd  %xmm3,0x30(%rsp)
movsd  %xmm2,0x40(%rsp)
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x48(%rsp)
movsd  0xe7b(%rip),%xmm0
call   1030 <atan@plt>
shl    $0x2,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
divsd  (%rsp),%xmm1
movapd 0xe6f(%rip),%xmm0
movapd %xmm1,(%rsp)
xorpd  %xmm1,%xmm0
movapd %xmm0,0x50(%rsp)
mulsd  0x20(%rsp),%xmm0
call   1040 <exp@plt>
movabs $0x3ff0000000000000,%rbp
mov    %rbp,0x80(%rsp)
xorpd  %xmm1,%xmm1
test   %ebx,%ebx
je     1224 <df2+0xe4>
movapd %xmm0,%xmm1
mulsd  0xe27(%rip),%xmm1
movapd %xmm1,0x20(%rsp)
movapd (%rsp),%xmm1
addsd  %xmm1,%xmm1
mulsd  0x10(%rsp),%xmm1
cvttsd2si %xmm1,%edi
movapd %xmm0,0x10(%rsp)
call   1050 <cos@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movapd 0x20(%rsp),%xmm0
movapd 0x10(%rsp),%xmm2
unpcklpd %xmm2,%xmm0
unpcklpd %xmm2,%xmm1
mulpd  %xmm0,%xmm1
movupd %xmm1,0x88(%rsp)
movsd  0x30(%rsp),%xmm0
mulsd  0x50(%rsp),%xmm0
call   1040 <exp@plt>
mov    %rbp,0x60(%rsp)
test   %r12d,%r12d
xorpd  %xmm1,%xmm1
je     1299 <df2+0x159>
movapd %xmm0,%xmm1
mulsd  0xdb0(%rip),%xmm1
movapd %xmm1,0x30(%rsp)
movapd (%rsp),%xmm1
addsd  %xmm1,%xmm1
mulsd  0x40(%rsp),%xmm1
cvttsd2si %xmm1,%edi
movapd %xmm0,(%rsp)
call   1050 <cos@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movapd 0x30(%rsp),%xmm0
movapd (%rsp),%xmm2
unpcklpd %xmm2,%xmm0
unpcklpd %xmm2,%xmm1
mulpd  %xmm0,%xmm1
movupd %xmm1,0x68(%rsp)
lea    0x60(%rsp),%rdi
lea    0x80(%rsp),%rdx
movsd  0x48(%rsp),%xmm0
mov    $0x2,%esi
mov    $0x2,%ecx
mov    %r15,%r8
mov    %r14,%r9
call   1060 <dfs@plt>
add    $0xa0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @df2(double %0, double %1, double %2, double %3, double %4, double %5, i32 %6, i32 %7, double* %8, i32* %9) {
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca i32
%18 = alloca i32
%19 = alloca double*
%20 = alloca i32*
%21 = alloca [3 x double]
%22 = alloca [3 x double]
%23 = alloca double
%24 = 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 i32 %6, i32* %17
store i32 %7, i32* %18
store double* %8, double** %19
store i32* %9, i32** %20
%25 = call i32 @atan(double 1.000000e+00)
%26 = mul nsw i32 4, %25
%27 = sitofp i32 %26 to double
%28 = load double, double* %12
%29 = fdiv double %27, %28
store double %29, double* %23
%30 = load double, double* %23
%31 = fneg double %30
%32 = load double, double* %16
%33 = fmul double %31, %32
%34 = call double @exp(double %33)
store double %34, double* %24
%35 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 0
store double 1.000000e+00, double* %35
%36 = load i32, i32* %18
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %54
38: ; preds = %10
%39 = load double, double* %24
%40 = fmul double -2.000000e+00, %39
%41 = load double, double* %23
%42 = fmul double 2.000000e+00, %41
%43 = load double, double* %15
%44 = fmul double %42, %43
%45 = fptosi double %44 to i32
%46 = call i32 @cos(i32 %45)
%47 = sitofp i32 %46 to double
%48 = fmul double %40, %47
%49 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 1
store double %48, double* %49
%50 = load double, double* %24
%51 = load double, double* %24
%52 = fmul double %50, %51
%53 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 2
store double %52, double* %53
br label %57
54: ; preds = %10
%55 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 1
store double 0.000000e+00, double* %55
%56 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 2
store double 0.000000e+00, double* %56
br label %57
57: ; preds = %54, %38
%58 = load double, double* %23
%59 = fneg double %58
%60 = load double, double* %14
%61 = fmul double %59, %60
%62 = call double @exp(double %61)
store double %62, double* %24
%63 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
store double 1.000000e+00, double* %63
%64 = load i32, i32* %17
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %82
66: ; preds = %57
%67 = load double, double* %24
%68 = fmul double -2.000000e+00, %67
%69 = load double, double* %23
%70 = fmul double 2.000000e+00, %69
%71 = load double, double* %13
%72 = fmul double %70, %71
%73 = fptosi double %72 to i32
%74 = call i32 @cos(i32 %73)
%75 = sitofp i32 %74 to double
%76 = fmul double %68, %75
%77 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
store double %76, double* %77
%78 = load double, double* %24
%79 = load double, double* %24
%80 = fmul double %78, %79
%81 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
store double %80, double* %81
br label %85
82: ; preds = %57
%83 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
store double 0.000000e+00, double* %83
%84 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
store double 0.000000e+00, double* %84
br label %85
85: ; preds = %82, %66
%86 = load double, double* %11
%87 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%88 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 0
%89 = load double*, double** %19
%90 = load i32*, i32** %20
%91 = call double @dfs(double %86, double* %87, i32 2, double* %88, i32 2, double* %89, i32* %90)
ret double %91
}

LLVM IR (-O2):
define double @df2(double %0, double %1, double %2, double %3, double %4, double %5, i32 %6, i32 %7, double* %8, i32* %9) {
%11 = alloca [3 x double]
%12 = alloca [3 x double]
%13 = bitcast [3 x double]* %11 to i8*
%14 = bitcast [3 x double]* %12 to i8*
%15 = tail call i32 @atan(double 1.000000e+00)
%16 = shl nsw i32 %15, 2
%17 = sitofp i32 %16 to double
%18 = fdiv double %17, %1
%19 = fneg double %18
%20 = fmul double %19, %5
%21 = tail call double @exp(double %20)
%22 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
store double 1.000000e+00, double* %22
%23 = icmp eq i32 %7, 0
br i1 %23, label %36, label %24
24: ; preds = %10
%25 = fmul double %21, -2.000000e+00
%26 = fmul double %18, 2.000000e+00
%27 = fmul double %26, %4
%28 = fptosi double %27 to i32
%29 = tail call i32 @cos(i32 %28)
%30 = sitofp i32 %29 to double
%31 = insertelement <2 x double> poison, double %25, i64 0
%32 = insertelement <2 x double> %31, double %21, i64 1
%33 = insertelement <2 x double> poison, double %30, i64 0
%34 = insertelement <2 x double> %33, double %21, i64 1
%35 = fmul <2 x double> %32, %34
br label %36
36: ; preds = %10, %24
%37 = phi <2 x double> [ %35, %24 ], [ zeroinitializer, %10 ]
%38 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
%39 = bitcast double* %38 to <2 x double>*
store <2 x double> %37, <2 x double>* %39
%40 = fmul double %19, %3
%41 = tail call double @exp(double %40)
%42 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 0
store double 1.000000e+00, double* %42
%43 = icmp eq i32 %6, 0
br i1 %43, label %56, label %44
44: ; preds = %36
%45 = fmul double %41, -2.000000e+00
%46 = fmul double %18, 2.000000e+00
%47 = fmul double %46, %2
%48 = fptosi double %47 to i32
%49 = tail call i32 @cos(i32 %48)
%50 = sitofp i32 %49 to double
%51 = insertelement <2 x double> poison, double %45, i64 0
%52 = insertelement <2 x double> %51, double %41, i64 1
%53 = insertelement <2 x double> poison, double %50, i64 0
%54 = insertelement <2 x double> %53, double %41, i64 1
%55 = fmul <2 x double> %52, %54
br label %56
56: ; preds = %36, %44
%57 = phi <2 x double> [ %55, %44 ], [ zeroinitializer, %36 ]
%58 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 1
%59 = bitcast double* %58 to <2 x double>*
store <2 x double> %57, <2 x double>* %59
%60 = call double @dfs(double %0, double* %42, i32 2, double* %22, i32 2, double* %8, i32* %9)
ret double %60
}