#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*/ FFTEval(double *, double *, double *, double *, int, int,
                           double *, int);
void grid_invfourier(double *realgrid, double *imaggrid, double *rmatrix,
                     double *imatrix, int size, double *workspace) {
  double *rout, *iout, *scratchpad;
  int i;
  rout = workspace;
  iout = rout + size;
  scratchpad = iout + size;
  for (i = 0; i < size; i++) {
    FFTEval(realgrid + (i * size), imaggrid + (i * size), rmatrix + (i * size),
            imatrix + (i * size), size, size, scratchpad, 1);
  }
}


x86 assembly (clang, -O0):
<grid_invfourier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11ec <grid_invfourier+0xdc>
mov    -0x8(%rbp),%rdi
mov    -0x4c(%rbp),%eax
imul   -0x24(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x4c(%rbp),%eax
imul   -0x24(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x18(%rbp),%rdx
mov    -0x4c(%rbp),%eax
imul   -0x24(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x20(%rbp),%rcx
mov    -0x4c(%rbp),%eax
imul   -0x24(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    -0x24(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    -0x48(%rbp),%rax
mov    %rax,(%rsp)
movl   $0x1,0x8(%rsp)
call   1030 <FFTEval@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1165 <grid_invfourier+0x55>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grid_invfourier>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,0xc(%rsp)
test   %r8d,%r8d
jle    1185 <grid_invfourier+0x75>
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    0xc(%rsp),%ecx
movslq %ecx,%r13
lea    (%r9,%r13,8),%rax
lea    (%rax,%r13,8),%rax
mov    %rax,0x10(%rsp)
mov    %ecx,%r14d
shl    $0x3,%r13
nop
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    0xc(%rsp),%r8d
mov    %r8d,%r9d
push   $0x1
push   0x18(%rsp)
call   1030 <FFTEval@plt>
add    $0x10,%rsp
add    %r13,%rbp
add    %r13,%rbx
add    %r13,%r12
add    %r13,%r15
add    $0xffffffffffffffff,%r14
jne    1150 <grid_invfourier+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @grid_invfourier(double* %0, double* %1, double* %2, double* %3, i32 %4, double* %5) {
%7 = sext i32 %4 to i64
%8 = getelementptr inbounds double, double* %5, i64 %7
%9 = getelementptr inbounds double, double* %8, i64 %7
%10 = icmp sgt i32 %4, 0
br i1 %10, label %11, label %23
11: ; preds = %6
%12 = zext i32 %4 to i64
br label %13
13: ; preds = %11, %13
%14 = phi i64 [ 0, %11 ], [ %21, %13 ]
%15 = mul nsw i64 %14, %7
%16 = getelementptr inbounds double, double* %0, i64 %15
%17 = getelementptr inbounds double, double* %1, i64 %15
%18 = getelementptr inbounds double, double* %2, i64 %15
%19 = getelementptr inbounds double, double* %3, i64 %15
%20 = tail call i32 @FFTEval(double* %16, double* %17, double* %18, double* %19, i32 %4, i32 %4, double* %9, i32 1)
%21 = add nuw nsw i64 %14, 1
%22 = icmp eq i64 %21, %12
br i1 %22, label %23, label %13
23: ; preds = %13, %6
ret void
}