void MyGer(int m, int n, double *x, int incx, double *y, int incy, double *A,
           int ldA) {
  for (int i = 0; i < m; i++)
    Axpy(n, x[(i)*incx], y, incy, &A[(0) * ldA + i], ldA);
}


x86 assembly (clang, -O0):
<MyGer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1191 <MyGer+0x81>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
imul   -0x14(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    0x10(%rbp),%rcx
imul   $0x0,0x18(%rbp),%eax
add    -0x28(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    0x18(%rbp),%r8d
mov    $0x1,%al
call   1030 <Axpy@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    113b <MyGer+0x2b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MyGer>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    116b <MyGer+0x5b>
mov    %r9d,%r15d
mov    %r8,%r13
mov    %rdx,%rbp
mov    %esi,%r12d
mov    0x40(%rsp),%rbx
movslq %ecx,%rax
mov    %edi,%r14d
shl    $0x3,%rax
mov    %rax,(%rsp)
xchg   %ax,%ax
movsd  0x0(%rbp),%xmm0
mov    %r12d,%edi
mov    %r13,%rsi
mov    %r15d,%edx
mov    %rbx,%rcx
mov    0x48(%rsp),%r8d
mov    $0x1,%al
call   1030 <Axpy@plt>
add    (%rsp),%rbp
add    $0x8,%rbx
add    $0xffffffffffffffff,%r14
jne    1140 <MyGer+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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