#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*/ input(int **, int, int);
int /*<<< orphan*/ output(int **, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, int *);
int /*<<< orphan*/ sum(int **, int **, int **, int, int);
main() {
  int a[5][5] = {0}, b[5][5] = {0}, c[5][5] = {0}, m, n;
  printf("Enter the dimensions of the matrix");
  scanf("%d%d", &m, &n);
  printf("\nMatrix 1 \n");
  input(a, m, n);
  printf("\n Matrix 2\n");
  input(b, m, n);
  sum(a, b, c, m, n);
  output(c, m, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
lea    -0xe0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
lea    -0x150(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
lea    0xe51(%rip),%rdi
call   1050 <printf@plt>
lea    0xe68(%rip),%rdi
lea    -0x154(%rbp),%rsi
lea    -0x158(%rbp),%rdx
call   1080 <scanf@plt>
lea    0xe53(%rip),%rdi
call   1050 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    -0x154(%rbp),%esi
mov    -0x158(%rbp),%edx
call   1030 <input@plt>
lea    0xe3e(%rip),%rdi
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rdi
mov    -0x154(%rbp),%esi
mov    -0x158(%rbp),%edx
call   1030 <input@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
lea    -0x150(%rbp),%rdx
mov    -0x154(%rbp),%ecx
mov    -0x158(%rbp),%r8d
call   1070 <sum@plt>
lea    -0x150(%rbp),%rdi
mov    -0x154(%rbp),%esi
mov    -0x158(%rbp),%edx
call   1040 <output@plt>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x160,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movl   $0x0,0x150(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movl   $0x0,0xe0(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x70(%rsp)
lea    0xdee(%rip),%rdi
call   1060 <printf@plt>
lea    0xe05(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1080 <scanf@plt>
lea    0xdf4(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xf0(%rsp),%r14
mov    %r14,%rdi
call   1030 <input@plt>
lea    0xddb(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <input@plt>
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
lea    0x10(%rsp),%r15
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1070 <sum@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %r15,%rdi
call   1050 <output@plt>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Enter the dimensions of the matrix\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [12 x i8] c"\0AMatrix 1 \0A\00"
@.str.3 = [12 x i8] c"\0A Matrix 2\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x [5 x i32]]
%3 = alloca [5 x [5 x i32]]
%4 = alloca [5 x [5 x i32]]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [5 x [5 x i32]]* %2 to i8*
%8 = bitcast [5 x [5 x i32]]* %3 to i8*
%9 = bitcast [5 x [5 x i32]]* %4 to i8*
%10 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %6)
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%13 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%14 = bitcast [5 x i32]* %13 to i32**
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = call i32 @input(i32** %14, i32 %15, i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%19 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %3, i64 0, i64 0
%20 = bitcast [5 x i32]* %19 to i32**
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = call i32 @input(i32** %20, i32 %21, i32 %22)
%24 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%25 = bitcast [5 x i32]* %24 to i32**
%26 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %3, i64 0, i64 0
%27 = bitcast [5 x i32]* %26 to i32**
%28 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %4, i64 0, i64 0
%29 = bitcast [5 x i32]* %28 to i32**
%30 = load i32, i32* %5
%31 = load i32, i32* %6
%32 = call i32 @sum(i32** %25, i32** %27, i32** %29, i32 %30, i32 %31)
%33 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %4, i64 0, i64 0
%34 = bitcast [5 x i32]* %33 to i32**
%35 = load i32, i32* %5
%36 = load i32, i32* %6
%37 = call i32 @output(i32** %34, i32 %35, i32 %36)
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"Enter the dimensions of the matrix\00"
@.str.1 = [5 x i8] c"%d%d\00"
@str = [11 x i8] c"\0AMatrix 1 \00"
@str.4 = [11 x i8] c"\0A Matrix 2\00"
define i32 @main() {
%1 = alloca [5 x [5 x i32]]
%2 = alloca [5 x [5 x i32]]
%3 = alloca [5 x [5 x i32]]
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [5 x [5 x i32]]* %1 to i8*
%7 = bitcast [5 x [5 x i32]]* %2 to i8*
%8 = bitcast [5 x [5 x i32]]* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%14 = bitcast [5 x [5 x i32]]* %1 to i32**
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = call i32 @input(i32** %14, i32 %15, i32 %16)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.4, i64 0, i64 0))
%19 = bitcast [5 x [5 x i32]]* %2 to i32**
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = call i32 @input(i32** %19, i32 %20, i32 %21)
%23 = bitcast [5 x [5 x i32]]* %3 to i32**
%24 = load i32, i32* %4
%25 = load i32, i32* %5
%26 = call i32 @sum(i32** %14, i32** %19, i32** %23, i32 %24, i32 %25)
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = call i32 @output(i32** %23, i32 %27, i32 %28)
ret i32 0
}