#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*/ modify(int **);
int /*<<< orphan*/ printMatrix(int **);
int /*<<< orphan*/ printf(char *);
int main() {
  int arr[5][5];
  for (int i = 0; i < 5; i++)
    for (int j = 0; j < 5; j++)
      arr[i][j] = 1;
  arr[0][0] = 0;
  arr[5 - 1][5 - 1] = 0;
  printf("\nOriginal:\n");
  printMatrix(arr);
  printf("\nNew: \n");
  modify(arr);
  printMatrix(arr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x74(%rbp)
cmpl   $0x5,-0x74(%rbp)
jge    119f <main+0x6f>
movl   $0x0,-0x78(%rbp)
cmpl   $0x5,-0x78(%rbp)
jge    118c <main+0x5c>
movslq -0x74(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x78(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    115a <main+0x2a>
jmp    1191 <main+0x61>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1149 <main+0x19>
movl   $0x0,-0x70(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xe4c(%rip),%rdi
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1050 <printMatrix@plt>
lea    0xe43(%rip),%rdi
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <modify@plt>
lea    -0x70(%rbp),%rdi
call   1050 <printMatrix@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
movaps 0xec4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
lea    0xeb1(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <printMatrix@plt>
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <modify@plt>
mov    %rbx,%rdi
call   1050 <printMatrix@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"\0AOriginal:\0A\00"
@.str.1 = [8 x i8] c"\0ANew: \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x [5 x i32]]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %23, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %26
8: ; preds = %5
store i32 0, i32* %4
br label %9
9: ; preds = %19, %8
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 5
br i1 %11, label %12, label %22
12: ; preds = %9
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 %14
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %15, i64 0, i64 %17
store i32 1, i32* %18
br label %19
19: ; preds = %12
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %9
22: ; preds = %9
br label %23
23: ; preds = %22
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %5
26: ; preds = %5
%27 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %27, i64 0, i64 0
store i32 0, i32* %28
%29 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 4
%30 = getelementptr inbounds [5 x i32], [5 x i32]* %29, i64 0, i64 4
store i32 0, i32* %30
%31 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%32 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%33 = bitcast [5 x i32]* %32 to i32**
%34 = call i32 @printMatrix(i32** %33)
%35 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%36 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%37 = bitcast [5 x i32]* %36 to i32**
%38 = call i32 @modify(i32** %37)
%39 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%40 = bitcast [5 x i32]* %39 to i32**
%41 = call i32 @printMatrix(i32** %40)
%42 = load i32, i32* %1
ret i32 %42
}

LLVM IR (-O2):
@str = [11 x i8] c"\0AOriginal:\00"
@str.2 = [7 x i8] c"\0ANew: \00"
define i32 @main() {
%1 = alloca [5 x [5 x i32]]
%2 = bitcast [5 x [5 x i32]]* %1 to i8*
%3 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 0, i64 4
%4 = bitcast i32* %3 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %4
%5 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 1, i64 3
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %6
%7 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 2, i64 2
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %8
%9 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 3, i64 1
%10 = bitcast i32* %9 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %10
%11 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 4, i64 0
%12 = bitcast i32* %11 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %12
%13 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %1, i64 0, i64 4, i64 4
%14 = bitcast [5 x [5 x i32]]* %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 1, i32 1>, <4 x i32>* %14
store i32 0, i32* %13
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%16 = bitcast [5 x [5 x i32]]* %1 to i32**
%17 = call i32 @printMatrix(i32** %16)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.2, i64 0, i64 0))
%19 = call i32 @modify(i32** %16)
%20 = call i32 @printMatrix(i32** %16)
ret i32 0
}