#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*/ inputArray(int, int *);
int /*<<< orphan*/ inputMatrix(int, int **);
int /*<<< orphan*/ printArray(int, int *);
int /*<<< orphan*/ printMatrix(int, int **);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ swapArray(int, int *, int *);
int /*<<< orphan*/ swapMatrix(int, int **, int **);
int main() {
  int arr1[5] = {}, arr2[5] = {};
  int mat1[5][5] = {}, mat2[5][5] = {};
  printf("Input array1\n");
  inputArray(5, arr1);
  printf("Input array2\n");
  inputArray(5, arr2);
  printf("Input matrix1\n");
  inputMatrix(5, mat1);
  printf("Input matrix2\n");
  inputMatrix(5, mat2);
  swapArray(5, arr1, arr2);
  swapMatrix(5, mat1, mat2);
  printf("Swapped.\n");
  printf("Array1:\n");
  printArray(5, arr1);
  printf("\n");
  printf("Array2:\n");
  printArray(5, arr2);
  printf("\n");
  printf("Matrix1:\n");
  printMatrix(5, mat1);
  printf("\n");
  printf("Matrix2:\n");
  printMatrix(5, mat2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1050 <memset@plt>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1050 <memset@plt>
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
lea    0xe21(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    $0x5,%edi
call   1070 <inputArray@plt>
lea    0xe15(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
mov    $0x5,%edi
call   1070 <inputArray@plt>
lea    0xe09(%rip),%rdi
call   1040 <printf@plt>
lea    -0xb0(%rbp),%rsi
mov    $0x5,%edi
call   1030 <inputMatrix@plt>
lea    0xdfb(%rip),%rdi
call   1040 <printf@plt>
lea    -0x120(%rbp),%rsi
mov    $0x5,%edi
call   1030 <inputMatrix@plt>
lea    -0x20(%rbp),%rsi
lea    -0x40(%rbp),%rdx
mov    $0x5,%edi
call   1080 <swapArray@plt>
lea    -0xb0(%rbp),%rsi
lea    -0x120(%rbp),%rdx
mov    $0x5,%edi
call   10a0 <swapMatrix@plt>
lea    0xdc3(%rip),%rdi
call   1040 <printf@plt>
lea    0xdc1(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    $0x5,%edi
call   1090 <printArray@plt>
lea    0xda5(%rip),%rdi
call   1040 <printf@plt>
lea    0xda4(%rip),%rdi
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
mov    $0x5,%edi
call   1090 <printArray@plt>
lea    0xd7f(%rip),%rdi
call   1040 <printf@plt>
lea    0xd87(%rip),%rdi
call   1040 <printf@plt>
lea    -0xb0(%rbp),%rsi
mov    $0x5,%edi
call   1060 <printMatrix@plt>
lea    0xd56(%rip),%rdi
call   1040 <printf@plt>
lea    0xd68(%rip),%rdi
call   1040 <printf@plt>
lea    -0x120(%rbp),%rsi
mov    $0x5,%edi
call   1060 <printMatrix@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x118,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0x0,0x30(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movl   $0x0,0x110(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movl   $0x0,0xa0(%rsp)
lea    0xde5(%rip),%rdi
call   1050 <puts@plt>
lea    0x20(%rsp),%rbx
mov    $0x5,%edi
mov    %rbx,%rsi
call   1070 <inputArray@plt>
lea    0xdd4(%rip),%rdi
call   1050 <puts@plt>
mov    %rsp,%r12
mov    $0x5,%edi
mov    %r12,%rsi
call   1070 <inputArray@plt>
lea    0xdc5(%rip),%rdi
call   1050 <puts@plt>
lea    0xb0(%rsp),%r15
mov    $0x5,%edi
mov    %r15,%rsi
call   1030 <inputMatrix@plt>
lea    0xdb2(%rip),%rdi
call   1050 <puts@plt>
lea    0x40(%rsp),%r14
mov    $0x5,%edi
mov    %r14,%rsi
call   1030 <inputMatrix@plt>
mov    $0x5,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1080 <swapArray@plt>
mov    $0x5,%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   10a0 <swapMatrix@plt>
lea    0xd82(%rip),%rdi
call   1050 <puts@plt>
lea    0xd7f(%rip),%rdi
call   1050 <puts@plt>
mov    $0x5,%edi
mov    %rbx,%rsi
call   1090 <printArray@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xd64(%rip),%rdi
call   1050 <puts@plt>
mov    $0x5,%edi
mov    %r12,%rsi
call   1090 <printArray@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xd49(%rip),%rdi
call   1050 <puts@plt>
mov    $0x5,%edi
mov    %r15,%rsi
call   1060 <printMatrix@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xd2f(%rip),%rdi
call   1050 <puts@plt>
mov    $0x5,%edi
mov    %r14,%rsi
call   1060 <printMatrix@plt>
xor    %eax,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Input array1\0A\00"
@.str.1 = [14 x i8] c"Input array2\0A\00"
@.str.2 = [15 x i8] c"Input matrix1\0A\00"
@.str.3 = [15 x i8] c"Input matrix2\0A\00"
@.str.4 = [10 x i8] c"Swapped.\0A\00"
@.str.5 = [9 x i8] c"Array1:\0A\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [9 x i8] c"Array2:\0A\00"
@.str.8 = [10 x i8] c"Matrix1:\0A\00"
@.str.9 = [10 x i8] c"Matrix2:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca [5 x i32]
%4 = alloca [5 x [5 x i32]]
%5 = alloca [5 x [5 x i32]]
store i32 0, i32* %1
%6 = bitcast [5 x i32]* %2 to i8*
%7 = bitcast [5 x i32]* %3 to i8*
%8 = bitcast [5 x [5 x i32]]* %4 to i8*
%9 = bitcast [5 x [5 x i32]]* %5 to i8*
%10 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%12 = call i32 @inputArray(i32 5, i32* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%15 = call i32 @inputArray(i32 5, i32* %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%17 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %4, i64 0, i64 0
%18 = bitcast [5 x i32]* %17 to i32**
%19 = call i32 @inputMatrix(i32 5, i32** %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%21 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %5, i64 0, i64 0
%22 = bitcast [5 x i32]* %21 to i32**
%23 = call i32 @inputMatrix(i32 5, i32** %22)
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%25 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%26 = call i32 @swapArray(i32 5, i32* %24, i32* %25)
%27 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %4, i64 0, i64 0
%28 = bitcast [5 x i32]* %27 to i32**
%29 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %5, i64 0, i64 0
%30 = bitcast [5 x i32]* %29 to i32**
%31 = call i32 @swapMatrix(i32 5, i32** %28, i32** %30)
%32 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%33 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%34 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%35 = call i32 @printArray(i32 5, i32* %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%37 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%38 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%39 = call i32 @printArray(i32 5, i32* %38)
%40 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%41 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%42 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %4, i64 0, i64 0
%43 = bitcast [5 x i32]* %42 to i32**
%44 = call i32 @printMatrix(i32 5, i32** %43)
%45 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%46 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%47 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %5, i64 0, i64 0
%48 = bitcast [5 x i32]* %47 to i32**
%49 = call i32 @printMatrix(i32 5, i32** %48)
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"Input array1\00"
@str.10 = [13 x i8] c"Input array2\00"
@str.11 = [14 x i8] c"Input matrix1\00"
@str.12 = [14 x i8] c"Input matrix2\00"
@str.13 = [9 x i8] c"Swapped.\00"
@str.14 = [8 x i8] c"Array1:\00"
@str.15 = [8 x i8] c"Array2:\00"
@str.16 = [9 x i8] c"Matrix1:\00"
@str.17 = [9 x i8] c"Matrix2:\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca [5 x i32]
%3 = alloca [5 x [5 x i32]]
%4 = alloca [5 x [5 x i32]]
%5 = bitcast [5 x i32]* %1 to i8*
%6 = bitcast [5 x i32]* %2 to i8*
%7 = bitcast [5 x [5 x i32]]* %3 to i8*
%8 = bitcast [5 x [5 x i32]]* %4 to i8*
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%11 = call i32 @inputArray(i32 5, i32* %10)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.10, i64 0, i64 0))
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%14 = call i32 @inputArray(i32 5, i32* %13)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.11, i64 0, i64 0))
%16 = bitcast [5 x [5 x i32]]* %3 to i32**
%17 = call i32 @inputMatrix(i32 5, i32** %16)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.12, i64 0, i64 0))
%19 = bitcast [5 x [5 x i32]]* %4 to i32**
%20 = call i32 @inputMatrix(i32 5, i32** %19)
%21 = call i32 @swapArray(i32 5, i32* %10, i32* %13)
%22 = call i32 @swapMatrix(i32 5, i32** %16, i32** %19)
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.13, i64 0, i64 0))
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.14, i64 0, i64 0))
%25 = call i32 @printArray(i32 5, i32* %10)
%26 = call i32 @putchar(i32 10)
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.15, i64 0, i64 0))
%28 = call i32 @printArray(i32 5, i32* %13)
%29 = call i32 @putchar(i32 10)
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.16, i64 0, i64 0))
%31 = call i32 @printMatrix(i32 5, i32** %16)
%32 = call i32 @putchar(i32 10)
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.17, i64 0, i64 0))
%34 = call i32 @printMatrix(i32 5, i32** %19)
ret i32 0
}