#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 */
double iglsadfft(double, double *, int const, double *);
double iglsadft(double x, double *c, const int m, const int n, double *d) {
  int i;
  for (i = 0; i < n; i++)
    x = iglsadfft(x, c, m, &d[i * (m + 1)]);
  return (x);
}


x86 assembly (clang, -O0):
<iglsadft>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    117b <iglsadft+0x6b>
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
call   1030 <iglsadfft@plt>
movsd  %xmm0,-0x8(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1132 <iglsadft+0x22>
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iglsadft>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edx,%edx
jle    1157 <iglsadft+0x47>
mov    %rcx,%rbx
mov    %esi,%r15d
mov    %rdi,%r14
movslq %esi,%rax
mov    %edx,%ebp
lea    0x8(,%rax,8),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15d,%esi
mov    %rbx,%rdx
call   1030 <iglsadfft@plt>
add    %r12,%rbx
add    $0xffffffffffffffff,%rbp
jne    1140 <iglsadft+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @iglsadft(double %0, double* %1, i32 %2, i32 %3, double* %4) {
%6 = alloca double
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
%11 = alloca i32
store double %0, double* %6
store double* %1, double** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store double* %4, double** %10
store i32 0, i32* %11
br label %12
12: ; preds = %28, %5
%13 = load i32, i32* %11
%14 = load i32, i32* %9
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %31
16: ; preds = %12
%17 = load double, double* %6
%18 = load double*, double** %7
%19 = load i32, i32* %8
%20 = load double*, double** %10
%21 = load i32, i32* %11
%22 = load i32, i32* %8
%23 = add nsw i32 %22, 1
%24 = mul nsw i32 %21, %23
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %20, i64 %25
%27 = call double @iglsadfft(double %17, double* %18, i32 %19, double* %26)
store double %27, double* %6
br label %28
28: ; preds = %16
%29 = load i32, i32* %11
%30 = add nsw i32 %29, 1
store i32 %30, i32* %11
br label %12
31: ; preds = %12
%32 = load double, double* %6
ret double %32
}

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