#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*/ memcpy(double *, double *, size_t);
int /*<<< orphan*/ radf2(size_t, size_t, double *, double *, double const *);
int /*<<< orphan*/ radf3(size_t, size_t, double *, double *, double const *);
int /*<<< orphan*/ radf4(size_t, size_t, double *, double *, double const *);
int /*<<< orphan*/ radf5(size_t, size_t, double *, double *, double const *);
int /*<<< orphan*/ radfg(size_t, size_t, size_t, size_t, double *, double *,
                         double const *);
void rfftf1(size_t n, double c[], double ch[], const double wa[],
            const size_t ifac[]) {
  size_t k1, l1 = n, nf = ifac[1], iw = n - 1;
  double *p1 = ch, *p2 = c;
  for (k1 = 1; k1 <= nf; ++k1) {
    size_t ip = ifac[nf - k1 + 2];
    size_t ido = n / l1;
    l1 /= ip;
    iw -= (ip - 1) * ido;
    do {
      double *tmp_ = (p1);
      (p1) = (p2);
      (p2) = tmp_;
    } while (0);
    if (ip == 4)
      radf4(ido, l1, p1, p2, wa + iw);
    else if (ip == 2)
      radf2(ido, l1, p1, p2, wa + iw);
    else if (ip == 3)
      radf3(ido, l1, p1, p2, wa + iw);
    else if (ip == 5)
      radf5(ido, l1, p1, p2, wa + iw);
    else {
      if (ido == 1)
        do {
          double *tmp_ = (p1);
          (p1) = (p2);
          (p2) = tmp_;
        } while (0);
      radfg(ido, ip, l1, ido * l1, p1, p2, wa + iw);
      do {
        double *tmp_ = (p1);
        (p1) = (p2);
        (p2) = tmp_;
      } while (0);
    }
  }
  if (p1 == c)
    memcpy(c, ch, n * sizeof(double));
}


x86 assembly (clang, -O0):
<rfftf1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
movq   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x40(%rbp),%rax
ja     139f <rfftf1+0x23f>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    -0x30(%rbp),%rcx
mov    0x10(%rax,%rcx,8),%rax
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x38(%rbp)
mov    %rax,-0x68(%rbp)
mov    -0x60(%rbp),%rcx
mov    -0x38(%rbp),%rax
xor    %edx,%edx
div    %rcx
mov    %rax,-0x38(%rbp)
mov    -0x60(%rbp),%rcx
sub    $0x1,%rcx
imul   -0x68(%rbp),%rcx
mov    -0x48(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x58(%rbp)
cmpq   $0x4,-0x60(%rbp)
jne    125f <rfftf1+0xff>
mov    -0x68(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x50(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x48(%rbp),%rax
shl    $0x3,%rax
add    %rax,%r8
call   1070 <radf4@plt>
jmp    1389 <rfftf1+0x229>
cmpq   $0x2,-0x60(%rbp)
jne    1293 <rfftf1+0x133>
mov    -0x68(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x50(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x48(%rbp),%rax
shl    $0x3,%rax
add    %rax,%r8
call   1080 <radf2@plt>
jmp    1384 <rfftf1+0x224>
cmpq   $0x3,-0x60(%rbp)
jne    12c7 <rfftf1+0x167>
mov    -0x68(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x50(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x48(%rbp),%rax
shl    $0x3,%rax
add    %rax,%r8
call   1040 <radf3@plt>
jmp    137f <rfftf1+0x21f>
cmpq   $0x5,-0x60(%rbp)
jne    12fb <rfftf1+0x19b>
mov    -0x68(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x50(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x48(%rbp),%rax
shl    $0x3,%rax
add    %rax,%r8
call   1030 <radf5@plt>
jmp    137a <rfftf1+0x21a>
cmpq   $0x1,-0x68(%rbp)
jne    1328 <rfftf1+0x1c8>
jmp    130b <rfftf1+0x1ab>
mov    -0x50(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0x58(%rbp)
jmp    1328 <rfftf1+0x1c8>
mov    -0x68(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x68(%rbp),%rcx
imul   -0x38(%rbp),%rcx
mov    -0x50(%rbp),%r8
mov    -0x58(%rbp),%r9
mov    -0x20(%rbp),%rax
mov    -0x48(%rbp),%r10
shl    $0x3,%r10
add    %r10,%rax
mov    %rax,(%rsp)
call   1050 <radfg@plt>
mov    -0x50(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x80(%rbp),%rax
mov    %rax,-0x58(%rbp)
jmp    137a <rfftf1+0x21a>
jmp    137f <rfftf1+0x21f>
jmp    1384 <rfftf1+0x224>
jmp    1389 <rfftf1+0x229>
jmp    138e <rfftf1+0x22e>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    11b7 <rfftf1+0x57>
mov    -0x50(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    13c2 <rfftf1+0x262>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%rdx
shl    $0x3,%rdx
call   1060 <memcpy@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rfftf1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rcx,0x18(%rsp)
mov    %rsi,0x28(%rsp)
mov    %rdi,%rax
mov    0x8(%r8),%rsi
mov    %rdx,0x20(%rsp)
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rsi,0x30(%rsp)
test   %rsi,%rsi
je     132f <rfftf1+0x1cf>
lea    -0x1(%rax),%r9
mov    0x30(%rsp),%rcx
lea    (%r8,%rcx,8),%r13
add    $0x8,%r13
mov    $0x1,%r12d
mov    %rax,%rbx
mov    0x20(%rsp),%r14
mov    0x28(%rsp),%rbp
mov    %rax,0x10(%rsp)
jmp    120e <rfftf1+0xae>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x18(%rsp),%rax
lea    (%rax,%r9,8),%r8
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r14,%rcx
mov    %r9,%r15
call   1070 <radf4@plt>
mov    %r15,%r9
mov    0x10(%rsp),%rax
mov    %rbp,%rcx
mov    %r14,%rbp
add    $0x1,%r12
add    $0xfffffffffffffff8,%r13
mov    %rcx,%r14
cmp    %r12,0x30(%rsp)
jb     132f <rfftf1+0x1cf>
mov    0x0(%r13),%rsi
mov    %rax,%rcx
or     %rbx,%rcx
shr    $0x20,%rcx
je     1230 <rfftf1+0xd0>
xor    %edx,%edx
div    %rbx
mov    %rax,%rdi
jmp    1236 <rfftf1+0xd6>
nopl   0x0(%rax,%rax,1)
xor    %edx,%edx
div    %ebx
mov    %eax,%edi
mov    %rbx,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     1250 <rfftf1+0xf0>
mov    %rbx,%rax
xor    %edx,%edx
div    %rsi
mov    %rax,%rbx
jmp    1258 <rfftf1+0xf8>
nop
mov    %ebx,%eax
xor    %edx,%edx
div    %esi
mov    %eax,%ebx
lea    -0x1(%rsi),%rax
imul   %rdi,%rax
sub    %rax,%r9
lea    -0x2(%rsi),%rax
cmp    $0x3,%rax
ja     12a0 <rfftf1+0x140>
lea    0xd8c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x18(%rsp),%rax
lea    (%rax,%r9,8),%r8
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r14,%rcx
mov    %r9,%r15
call   1080 <radf2@plt>
jmp    11ea <rfftf1+0x8a>
nopl   0x0(%rax)
cmp    $0x1,%rdi
mov    %r14,%r15
cmove  %rbp,%r15
cmovne %rbp,%r14
mov    %rbx,%rcx
imul   %rdi,%rcx
mov    0x18(%rsp),%rax
lea    (%rax,%r9,8),%rax
mov    %rax,(%rsp)
mov    %rbx,%rdx
mov    %r14,%r8
mov    %r9,%rbp
mov    %r15,%r9
call   1050 <radfg@plt>
mov    %rbp,%r9
mov    0x10(%rsp),%rax
mov    %r15,%rbp
jmp    11f2 <rfftf1+0x92>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x18(%rsp),%rax
lea    (%rax,%r9,8),%r8
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r14,%rcx
mov    %r9,%r15
call   1040 <radf3@plt>
jmp    11ea <rfftf1+0x8a>
nop
mov    0x18(%rsp),%rax
lea    (%rax,%r9,8),%r8
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r14,%rcx
mov    %r9,%r15
call   1030 <radf5@plt>
jmp    11ea <rfftf1+0x8a>
mov    0x28(%rsp),%rdi
cmp    %rdi,%rcx
je     1348 <rfftf1+0x1e8>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
shl    $0x3,%rax
mov    0x20(%rsp),%rsi
mov    %rax,%rdx
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <memcpy@plt>

LLVM IR (-O0):
define void @rfftf1(i64 %0, double* %1, double* %2, double* %3, i64* %4) {
%6 = alloca i64
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca i64*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca double*
%16 = alloca double*
%17 = alloca i64
%18 = alloca i64
%19 = alloca double*
%20 = alloca double*
%21 = alloca double*
store i64 %0, i64* %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
store i64* %4, i64** %10
%22 = load i64, i64* %6
store i64 %22, i64* %12
%23 = load i64*, i64** %10
%24 = getelementptr inbounds i64, i64* %23, i64 1
%25 = load i64, i64* %24
store i64 %25, i64* %13
%26 = load i64, i64* %6
%27 = sub i64 %26, 1
store i64 %27, i64* %14
%28 = load double*, double** %8
store double* %28, double** %15
%29 = load double*, double** %7
store double* %29, double** %16
store i64 1, i64* %11
br label %30
30: ; preds = %137, %5
%31 = load i64, i64* %11
%32 = load i64, i64* %13
%33 = icmp ule i64 %31, %32
br i1 %33, label %34, label %140
34: ; preds = %30
%35 = load i64*, i64** %10
%36 = load i64, i64* %13
%37 = load i64, i64* %11
%38 = sub i64 %36, %37
%39 = add i64 %38, 2
%40 = getelementptr inbounds i64, i64* %35, i64 %39
%41 = load i64, i64* %40
store i64 %41, i64* %17
%42 = load i64, i64* %6
%43 = load i64, i64* %12
%44 = udiv i64 %42, %43
store i64 %44, i64* %18
%45 = load i64, i64* %17
%46 = load i64, i64* %12
%47 = udiv i64 %46, %45
store i64 %47, i64* %12
%48 = load i64, i64* %17
%49 = sub i64 %48, 1
%50 = load i64, i64* %18
%51 = mul i64 %49, %50
%52 = load i64, i64* %14
%53 = sub i64 %52, %51
store i64 %53, i64* %14
br label %54
54: ; preds = %34
%55 = load double*, double** %15
store double* %55, double** %19
%56 = load double*, double** %16
store double* %56, double** %15
%57 = load double*, double** %19
store double* %57, double** %16
br label %58
58: ; preds = %54
%59 = load i64, i64* %17
%60 = icmp eq i64 %59, 4
br i1 %60, label %61, label %70
61: ; preds = %58
%62 = load i64, i64* %18
%63 = load i64, i64* %12
%64 = load double*, double** %15
%65 = load double*, double** %16
%66 = load double*, double** %9
%67 = load i64, i64* %14
%68 = getelementptr inbounds double, double* %66, i64 %67
%69 = call i32 @radf4(i64 %62, i64 %63, double* %64, double* %65, double* %68)
br label %136
70: ; preds = %58
%71 = load i64, i64* %17
%72 = icmp eq i64 %71, 2
br i1 %72, label %73, label %82
73: ; preds = %70
%74 = load i64, i64* %18
%75 = load i64, i64* %12
%76 = load double*, double** %15
%77 = load double*, double** %16
%78 = load double*, double** %9
%79 = load i64, i64* %14
%80 = getelementptr inbounds double, double* %78, i64 %79
%81 = call i32 @radf2(i64 %74, i64 %75, double* %76, double* %77, double* %80)
br label %135
82: ; preds = %70
%83 = load i64, i64* %17
%84 = icmp eq i64 %83, 3
br i1 %84, label %85, label %94
85: ; preds = %82
%86 = load i64, i64* %18
%87 = load i64, i64* %12
%88 = load double*, double** %15
%89 = load double*, double** %16
%90 = load double*, double** %9
%91 = load i64, i64* %14
%92 = getelementptr inbounds double, double* %90, i64 %91
%93 = call i32 @radf3(i64 %86, i64 %87, double* %88, double* %89, double* %92)
br label %134
94: ; preds = %82
%95 = load i64, i64* %17
%96 = icmp eq i64 %95, 5
br i1 %96, label %97, label %106
97: ; preds = %94
%98 = load i64, i64* %18
%99 = load i64, i64* %12
%100 = load double*, double** %15
%101 = load double*, double** %16
%102 = load double*, double** %9
%103 = load i64, i64* %14
%104 = getelementptr inbounds double, double* %102, i64 %103
%105 = call i32 @radf5(i64 %98, i64 %99, double* %100, double* %101, double* %104)
br label %133
106: ; preds = %94
%107 = load i64, i64* %18
%108 = icmp eq i64 %107, 1
br i1 %108, label %109, label %115
109: ; preds = %106
br label %110
110: ; preds = %109
%111 = load double*, double** %15
store double* %111, double** %20
%112 = load double*, double** %16
store double* %112, double** %15
%113 = load double*, double** %20
store double* %113, double** %16
br label %114
114: ; preds = %110
br label %115
115: ; preds = %114, %106
%116 = load i64, i64* %18
%117 = load i64, i64* %17
%118 = load i64, i64* %12
%119 = load i64, i64* %18
%120 = load i64, i64* %12
%121 = mul i64 %119, %120
%122 = load double*, double** %15
%123 = load double*, double** %16
%124 = load double*, double** %9
%125 = load i64, i64* %14
%126 = getelementptr inbounds double, double* %124, i64 %125
%127 = call i32 @radfg(i64 %116, i64 %117, i64 %118, i64 %121, double* %122, double* %123, double* %126)
br label %128
128: ; preds = %115
%129 = load double*, double** %15
store double* %129, double** %21
%130 = load double*, double** %16
store double* %130, double** %15
%131 = load double*, double** %21
store double* %131, double** %16
br label %132
132: ; preds = %128
br label %133
133: ; preds = %132, %97
br label %134
134: ; preds = %133, %85
br label %135
135: ; preds = %134, %73
br label %136
136: ; preds = %135, %61
br label %137
137: ; preds = %136
%138 = load i64, i64* %11
%139 = add i64 %138, 1
store i64 %139, i64* %11
br label %30
140: ; preds = %30
%141 = load double*, double** %15
%142 = load double*, double** %7
%143 = icmp eq double* %141, %142
br i1 %143, label %144, label %150
144: ; preds = %140
%145 = load double*, double** %7
%146 = load double*, double** %8
%147 = load i64, i64* %6
%148 = mul i64 %147, 8
%149 = call i32 @memcpy(double* %145, double* %146, i64 %148)
br label %150
150: ; preds = %144, %140
ret void
}

LLVM IR (-O2):
define void @rfftf1(i64 %0, double* %1, double* %2, double* %3, i64* nocapture %4) {
%6 = getelementptr inbounds i64, i64* %4, i64 1
%7 = load i64, i64* %6
%8 = icmp eq i64 %7, 0
br i1 %8, label %50, label %9
9: ; preds = %5
%10 = add i64 %0, -1
%11 = add i64 %7, 2
br label %12
12: ; preds = %9, %45
%13 = phi i64 [ 1, %9 ], [ %48, %45 ]
%14 = phi i64 [ %0, %9 ], [ %22, %45 ]
%15 = phi i64 [ %10, %9 ], [ %25, %45 ]
%16 = phi double* [ %2, %9 ], [ %47, %45 ]
%17 = phi double* [ %1, %9 ], [ %46, %45 ]
%18 = sub i64 %11, %13
%19 = getelementptr inbounds i64, i64* %4, i64 %18
%20 = load i64, i64* %19
%21 = udiv i64 %0, %14
%22 = udiv i64 %14, %20
%23 = add i64 %20, -1
%24 = mul i64 %23, %21
%25 = sub i64 %15, %24
switch i64 %20, label %38 [
i64 4, label %26
i64 2, label %29
i64 3, label %32
i64 5, label %35
]
26: ; preds = %12
%27 = getelementptr inbounds double, double* %3, i64 %25
%28 = tail call i32 @radf4(i64 %21, i64 %22, double* %17, double* %16, double* %27)
br label %45
29: ; preds = %12
%30 = getelementptr inbounds double, double* %3, i64 %25
%31 = tail call i32 @radf2(i64 %21, i64 %22, double* %17, double* %16, double* %30)
br label %45
32: ; preds = %12
%33 = getelementptr inbounds double, double* %3, i64 %25
%34 = tail call i32 @radf3(i64 %21, i64 %22, double* %17, double* %16, double* %33)
br label %45
35: ; preds = %12
%36 = getelementptr inbounds double, double* %3, i64 %25
%37 = tail call i32 @radf5(i64 %21, i64 %22, double* %17, double* %16, double* %36)
br label %45
38: ; preds = %12
%39 = icmp eq i64 %21, 1
%40 = select i1 %39, double* %17, double* %16
%41 = select i1 %39, double* %16, double* %17
%42 = mul i64 %22, %21
%43 = getelementptr inbounds double, double* %3, i64 %25
%44 = tail call i32 @radfg(i64 %21, i64 %20, i64 %22, i64 %42, double* %41, double* %40, double* %43)
br label %45
45: ; preds = %29, %35, %38, %32, %26
%46 = phi double* [ %16, %26 ], [ %16, %29 ], [ %16, %32 ], [ %16, %35 ], [ %41, %38 ]
%47 = phi double* [ %17, %26 ], [ %17, %29 ], [ %17, %32 ], [ %17, %35 ], [ %40, %38 ]
%48 = add i64 %13, 1
%49 = icmp ult i64 %7, %48
br i1 %49, label %50, label %12
50: ; preds = %45, %5
%51 = phi double* [ %2, %5 ], [ %47, %45 ]
%52 = icmp eq double* %51, %1
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = shl i64 %0, 3
%55 = tail call i32 @memcpy(double* %1, double* %2, i64 %54)
br label %56
56: ; preds = %53, %50
ret void
}