#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 *, char *, int *, int *, int *, double *,
                          double *, int *, double *, int *, double *, double *,
                          int *);
void square_dgemm(int N, double *A, double *B, double *C) {
  char TRANSA = 'N';
  char TRANSB = 'N';
  int M = N;
  int K = N;
  double ALPHA = 1.;
  double BETA = 1.;
  int LDA = N;
  int LDB = N;
  int LDC = N;
  dgemm_(&TRANSA, &TRANSB, &M, &N, &K, &ALPHA, A, &LDA, B, &LDB, &BETA, C,
         &LDC);
}


x86 assembly (clang, -O0):
<square_dgemm>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x90,%rsp
mov    %edi,-0x24(%rbp)
mov    %rsi,-0x30(%rbp)
mov    %rdx,-0x38(%rbp)
mov    %rcx,-0x40(%rbp)
movb   $0x4e,-0x41(%rbp)
movb   $0x4e,-0x42(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x4c(%rbp)
movsd  0xeb3(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xea6(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x30(%rbp),%r12
mov    -0x38(%rbp),%r14
mov    -0x40(%rbp),%r10
lea    -0x41(%rbp),%rdi
lea    -0x42(%rbp),%rsi
lea    -0x48(%rbp),%rdx
lea    -0x24(%rbp),%rcx
lea    -0x4c(%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):
<square_dgemm>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rcx,%rax
mov    %rdx,%r11
mov    %rsi,%r10
mov    %edi,0x24(%rsp)
movb   $0x4e,0xf(%rsp)
movb   $0x4e,0xe(%rsp)
mov    %edi,0x20(%rsp)
mov    %edi,0x1c(%rsp)
movabs $0x3ff0000000000000,%rcx
mov    %rcx,0x30(%rsp)
mov    %rcx,0x28(%rsp)
mov    %edi,0x18(%rsp)
mov    %edi,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    0x28(%rsp),%rdx
lea    0x2c(%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 @square_dgemm(i32 %0, double* %1, double* %2, double* %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca i8
%10 = alloca i8
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i32 %0, i32* %5
store double* %1, double** %6
store double* %2, double** %7
store double* %3, double** %8
store i8 78, i8* %9
store i8 78, i8* %10
%18 = load i32, i32* %5
store i32 %18, i32* %11
%19 = load i32, i32* %5
store i32 %19, i32* %12
store double 1.000000e+00, double* %13
store double 1.000000e+00, double* %14
%20 = load i32, i32* %5
store i32 %20, i32* %15
%21 = load i32, i32* %5
store i32 %21, i32* %16
%22 = load i32, i32* %5
store i32 %22, i32* %17
%23 = load double*, double** %6
%24 = load double*, double** %7
%25 = load double*, double** %8
%26 = call i32 @dgemm_(i8* %9, i8* %10, i32* %11, i32* %5, i32* %12, double* %13, double* %23, i32* %15, double* %24, i32* %16, double* %14, double* %25, i32* %17)
ret void
}

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