#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 */
float **makeMatrix(int, int);
int /*<<< orphan*/ matrMult(int, int, int, float **, float **, float **);
int /*<<< orphan*/ printMatrix(int, int, float **);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int m = 0;
  int p = 0;
  int n = 0;
  printf("M? ");
  scanf("%d", &m);
  printf("P? ");
  scanf("%d", &p);
  printf("N? ");
  scanf("%d", &n);
  printf("\n");
  float **a = makeMatrix(m, p);
  printf("a =\n");
  printMatrix(m, p, a);
  float **b = makeMatrix(p, n);
  printf("b =\n");
  printMatrix(p, n, b);
  float **c = NULL;
  printf("c =\n");
  matrMult(m, p, n, a, b, c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
lea    0xe7d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
lea    0xe61(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xe58(%rip),%rdi
call   1040 <printf@plt>
lea    0xe45(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xe43(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <makeMatrix@plt>
mov    %rax,-0x18(%rbp)
lea    0xe25(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1060 <printMatrix@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <makeMatrix@plt>
mov    %rax,-0x20(%rbp)
lea    0xe00(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1060 <printMatrix@plt>
movq   $0x0,-0x28(%rbp)
lea    0xde2(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
call   1050 <matrMult@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x10(%rsp)
lea    0xe6a(%rip),%rdi
call   1060 <printf@plt>
lea    0xe62(%rip),%rbx
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1090 <scanf@plt>
lea    0xe51(%rip),%rdi
call   1060 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1090 <scanf@plt>
lea    0xe3c(%rip),%rdi
call   1060 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1090 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x14(%rsp),%edi
mov    0xc(%rsp),%esi
call   1050 <makeMatrix@plt>
mov    %rax,%r14
lea    0xe0d(%rip),%rdi
call   1040 <puts@plt>
mov    0x14(%rsp),%edi
mov    0xc(%rsp),%esi
mov    %r14,%rdx
call   1080 <printMatrix@plt>
mov    0xc(%rsp),%edi
mov    0x10(%rsp),%esi
call   1050 <makeMatrix@plt>
mov    %rax,%rbx
lea    0xde5(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%edi
mov    0x10(%rsp),%esi
mov    %rbx,%rdx
call   1080 <printMatrix@plt>
lea    0xdcd(%rip),%rdi
call   1040 <puts@plt>
mov    0x14(%rsp),%edi
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %r14,%rcx
mov    %rbx,%r8
xor    %r9d,%r9d
call   1070 <matrMult@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"M? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"P? \00"
@.str.3 = [4 x i8] c"N? \00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [5 x i8] c"a =\0A\00"
@.str.6 = [5 x i8] c"b =\0A\00"
@.str.7 = [5 x i8] c"c =\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float**
%6 = alloca float**
%7 = alloca float**
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%14 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = call float** @makeMatrix(i32 %15, i32 %16)
store float** %17, float*** %5
%18 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = load float**, float*** %5
%22 = call i32 @printMatrix(i32 %19, i32 %20, float** %21)
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = call float** @makeMatrix(i32 %23, i32 %24)
store float** %25, float*** %6
%26 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = load float**, float*** %6
%30 = call i32 @printMatrix(i32 %27, i32 %28, float** %29)
store float** null, float*** %7
%31 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%32 = load i32, i32* %2
%33 = load i32, i32* %3
%34 = load i32, i32* %4
%35 = load float**, float*** %5
%36 = load float**, float*** %6
%37 = load float**, float*** %7
%38 = call i32 @matrMult(i32 %32, i32 %33, i32 %34, float** %35, float** %36, float** %37)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"M? \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"P? \00"
@.str.3 = [4 x i8] c"N? \00"
@str = [4 x i8] c"a =\00"
@str.8 = [4 x i8] c"b =\00"
@str.9 = [4 x i8] c"c =\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = call i32 @putchar(i32 10)
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = call float** @makeMatrix(i32 %14, i32 %15)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%18 = load i32, i32* %1
%19 = load i32, i32* %2
%20 = call i32 @printMatrix(i32 %18, i32 %19, float** %16)
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = call float** @makeMatrix(i32 %21, i32 %22)
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.8, i64 0, i64 0))
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = call i32 @printMatrix(i32 %25, i32 %26, float** %23)
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.9, i64 0, i64 0))
%29 = load i32, i32* %1
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = call i32 @matrMult(i32 %29, i32 %30, i32 %31, float** %16, float** %23, float** null)
ret i32 0
}