#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*/ mm_destroy(int, double **);
double **mm_gen(int);
double **mm_mul(int, double **, double **);
int main(int argc, char *argv[]) {
  int n = 300;
  double **a, **b, **m;
  n = (n / 2) * 2;
  a = mm_gen(n);
  b = mm_gen(n);
  m = mm_mul(n, a, b);
  mm_destroy(n, a);
  mm_destroy(n, b);
  mm_destroy(n, m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x12c,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <mm_gen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <mm_gen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1050 <mm_mul@plt>
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1040 <mm_destroy@plt>
mov    -0x14(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1040 <mm_destroy@plt>
mov    -0x14(%rbp),%edi
mov    -0x30(%rbp),%rsi
call   1040 <mm_destroy@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x12c,%edi
call   1030 <mm_gen@plt>
mov    %rax,%rbx
mov    $0x12c,%edi
call   1030 <mm_gen@plt>
mov    %rax,%r14
mov    $0x12c,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1050 <mm_mul@plt>
mov    %rax,%r15
mov    $0x12c,%edi
mov    %rbx,%rsi
call   1040 <mm_destroy@plt>
mov    $0x12c,%edi
mov    %r14,%rsi
call   1040 <mm_destroy@plt>
mov    $0x12c,%edi
mov    %r15,%rsi
call   1040 <mm_destroy@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double**
%8 = alloca double**
%9 = alloca double**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 300, i32* %6
%10 = load i32, i32* %6
%11 = sdiv i32 %10, 2
%12 = mul nsw i32 %11, 2
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = call double** @mm_gen(i32 %13)
store double** %14, double*** %7
%15 = load i32, i32* %6
%16 = call double** @mm_gen(i32 %15)
store double** %16, double*** %8
%17 = load i32, i32* %6
%18 = load double**, double*** %7
%19 = load double**, double*** %8
%20 = call double** @mm_mul(i32 %17, double** %18, double** %19)
store double** %20, double*** %9
%21 = load i32, i32* %6
%22 = load double**, double*** %7
%23 = call i32 @mm_destroy(i32 %21, double** %22)
%24 = load i32, i32* %6
%25 = load double**, double*** %8
%26 = call i32 @mm_destroy(i32 %24, double** %25)
%27 = load i32, i32* %6
%28 = load double**, double*** %9
%29 = call i32 @mm_destroy(i32 %27, double** %28)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call double** @mm_gen(i32 300)
%4 = tail call double** @mm_gen(i32 300)
%5 = tail call double** @mm_mul(i32 300, double** %3, double** %4)
%6 = tail call i32 @mm_destroy(i32 300, double** %3)
%7 = tail call i32 @mm_destroy(i32 300, double** %4)
%8 = tail call i32 @mm_destroy(i32 300, double** %5)
ret i32 0
}