#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*/ FFTInterp(double *, double *, double *, double *, int, int,
                             double *, int);
void grid_fourier_so3(double *realgrid, double *imaggrid, double *rmatrix,
                      double *imatrix, int rows, int cols, double *scratchpad) {
  int i;
  for (i = 0; i < rows; i++) {
    FFTInterp(realgrid + (i * cols), imaggrid + (i * cols),
              rmatrix + (i * cols), imatrix + (i * cols), cols, cols,
              scratchpad, 1);
  }
}


x86 assembly (clang, -O0):
<grid_fourier_so3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11c2 <grid_fourier_so3+0xb2>
mov    -0x8(%rbp),%rdi
mov    -0x2c(%rbp),%eax
imul   -0x28(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x2c(%rbp),%eax
imul   -0x28(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x18(%rbp),%rdx
mov    -0x2c(%rbp),%eax
imul   -0x28(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x20(%rbp),%rcx
mov    -0x2c(%rbp),%eax
imul   -0x28(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    -0x28(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    0x10(%rbp),%rax
mov    %rax,(%rsp)
movl   $0x1,0x8(%rsp)
call   1030 <FFTInterp@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    113b <grid_fourier_so3+0x2b>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grid_fourier_so3>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,0x4(%rsp)
test   %r8d,%r8d
jle    1175 <grid_fourier_so3+0x65>
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%rbp
movslq 0x4(%rsp),%r13
mov    %r8d,%r14d
shl    $0x3,%r13
nopl   (%rax)
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    0x4(%rsp),%r8d
mov    %r8d,%r9d
push   $0x1
push   0x48(%rsp)
call   1030 <FFTInterp@plt>
add    $0x10,%rsp
add    %r13,%rbp
add    %r13,%rbx
add    %r13,%r12
add    %r13,%r15
add    $0xffffffffffffffff,%r14
jne    1140 <grid_fourier_so3+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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