#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ dgemm_(char const *, char const *, int const *, int const *,
                          int const *, double const *, double const *const,
                          int const *, double const *const, int const *,
                          double const *, double *const, int const *);
void matmul(const int M, const int N, const int K, const double *const A,
            const double *const B, double *const C) {
  const char TRANSA = 'T';
  const char TRANSB = 'N';
  const double ALPHA = 1.;
  const double BETA = 0.;
  const int LDA = K;
  const int LDB = K;
  const int LDC = M;
  dgemm_(&TRANSA, &TRANSB, &M, &N, &K, &ALPHA, A, &LDA, B, &LDB, &BETA, C,
         &LDC);
}


x86 assembly (clang, -O0):
<matmul>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x90,%rsp
mov    %edi,-0x24(%rbp)
mov    %esi,-0x28(%rbp)
mov    %edx,-0x2c(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %r8,-0x40(%rbp)
mov    %r9,-0x48(%rbp)
movb   $0x54,-0x49(%rbp)
movb   $0x4e,-0x4a(%rbp)
movsd  0xeb9(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x38(%rbp),%r12
mov    -0x40(%rbp),%r14
mov    -0x48(%rbp),%r10
lea    -0x49(%rbp),%rdi
lea    -0x4a(%rbp),%rsi
lea    -0x24(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x2c(%rbp),%r8
lea    -0x58(%rbp),%r9
lea    -0x64(%rbp),%r15
lea    -0x68(%rbp),%rbx
lea    -0x60(%rbp),%r11
lea    -0x6c(%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    $0x90,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<matmul>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,%rax
mov    %r8,%r11
mov    %rcx,%r10
mov    %edi,0x24(%rsp)
mov    %esi,0x20(%rsp)
mov    %edx,0x1c(%rsp)
movb   $0x54,0xf(%rsp)
movb   $0x4e,0xe(%rsp)
movabs $0x3ff0000000000000,%rcx
mov    %rcx,0x30(%rsp)
movq   $0x0,0x28(%rsp)
mov    %edx,0x18(%rsp)
mov    %edx,0x14(%rsp)
mov    %edi,0x10(%rsp)
sub    $0x8,%rsp
lea    0x18(%rsp),%rbx
lea    0x30(%rsp),%r14
lea    0x1c(%rsp),%r15
lea    0x20(%rsp),%r12
lea    0x17(%rsp),%rdi
lea    0x16(%rsp),%rsi
lea    0x2c(%rsp),%rdx
lea    0x28(%rsp),%rcx
lea    0x24(%rsp),%r8
lea    0x38(%rsp),%r9
push   %rbx
push   %rax
push   %r14
push   %r15
push   %r11
push   %r12
push   %r10
call   1030 <dgemm_@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @matmul(i32 %0, i32 %1, i32 %2, double* %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca i8
%14 = alloca i8
%15 = alloca double
%16 = alloca double
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
store i8 84, i8* %13
store i8 78, i8* %14
store double 1.000000e+00, double* %15
store double 0.000000e+00, double* %16
%20 = load i32, i32* %9
store i32 %20, i32* %17
%21 = load i32, i32* %9
store i32 %21, i32* %18
%22 = load i32, i32* %7
store i32 %22, i32* %19
%23 = load double*, double** %10
%24 = load double*, double** %11
%25 = load double*, double** %12
%26 = call i32 @dgemm_(i8* %13, i8* %14, i32* %7, i32* %8, i32* %9, double* %15, double* %23, i32* %17, double* %24, i32* %18, double* %16, double* %25, i32* %19)
ret void
}

LLVM IR (-O2):
define void @matmul(i32 %0, i32 %1, i32 %2, double* %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
%11 = alloca i8
%12 = alloca double
%13 = alloca double
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i8 84, i8* %10
store i8 78, i8* %11
%17 = bitcast double* %12 to i8*
store double 1.000000e+00, double* %12
%18 = bitcast double* %13 to i8*
store double 0.000000e+00, double* %13
%19 = bitcast i32* %14 to i8*
store i32 %2, i32* %14
%20 = bitcast i32* %15 to i8*
store i32 %2, i32* %15
%21 = bitcast i32* %16 to i8*
store i32 %0, i32* %16
%22 = call i32 @dgemm_(i8* %10, i8* %11, i32* %7, i32* %8, i32* %9, double* %12, double* %3, i32* %14, double* %4, i32* %15, double* %13, double* %5, i32* %16)
ret void
}