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


x86 assembly (clang, -O0):
<rfftb1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movq   $0x1,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x58(%rbp)
movq   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x40(%rbp),%rax
ja     137e <rfftb1+0x21e>
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    0x8(%rax,%rcx,8),%rax
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x60(%rbp),%rcx
imul   -0x38(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x68(%rbp)
cmpq   $0x4,-0x60(%rbp)
jne    121c <rfftb1+0xbc>
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   1050 <radb4@plt>
jmp    132e <rfftb1+0x1ce>
cmpq   $0x2,-0x60(%rbp)
jne    1250 <rfftb1+0xf0>
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 <radb2@plt>
jmp    1329 <rfftb1+0x1c9>
cmpq   $0x3,-0x60(%rbp)
jne    1284 <rfftb1+0x124>
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 <radb3@plt>
jmp    1324 <rfftb1+0x1c4>
cmpq   $0x5,-0x60(%rbp)
jne    12b8 <rfftb1+0x158>
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 <radb5@plt>
jmp    131f <rfftb1+0x1bf>
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   1040 <radbg@plt>
cmpq   $0x1,-0x68(%rbp)
je     131a <rfftb1+0x1ba>
jmp    12fd <rfftb1+0x19d>
mov    -0x50(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x58(%rbp)
jmp    131a <rfftb1+0x1ba>
jmp    131f <rfftb1+0x1bf>
jmp    1324 <rfftb1+0x1c4>
jmp    1329 <rfftb1+0x1c9>
jmp    132e <rfftb1+0x1ce>
jmp    1333 <rfftb1+0x1d3>
mov    -0x50(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x60(%rbp),%rax
imul   -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x60(%rbp),%rax
sub    $0x1,%rax
imul   -0x68(%rbp),%rax
add    -0x48(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    11b3 <rfftb1+0x53>
mov    -0x50(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     13a1 <rfftb1+0x241>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%rdx
shl    $0x3,%rdx
call   1060 <memcpy@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rfftb1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rcx,0x18(%rsp)
mov    %r8,0x40(%rsp)
mov    0x8(%r8),%rcx
mov    %rcx,0x38(%rsp)
test   %rcx,%rcx
je     1338 <rfftb1+0x1d8>
mov    %rdi,%rax
mov    $0x1,%r12d
xor    %r15d,%r15d
mov    $0x1,%ebx
mov    %rsi,0x28(%rsp)
mov    %rsi,%r10
mov    %rdx,0x30(%rsp)
mov    %rdx,%rbp
mov    %rdi,0x10(%rsp)
jmp    1200 <rfftb1+0xa0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x18(%rsp),%rax
lea    (%rax,%r15,8),%r8
mov    %r13,%rdi
mov    %r9,%rsi
mov    %r10,%rdx
mov    %rbp,%rcx
call   1050 <radb4@plt>
mov    0x20(%rsp),%rdx
mov    0x10(%rsp),%rax
mov    %rbp,%r10
add    $0xffffffffffffffff,%r14
imul   %r13,%r14
add    %r14,%r15
mov    %rdx,%rbp
cmp    0x38(%rsp),%r12
ja     130f <rfftb1+0x1af>
mov    %rbx,%r9
mov    0x40(%rsp),%rcx
mov    0x8(%rcx,%r12,8),%r14
mov    %r14,%rbx
imul   %r9,%rbx
mov    %rax,%rcx
or     %rbx,%rcx
shr    $0x20,%rcx
je     1230 <rfftb1+0xd0>
xor    %edx,%edx
div    %rbx
mov    %rax,%r13
jmp    1237 <rfftb1+0xd7>
nopw   0x0(%rax,%rax,1)
xor    %edx,%edx
div    %ebx
mov    %eax,%r13d
add    $0x1,%r12
lea    -0x2(%r14),%rax
cmp    $0x3,%rax
mov    %r10,0x20(%rsp)
ja     1280 <rfftb1+0x120>
lea    0xdaf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x18(%rsp),%rax
lea    (%rax,%r15,8),%r8
mov    %r13,%rdi
mov    %r9,%rsi
mov    %r10,%rdx
mov    %rbp,%rcx
call   1030 <radb2@plt>
jmp    11da <rfftb1+0x7a>
nopl   0x0(%rax)
mov    %r13,%rcx
imul   %r9,%rcx
mov    0x18(%rsp),%rax
lea    (%rax,%r15,8),%rax
mov    %rax,(%rsp)
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r9,%rdx
mov    %r10,%r8
mov    %rbp,%r9
call   1040 <radbg@plt>
mov    0x20(%rsp),%rdx
mov    0x10(%rsp),%rax
cmp    $0x1,%r13
mov    %rdx,%r10
cmove  %rbp,%r10
cmovne %rbp,%rdx
jmp    11e7 <rfftb1+0x87>
cs nopw 0x0(%rax,%rax,1)
mov    0x18(%rsp),%rax
lea    (%rax,%r15,8),%r8
mov    %r13,%rdi
mov    %r9,%rsi
mov    %r10,%rdx
mov    %rbp,%rcx
call   1070 <radb3@plt>
jmp    11da <rfftb1+0x7a>
nop
mov    0x18(%rsp),%rax
lea    (%rax,%r15,8),%r8
mov    %r13,%rdi
mov    %r9,%rsi
mov    %r10,%rdx
mov    %rbp,%rcx
call   1080 <radb5@plt>
jmp    11da <rfftb1+0x7a>
mov    0x28(%rsp),%rdi
cmp    %rdi,%r10
mov    0x30(%rsp),%rsi
je     1338 <rfftb1+0x1d8>
shl    $0x3,%rax
mov    %rax,%rdx
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <memcpy@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @rfftb1(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 %51, label %9
9: ; preds = %5, %39
%10 = phi i64 [ %15, %39 ], [ 1, %5 ]
%11 = phi i64 [ %18, %39 ], [ 1, %5 ]
%12 = phi i64 [ %44, %39 ], [ 0, %5 ]
%13 = phi double* [ %40, %39 ], [ %1, %5 ]
%14 = phi double* [ %41, %39 ], [ %2, %5 ]
%15 = add i64 %10, 1
%16 = getelementptr inbounds i64, i64* %4, i64 %15
%17 = load i64, i64* %16
%18 = mul i64 %17, %11
%19 = udiv i64 %0, %18
switch i64 %17, label %32 [
i64 4, label %20
i64 2, label %23
i64 3, label %26
i64 5, label %29
]
20: ; preds = %9
%21 = getelementptr inbounds double, double* %3, i64 %12
%22 = tail call i32 @radb4(i64 %19, i64 %11, double* %13, double* %14, double* %21)
br label %39
23: ; preds = %9
%24 = getelementptr inbounds double, double* %3, i64 %12
%25 = tail call i32 @radb2(i64 %19, i64 %11, double* %13, double* %14, double* %24)
br label %39
26: ; preds = %9
%27 = getelementptr inbounds double, double* %3, i64 %12
%28 = tail call i32 @radb3(i64 %19, i64 %11, double* %13, double* %14, double* %27)
br label %39
29: ; preds = %9
%30 = getelementptr inbounds double, double* %3, i64 %12
%31 = tail call i32 @radb5(i64 %19, i64 %11, double* %13, double* %14, double* %30)
br label %39
32: ; preds = %9
%33 = mul i64 %19, %11
%34 = getelementptr inbounds double, double* %3, i64 %12
%35 = tail call i32 @radbg(i64 %19, i64 %17, i64 %11, i64 %33, double* %13, double* %14, double* %34)
%36 = icmp eq i64 %19, 1
%37 = select i1 %36, double* %14, double* %13
%38 = select i1 %36, double* %13, double* %14
br label %39
39: ; preds = %32, %20, %26, %29, %23
%40 = phi double* [ %14, %20 ], [ %14, %23 ], [ %14, %26 ], [ %14, %29 ], [ %37, %32 ]
%41 = phi double* [ %13, %20 ], [ %13, %23 ], [ %13, %26 ], [ %13, %29 ], [ %38, %32 ]
%42 = add i64 %17, -1
%43 = mul i64 %42, %19
%44 = add i64 %43, %12
%45 = icmp ugt i64 %15, %7
br i1 %45, label %46, label %9
46: ; preds = %39
%47 = icmp eq double* %40, %1
br i1 %47, label %51, label %48
48: ; preds = %46
%49 = shl i64 %0, 3
%50 = tail call i32 @memcpy(double* %1, double* %2, i64 %49)
br label %51
51: ; preds = %5, %48, %46
ret void
}