#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*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ check_intInput(int *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fill_D_array(int, int, int **);
int /*<<< orphan*/ multiplication_of_matrices(int, int, int **, int **);
int /*<<< orphan*/ printf(char *);
int main() {
  int row, col;
  printf("Enter row and col:");
  check_intInput(&row);
  check_intInput(&col);
  if (row <= 0 || col <= 0) {
    printf("row > 0 and col > 0 !");
    exit(EXIT_FAILURE);
  }
  int matrix_A[row][col], matrix_B[col][row];
  printf("Enter matrix element:\n");
  fill_D_array(row, col, matrix_A);
  fill_D_array(col, row, matrix_B);
  multiplication_of_matrices(row, col, matrix_A, matrix_B);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1030 <check_intInput@plt>
lea    -0xc(%rbp),%rdi
call   1030 <check_intInput@plt>
cmpl   $0x0,-0x8(%rbp)
jle    1191 <main+0x41>
cmpl   $0x0,-0xc(%rbp)
jg     11ab <main+0x5b>
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
mov    %rsp,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,%rdx
imul   %rax,%rdx
lea    0xf(,%rdx,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x48(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x20(%rbp)
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
mov    %rcx,%rdx
imul   %rax,%rdx
lea    0xf(,%rdx,4),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x40(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x30(%rbp)
mov    %rax,-0x38(%rbp)
lea    0xe10(%rip),%rdi
call   1040 <printf@plt>
mov    -0x48(%rbp),%rdx
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <fill_D_array@plt>
mov    -0x40(%rbp),%rdx
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <fill_D_array@plt>
mov    -0x48(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <multiplication_of_matrices@plt>
mov    0x2d82(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xe8f(%rip),%rdi
call   1050 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <check_intInput@plt>
lea    -0x1c(%rbp),%rdi
call   1030 <check_intInput@plt>
mov    -0x20(%rbp),%eax
test   %eax,%eax
jle    1229 <main+0xc9>
mov    -0x1c(%rbp),%ecx
test   %ecx,%ecx
jle    1229 <main+0xc9>
mov    %rsp,%r15
imul   %rax,%rcx
lea    0xf(,%rcx,4),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r14
sub    %rax,%r14
mov    %r14,%rsp
mov    -0x1c(%rbp),%eax
mov    -0x20(%rbp),%ecx
imul   %rax,%rcx
lea    0xf(,%rcx,4),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe49(%rip),%rdi
call   1040 <puts@plt>
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    %r14,%rdx
call   1060 <fill_D_array@plt>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    %rbx,%rdx
call   1060 <fill_D_array@plt>
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    %r14,%rdx
mov    %rbx,%rcx
call   1070 <multiplication_of_matrices@plt>
mov    0x2dbf(%rip),%rax
mov    (%rax),%eax
mov    %r15,%rsp
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xde3(%rip),%rdi
call   1050 <printf@plt>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Enter row and col:\00"
@.str.1 = [22 x i8] c"row > 0 and col > 0 !\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [23 x i8] c"Enter matrix element:\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i32 0, i32* %1
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @check_intInput(i32* %2)
%11 = call i32 @check_intInput(i32* %3)
%12 = load i32, i32* %2
%13 = icmp sle i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %0
%15 = load i32, i32* %3
%16 = icmp sle i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %14, %0
%18 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %14
%22 = load i32, i32* %2
%23 = zext i32 %22 to i64
%24 = load i32, i32* %3
%25 = zext i32 %24 to i64
%26 = call i8* @llvm.stacksave()
store i8* %26, i8** %4
%27 = mul nuw i64 %23, %25
%28 = alloca i32, i64 %27
store i64 %23, i64* %5
store i64 %25, i64* %6
%29 = load i32, i32* %3
%30 = zext i32 %29 to i64
%31 = load i32, i32* %2
%32 = zext i32 %31 to i64
%33 = mul nuw i64 %30, %32
%34 = alloca i32, i64 %33
store i64 %30, i64* %7
store i64 %32, i64* %8
%35 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%36 = load i32, i32* %2
%37 = load i32, i32* %3
%38 = bitcast i32* %28 to i32**
%39 = call i32 @fill_D_array(i32 %36, i32 %37, i32** %38)
%40 = load i32, i32* %3
%41 = load i32, i32* %2
%42 = bitcast i32* %34 to i32**
%43 = call i32 @fill_D_array(i32 %40, i32 %41, i32** %42)
%44 = load i32, i32* %2
%45 = load i32, i32* %3
%46 = bitcast i32* %28 to i32**
%47 = bitcast i32* %34 to i32**
%48 = call i32 @multiplication_of_matrices(i32 %44, i32 %45, i32** %46, i32** %47)
%49 = load i32, i32* @EXIT_SUCCESS
store i32 %49, i32* %1
%50 = load i8*, i8** %4
%51 = load i32, i32* %1
ret i32 %51
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter row and col:\00"
@.str.1 = [22 x i8] c"row > 0 and col > 0 !\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [22 x i8] c"Enter matrix element:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @check_intInput(i32* %1)
%7 = call i32 @check_intInput(i32* %2)
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 1
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 1
%12 = select i1 %9, i1 true, i1 %11
br i1 %12, label %13, label %17
13: ; preds = %0
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %0
%18 = zext i32 %8 to i64
%19 = zext i32 %10 to i64
%20 = call i8* @llvm.stacksave()
%21 = mul nuw nsw i64 %19, %18
%22 = alloca i32, i64 %21
%23 = load i32, i32* %2
%24 = zext i32 %23 to i64
%25 = load i32, i32* %1
%26 = zext i32 %25 to i64
%27 = mul nuw i64 %26, %24
%28 = alloca i32, i64 %27
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%30 = load i32, i32* %1
%31 = load i32, i32* %2
%32 = bitcast i32* %22 to i32**
%33 = call i32 @fill_D_array(i32 %30, i32 %31, i32** %32)
%34 = load i32, i32* %2
%35 = load i32, i32* %1
%36 = bitcast i32* %28 to i32**
%37 = call i32 @fill_D_array(i32 %34, i32 %35, i32** %36)
%38 = load i32, i32* %1
%39 = load i32, i32* %2
%40 = call i32 @multiplication_of_matrices(i32 %38, i32 %39, i32** %32, i32** %36)
%41 = load i32, i32* @EXIT_SUCCESS
ret i32 %41
}