#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*/ printf(char *, int, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, double *);
void inputMatrix(double src[3][3], int rows, int cols) {
  puts("Enter the matrix elements:");
  int i, j;
  for (i = 0; i < rows; ++i) {
    for (j = 0; j < cols; ++j) {
      printf(">> Element[%d][%d]: ", i, j);
      scanf("%lf", &src[i][j]);
    }
  }
}


x86 assembly (clang, -O0):
<inputMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11cd <inputMatrix+0x9d>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11ba <inputMatrix+0x8a>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0x14(%rbp),%rax
imul   $0x18,%rax,%rax
add    %rax,%rsi
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe89(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1168 <inputMatrix+0x38>
jmp    11bf <inputMatrix+0x8f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1155 <inputMatrix+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inputMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0x4(%rsp)
mov    %esi,%ebx
mov    %rdi,0x8(%rsp)
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
test   %ebx,%ebx
jle    11c7 <inputMatrix+0x97>
mov    %ebx,%eax
mov    %rax,0x10(%rsp)
mov    0x4(%rsp),%r15d
xor    %ebp,%ebp
lea    0xead(%rip),%r12
lea    0xebb(%rip),%r13
jmp    1191 <inputMatrix+0x61>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
addq   $0x18,0x8(%rsp)
cmp    0x10(%rsp),%rbp
je     11c7 <inputMatrix+0x97>
cmpl   $0x0,0x4(%rsp)
jle    1180 <inputMatrix+0x50>
mov    0x8(%rsp),%rbx
xor    %r14d,%r14d
mov    %r12,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%r14
add    $0x8,%rbx
cmp    %r14,%r15
jne    11a0 <inputMatrix+0x70>
jmp    1180 <inputMatrix+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [27 x i8] c"Enter the matrix elements:\00"
@.str.1 = [21 x i8] c">> Element[%d][%d]: \00"
@.str.2 = [4 x i8] c"%lf\00"
define void @inputMatrix([3 x double]* %0, i32 %1, i32 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %25
6: ; preds = %3
%7 = icmp sgt i32 %2, 0
%8 = zext i32 %1 to i64
%9 = zext i32 %2 to i64
br label %10
10: ; preds = %6, %22
%11 = phi i64 [ 0, %6 ], [ %23, %22 ]
br i1 %7, label %12, label %22
12: ; preds = %10
%13 = trunc i64 %11 to i32
br label %14
14: ; preds = %12, %14
%15 = phi i64 [ 0, %12 ], [ %20, %14 ]
%16 = trunc i64 %15 to i32
%17 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %16)
%18 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %11, i64 %15
%19 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %18)
%20 = add nuw nsw i64 %15, 1
%21 = icmp eq i64 %20, %9
br i1 %21, label %22, label %14
22: ; preds = %14, %10
%23 = add nuw nsw i64 %11, 1
%24 = icmp eq i64 %23, %8
br i1 %24, label %25, label %10
25: ; preds = %22, %3
ret void
}