#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*/ scanf(char *, int *);
void inputMatrix(int len, int mat[len][len]) {
  for (int i = 0; i < len; ++i) {
    for (int j = 0; j < len; ++j) {
      scanf("%d", &mat[i][j]);
    }
  }
}


x86 assembly (clang, -O0):
<inputMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    119b <inputMatrix+0x8b>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1188 <inputMatrix+0x78>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
imul   %rcx,%rax
shl    $0x2,%rax
add    %rax,%rsi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe8b(%rip),%rdi
call   1030 <scanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1140 <inputMatrix+0x30>
jmp    118d <inputMatrix+0x7d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <inputMatrix+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inputMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1172 <inputMatrix+0x62>
mov    %rsi,%r14
mov    %edi,%r13d
lea    0x0(,%r13,4),%rax
mov    %rax,(%rsp)
xor    %ebp,%ebp
lea    0xec6(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %r13,%r12
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <scanf@plt>
add    $0x4,%rbx
add    $0xffffffffffffffff,%r12
jne    1150 <inputMatrix+0x40>
add    $0x1,%rbp
add    (%rsp),%r14
cmp    %r13,%rbp
jne    1140 <inputMatrix+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @inputMatrix(i32 %0, i32* %1) {
%3 = zext i32 %0 to i64
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %9
5: ; preds = %2, %10
%6 = phi i64 [ %11, %10 ], [ 0, %2 ]
%7 = mul nuw nsw i64 %6, %3
%8 = getelementptr inbounds i32, i32* %1, i64 %7
br label %13
9: ; preds = %10, %2
ret void
10: ; preds = %13
%11 = add nuw nsw i64 %6, 1
%12 = icmp eq i64 %11, %3
br i1 %12, label %9, label %5
13: ; preds = %5, %13
%14 = phi i64 [ 0, %5 ], [ %17, %13 ]
%15 = getelementptr inbounds i32, i32* %8, i64 %14
%16 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %15)
%17 = add nuw nsw i64 %14, 1
%18 = icmp eq i64 %17, %3
br i1 %18, label %10, label %13
}