#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*/ free(double **);
double **malloc(int);
int /*<<< orphan*/ mltranspose(int, int, double **, double **);
int /*<<< orphan*/ mmlmul(int, int, double **, int, double **, double **);
void mmtlmul(int rla, int cla, double A[rla][cla], int rlb, double B[rlb][cla],
             double C[rla][rlb]) {
  double(*T)[rlb] = malloc(sizeof(double[cla][rlb]));
  mltranspose(rlb, cla, B, T);
  mmlmul(rla, cla, A, rlb, T, C);
  free(T);
}


x86 assembly (clang, -O0):
<mmtlmul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
imul   %rcx,%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1050 <mltranspose@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x30(%rbp),%r8
mov    -0x28(%rbp),%r9
call   1040 <mmlmul@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mmtlmul>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,(%rsp)
mov    %r8,%r12
mov    %ecx,%ebp
mov    %rdx,%r15
mov    %esi,%ebx
mov    %edi,%r13d
mov    %esi,%edi
imul   %ecx,%edi
shl    $0x3,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r12,%rdx
mov    %rax,%rcx
call   1050 <mltranspose@plt>
mov    %r13d,%edi
mov    %ebx,%esi
mov    %r15,%rdx
mov    %ebp,%ecx
mov    %r14,%r8
mov    (%rsp),%r9
call   1040 <mmlmul@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @mmtlmul(i32 %0, i32 %1, double* %2, i32 %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca i32
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
store i32 %0, i32* %7
store i32 %1, i32* %8
store double* %2, double** %9
store i32 %3, i32* %10
store double* %4, double** %11
store double* %5, double** %12
%14 = load i32, i32* %7
%15 = zext i32 %14 to i64
%16 = load i32, i32* %8
%17 = zext i32 %16 to i64
%18 = load i32, i32* %10
%19 = zext i32 %18 to i64
%20 = load i32, i32* %8
%21 = zext i32 %20 to i64
%22 = load i32, i32* %7
%23 = zext i32 %22 to i64
%24 = load i32, i32* %10
%25 = zext i32 %24 to i64
%26 = load i32, i32* %10
%27 = zext i32 %26 to i64
%28 = load i32, i32* %8
%29 = zext i32 %28 to i64
%30 = load i32, i32* %10
%31 = zext i32 %30 to i64
%32 = mul nuw i64 %29, %31
%33 = mul nuw i64 8, %32
%34 = trunc i64 %33 to i32
%35 = call double** @malloc(i32 %34)
%36 = bitcast double** %35 to double*
store double* %36, double** %13
%37 = load i32, i32* %10
%38 = load i32, i32* %8
%39 = load double*, double** %11
%40 = bitcast double* %39 to double**
%41 = load double*, double** %13
%42 = bitcast double* %41 to double**
%43 = call i32 @mltranspose(i32 %37, i32 %38, double** %40, double** %42)
%44 = load i32, i32* %7
%45 = load i32, i32* %8
%46 = load double*, double** %9
%47 = bitcast double* %46 to double**
%48 = load i32, i32* %10
%49 = load double*, double** %13
%50 = bitcast double* %49 to double**
%51 = load double*, double** %12
%52 = bitcast double* %51 to double**
%53 = call i32 @mmlmul(i32 %44, i32 %45, double** %47, i32 %48, double** %50, double** %52)
%54 = load double*, double** %13
%55 = bitcast double* %54 to double**
%56 = call i32 @free(double** %55)
ret void
}

LLVM IR (-O2):
define void @mmtlmul(i32 %0, i32 %1, double* %2, i32 %3, double* %4, double* %5) {
%7 = shl i32 %1, 3
%8 = mul i32 %7, %3
%9 = tail call double** @malloc(i32 %8)
%10 = bitcast double* %4 to double**
%11 = tail call i32 @mltranspose(i32 %3, i32 %1, double** %10, double** %9)
%12 = bitcast double* %2 to double**
%13 = bitcast double* %5 to double**
%14 = tail call i32 @mmlmul(i32 %0, i32 %1, double** %12, i32 %3, double** %9, double** %13)
%15 = tail call i32 @free(double** %9)
ret void
}