#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*/ dDFTr(double *, int const, int const, int);
int /*<<< orphan*/ dzero(int const, double *, int);
void filter(double *data, const int mode, const int nz, const int nplane) {
  if (mode != -1) {
    dDFTr(data, nz, nplane, +1);
    if (mode == 0)
      dzero(nplane, data, 1);
    else if (mode == (nz >> 1))
      dzero(nplane, data + nplane, 1);
    else
      dzero(2 * nplane, data + 2 * mode * nplane, 1);
    dDFTr(data, nz, nplane, -1);
  }
}


x86 assembly (clang, -O0):
<filter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     11e5 <filter+0xc5>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    $0x1,%ecx
call   1040 <dDFTr@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1173 <filter+0x53>
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    $0x1,%edx
call   1030 <dzero@plt>
jmp    11d1 <filter+0xb1>
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
sar    $0x1,%ecx
cmp    %ecx,%eax
jne    11a5 <filter+0x85>
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
mov    $0x1,%edx
call   1030 <dzero@plt>
jmp    11cc <filter+0xac>
mov    -0x14(%rbp),%edi
shl    $0x1,%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
imul   -0x14(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    $0x1,%edx
call   1030 <dzero@plt>
jmp    11d1 <filter+0xb1>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    $0xffffffff,%ecx
call   1040 <dDFTr@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filter>:
cmp    $0xffffffff,%esi
je     115c <filter+0x3c>
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
mov    %edx,%esi
mov    %ecx,%edx
mov    $0x1,%ecx
call   1040 <dDFTr@plt>
test   %ebp,%ebp
je     115d <filter+0x3d>
mov    %r14d,%eax
sar    %eax
cmp    %ebp,%eax
jne    1164 <filter+0x44>
movslq %ebx,%rax
lea    (%r15,%rax,8),%rsi
mov    %ebx,%edi
jmp    1173 <filter+0x53>
ret
mov    %ebx,%edi
mov    %r15,%rsi
jmp    1173 <filter+0x53>
lea    (%rbx,%rbx,1),%edi
imul   %ebx,%ebp
add    %ebp,%ebp
movslq %ebp,%rax
lea    (%r15,%rax,8),%rsi
mov    $0x1,%edx
call   1030 <dzero@plt>
mov    %r15,%rdi
mov    %r14d,%esi
mov    %ebx,%edx
mov    $0xffffffff,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <dDFTr@plt>

LLVM IR (-O0):
define void @filter(double* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store double* %0, double** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, -1
br i1 %10, label %11, label %51
11: ; preds = %4
%12 = load double*, double** %5
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = call i32 @dDFTr(double* %12, i32 %13, i32 %14, i32 1)
%16 = load i32, i32* %6
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %11
%19 = load i32, i32* %8
%20 = load double*, double** %5
%21 = call i32 @dzero(i32 %19, double* %20, i32 1)
br label %46
22: ; preds = %11
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = ashr i32 %24, 1
%26 = icmp eq i32 %23, %25
br i1 %26, label %27, label %34
27: ; preds = %22
%28 = load i32, i32* %8
%29 = load double*, double** %5
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
%33 = call i32 @dzero(i32 %28, double* %32, i32 1)
br label %45
34: ; preds = %22
%35 = load i32, i32* %8
%36 = mul nsw i32 2, %35
%37 = load double*, double** %5
%38 = load i32, i32* %6
%39 = mul nsw i32 2, %38
%40 = load i32, i32* %8
%41 = mul nsw i32 %39, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %37, i64 %42
%44 = call i32 @dzero(i32 %36, double* %43, i32 1)
br label %45
45: ; preds = %34, %27
br label %46
46: ; preds = %45, %18
%47 = load double*, double** %5
%48 = load i32, i32* %7
%49 = load i32, i32* %8
%50 = call i32 @dDFTr(double* %47, i32 %48, i32 %49, i32 -1)
br label %51
51: ; preds = %46, %4
ret void
}

LLVM IR (-O2):
define void @filter(double* %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %1, -1
br i1 %5, label %27, label %6
6: ; preds = %4
%7 = tail call i32 @dDFTr(double* %0, i32 %2, i32 %3, i32 1)
%8 = icmp eq i32 %1, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @dzero(i32 %3, double* %0, i32 1)
br label %25
11: ; preds = %6
%12 = ashr i32 %2, 1
%13 = icmp eq i32 %12, %1
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = sext i32 %3 to i64
%16 = getelementptr inbounds double, double* %0, i64 %15
%17 = tail call i32 @dzero(i32 %3, double* %16, i32 1)
br label %25
18: ; preds = %11
%19 = shl nsw i32 %3, 1
%20 = shl nsw i32 %1, 1
%21 = mul nsw i32 %20, %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double, double* %0, i64 %22
%24 = tail call i32 @dzero(i32 %19, double* %23, i32 1)
br label %25
25: ; preds = %14, %18, %9
%26 = tail call i32 @dDFTr(double* %0, i32 %2, i32 %3, i32 -1)
br label %27
27: ; preds = %25, %4
ret void
}