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


x86 assembly (clang, -O0):
<sgemm>:
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)
movss  %xmm0,-0x34(%rbp)
mov    %r9,-0x40(%rbp)
movss  %xmm1,-0x44(%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    -0x34(%rbp),%r9
lea    0x10(%rbp),%r15
lea    0x20(%rbp),%rbx
lea    -0x44(%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 <sgemm_@plt>
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<sgemm>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%rax
mov    0x48(%rsp),%r10
mov    0x58(%rsp),%r11
mov    %dil,0x3(%rsp)
mov    %sil,0x2(%rsp)
mov    %edx,0x14(%rsp)
mov    %ecx,0x10(%rsp)
mov    %r8d,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
movss  %xmm1,0x4(%rsp)
sub    $0x8,%rsp
lea    0x68(%rsp),%rbx
lea    0xc(%rsp),%r14
lea    0x58(%rsp),%r15
lea    0x48(%rsp),%r12
lea    0xb(%rsp),%rdi
lea    0xa(%rsp),%rsi
lea    0x1c(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0x14(%rsp),%r8
lea    0x10(%rsp),%r9
push   %rbx
push   %r11
push   %r14
push   %r15
push   %r10
push   %r12
push   %rax
call   1030 <sgemm_@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @sgemm(i8 signext %0, i8 signext %1, i32 %2, i32 %3, i32 %4, float %5, float* %6, i32 %7, float* %8, i32 %9, float %10, float* %11, i32 %12) {
%14 = alloca i8
%15 = alloca i8
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca float
%20 = alloca i32
%21 = alloca i32
%22 = alloca float
%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 float %5, float* %19
store i32 %7, i32* %20
store i32 %9, i32* %21
store float %10, float* %22
store i32 %12, i32* %23
%24 = call i32 @sgemm_(i8* %14, i8* %15, i32* %16, i32* %17, i32* %18, float* %19, float* %6, i32* %20, float* %8, i32* %21, float* %22, float* %11, i32* %23)
ret i32 %24
}