#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 const eval_A(int, int);
void eval_At_times_u(int N, const double u[], double Au[]) {
  int i, j;
  for (i = 0; i < N; i++) {
    Au[i] = 0;
    for (j = 0; j < N; j++) {
      Au[i] += eval_A(j, i) * u[j];
    }
  }
}


x86 assembly (clang, -O0):
<eval_At_times_u>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ac <eval_At_times_u+0x9c>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1199 <eval_At_times_u+0x89>
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1030 <eval_A@plt>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114d <eval_At_times_u+0x3d>
jmp    119e <eval_At_times_u+0x8e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112a <eval_At_times_u+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eval_At_times_u>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %edi,%edi
jle    116e <eval_At_times_u+0x5e>
mov    %rdx,%r15
mov    %rsi,%r14
mov    %edi,%r13d
xor    %r12d,%r12d
nopl   0x0(%rax)
movq   $0x0,(%r15,%r12,8)
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %r12d,%esi
call   1030 <eval_A@plt>
mulsd  (%r14,%rbx,8),%xmm0
addsd  (%r15,%r12,8),%xmm0
movsd  %xmm0,(%r15,%r12,8)
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1140 <eval_At_times_u+0x30>
add    $0x1,%r12
cmp    %r13,%r12
jne    1130 <eval_At_times_u+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @eval_At_times_u(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
store i32 0, i32* %7
br label %9
9: ; preds = %41, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %44
13: ; preds = %9
%14 = load double*, double** %6
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %14, i64 %16
store double 0.000000e+00, double* %17
store i32 0, i32* %8
br label %18
18: ; preds = %37, %13
%19 = load i32, i32* %8
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %40
22: ; preds = %18
%23 = load i32, i32* %8
%24 = load i32, i32* %7
%25 = call double @eval_A(i32 %23, i32 %24)
%26 = load double*, double** %5
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
%30 = load double, double* %29
%31 = load double*, double** %6
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
%35 = load double, double* %34
%36 = call double @llvm.fmuladd.f64(double %25, double %30, double %35)
store double %36, double* %34
br label %37
37: ; preds = %22
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %8
br label %18
40: ; preds = %18
br label %41
41: ; preds = %40
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
br label %9
44: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @eval_At_times_u(i32 %0, double* nocapture %1, double* nocapture %2) {
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %24
5: ; preds = %3
%6 = zext i32 %0 to i64
br label %7
7: ; preds = %21, %5
%8 = phi i64 [ 0, %5 ], [ %22, %21 ]
%9 = getelementptr inbounds double, double* %2, i64 %8
store double 0.000000e+00, double* %9
%10 = trunc i64 %8 to i32
br label %11
11: ; preds = %7, %11
%12 = phi i64 [ 0, %7 ], [ %19, %11 ]
%13 = trunc i64 %12 to i32
%14 = tail call double @eval_A(i32 %13, i32 %10)
%15 = getelementptr inbounds double, double* %1, i64 %12
%16 = load double, double* %15
%17 = load double, double* %9
%18 = tail call double @llvm.fmuladd.f64(double %14, double %16, double %17)
store double %18, double* %9
%19 = add nuw nsw i64 %12, 1
%20 = icmp eq i64 %19, %6
br i1 %20, label %21, label %11
21: ; preds = %11
%22 = add nuw nsw i64 %8, 1
%23 = icmp eq i64 %22, %6
br i1 %23, label %24, label %7
24: ; preds = %21, %3
ret void
}