#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int matrix[10][10] = {0};
  matrix[0][0] = 0;
  matrix[1][1] = 1;
  matrix[2][2] = 2;
  matrix[3][3] = 3;
  matrix[4][4] = 4;
  matrix[5][5] = 5;
  matrix[6][6] = 6;
  matrix[7][7] = 7;
  matrix[8][8] = 8;
  matrix[9][9] = 9;
  int rowNum, colNum;
  printf("Write the row you want to get:\n");
  scanf("%i", &rowNum);
  printf("Write the col you want to get:\n");
  scanf("%i", &colNum);
  printf("Final result is %i", matrix[rowNum][colNum]);
  matrix[rowNum][colNum] = 1;
  printf("\n");
  printf("\n");
  printf("Whole Matrix is \n");
  for (int row = 0; row < 10; row++) {
    for (int col = 0; col < 10; col++) {
      printf("%i", matrix[row][col]);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1040 <memset@plt>
movl   $0x0,-0x1a0(%rbp)
movl   $0x1,-0x174(%rbp)
movl   $0x2,-0x148(%rbp)
movl   $0x3,-0x11c(%rbp)
movl   $0x4,-0xf0(%rbp)
movl   $0x5,-0xc4(%rbp)
movl   $0x6,-0x98(%rbp)
movl   $0x7,-0x6c(%rbp)
movl   $0x8,-0x40(%rbp)
movl   $0x9,-0x14(%rbp)
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8b(%rip),%rdi
lea    -0x1a4(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6a(%rip),%rdi
lea    -0x1a8(%rbp),%rsi
call   1050 <scanf@plt>
movslq -0x1a4(%rbp),%rcx
lea    -0x1a0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x1a8(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x1a4(%rbp),%rcx
lea    -0x1a0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x1a8(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1ac(%rbp)
cmpl   $0xa,-0x1ac(%rbp)
jge    12fd <main+0x1cd>
movl   $0x0,-0x1b0(%rbp)
cmpl   $0xa,-0x1b0(%rbp)
jge    12db <main+0x1ab>
movslq -0x1ac(%rbp),%rcx
lea    -0x1a0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x1b0(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1b0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b0(%rbp)
jmp    128d <main+0x15d>
lea    0xd81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    1276 <main+0x146>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1a8,%rsp
lea    0x10(%rsp),%rdi
mov    $0x190,%edx
xor    %esi,%esi
call   1060 <memset@plt>
movl   $0x1,0x3c(%rsp)
movl   $0x2,0x68(%rsp)
movl   $0x3,0x94(%rsp)
movl   $0x4,0xc0(%rsp)
movl   $0x5,0xec(%rsp)
movl   $0x6,0x118(%rsp)
movl   $0x7,0x144(%rsp)
movl   $0x8,0x170(%rsp)
movl   $0x9,0x19c(%rsp)
lea    0xe44(%rip),%rdi
call   1040 <puts@plt>
lea    0xe35(%rip),%r14
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1070 <scanf@plt>
lea    0xe43(%rip),%rdi
call   1040 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1070 <scanf@plt>
movslq 0xc(%rsp),%rax
movslq 0x8(%rsp),%rcx
lea    (%rax,%rax,4),%rax
lea    (%rsp,%rax,8),%rax
add    $0x10,%rax
mov    (%rax,%rcx,4),%esi
lea    0xddf(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movslq 0xc(%rsp),%rax
movslq 0x8(%rsp),%rcx
lea    (%rax,%rax,4),%rax
lea    (%rsp,%rax,8),%rax
add    $0x10,%rax
movl   $0x1,(%rax,%rcx,4)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdf1(%rip),%rdi
call   1040 <puts@plt>
mov    $0x24,%ebx
nopw   0x0(%rax,%rax,1)
mov    -0x14(%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x10(%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0xc(%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x8(%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x4(%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x28,%rbx
cmp    $0x1b4,%rbx
jne    1270 <main+0x120>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Write the row you want to get:\0A\00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [32 x i8] c"Write the col you want to get:\0A\00"
@.str.3 = [19 x i8] c"Final result is %i\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [18 x i8] c"Whole Matrix is \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x [10 x i32]]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [10 x [10 x i32]]* %2 to i8*
%8 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 0
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %8, i64 0, i64 0
store i32 0, i32* %9
%10 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 1
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %10, i64 0, i64 1
store i32 1, i32* %11
%12 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 2
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %12, i64 0, i64 2
store i32 2, i32* %13
%14 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 3
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %14, i64 0, i64 3
store i32 3, i32* %15
%16 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 4
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %16, i64 0, i64 4
store i32 4, i32* %17
%18 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 5
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %18, i64 0, i64 5
store i32 5, i32* %19
%20 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 6
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %20, i64 0, i64 6
store i32 6, i32* %21
%22 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 7
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %22, i64 0, i64 7
store i32 7, i32* %23
%24 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 8
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %24, i64 0, i64 8
store i32 8, i32* %25
%26 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 9
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %26, i64 0, i64 9
store i32 9, i32* %27
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 %33
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %34, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 %41
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [10 x i32], [10 x i32]* %42, i64 0, i64 %44
store i32 1, i32* %45
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %5
br label %49
49: ; preds = %70, %0
%50 = load i32, i32* %5
%51 = icmp slt i32 %50, 10
br i1 %51, label %52, label %73
52: ; preds = %49
store i32 0, i32* %6
br label %53
53: ; preds = %65, %52
%54 = load i32, i32* %6
%55 = icmp slt i32 %54, 10
br i1 %55, label %56, label %68
56: ; preds = %53
%57 = load i32, i32* %5
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %2, i64 0, i64 %58
%60 = load i32, i32* %6
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [10 x i32], [10 x i32]* %59, i64 0, i64 %61
%63 = load i32, i32* %62
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %63)
br label %65
65: ; preds = %56
%66 = load i32, i32* %6
%67 = add nsw i32 %66, 1
store i32 %67, i32* %6
br label %53
68: ; preds = %53
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %70
70: ; preds = %68
%71 = load i32, i32* %5
%72 = add nsw i32 %71, 1
store i32 %72, i32* %5
br label %49
73: ; preds = %49
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%i\00"
@.str.3 = [19 x i8] c"Final result is %i\00"
@str = [31 x i8] c"Write the row you want to get:\00"
@str.6 = [31 x i8] c"Write the col you want to get:\00"
@str.7 = [17 x i8] c"Whole Matrix is \00"
define i32 @main() {
%1 = alloca [10 x [10 x i32]]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [10 x [10 x i32]]* %1 to i8*
%5 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 1, i64 1
%6 = bitcast [10 x [10 x i32]]* %1 to i8*
store i32 1, i32* %5
%7 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 2, i64 2
store i32 2, i32* %7
%8 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 3, i64 3
store i32 3, i32* %8
%9 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 4, i64 4
store i32 4, i32* %9
%10 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 5, i64 5
store i32 5, i32* %10
%11 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 6, i64 6
store i32 6, i32* %11
%12 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 7, i64 7
store i32 7, i32* %12
%13 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 8, i64 8
store i32 8, i32* %13
%14 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 9, i64 9
store i32 9, i32* %14
%15 = bitcast i32* %2 to i8*
%16 = bitcast i32* %3 to i8*
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.6, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %22, i64 %24
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %2
%29 = sext i32 %28 to i64
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %29, i64 %31
store i32 1, i32* %32
%33 = call i32 @putchar(i32 10)
%34 = call i32 @putchar(i32 10)
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0))
br label %36
36: ; preds = %0, %36
%37 = phi i64 [ 0, %0 ], [ %69, %36 ]
%38 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %37, i64 0
%39 = load i32, i32* %38
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %39)
%41 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %37, i64 1
%42 = load i32, i32* %41
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %42)
%44 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %37, i64 2
%45 = load i32, i32* %44
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %45)
%47 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %37, i64 3
%48 = load i32, i32* %47
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %37, i64 4
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %51)
%53 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %37, i64 5
%54 = load i32, i32* %53
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %54)
%56 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %37, i64 6
%57 = load i32, i32* %56
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %57)
%59 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %37, i64 7
%60 = load i32, i32* %59
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %60)
%62 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %37, i64 8
%63 = load i32, i32* %62
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %63)
%65 = getelementptr inbounds [10 x [10 x i32]], [10 x [10 x i32]]* %1, i64 0, i64 %37, i64 9
%66 = load i32, i32* %65
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %66)
%68 = call i32 @putchar(i32 10)
%69 = add nuw nsw i64 %37, 1
%70 = icmp eq i64 %69, 10
br i1 %70, label %71, label %36
71: ; preds = %36
ret i32 0
}