#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);
int /*<<< orphan*/ sms_ifft(int, double *);
int sms_invQuickSpectrumW(double *pFMagSpectrum, double *pFPhaseSpectrum,
                          int sizeFft, double *pFWaveform, int sizeWave,
                          double *pFWindow, double *pFftBuffer) {
  int i, it2;
  int sizeMag = sizeFft >> 1;
  for (i = 0; i < sizeMag; i++) {
    it2 = i << 1;
    pFftBuffer[it2] = pFMagSpectrum[i] * cos(pFPhaseSpectrum[i]);
    pFftBuffer[it2 + 1] = pFMagSpectrum[i] * sin(pFPhaseSpectrum[i]);
  }
  sms_ifft(sizeFft, pFftBuffer);
  for (i = 0; i < sizeWave; i++)
    pFWaveform[i] += (pFftBuffer[i] * pFWindow[i] * .5);
  return sizeMag;
}


x86 assembly (clang, -O0):
<sms_invQuickSpectrumW>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x14(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x3c(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1205 <sms_invQuickSpectrumW+0xd5>
mov    -0x34(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1163 <sms_invQuickSpectrumW+0x33>
mov    -0x14(%rbp),%edi
mov    0x10(%rbp),%rsi
call   1050 <sms_ifft@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    126e <sms_invQuickSpectrumW+0x13e>
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  0xdad(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1218 <sms_invQuickSpectrumW+0xe8>
mov    -0x3c(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sms_invQuickSpectrumW>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,0x20(%rsp)
mov    %r8d,0x1c(%rsp)
mov    %rcx,%rbx
mov    0x60(%rsp),%rbp
mov    %edx,%eax
sar    %eax
mov    %eax,0xc(%rsp)
mov    %edx,0x18(%rsp)
cmp    $0x2,%edx
jl     11d1 <sms_invQuickSpectrumW+0xa1>
mov    %rsi,%r15
mov    %rdi,%r12
mov    0xc(%rsp),%eax
cmp    $0x2,%eax
mov    $0x1,%r13d
cmovge %eax,%r13d
shl    $0x3,%r13
xor    %r14d,%r14d
nop
movsd  (%r12,%r14,1),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%r15,%r14,1),%xmm0
call   1040 <cos@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x0(%rbp,%r14,2)
movsd  (%r12,%r14,1),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%r15,%r14,1),%xmm0
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x8(%rbp,%r14,2)
add    $0x8,%r14
cmp    %r14,%r13
jne    1180 <sms_invQuickSpectrumW+0x50>
mov    0x18(%rsp),%edi
mov    %rbp,%rsi
call   1050 <sms_ifft@plt>
mov    0x1c(%rsp),%ecx
test   %ecx,%ecx
mov    0x20(%rsp),%rdi
jle    132e <sms_invQuickSpectrumW+0x1fe>
mov    %ecx,%eax
cmp    $0x4,%ecx
jae    11fc <sms_invQuickSpectrumW+0xcc>
xor    %ecx,%ecx
jmp    12b3 <sms_invQuickSpectrumW+0x183>
lea    (%rbx,%rax,8),%rcx
lea    0x0(,%rax,8),%rdx
add    %rbp,%rdx
cmp    %rbx,%rdx
seta   %r9b
lea    (%rdi,%rax,8),%rdx
cmp    %rbp,%rcx
seta   %r8b
cmp    %rbx,%rdx
seta   %dl
cmp    %rdi,%rcx
seta   %sil
xor    %ecx,%ecx
test   %r8b,%r9b
jne    12b3 <sms_invQuickSpectrumW+0x183>
and    %sil,%dl
jne    12b3 <sms_invQuickSpectrumW+0x183>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
lea    0x0(,%rax,8),%rdx
and    $0xffffffffffffffe0,%rdx
xor    %esi,%esi
movapd 0xdab(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nop
movupd 0x0(%rbp,%rsi,1),%xmm1
movupd 0x10(%rbp,%rsi,1),%xmm2
movupd (%rdi,%rsi,1),%xmm3
mulpd  %xmm1,%xmm3
movupd 0x10(%rdi,%rsi,1),%xmm1
mulpd  %xmm2,%xmm1
movupd (%rbx,%rsi,1),%xmm2
movupd 0x10(%rbx,%rsi,1),%xmm4
mulpd  %xmm0,%xmm3
addpd  %xmm2,%xmm3
mulpd  %xmm0,%xmm1
addpd  %xmm4,%xmm1
movupd %xmm3,(%rbx,%rsi,1)
movupd %xmm1,0x10(%rbx,%rsi,1)
add    $0x20,%rsi
cmp    %rsi,%rdx
jne    1260 <sms_invQuickSpectrumW+0x130>
cmp    %rax,%rcx
je     132e <sms_invQuickSpectrumW+0x1fe>
mov    %rcx,%rdx
not    %rdx
test   $0x1,%al
je     12de <sms_invQuickSpectrumW+0x1ae>
movsd  0x0(%rbp,%rcx,8),%xmm0
mulsd  (%rdi,%rcx,8),%xmm0
mulsd  0xd40(%rip),%xmm0
addsd  (%rbx,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
or     $0x1,%rcx
add    %rax,%rdx
je     132e <sms_invQuickSpectrumW+0x1fe>
movsd  0xd25(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%rcx,8),%xmm1
mulsd  (%rdi,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rbx,%rcx,8),%xmm1
movsd  %xmm1,(%rbx,%rcx,8)
movsd  0x8(%rbp,%rcx,8),%xmm1
mulsd  0x8(%rdi,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x8(%rbx,%rcx,8),%xmm1
movsd  %xmm1,0x8(%rbx,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%rax
jne    12f0 <sms_invQuickSpectrumW+0x1c0>
mov    0xc(%rsp),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @sms_invQuickSpectrumW(double* nocapture %0, double* nocapture %1, i32 %2, double* nocapture %3, i32 %4, double* nocapture %5, double* %6) {
%8 = ashr i32 %2, 1
%9 = icmp sgt i32 %2, 1
br i1 %9, label %10, label %31
10: ; preds = %7
%11 = call i32 @llvm.smax.i32(i32 %8, i32 1)
%12 = zext i32 %11 to i64
br label %13
13: ; preds = %10, %13
%14 = phi i64 [ 0, %10 ], [ %29, %13 ]
%15 = shl nuw i64 %14, 1
%16 = getelementptr inbounds double, double* %0, i64 %14
%17 = load double, double* %16
%18 = getelementptr inbounds double, double* %1, i64 %14
%19 = load double, double* %18
%20 = tail call double @cos(double %19)
%21 = fmul double %17, %20
%22 = getelementptr inbounds double, double* %6, i64 %15
store double %21, double* %22
%23 = load double, double* %16
%24 = load double, double* %18
%25 = tail call double @sin(double %24)
%26 = fmul double %23, %25
%27 = or i64 %15, 1
%28 = getelementptr inbounds double, double* %6, i64 %27
store double %26, double* %28
%29 = add nuw nsw i64 %14, 1
%30 = icmp eq i64 %29, %12
br i1 %30, label %31, label %13
31: ; preds = %13, %7
%32 = tail call i32 @sms_ifft(i32 %2, double* %6)
%33 = icmp sgt i32 %4, 0
br i1 %33, label %34, label %120
34: ; preds = %31
%35 = zext i32 %4 to i64
%36 = icmp ult i32 %4, 4
br i1 %36, label %80, label %37
37: ; preds = %34
%38 = getelementptr double, double* %3, i64 %35
%39 = getelementptr double, double* %6, i64 %35
%40 = getelementptr double, double* %5, i64 %35
%41 = icmp ugt double* %39, %3
%42 = icmp ugt double* %38, %6
%43 = and i1 %41, %42
%44 = icmp ugt double* %40, %3
%45 = icmp ugt double* %38, %5
%46 = and i1 %44, %45
%47 = or i1 %43, %46
br i1 %47, label %80, label %48
48: ; preds = %37
%49 = and i64 %35, 4294967292
br label %50
50: ; preds = %50, %48
%51 = phi i64 [ 0, %48 ], [ %76, %50 ]
%52 = getelementptr inbounds double, double* %6, i64 %51
%53 = bitcast double* %52 to <2 x double>*
%54 = load <2 x double>, <2 x double>* %53
%55 = getelementptr inbounds double, double* %52, i64 2
%56 = bitcast double* %55 to <2 x double>*
%57 = load <2 x double>, <2 x double>* %56
%58 = getelementptr inbounds double, double* %5, i64 %51
%59 = bitcast double* %58 to <2 x double>*
%60 = load <2 x double>, <2 x double>* %59
%61 = getelementptr inbounds double, double* %58, i64 2
%62 = bitcast double* %61 to <2 x double>*
%63 = load <2 x double>, <2 x double>* %62
%64 = fmul <2 x double> %54, %60
%65 = fmul <2 x double> %57, %63
%66 = getelementptr inbounds double, double* %3, i64 %51
%67 = bitcast double* %66 to <2 x double>*
%68 = load <2 x double>, <2 x double>* %67
%69 = getelementptr inbounds double, double* %66, i64 2
%70 = bitcast double* %69 to <2 x double>*
%71 = load <2 x double>, <2 x double>* %70
%72 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %64, <2 x double> <double 5.000000e-01, double 5.000000e-01>, <2 x double> %68)
%73 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %65, <2 x double> <double 5.000000e-01, double 5.000000e-01>, <2 x double> %71)
%74 = bitcast double* %66 to <2 x double>*
store <2 x double> %72, <2 x double>* %74
%75 = bitcast double* %69 to <2 x double>*
store <2 x double> %73, <2 x double>* %75
%76 = add nuw i64 %51, 4
%77 = icmp eq i64 %76, %49
br i1 %77, label %78, label %50
78: ; preds = %50
%79 = icmp eq i64 %49, %35
br i1 %79, label %120, label %80
80: ; preds = %37, %34, %78
%81 = phi i64 [ 0, %37 ], [ 0, %34 ], [ %49, %78 ]
%82 = xor i64 %81, -1
%83 = and i64 %35, 1
%84 = icmp eq i64 %83, 0
br i1 %84, label %95, label %85
85: ; preds = %80
%86 = getelementptr inbounds double, double* %6, i64 %81
%87 = load double, double* %86
%88 = getelementptr inbounds double, double* %5, i64 %81
%89 = load double, double* %88
%90 = fmul double %87, %89
%91 = getelementptr inbounds double, double* %3, i64 %81
%92 = load double, double* %91
%93 = tail call double @llvm.fmuladd.f64(double %90, double 5.000000e-01, double %92)
store double %93, double* %91
%94 = or i64 %81, 1
br label %95
95: ; preds = %85, %80
%96 = phi i64 [ %81, %80 ], [ %94, %85 ]
%97 = sub nsw i64 0, %35
%98 = icmp eq i64 %82, %97
br i1 %98, label %120, label %99
99: ; preds = %95, %99
%100 = phi i64 [ %118, %99 ], [ %96, %95 ]
%101 = getelementptr inbounds double, double* %6, i64 %100
%102 = load double, double* %101
%103 = getelementptr inbounds double, double* %5, i64 %100
%104 = load double, double* %103
%105 = fmul double %102, %104
%106 = getelementptr inbounds double, double* %3, i64 %100
%107 = load double, double* %106
%108 = tail call double @llvm.fmuladd.f64(double %105, double 5.000000e-01, double %107)
store double %108, double* %106
%109 = add nuw nsw i64 %100, 1
%110 = getelementptr inbounds double, double* %6, i64 %109
%111 = load double, double* %110
%112 = getelementptr inbounds double, double* %5, i64 %109
%113 = load double, double* %112
%114 = fmul double %111, %113
%115 = getelementptr inbounds double, double* %3, i64 %109
%116 = load double, double* %115
%117 = tail call double @llvm.fmuladd.f64(double %114, double 5.000000e-01, double %116)
store double %117, double* %115
%118 = add nuw nsw i64 %100, 2
%119 = icmp eq i64 %118, %35
br i1 %119, label %120, label %99
120: ; preds = %95, %99, %78, %31
ret i32 %8
}