#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(int);
double powof(double, int);
double sin(int);
double sqrt(double);
void fbspwavf(double *x, int sigInLength, int m, double fb, double fc,
              double *psir, double *psii, int sigOutLength, double ys) {
  int count;
  double con, econ;
  con = sqrt(fb);
  for (count = 0; count < sigInLength; count++) {
    if (x[count] != 0)
      econ = sin(x[count] * fb * 3.1415926535897931159980 / (double)m) /
             (x[count] * fb * 3.1415926535897931159980 / (double)m);
    else
      econ = 1;
    psir[count] = cos(2 * 3.1415926535897931159980 * fc * x[count]) *
                  powof(econ, m) * con / ys;
    psii[count] = sin(2 * 3.1415926535897931159980 * fc * x[count]) *
                  powof(econ, m) * con / ys;
  }
  return;
}


x86 assembly (clang, -O0):
<fbspwavf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
movsd  %xmm2,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12e4 <fbspwavf+0x1a4>
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11b4 <fbspwavf+0x74>
jp     11b4 <fbspwavf+0x74>
jmp    1219 <fbspwavf+0xd9>
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xe3a(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  0xe0a(%rip),%xmm2
mulsd  %xmm2,%xmm1
cvtsi2sdl -0x10(%rbp),%xmm2
divsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    1226 <fbspwavf+0xe6>
movsd  0xddf(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xde2(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
cvttsd2si %xmm0,%edi
call   1050 <cos@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    -0x10(%rbp),%edi
call   1030 <powof@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x50(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xd8a(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    -0x10(%rbp),%edi
call   1030 <powof@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x50(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1183 <fbspwavf+0x43>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fbspwavf>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movsd  %xmm2,0x30(%rsp)
mov    %r8,%r14
mov    %rcx,%r15
movsd  %xmm1,(%rsp)
mov    %edx,%r13d
mov    %esi,%r12d
mov    %rdi,%rbx
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
movsd  %xmm0,0x28(%rsp)
jb     117e <fbspwavf+0x3e>
sqrtsd %xmm0,%xmm0
jmp    1183 <fbspwavf+0x43>
call   1060 <sqrt@plt>
movsd  %xmm0,0x10(%rsp)
test   %r12d,%r12d
jle    12b6 <fbspwavf+0x176>
xorps  %xmm0,%xmm0
cvtsi2sd %r13d,%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
mulsd  0xe53(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    %r12d,%r12d
xor    %ebp,%ebp
jmp    128a <fbspwavf+0x14a>
nopl   0x0(%rax)
mulsd  0x28(%rsp),%xmm2
movsd  0xe42(%rip),%xmm1
mulsd  %xmm1,%xmm2
divsd  0x20(%rsp),%xmm2
cvttsd2si %xmm2,%edi
call   1040 <sin@plt>
movsd  (%rbx,%rbp,8),%xmm2
movapd %xmm2,%xmm1
mulsd  0x28(%rsp),%xmm1
mulsd  0xe18(%rip),%xmm1
divsd  0x20(%rsp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
mulsd  (%rsp),%xmm2
cvttsd2si %xmm2,%edi
call   1050 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
mov    %r13d,%edi
call   1030 <powof@plt>
mulsd  0x8(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
divsd  0x30(%rsp),%xmm0
movsd  %xmm0,(%r15,%rbp,8)
movsd  (%rbx,%rbp,8),%xmm0
mulsd  (%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
mov    %r13d,%edi
call   1030 <powof@plt>
mulsd  0x8(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
divsd  0x30(%rsp),%xmm0
movsd  %xmm0,(%r14,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%r12
je     12b6 <fbspwavf+0x176>
movsd  (%rbx,%rbp,8),%xmm2
ucomisd 0xd81(%rip),%xmm2
jne    11c0 <fbspwavf+0x80>
jp     11c0 <fbspwavf+0x80>
movsd  0xd5d(%rip),%xmm1
movsd  %xmm1,0x18(%rsp)
jmp    1208 <fbspwavf+0xc8>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @fbspwavf(double* nocapture %0, i32 %1, i32 %2, double %3, double %4, double* nocapture writeonly %5, double* nocapture writeonly %6, i32 %7, double %8) {
%10 = tail call double @sqrt(double %3)
%11 = icmp sgt i32 %1, 0
br i1 %11, label %12, label %54
12: ; preds = %9
%13 = sitofp i32 %2 to double
%14 = fmul double %4, 0x401921FB54442D18
%15 = zext i32 %1 to i64
br label %16
16: ; preds = %12, %32
%17 = phi i64 [ 0, %12 ], [ %52, %32 ]
%18 = getelementptr inbounds double, double* %0, i64 %17
%19 = load double, double* %18
%20 = fcmp une double %19, 0.000000e+00
br i1 %20, label %21, label %32
21: ; preds = %16
%22 = fmul double %19, %3
%23 = fmul double %22, 0x400921FB54442D18
%24 = fdiv double %23, %13
%25 = fptosi double %24 to i32
%26 = tail call double @sin(i32 %25)
%27 = load double, double* %18
%28 = fmul double %27, %3
%29 = fmul double %28, 0x400921FB54442D18
%30 = fdiv double %29, %13
%31 = fdiv double %26, %30
br label %32
32: ; preds = %16, %21
%33 = phi double [ %27, %21 ], [ %19, %16 ]
%34 = phi double [ %31, %21 ], [ 1.000000e+00, %16 ]
%35 = fmul double %14, %33
%36 = fptosi double %35 to i32
%37 = tail call double @cos(i32 %36)
%38 = tail call double @powof(double %34, i32 %2)
%39 = fmul double %37, %38
%40 = fmul double %10, %39
%41 = fdiv double %40, %8
%42 = getelementptr inbounds double, double* %5, i64 %17
store double %41, double* %42
%43 = load double, double* %18
%44 = fmul double %14, %43
%45 = fptosi double %44 to i32
%46 = tail call double @sin(i32 %45)
%47 = tail call double @powof(double %34, i32 %2)
%48 = fmul double %46, %47
%49 = fmul double %10, %48
%50 = fdiv double %49, %8
%51 = getelementptr inbounds double, double* %6, i64 %17
store double %50, double* %51
%52 = add nuw nsw i64 %17, 1
%53 = icmp eq i64 %52, %15
br i1 %53, label %54, label %16
54: ; preds = %32, %9
ret void
}