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


x86 assembly (clang, -O0):
<iglsadf>:
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    1176 <iglsadf+0x66>
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x14(%rbp),%eax
imul   -0x24(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
call   1030 <zerodf1@plt>
movsd  %xmm0,-0x8(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1132 <iglsadf+0x22>
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iglsadf>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edx,%edx
jle    1147 <iglsadf+0x37>
mov    %rcx,%rbx
mov    %esi,%r15d
mov    %rdi,%r14
movslq %esi,%r12
mov    %edx,%ebp
shl    $0x3,%r12
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15d,%esi
mov    %rbx,%rdx
call   1030 <zerodf1@plt>
add    %r12,%rbx
add    $0xffffffffffffffff,%rbp
jne    1130 <iglsadf+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @iglsadf(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 = %27, %5
%13 = load i32, i32* %11
%14 = load i32, i32* %9
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %30
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* %8
%22 = load i32, i32* %11
%23 = mul nsw i32 %21, %22
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %20, i64 %24
%26 = call double @zerodf1(double %17, double* %18, i32 %19, double* %25)
store double %26, double* %6
br label %27
27: ; preds = %16
%28 = load i32, i32* %11
%29 = add nsw i32 %28, 1
store i32 %29, i32* %11
br label %12
30: ; preds = %12
%31 = load double, double* %6
ret double %31
}

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