void Ger(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, incx, &A[(j)*ldA + 0], 1);
}


x86 assembly (clang, -O0):
<Ger>:
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 <Ger+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    -0x14(%rbp),%edx
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    $0x1,%al
call   1030 <Axpy@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    113b <Ger+0x2b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Ger>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %esi,%esi
jle    117d <Ger+0x6d>
mov    %r8,%rbx
mov    %ecx,%r12d
mov    %rdx,%r13
mov    %edi,%r14d
mov    0x50(%rsp),%rbp
movslq %r9d,%r8
movslq 0x58(%rsp),%rax
mov    %esi,%r15d
shl    $0x3,%rax
mov    %rax,0x8(%rsp)
shl    $0x3,%r8
mov    %r8,0x10(%rsp)
movsd  (%rbx),%xmm0
mov    %r14d,%edi
mov    %r13,%rsi
mov    %r12d,%edx
mov    %rbp,%rcx
mov    $0x1,%r8d
mov    $0x1,%al
call   1030 <Axpy@plt>
add    0x8(%rsp),%rbp
add    0x10(%rsp),%rbx
add    $0xffffffffffffffff,%r15
jne    1150 <Ger+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @Ger(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 = %41, %8
%19 = load i32, i32* %17
%20 = load i32, i32* %10
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %44
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 i32, i32* %12
%33 = load double*, double** %15
%34 = load i32, i32* %17
%35 = load i32, i32* %16
%36 = mul nsw i32 %34, %35
%37 = add nsw i32 %36, 0
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %33, i64 %38
%40 = 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 1)
br label %41
41: ; preds = %22
%42 = load i32, i32* %17
%43 = add nsw i32 %42, 1
store i32 %43, i32* %17
br label %18
44: ; preds = %18
ret void
}

LLVM IR (-O2):
define void @Ger(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 %3, double* %21, i32 1)
%23 = add nuw nsw i64 %16, 1
%24 = icmp eq i64 %23, %13
br i1 %24, label %14, label %15
}