#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 *, long *, long *, long *, double *,
                          double *, long *, double *, long *, double *,
                          double *, long *);
void dmat_mul_bcol(double **a11, double **a12, double **a21, double **a22,
                   double **b1x, double **b2x, long n, double **c1x,
                   double **c2x) {
  double alpha = 1.;
  double beta = 0.;
  beta = 0.;
  dgemm_("n", "n", &n, &n, &n, &alpha, *b1x, &n, *a11, &n, &beta, *c1x, &n);
  beta = 1.;
  dgemm_("n", "n", &n, &n, &n, &alpha, *b2x, &n, *a12, &n, &beta, *c1x, &n);
  beta = 0.;
  dgemm_("n", "n", &n, &n, &n, &alpha, *b1x, &n, *a21, &n, &beta, *c2x, &n);
  beta = 1.;
  dgemm_("n", "n", &n, &n, &n, &alpha, *b2x, &n, *a22, &n, &beta, *c2x, &n);
}


x86 assembly (clang, -O0):
<dmat_mul_bcol>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
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  0xeb6(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%r14
mov    -0x18(%rbp),%rax
mov    (%rax),%rbx
mov    0x18(%rbp),%rax
mov    (%rax),%r10
lea    0xe8d(%rip),%rsi
lea    0x10(%rbp),%rax
lea    -0x48(%rbp),%r9
lea    -0x50(%rbp),%r11
mov    %rsi,%rdi
mov    %rax,%rdx
mov    %rax,%rcx
mov    %rax,%r8
mov    %r14,(%rsp)
mov    %rax,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    %r11,0x20(%rsp)
mov    %r10,0x28(%rsp)
mov    %rax,0x30(%rsp)
call   1030 <dgemm_@plt>
movsd  0xe3e(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x40(%rbp),%rax
mov    (%rax),%r14
mov    -0x20(%rbp),%rax
mov    (%rax),%rbx
mov    0x18(%rbp),%rax
mov    (%rax),%r10
lea    0xe25(%rip),%rsi
lea    0x10(%rbp),%rax
lea    -0x48(%rbp),%r9
lea    -0x50(%rbp),%r11
mov    %rsi,%rdi
mov    %rax,%rdx
mov    %rax,%rcx
mov    %rax,%r8
mov    %r14,(%rsp)
mov    %rax,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    %r11,0x20(%rsp)
mov    %r10,0x28(%rsp)
mov    %rax,0x30(%rsp)
call   1030 <dgemm_@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%r14
mov    -0x28(%rbp),%rax
mov    (%rax),%rbx
mov    0x20(%rbp),%rax
mov    (%rax),%r10
lea    0xdc2(%rip),%rsi
lea    0x10(%rbp),%rax
lea    -0x48(%rbp),%r9
lea    -0x50(%rbp),%r11
mov    %rsi,%rdi
mov    %rax,%rdx
mov    %rax,%rcx
mov    %rax,%r8
mov    %r14,(%rsp)
mov    %rax,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    %r11,0x20(%rsp)
mov    %r10,0x28(%rsp)
mov    %rax,0x30(%rsp)
call   1030 <dgemm_@plt>
movsd  0xd73(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x40(%rbp),%rax
mov    (%rax),%r14
mov    -0x30(%rbp),%rax
mov    (%rax),%rbx
mov    0x20(%rbp),%rax
mov    (%rax),%r10
lea    0xd5a(%rip),%rsi
lea    0x10(%rbp),%rax
lea    -0x48(%rbp),%r9
lea    -0x50(%rbp),%r11
mov    %rsi,%rdi
mov    %rax,%rdx
mov    %rax,%rcx
mov    %rax,%r8
mov    %r14,(%rsp)
mov    %rax,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    %r11,0x20(%rsp)
mov    %r10,0x28(%rsp)
mov    %rax,0x30(%rsp)
call   1030 <dgemm_@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmat_mul_bcol>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,%r13
mov    %r8,%rax
mov    %r8,0x10(%rsp)
mov    %rcx,0x28(%rsp)
mov    %rdx,0x20(%rsp)
mov    %rsi,0x18(%rsp)
mov    %rdi,%r10
mov    0x78(%rsp),%r12
movabs $0x3ff0000000000000,%rcx
mov    %rcx,0x30(%rsp)
movq   $0x0,0x8(%rsp)
sub    $0x8,%rsp
lea    0x78(%rsp),%rbx
lea    0x10(%rsp),%rbp
lea    0xe93(%rip),%r14
lea    0x38(%rsp),%r15
mov    %r14,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
mov    %r15,%r9
push   %rbx
push   (%r12)
push   %rbp
push   %rbx
push   (%r10)
push   %rbx
push   (%rax)
call   1030 <dgemm_@plt>
add    $0x40,%rsp
movabs $0x3ff0000000000000,%rax
mov    %rax,0x8(%rsp)
sub    $0x8,%rsp
mov    %r14,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
mov    %r15,%r9
push   %rbx
push   (%r12)
push   %rbp
mov    %rbp,%r12
push   %rbx
mov    0x40(%rsp),%rax
push   (%rax)
push   %rbx
push   0x0(%r13)
call   1030 <dgemm_@plt>
add    $0x40,%rsp
movq   $0x0,0x8(%rsp)
sub    $0x8,%rsp
mov    %r14,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
mov    %r15,%r9
push   %rbx
mov    0x90(%rsp),%rbp
push   0x0(%rbp)
push   %r12
push   %rbx
mov    0x48(%rsp),%rax
push   (%rax)
push   %rbx
mov    0x48(%rsp),%rax
push   (%rax)
call   1030 <dgemm_@plt>
add    $0x40,%rsp
movabs $0x3ff0000000000000,%rax
mov    %rax,0x8(%rsp)
sub    $0x8,%rsp
mov    %r14,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rbx,%r8
mov    %r15,%r9
push   %rbx
push   0x0(%rbp)
push   %r12
push   %rbx
mov    0x50(%rsp),%rax
push   (%rax)
push   %rbx
push   0x0(%r13)
call   1030 <dgemm_@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"n\00"
define void @dmat_mul_bcol(double** %0, double** %1, double** %2, double** %3, double** %4, double** %5, i64 %6, double** %7, double** %8) {
%10 = alloca double**
%11 = alloca double**
%12 = alloca double**
%13 = alloca double**
%14 = alloca double**
%15 = alloca double**
%16 = alloca i64
%17 = alloca double**
%18 = alloca double**
%19 = alloca double
%20 = alloca double
store double** %0, double*** %10
store double** %1, double*** %11
store double** %2, double*** %12
store double** %3, double*** %13
store double** %4, double*** %14
store double** %5, double*** %15
store i64 %6, i64* %16
store double** %7, double*** %17
store double** %8, double*** %18
store double 1.000000e+00, double* %19
store double 0.000000e+00, double* %20
store double 0.000000e+00, double* %20
%21 = load double**, double*** %14
%22 = load double*, double** %21
%23 = load double**, double*** %10
%24 = load double*, double** %23
%25 = load double**, double*** %17
%26 = load double*, double** %25
%27 = call i32 @dgemm_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64* %16, i64* %16, i64* %16, double* %19, double* %22, i64* %16, double* %24, i64* %16, double* %20, double* %26, i64* %16)
store double 1.000000e+00, double* %20
%28 = load double**, double*** %15
%29 = load double*, double** %28
%30 = load double**, double*** %11
%31 = load double*, double** %30
%32 = load double**, double*** %17
%33 = load double*, double** %32
%34 = call i32 @dgemm_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64* %16, i64* %16, i64* %16, double* %19, double* %29, i64* %16, double* %31, i64* %16, double* %20, double* %33, i64* %16)
store double 0.000000e+00, double* %20
%35 = load double**, double*** %14
%36 = load double*, double** %35
%37 = load double**, double*** %12
%38 = load double*, double** %37
%39 = load double**, double*** %18
%40 = load double*, double** %39
%41 = call i32 @dgemm_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64* %16, i64* %16, i64* %16, double* %19, double* %36, i64* %16, double* %38, i64* %16, double* %20, double* %40, i64* %16)
store double 1.000000e+00, double* %20
%42 = load double**, double*** %15
%43 = load double*, double** %42
%44 = load double**, double*** %13
%45 = load double*, double** %44
%46 = load double**, double*** %18
%47 = load double*, double** %46
%48 = call i32 @dgemm_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64* %16, i64* %16, i64* %16, double* %19, double* %43, i64* %16, double* %45, i64* %16, double* %20, double* %47, i64* %16)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"n\00"
define void @dmat_mul_bcol(double** nocapture %0, double** nocapture %1, double** nocapture %2, double** nocapture %3, double** nocapture %4, double** nocapture %5, i64 %6, double** nocapture %7, double** nocapture %8) {
%10 = alloca i64
%11 = alloca double
%12 = alloca double
store i64 %6, i64* %10
%13 = bitcast double* %11 to i8*
store double 1.000000e+00, double* %11
%14 = bitcast double* %12 to i8*
store double 0.000000e+00, double* %12
%15 = load double*, double** %4
%16 = load double*, double** %0
%17 = load double*, double** %7
%18 = call i32 @dgemm_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64* %10, i64* %10, i64* %10, double* %11, double* %15, i64* %10, double* %16, i64* %10, double* %12, double* %17, i64* %10)
store double 1.000000e+00, double* %12
%19 = load double*, double** %5
%20 = load double*, double** %1
%21 = load double*, double** %7
%22 = call i32 @dgemm_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64* %10, i64* %10, i64* %10, double* %11, double* %19, i64* %10, double* %20, i64* %10, double* %12, double* %21, i64* %10)
store double 0.000000e+00, double* %12
%23 = load double*, double** %4
%24 = load double*, double** %2
%25 = load double*, double** %8
%26 = call i32 @dgemm_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64* %10, i64* %10, i64* %10, double* %11, double* %23, i64* %10, double* %24, i64* %10, double* %12, double* %25, i64* %10)
store double 1.000000e+00, double* %12
%27 = load double*, double** %5
%28 = load double*, double** %3
%29 = load double*, double** %8
%30 = call i32 @dgemm_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64* %10, i64* %10, i64* %10, double* %11, double* %27, i64* %10, double* %28, i64* %10, double* %12, double* %29, i64* %10)
ret void
}