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


x86 assembly (clang, -O0):
<modifyMatrix>:
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
cmp    -0xc(%rbp),%eax
jge    11b1 <modifyMatrix+0x91>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    119e <modifyMatrix+0x7e>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe9b(%rip),%rdi
call   1030 <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    0xe8a(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114c <modifyMatrix+0x2c>
jmp    11a3 <modifyMatrix+0x83>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <modifyMatrix+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modifyMatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0x4(%rsp)
mov    %rdi,0x8(%rsp)
test   %esi,%esi
jle    11a7 <modifyMatrix+0x87>
mov    %esi,%eax
mov    %rax,0x10(%rsp)
mov    0x4(%rsp),%r15d
xor    %ebp,%ebp
lea    0xeb0(%rip),%r12
lea    0xebe(%rip),%r13
jmp    1171 <modifyMatrix+0x51>
nopl   0x0(%rax)
add    $0x1,%rbp
addq   $0x18,0x8(%rsp)
cmp    0x10(%rsp),%rbp
je     11a7 <modifyMatrix+0x87>
cmpl   $0x0,0x4(%rsp)
jle    1160 <modifyMatrix+0x40>
mov    0x8(%rsp),%rbx
xor    %r14d,%r14d
mov    %r12,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
add    $0x1,%r14
add    $0x8,%rbx
cmp    %r14,%r15
jne    1180 <modifyMatrix+0x60>
jmp    1160 <modifyMatrix+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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