#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 read_into_matrix(int a[][10], int m, int n) {
  for (int i = 0; i <= m - 1; i++) {
    for (int j = 0; j <= n - 1; j++) {
      scanf("%d", &a[i][j]);
    }
  }
}


x86 assembly (clang, -O0):
<read_into_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1199 <read_into_matrix+0x89>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     1186 <read_into_matrix+0x76>
mov    -0x8(%rbp),%rsi
movslq -0x14(%rbp),%rax
imul   $0x28,%rax,%rax
add    %rax,%rsi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe8d(%rip),%rdi
call   1030 <scanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1141 <read_into_matrix+0x31>
jmp    118b <read_into_matrix+0x7b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <read_into_matrix+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_into_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0xc(%rsp)
test   %esi,%esi
jle    1187 <read_into_matrix+0x77>
mov    %rdi,%r15
mov    %esi,%eax
mov    %rax,0x10(%rsp)
mov    0xc(%rsp),%r12d
xor    %r14d,%r14d
lea    0xec1(%rip),%rbp
jmp    115f <read_into_matrix+0x4f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14
add    $0x28,%r15
cmp    0x10(%rsp),%r14
je     1187 <read_into_matrix+0x77>
mov    %r12,%r13
mov    %r15,%rbx
cmpl   $0x0,0xc(%rsp)
jle    1150 <read_into_matrix+0x40>
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <scanf@plt>
add    $0x4,%rbx
add    $0xffffffffffffffff,%r13
jne    1170 <read_into_matrix+0x60>
jmp    1150 <read_into_matrix+0x40>
add    $0x18,%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 @read_into_matrix([10 x i32]* %0, i32 %1, i32 %2) {
%4 = alloca [10 x i32]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store [10 x i32]* %0, [10 x i32]** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %9
9: ; preds = %33, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %5
%12 = sub nsw i32 %11, 1
%13 = icmp sle i32 %10, %12
br i1 %13, label %14, label %36
14: ; preds = %9
store i32 0, i32* %8
br label %15
15: ; preds = %29, %14
%16 = load i32, i32* %8
%17 = load i32, i32* %6
%18 = sub nsw i32 %17, 1
%19 = icmp sle i32 %16, %18
br i1 %19, label %20, label %32
20: ; preds = %15
%21 = load [10 x i32]*, [10 x i32]** %4
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %21, i64 %23
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %24, i64 0, i64 %26
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %27)
br label %29
29: ; preds = %20
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
store i32 %31, i32* %8
br label %15
32: ; preds = %15
br label %33
33: ; preds = %32
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %9
36: ; preds = %9
ret void
}

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