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


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    -0x8(%rbp),%eax
jge    1196 <MyGer+0x86>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
imul   -0x24(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rsi
mov    0x10(%rbp),%rcx
mov    -0x28(%rbp),%eax
imul   0x18(%rbp),%eax
add    $0x0,%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    $0x1,%r8d
mov    %r8d,%edx
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   %esi,%esi
jle    117c <MyGer+0x6c>
mov    %r8,%rbx
mov    %rdx,%r15
mov    %edi,%r12d
mov    0x40(%rsp),%rbp
movslq %r9d,%r13
movslq 0x48(%rsp),%rax
mov    %esi,%r14d
shl    $0x3,%rax
mov    %rax,(%rsp)
shl    $0x3,%r13
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%rbx),%xmm0
mov    %r12d,%edi
mov    %r15,%rsi
mov    $0x1,%edx
mov    %rbp,%rcx
mov    $0x1,%r8d
mov    $0x1,%al
call   1030 <Axpy@plt>
add    (%rsp),%rbp
add    %r13,%rbx
add    $0xffffffffffffffff,%r14
jne    1150 <MyGer+0x40>
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 = %40, %8
%19 = load i32, i32* %17
%20 = load i32, i32* %10
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %43
22: ; preds = %18
%23 = load i32, i32* %9
%24 = load double*, double** %13
%25 = load i32, i32* %17
%26 = load i32, i32* %14
%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** %11
%32 = load double*, double** %15
%33 = load i32, i32* %17
%34 = load i32, i32* %16
%35 = mul nsw i32 %33, %34
%36 = add nsw i32 %35, 0
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %32, i64 %37
%39 = 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 1, double* %38, i32 1)
br label %40
40: ; preds = %22
%41 = load i32, i32* %17
%42 = add nsw i32 %41, 1
store i32 %42, i32* %17
br label %18
43: ; preds = %18
ret void
}

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