#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 */
typedef scalar_t__ int32_t;

/* Variables and functions */
int /*<<< orphan*/ dgemm(char, char, scalar_t__, scalar_t__, scalar_t__, double,
                         double *, scalar_t__, double *, scalar_t__, double,
                         double *, scalar_t__);
void dgemm_rrr(double *A, double *X, double *Y, int32_t m, int32_t n, int32_t k,
               double beta) {
  dgemm('N', 'N', n, m, k, 1.0, X, (n > 0) ? n : 1, A, (k > 0) ? k : 1, beta, Y,
        n);
}


x86 assembly (clang, -O0):
<dgemm_rrr>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0xa0,%rsp
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
movsd  %xmm0,-0x48(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x38(%rbp)
jle    1173 <dgemm_rrr+0x63>
mov    -0x38(%rbp),%rax
mov    %rax,-0x70(%rbp)
jmp    1181 <dgemm_rrr+0x71>
mov    $0x1,%eax
mov    %rax,-0x70(%rbp)
jmp    1181 <dgemm_rrr+0x71>
mov    -0x70(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x40(%rbp)
jle    11ac <dgemm_rrr+0x9c>
mov    -0x40(%rbp),%rax
mov    %rax,-0x88(%rbp)
jmp    11bd <dgemm_rrr+0xad>
mov    $0x1,%eax
mov    %rax,-0x88(%rbp)
jmp    11bd <dgemm_rrr+0xad>
mov    -0x78(%rbp),%rbx
mov    -0x80(%rbp),%r14
mov    -0x50(%rbp),%r9
mov    -0x58(%rbp),%r8
mov    -0x60(%rbp),%rcx
mov    -0x68(%rbp),%rdx
mov    -0x88(%rbp),%r11
movsd  -0x48(%rbp),%xmm1
mov    -0x28(%rbp),%r10
mov    -0x38(%rbp),%rax
mov    $0x4e,%esi
movsd  0xe0a(%rip),%xmm0
mov    %esi,%edi
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1030 <dgemm@plt>
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<dgemm_rrr>:
push   %r15
push   %r14
push   %rbx
movaps %xmm0,%xmm1
mov    %r8,%rax
mov    %rdx,%r10
mov    %rsi,%r11
mov    %rdi,%r14
test   %r8,%r8
mov    $0x1,%r15d
cmovg  %r8,%r15
mov    $0x1,%ebx
test   %r9,%r9
cmovg  %r9,%rbx
sub    $0x8,%rsp
movsd  0xeb7(%rip),%xmm0
mov    $0x4e,%edi
mov    $0x4e,%esi
mov    %r8,%rdx
mov    %r9,%r8
mov    %r11,%r9
push   %rax
push   %r10
push   %rbx
push   %r14
push   %r15
call   1030 <dgemm@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @dgemm_rrr(double* %0, double* %1, double* %2, i64 %3, i64 %4, i64 %5, double %6) {
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca double
store double* %0, double** %8
store double* %1, double** %9
store double* %2, double** %10
store i64 %3, i64* %11
store i64 %4, i64* %12
store i64 %5, i64* %13
store double %6, double* %14
%15 = load i64, i64* %12
%16 = load i64, i64* %11
%17 = load i64, i64* %13
%18 = load double*, double** %9
%19 = load i64, i64* %12
%20 = icmp sgt i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %7
%22 = load i64, i64* %12
br label %24
23: ; preds = %7
br label %24
24: ; preds = %23, %21
%25 = phi i64 [ %22, %21 ], [ 1, %23 ]
%26 = load double*, double** %8
%27 = load i64, i64* %13
%28 = icmp sgt i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = load i64, i64* %13
br label %32
31: ; preds = %24
br label %32
32: ; preds = %31, %29
%33 = phi i64 [ %30, %29 ], [ 1, %31 ]
%34 = load double, double* %14
%35 = load double*, double** %10
%36 = load i64, i64* %12
%37 = call i32 @dgemm(i8 signext 78, i8 signext 78, i64 %15, i64 %16, i64 %17, double 1.000000e+00, double* %18, i64 %25, double* %26, i64 %33, double %34, double* %35, i64 %36)
ret void
}

LLVM IR (-O2):
define void @dgemm_rrr(double* %0, double* %1, double* %2, i64 %3, i64 %4, i64 %5, double %6) {
%8 = icmp sgt i64 %4, 1
%9 = select i1 %8, i64 %4, i64 1
%10 = icmp sgt i64 %5, 1
%11 = select i1 %10, i64 %5, i64 1
%12 = tail call i32 @dgemm(i8 signext 78, i8 signext 78, i64 %4, i64 %3, i64 %5, double 1.000000e+00, double* %1, i64 %9, double* %0, i64 %11, double %6, double* %2, i64 %4)
ret void
}