int dgemm(char transa, char transb, int m, int n, int k, double alpha,
          double *a, int lda, double *b, int ldb, double beta, double *c,
          int ldc) {
  extern int dgemm_(char *transa, char *transb, int *m, int *n, int *k,
                    double *alpha, double *a, int *lda, double *b, int *ldb,
                    double *beta, double *c, int *ldc);
  return dgemm_(&transa, &transb, &m, &n, &k, &alpha, a, &lda, b, &ldb, &beta,
                c, &ldc);
}


x86 assembly (clang, -O0):
<dgemm>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x60,%rsp
mov    %sil,%al
mov    %dil,%sil
mov    0x30(%rbp),%edi
mov    0x28(%rbp),%rdi
mov    0x20(%rbp),%edi
mov    0x18(%rbp),%rdi
mov    0x10(%rbp),%edi
mov    %sil,-0x21(%rbp)
mov    %al,-0x22(%rbp)
mov    %edx,-0x28(%rbp)
mov    %ecx,-0x2c(%rbp)
mov    %r8d,-0x30(%rbp)
movsd  %xmm0,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
movsd  %xmm1,-0x48(%rbp)
mov    -0x40(%rbp),%r12
mov    0x18(%rbp),%r14
mov    0x28(%rbp),%r10
lea    -0x21(%rbp),%rdi
lea    -0x22(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
lea    -0x30(%rbp),%r8
lea    -0x38(%rbp),%r9
lea    0x10(%rbp),%r15
lea    0x20(%rbp),%rbx
lea    -0x48(%rbp),%r11
lea    0x30(%rbp),%rax
mov    %r12,(%rsp)
mov    %r15,0x8(%rsp)
mov    %r14,0x10(%rsp)
mov    %rbx,0x18(%rsp)
mov    %r11,0x20(%rsp)
mov    %r10,0x28(%rsp)
mov    %rax,0x30(%rsp)
call   1030 <dgemm_@plt>
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<dgemm>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,%rax
mov    0x58(%rsp),%r10
mov    0x68(%rsp),%r11
mov    %dil,0xb(%rsp)
mov    %sil,0xa(%rsp)
mov    %edx,0x14(%rsp)
mov    %ecx,0x10(%rsp)
mov    %r8d,0xc(%rsp)
movsd  %xmm0,0x20(%rsp)
movsd  %xmm1,0x18(%rsp)
sub    $0x8,%rsp
lea    0x78(%rsp),%rbx
lea    0x20(%rsp),%r14
lea    0x68(%rsp),%r15
lea    0x58(%rsp),%r12
lea    0x13(%rsp),%rdi
lea    0x12(%rsp),%rsi
lea    0x1c(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x14(%rsp),%r8
lea    0x28(%rsp),%r9
push   %rbx
push   %r11
push   %r14
push   %r15
push   %r10
push   %r12
push   %rax
call   1030 <dgemm_@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @dgemm(i8 signext %0, i8 signext %1, i32 %2, i32 %3, i32 %4, double %5, double* %6, i32 %7, double* %8, i32 %9, double %10, double* %11, i32 %12) {
%14 = alloca i8
%15 = alloca i8
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca double
%20 = alloca double*
%21 = alloca i32
%22 = alloca double*
%23 = alloca i32
%24 = alloca double
%25 = alloca double*
%26 = alloca i32
store i8 %0, i8* %14
store i8 %1, i8* %15
store i32 %2, i32* %16
store i32 %3, i32* %17
store i32 %4, i32* %18
store double %5, double* %19
store double* %6, double** %20
store i32 %7, i32* %21
store double* %8, double** %22
store i32 %9, i32* %23
store double %10, double* %24
store double* %11, double** %25
store i32 %12, i32* %26
%27 = load double*, double** %20
%28 = load double*, double** %22
%29 = load double*, double** %25
%30 = call i32 @dgemm_(i8* %14, i8* %15, i32* %16, i32* %17, i32* %18, double* %19, double* %27, i32* %21, double* %28, i32* %23, double* %24, double* %29, i32* %26)
ret i32 %30
}

LLVM IR (-O2):
define i32 @dgemm(i8 signext %0, i8 signext %1, i32 %2, i32 %3, i32 %4, double %5, double* %6, i32 %7, double* %8, i32 %9, double %10, double* %11, i32 %12) {
%14 = alloca i8
%15 = alloca i8
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca double
%20 = alloca i32
%21 = alloca i32
%22 = alloca double
%23 = alloca i32
store i8 %0, i8* %14
store i8 %1, i8* %15
store i32 %2, i32* %16
store i32 %3, i32* %17
store i32 %4, i32* %18
store double %5, double* %19
store i32 %7, i32* %20
store i32 %9, i32* %21
store double %10, double* %22
store i32 %12, i32* %23
%24 = call i32 @dgemm_(i8* %14, i8* %15, i32* %16, i32* %17, i32* %18, double* %19, double* %6, i32* %20, double* %8, i32* %21, double* %22, double* %11, i32* %23)
ret i32 %24
}