#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 /*<<< orphan*/ BR_permute(double *, int);
double sqrt(double);
int /*<<< orphan*/ srrec(double *, double *, int);
void srfft(double *xr, double *xi, int logm) {
  int i, m;
  double fac, *xrp, *xip;
  srrec(xr, xi, logm);
  if (logm > 1) {
    BR_permute(xr, logm);
    BR_permute(xi, logm);
  }
  m = 1 << logm;
  fac = 1.0 / sqrt((double)m);
  xrp = xr;
  xip = xi;
  for (i = 0; i < m; i++) {
    *xrp++ *= fac;
    *xip++ *= fac;
  }
}


x86 assembly (clang, -O0):
<srfft>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <srrec@plt>
cmpl   $0x1,-0x14(%rbp)
jle    1175 <srfft+0x45>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <BR_permute@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <BR_permute@plt>
mov    -0x14(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x1c(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xe69(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1209 <srfft+0xd9>
movsd  -0x28(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x30(%rbp)
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x38(%rbp)
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b7 <srfft+0x87>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<srfft>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <srrec@plt>
cmp    $0x2,%r15d
jl     1161 <srfft+0x31>
mov    %rbx,%rdi
mov    %r15d,%esi
call   1030 <BR_permute@plt>
mov    %r14,%rdi
mov    %r15d,%esi
call   1030 <BR_permute@plt>
mov    $0x1,%ebp
mov    %r15d,%ecx
shl    %cl,%ebp
cvtsi2sd %ebp,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1188 <srfft+0x58>
sqrtsd %xmm0,%xmm0
cmp    $0x1f,%r15d
jne    1197 <srfft+0x67>
jmp    1388 <srfft+0x258>
call   1050 <sqrt@plt>
cmp    $0x1f,%r15d
je     1388 <srfft+0x258>
movsd  0xe61(%rip),%xmm1
cmp    $0x2,%ebp
mov    $0x1,%eax
cmovge %ebp,%eax
divsd  %xmm0,%xmm1
lea    -0x1(%rax),%edx
xor    %ecx,%ecx
cmp    $0x3,%edx
jb     12f9 <srfft+0x1c9>
lea    (%r14,%rdx,8),%rsi
add    $0x8,%rsi
cmp    %rbx,%rsi
jbe    11da <srfft+0xaa>
lea    (%rbx,%rdx,8),%rsi
add    $0x8,%rsi
cmp    %r14,%rsi
ja     12f9 <srfft+0x1c9>
add    $0x1,%rdx
mov    %rdx,%rcx
and    $0xfffffffffffffffc,%rcx
movapd %xmm1,%xmm0
unpcklpd %xmm1,%xmm0
lea    -0x4(%rcx),%rsi
mov    %rsi,%rbp
shr    $0x2,%rbp
add    $0x1,%rbp
test   %rsi,%rsi
je     1393 <srfft+0x263>
mov    %rbp,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %esi,%esi
xchg   %ax,%ax
movupd (%rbx,%rsi,8),%xmm2
movupd 0x10(%rbx,%rsi,8),%xmm3
mulpd  %xmm0,%xmm2
mulpd  %xmm0,%xmm3
movupd %xmm2,(%rbx,%rsi,8)
movupd %xmm3,0x10(%rbx,%rsi,8)
movupd (%r14,%rsi,8),%xmm2
movupd 0x10(%r14,%rsi,8),%xmm3
mulpd  %xmm0,%xmm2
mulpd  %xmm0,%xmm3
movupd %xmm2,(%r14,%rsi,8)
movupd %xmm3,0x10(%r14,%rsi,8)
movupd 0x20(%rbx,%rsi,8),%xmm2
movupd 0x30(%rbx,%rsi,8),%xmm3
mulpd  %xmm0,%xmm2
mulpd  %xmm0,%xmm3
movupd %xmm2,0x20(%rbx,%rsi,8)
movupd %xmm3,0x30(%rbx,%rsi,8)
movupd 0x20(%r14,%rsi,8),%xmm2
movupd 0x30(%r14,%rsi,8),%xmm3
mulpd  %xmm0,%xmm2
mulpd  %xmm0,%xmm3
movupd %xmm2,0x20(%r14,%rsi,8)
movupd %xmm3,0x30(%r14,%rsi,8)
add    $0x8,%rsi
add    $0xfffffffffffffffe,%rdi
jne    1210 <srfft+0xe0>
test   $0x1,%bpl
je     12e8 <srfft+0x1b8>
movupd (%rbx,%rsi,8),%xmm2
movupd 0x10(%rbx,%rsi,8),%xmm3
mulpd  %xmm0,%xmm2
mulpd  %xmm0,%xmm3
movupd %xmm2,(%rbx,%rsi,8)
movupd %xmm3,0x10(%rbx,%rsi,8)
movupd (%r14,%rsi,8),%xmm2
movupd 0x10(%r14,%rsi,8),%xmm3
mulpd  %xmm0,%xmm2
mulpd  %xmm0,%xmm3
movupd %xmm2,(%r14,%rsi,8)
movupd %xmm3,0x10(%r14,%rsi,8)
cmp    %rcx,%rdx
je     1388 <srfft+0x258>
lea    (%r14,%rcx,8),%r14
lea    (%rbx,%rcx,8),%rbx
mov    %eax,%esi
sub    %ecx,%esi
lea    0x1(%rcx),%edx
test   $0x1,%sil
je     132a <srfft+0x1fa>
movsd  (%rbx),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx)
add    $0x8,%rbx
movsd  (%r14),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
add    $0x8,%r14
mov    %edx,%ecx
cmp    %edx,%eax
je     1388 <srfft+0x258>
sub    %ecx,%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rbx,%rcx,8),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
movsd  (%r14,%rcx,8),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%r14,%rcx,8)
movsd  0x8(%rbx,%rcx,8),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rbx,%rcx,8)
movsd  0x8(%r14,%rcx,8),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%r14,%rcx,8)
add    $0x2,%rcx
cmp    %ecx,%eax
jne    1340 <srfft+0x210>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %esi,%esi
test   $0x1,%bpl
jne    12a8 <srfft+0x178>
jmp    12e8 <srfft+0x1b8>

LLVM IR (-O0):
define void @srfft(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double*
%11 = alloca double*
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
%12 = load double*, double** %4
%13 = load double*, double** %5
%14 = load i32, i32* %6
%15 = call i32 @srrec(double* %12, double* %13, i32 %14)
%16 = load i32, i32* %6
%17 = icmp sgt i32 %16, 1
br i1 %17, label %18, label %25
18: ; preds = %3
%19 = load double*, double** %4
%20 = load i32, i32* %6
%21 = call i32 @BR_permute(double* %19, i32 %20)
%22 = load double*, double** %5
%23 = load i32, i32* %6
%24 = call i32 @BR_permute(double* %22, i32 %23)
br label %25
25: ; preds = %18, %3
%26 = load i32, i32* %6
%27 = shl i32 1, %26
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = sitofp i32 %28 to double
%30 = call double @sqrt(double %29)
%31 = fdiv double 1.000000e+00, %30
store double %31, double* %9
%32 = load double*, double** %4
store double* %32, double** %10
%33 = load double*, double** %5
store double* %33, double** %11
store i32 0, i32* %7
br label %34
34: ; preds = %49, %25
%35 = load i32, i32* %7
%36 = load i32, i32* %8
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %52
38: ; preds = %34
%39 = load double, double* %9
%40 = load double*, double** %10
%41 = getelementptr inbounds double, double* %40, i32 1
store double* %41, double** %10
%42 = load double, double* %40
%43 = fmul double %42, %39
store double %43, double* %40
%44 = load double, double* %9
%45 = load double*, double** %11
%46 = getelementptr inbounds double, double* %45, i32 1
store double* %46, double** %11
%47 = load double, double* %45
%48 = fmul double %47, %44
store double %48, double* %45
br label %49
49: ; preds = %38
%50 = load i32, i32* %7
%51 = add nsw i32 %50, 1
store i32 %51, i32* %7
br label %34
52: ; preds = %34
ret void
}

LLVM IR (-O2):
define void @srfft(double* %0, double* %1, i32 %2) {
%4 = tail call i32 @srrec(double* %0, double* %1, i32 %2)
%5 = icmp sgt i32 %2, 1
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @BR_permute(double* %0, i32 %2)
%8 = tail call i32 @BR_permute(double* %1, i32 %2)
br label %9
9: ; preds = %6, %3
%10 = shl nuw i32 1, %2
%11 = sitofp i32 %10 to double
%12 = tail call double @sqrt(double %11)
%13 = fdiv double 1.000000e+00, %12
%14 = icmp eq i32 %2, 31
br i1 %14, label %158, label %15
15: ; preds = %9
%16 = call i32 @llvm.smax.i32(i32 %10, i32 1)
%17 = add nsw i32 %16, -1
%18 = zext i32 %17 to i64
%19 = add nuw nsw i64 %18, 1
%20 = icmp ult i32 %17, 3
br i1 %20, label %119, label %21
21: ; preds = %15
%22 = add nsw i32 %16, -1
%23 = zext i32 %22 to i64
%24 = add nuw nsw i64 %23, 1
%25 = getelementptr double, double* %0, i64 %24
%26 = getelementptr double, double* %1, i64 %24
%27 = icmp ugt double* %26, %0
%28 = icmp ugt double* %25, %1
%29 = and i1 %27, %28
br i1 %29, label %119, label %30
30: ; preds = %21
%31 = and i64 %19, 8589934588
%32 = getelementptr double, double* %1, i64 %31
%33 = getelementptr double, double* %0, i64 %31
%34 = trunc i64 %31 to i32
%35 = insertelement <2 x double> poison, double %13, i64 0
%36 = shufflevector <2 x double> %35, <2 x double> poison, <2 x i32> zeroinitializer
%37 = insertelement <2 x double> poison, double %13, i64 0
%38 = shufflevector <2 x double> %37, <2 x double> poison, <2 x i32> zeroinitializer
%39 = add nsw i64 %31, -4
%40 = lshr exact i64 %39, 2
%41 = add nuw nsw i64 %40, 1
%42 = and i64 %41, 1
%43 = icmp eq i64 %39, 0
br i1 %43, label %93, label %44
44: ; preds = %30
%45 = and i64 %41, 9223372036854775806
br label %46
46: ; preds = %46, %44
%47 = phi i64 [ 0, %44 ], [ %90, %46 ]
%48 = phi i64 [ 0, %44 ], [ %91, %46 ]
%49 = getelementptr double, double* %1, i64 %47
%50 = getelementptr double, double* %0, i64 %47
%51 = bitcast double* %50 to <2 x double>*
%52 = load <2 x double>, <2 x double>* %51
%53 = getelementptr double, double* %50, i64 2
%54 = bitcast double* %53 to <2 x double>*
%55 = load <2 x double>, <2 x double>* %54
%56 = fmul <2 x double> %36, %52
%57 = fmul <2 x double> %38, %55
%58 = bitcast double* %50 to <2 x double>*
store <2 x double> %56, <2 x double>* %58
%59 = bitcast double* %53 to <2 x double>*
store <2 x double> %57, <2 x double>* %59
%60 = bitcast double* %49 to <2 x double>*
%61 = load <2 x double>, <2 x double>* %60
%62 = getelementptr double, double* %49, i64 2
%63 = bitcast double* %62 to <2 x double>*
%64 = load <2 x double>, <2 x double>* %63
%65 = fmul <2 x double> %36, %61
%66 = fmul <2 x double> %38, %64
%67 = bitcast double* %49 to <2 x double>*
store <2 x double> %65, <2 x double>* %67
%68 = bitcast double* %62 to <2 x double>*
store <2 x double> %66, <2 x double>* %68
%69 = or i64 %47, 4
%70 = getelementptr double, double* %1, i64 %69
%71 = getelementptr double, double* %0, i64 %69
%72 = bitcast double* %71 to <2 x double>*
%73 = load <2 x double>, <2 x double>* %72
%74 = getelementptr double, double* %71, i64 2
%75 = bitcast double* %74 to <2 x double>*
%76 = load <2 x double>, <2 x double>* %75
%77 = fmul <2 x double> %36, %73
%78 = fmul <2 x double> %38, %76
%79 = bitcast double* %71 to <2 x double>*
store <2 x double> %77, <2 x double>* %79
%80 = bitcast double* %74 to <2 x double>*
store <2 x double> %78, <2 x double>* %80
%81 = bitcast double* %70 to <2 x double>*
%82 = load <2 x double>, <2 x double>* %81
%83 = getelementptr double, double* %70, i64 2
%84 = bitcast double* %83 to <2 x double>*
%85 = load <2 x double>, <2 x double>* %84
%86 = fmul <2 x double> %36, %82
%87 = fmul <2 x double> %38, %85
%88 = bitcast double* %70 to <2 x double>*
store <2 x double> %86, <2 x double>* %88
%89 = bitcast double* %83 to <2 x double>*
store <2 x double> %87, <2 x double>* %89
%90 = add nuw i64 %47, 8
%91 = add i64 %48, 2
%92 = icmp eq i64 %91, %45
br i1 %92, label %93, label %46
93: ; preds = %46, %30
%94 = phi i64 [ 0, %30 ], [ %90, %46 ]
%95 = icmp eq i64 %42, 0
br i1 %95, label %117, label %96
96: ; preds = %93
%97 = getelementptr double, double* %1, i64 %94
%98 = getelementptr double, double* %0, i64 %94
%99 = bitcast double* %98 to <2 x double>*
%100 = load <2 x double>, <2 x double>* %99
%101 = getelementptr double, double* %98, i64 2
%102 = bitcast double* %101 to <2 x double>*
%103 = load <2 x double>, <2 x double>* %102
%104 = fmul <2 x double> %36, %100
%105 = fmul <2 x double> %38, %103
%106 = bitcast double* %98 to <2 x double>*
store <2 x double> %104, <2 x double>* %106
%107 = bitcast double* %101 to <2 x double>*
store <2 x double> %105, <2 x double>* %107
%108 = bitcast double* %97 to <2 x double>*
%109 = load <2 x double>, <2 x double>* %108
%110 = getelementptr double, double* %97, i64 2
%111 = bitcast double* %110 to <2 x double>*
%112 = load <2 x double>, <2 x double>* %111
%113 = fmul <2 x double> %36, %109
%114 = fmul <2 x double> %38, %112
%115 = bitcast double* %97 to <2 x double>*
store <2 x double> %113, <2 x double>* %115
%116 = bitcast double* %110 to <2 x double>*
store <2 x double> %114, <2 x double>* %116
br label %117
117: ; preds = %93, %96
%118 = icmp eq i64 %19, %31
br i1 %118, label %158, label %119
119: ; preds = %21, %15, %117
%120 = phi double* [ %1, %21 ], [ %1, %15 ], [ %32, %117 ]
%121 = phi double* [ %0, %21 ], [ %0, %15 ], [ %33, %117 ]
%122 = phi i32 [ 0, %21 ], [ 0, %15 ], [ %34, %117 ]
%123 = sub i32 %16, %122
%124 = add i32 %122, 1
%125 = and i32 %123, 1
%126 = icmp eq i32 %125, 0
br i1 %126, label %135, label %127
127: ; preds = %119
%128 = getelementptr inbounds double, double* %121, i64 1
%129 = load double, double* %121
%130 = fmul double %13, %129
store double %130, double* %121
%131 = getelementptr inbounds double, double* %120, i64 1
%132 = load double, double* %120
%133 = fmul double %13, %132
store double %133, double* %120
%134 = add nuw nsw i32 %122, 1
br label %135
135: ; preds = %127, %119
%136 = phi double* [ %120, %119 ], [ %131, %127 ]
%137 = phi double* [ %121, %119 ], [ %128, %127 ]
%138 = phi i32 [ %122, %119 ], [ %134, %127 ]
%139 = icmp eq i32 %16, %124
br i1 %139, label %158, label %140
140: ; preds = %135, %140
%141 = phi double* [ %153, %140 ], [ %136, %135 ]
%142 = phi double* [ %150, %140 ], [ %137, %135 ]
%143 = phi i32 [ %156, %140 ], [ %138, %135 ]
%144 = getelementptr inbounds double, double* %142, i64 1
%145 = load double, double* %142
%146 = fmul double %13, %145
store double %146, double* %142
%147 = getelementptr inbounds double, double* %141, i64 1
%148 = load double, double* %141
%149 = fmul double %13, %148
store double %149, double* %141
%150 = getelementptr inbounds double, double* %142, i64 2
%151 = load double, double* %144
%152 = fmul double %13, %151
store double %152, double* %144
%153 = getelementptr inbounds double, double* %141, i64 2
%154 = load double, double* %147
%155 = fmul double %13, %154
store double %155, double* %147
%156 = add nuw nsw i32 %143, 2
%157 = icmp eq i32 %156, %16
br i1 %157, label %158, label %140
158: ; preds = %135, %140, %117, %9
ret void
}