#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*/ doubles_mat_AB(double const *, int, int, double const *, int,
                                  int, double *, int, int);
void doubles_mat_ABC(const double *A, int Arows, int Acols, const double *B,
                     int Brows, int Bcols, const double *C, int Crows,
                     int Ccols, double *R, int Rrows, int Rcols) {
  double tmp[Arows * Bcols];
  doubles_mat_AB(A, Arows, Acols, B, Brows, Bcols, tmp, Arows, Bcols);
  doubles_mat_AB(tmp, Arows, Bcols, C, Crows, Ccols, R, Rrows, Rcols);
}


x86 assembly (clang, -O0):
<doubles_mat_ABC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x20(%rbp),%ecx
imul   %ecx,%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%r11
sub    %rcx,%r11
mov    %r11,-0x38(%rbp)
mov    %r11,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
mov    -0xc(%rbp),%r10d
mov    -0x20(%rbp),%eax
sub    $0x20,%rsp
mov    %r11,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <doubles_mat_AB@plt>
mov    -0x38(%rbp),%rdi
add    $0x20,%rsp
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    0x10(%rbp),%rcx
mov    0x18(%rbp),%r8d
mov    0x20(%rbp),%r9d
mov    0x28(%rbp),%r11
mov    0x30(%rbp),%r10d
mov    0x38(%rbp),%eax
sub    $0x20,%rsp
mov    %r11,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <doubles_mat_AB@plt>
add    $0x20,%rsp
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doubles_mat_ABC>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r13d
mov    %esi,%ebx
mov    0x20(%rbp),%r12d
mov    0x38(%rbp),%r15d
mov    %r9d,%eax
imul   %esi,%eax
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r14
sub    %rax,%r14
mov    %r14,%rsp
sub    $0x8,%rsp
push   %r13
push   %rbx
push   %r14
call   1030 <doubles_mat_AB@plt>
add    $0x18,%rsp
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r13d,%edx
mov    0x10(%rbp),%rcx
mov    0x18(%rbp),%r8d
mov    %r12d,%r9d
push   %r15
mov    0x30(%rbp),%eax
push   %rax
push   0x28(%rbp)
call   1030 <doubles_mat_AB@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @doubles_mat_ABC(double* %0, i32 %1, i32 %2, double* %3, i32 %4, i32 %5, double* %6, i32 %7, i32 %8, double* %9, i32 %10, i32 %11) {
%13 = alloca double*
%14 = alloca i32
%15 = alloca i32
%16 = alloca double*
%17 = alloca i32
%18 = alloca i32
%19 = alloca double*
%20 = alloca i32
%21 = alloca i32
%22 = alloca double*
%23 = alloca i32
%24 = alloca i32
%25 = alloca i8*
%26 = alloca i64
store double* %0, double** %13
store i32 %1, i32* %14
store i32 %2, i32* %15
store double* %3, double** %16
store i32 %4, i32* %17
store i32 %5, i32* %18
store double* %6, double** %19
store i32 %7, i32* %20
store i32 %8, i32* %21
store double* %9, double** %22
store i32 %10, i32* %23
store i32 %11, i32* %24
%27 = load i32, i32* %14
%28 = load i32, i32* %18
%29 = mul nsw i32 %27, %28
%30 = zext i32 %29 to i64
%31 = call i8* @llvm.stacksave()
store i8* %31, i8** %25
%32 = alloca double, i64 %30
store i64 %30, i64* %26
%33 = load double*, double** %13
%34 = load i32, i32* %14
%35 = load i32, i32* %15
%36 = load double*, double** %16
%37 = load i32, i32* %17
%38 = load i32, i32* %18
%39 = load i32, i32* %14
%40 = load i32, i32* %18
%41 = call i32 @doubles_mat_AB(double* %33, i32 %34, i32 %35, double* %36, i32 %37, i32 %38, double* %32, i32 %39, i32 %40)
%42 = load i32, i32* %14
%43 = load i32, i32* %18
%44 = load double*, double** %19
%45 = load i32, i32* %20
%46 = load i32, i32* %21
%47 = load double*, double** %22
%48 = load i32, i32* %23
%49 = load i32, i32* %24
%50 = call i32 @doubles_mat_AB(double* %32, i32 %42, i32 %43, double* %44, i32 %45, i32 %46, double* %47, i32 %48, i32 %49)
%51 = load i8*, i8** %25
ret void
}

LLVM IR (-O2):
define void @doubles_mat_ABC(double* %0, i32 %1, i32 %2, double* %3, i32 %4, i32 %5, double* %6, i32 %7, i32 %8, double* %9, i32 %10, i32 %11) {
%13 = mul nsw i32 %5, %1
%14 = zext i32 %13 to i64
%15 = alloca double, i64 %14
%16 = call i32 @doubles_mat_AB(double* %0, i32 %1, i32 %2, double* %3, i32 %4, i32 %5, double* %15, i32 %1, i32 %5)
%17 = call i32 @doubles_mat_AB(double* %15, i32 %1, i32 %5, double* %6, i32 %7, i32 %8, double* %9, i32 %10, i32 %11)
ret void
}