#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*/ addMat(int **, int **, int **);
int /*<<< orphan*/ inputMat(int **);
int /*<<< orphan*/ printMat(int **);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int i, j;
  int matA[3][3], matB[3][3], matC[3][3];
  printf("Enter The Value of Matrix A (%dx%d) \n", 3, 3);
  inputMat(matA);
  printf("Enter The Value of Matrix B (%dx%d) \n", 3, 3);
  inputMat(matB);
  addMat(matA, matB, matC);
  printf("ANS: \n");
  printMat(matC);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x3,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1060 <inputMat@plt>
lea    0xeaf(%rip),%rdi
mov    $0x3,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1060 <inputMat@plt>
lea    -0x30(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x90(%rbp),%rdx
call   1030 <addMat@plt>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x90(%rbp),%rdi
call   1040 <printMat@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x90,%rsp
lea    0xe9d(%rip),%rdi
mov    $0x3,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x60(%rsp),%r14
mov    %r14,%rdi
call   1070 <inputMat@plt>
lea    0xe9e(%rip),%rdi
mov    $0x3,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <inputMat@plt>
mov    %rsp,%r15
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1040 <addMat@plt>
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1050 <printMat@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Enter The Value of Matrix A (%dx%d) \0A\00"
@.str.1 = [38 x i8] c"Enter The Value of Matrix B (%dx%d) \0A\00"
@.str.2 = [7 x i8] c"ANS: \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [3 x [3 x i32]]
%5 = alloca [3 x [3 x i32]]
%6 = alloca [3 x [3 x i32]]
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 3, i32 3)
%8 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %4, i64 0, i64 0
%9 = bitcast [3 x i32]* %8 to i32**
%10 = call i32 @inputMat(i32** %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 3)
%12 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %5, i64 0, i64 0
%13 = bitcast [3 x i32]* %12 to i32**
%14 = call i32 @inputMat(i32** %13)
%15 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %4, i64 0, i64 0
%16 = bitcast [3 x i32]* %15 to i32**
%17 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %5, i64 0, i64 0
%18 = bitcast [3 x i32]* %17 to i32**
%19 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %6, i64 0, i64 0
%20 = bitcast [3 x i32]* %19 to i32**
%21 = call i32 @addMat(i32** %16, i32** %18, i32** %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%23 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %6, i64 0, i64 0
%24 = bitcast [3 x i32]* %23 to i32**
%25 = call i32 @printMat(i32** %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"Enter The Value of Matrix A (%dx%d) \0A\00"
@.str.1 = [38 x i8] c"Enter The Value of Matrix B (%dx%d) \0A\00"
@str = [6 x i8] c"ANS: \00"
define i32 @main() {
%1 = alloca [3 x [3 x i32]]
%2 = alloca [3 x [3 x i32]]
%3 = alloca [3 x [3 x i32]]
%4 = bitcast [3 x [3 x i32]]* %1 to i8*
%5 = bitcast [3 x [3 x i32]]* %2 to i8*
%6 = bitcast [3 x [3 x i32]]* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 3, i32 3)
%8 = bitcast [3 x [3 x i32]]* %1 to i32**
%9 = call i32 @inputMat(i32** %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 3)
%11 = bitcast [3 x [3 x i32]]* %2 to i32**
%12 = call i32 @inputMat(i32** %11)
%13 = bitcast [3 x [3 x i32]]* %3 to i32**
%14 = call i32 @addMat(i32** %8, i32** %11, i32** %13)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%16 = call i32 @printMat(i32** %13)
ret i32 0
}