#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 **createMatrix(int, int);
int /*<<< orphan*/ delMatrix(int **, int);
int /*<<< orphan*/ displayMatrix(int **, int, int);
int /*<<< orphan*/ inputMatrix(int **, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int **mat, row = 0, col = 0;
  printf("Please enter the number of rows you want in your matrix.\n");
  scanf("%d", &row);
  printf("Please enter the number of columns you want in your matrix.\n");
  scanf("%d", &col);
  mat = createMatrix(row, col);
  printf("Please enter the elements of the matrix.\n");
  inputMatrix(mat, row, col);
  printf("The matrix you have entered is : \n");
  displayMatrix(mat, row, col);
  delMatrix(mat, row);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
lea    0xe95(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1060 <createMatrix@plt>
mov    %rax,-0x8(%rbp)
lea    0xeb6(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <inputMatrix@plt>
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1080 <displayMatrix@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <delMatrix@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0x8(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xe87(%rip),%rdi
call   1040 <puts@plt>
lea    0xe78(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xea0(%rip),%rdi
call   1040 <puts@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
mov    0x8(%rsp),%edi
mov    0xc(%rsp),%esi
call   1060 <createMatrix@plt>
mov    %rax,%rbx
lea    0xeb3(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
call   1030 <inputMatrix@plt>
lea    0xec0(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
call   1080 <displayMatrix@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1050 <delMatrix@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [58 x i8] c"Please enter the number of rows you want in your matrix.\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [61 x i8] c"Please enter the number of columns you want in your matrix.\0A\00"
@.str.3 = [42 x i8] c"Please enter the elements of the matrix.\0A\00"
@.str.4 = [35 x i8] c"The matrix you have entered is : \0A\00"
define i32 @main() {
%1 = alloca i32**
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %2
store i32 0, i32* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32** @createMatrix(i32 %8, i32 %9)
store i32** %10, i32*** %1
%11 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%12 = load i32**, i32*** %1
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = call i32 @inputMatrix(i32** %12, i32 %13, i32 %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
%17 = load i32**, i32*** %1
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i32 @displayMatrix(i32** %17, i32 %18, i32 %19)
%21 = load i32**, i32*** %1
%22 = load i32, i32* %2
%23 = call i32 @delMatrix(i32** %21, i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [57 x i8] c"Please enter the number of rows you want in your matrix.\00"
@str.5 = [60 x i8] c"Please enter the number of columns you want in your matrix.\00"
@str.6 = [41 x i8] c"Please enter the elements of the matrix.\00"
@str.7 = [34 x i8] c"The matrix you have entered is : \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.5, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = call i32** @createMatrix(i32 %9, i32 %10)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.6, i64 0, i64 0))
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = call i32 @inputMatrix(i32** %11, i32 %13, i32 %14)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.7, i64 0, i64 0))
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = call i32 @displayMatrix(i32** %11, i32 %17, i32 %18)
%20 = load i32, i32* %1
%21 = call i32 @delMatrix(i32** %11, i32 %20)
ret i32 0
}