#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 r, c, a[100][100], b[100][100], i, j, max, min;
  printf("Enter number of rows");
  scanf("%d", &r);
  printf("Enter number of columns");
  scanf("%d", &c);
  printf("\nEnter elements of matrix:\n");
  for (i = 0; i < r; ++i)
    for (j = 0; j < c; ++j) {
      printf("Enter element a%d%d: ", i + 1, j + 1);
      scanf("%d", &a[i][j]);
    }
  for (i = 0; i < r; i++) {
    for (j = 0; j < c; j++)
      printf("%d", a[i][j]);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x138a0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x13894(%rbp)
mov    -0x13894(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    122d <main+0x10d>
movl   $0x0,-0x13898(%rbp)
mov    -0x13898(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1214 <main+0xf4>
mov    -0x13894(%rbp),%esi
add    $0x1,%esi
mov    -0x13898(%rbp),%edx
add    $0x1,%edx
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x13894(%rbp),%rax
lea    -0x9c50(%rbp),%rsi
imul   $0x190,%rax,%rax
add    %rax,%rsi
movslq -0x13898(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe1a(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x13898(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13898(%rbp)
jmp    119f <main+0x7f>
jmp    1219 <main+0xf9>
mov    -0x13894(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13894(%rbp)
jmp    1186 <main+0x66>
movl   $0x0,-0x13894(%rbp)
mov    -0x13894(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12c5 <main+0x1a5>
movl   $0x0,-0x13898(%rbp)
mov    -0x13898(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12a3 <main+0x183>
movslq -0x13894(%rbp),%rcx
lea    -0x9c50(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x13898(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x13898(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13898(%rbp)
jmp    1250 <main+0x130>
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x13894(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13894(%rbp)
jmp    1237 <main+0x117>
xor    %eax,%eax
add    $0x138a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x9c58,%rsp
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeaf(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xe9e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xeb1(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%ecx
test   %ecx,%ecx
jle    128e <main+0x14e>
lea    0x10(%rsp),%rbp
mov    0x8(%rsp),%eax
lea    0xe7a(%rip),%r14
lea    0xe58(%rip),%r15
xor    %r12d,%r12d
jmp    11df <main+0x9f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq %ecx,%rdx
add    $0x190,%rbp
cmp    %rdx,%r12
jge    1222 <main+0xe2>
add    $0x1,%r12
test   %eax,%eax
jle    11d0 <main+0x90>
mov    %rbp,%r13
xor    %ebx,%ebx
nopl   0x0(%rax)
add    $0x1,%rbx
mov    %r14,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
movslq 0x8(%rsp),%rax
add    $0x4,%r13
cmp    %rax,%rbx
jl     11f0 <main+0xb0>
mov    0xc(%rsp),%ecx
jmp    11d0 <main+0x90>
test   %ecx,%ecx
jle    128e <main+0x14e>
lea    0x10(%rsp),%rbp
lea    0xde3(%rip),%r15
xor    %r14d,%r14d
jmp    125f <main+0x11f>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
movslq 0xc(%rsp),%rax
add    $0x190,%rbp
cmp    %rax,%r14
jge    128e <main+0x14e>
cmpl   $0x0,0x8(%rsp)
jle    1240 <main+0x100>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
cmp    %rax,%rbx
jl     1270 <main+0x130>
jmp    1240 <main+0x100>
xor    %eax,%eax
add    $0x9c58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [21 x i8] c"Enter number of rows\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"Enter number of columns\00"
@.str.4 = [22 x i8] c"Enter element a%d%d: \00"
@str = [27 x i8] c"\0AEnter elements of matrix:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x [100 x i32]]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast [100 x [100 x i32]]* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%12 = load i32, i32* %1
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %62
14: ; preds = %0
%15 = load i32, i32* %2
br label %16
16: ; preds = %14, %38
%17 = phi i32 [ %12, %14 ], [ %39, %38 ]
%18 = phi i32 [ %15, %14 ], [ %40, %38 ]
%19 = phi i64 [ 0, %14 ], [ %21, %38 ]
%20 = icmp sgt i32 %18, 0
%21 = add nuw nsw i64 %19, 1
br i1 %20, label %22, label %38
22: ; preds = %16
%23 = trunc i64 %21 to i32
br label %26
24: ; preds = %38
%25 = icmp sgt i32 %39, 0
br i1 %25, label %43, label %62
26: ; preds = %22, %26
%27 = phi i64 [ 0, %22 ], [ %28, %26 ]
%28 = add nuw nsw i64 %27, 1
%29 = trunc i64 %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %23, i32 %29)
%31 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %3, i64 0, i64 %19, i64 %27
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %31)
%33 = load i32, i32* %2
%34 = sext i32 %33 to i64
%35 = icmp slt i64 %28, %34
br i1 %35, label %26, label %36
36: ; preds = %26
%37 = load i32, i32* %1
br label %38
38: ; preds = %16, %36
%39 = phi i32 [ %37, %36 ], [ %17, %16 ]
%40 = phi i32 [ %33, %36 ], [ %18, %16 ]
%41 = sext i32 %39 to i64
%42 = icmp slt i64 %21, %41
br i1 %42, label %16, label %24
43: ; preds = %24, %56
%44 = phi i64 [ %58, %56 ], [ 0, %24 ]
%45 = load i32, i32* %2
%46 = icmp sgt i32 %45, 0
br i1 %46, label %47, label %56
47: ; preds = %43, %47
%48 = phi i64 [ %52, %47 ], [ 0, %43 ]
%49 = getelementptr inbounds [100 x [100 x i32]], [100 x [100 x i32]]* %3, i64 0, i64 %44, i64 %48
%50 = load i32, i32* %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %50)
%52 = add nuw nsw i64 %48, 1
%53 = load i32, i32* %2
%54 = sext i32 %53 to i64
%55 = icmp slt i64 %52, %54
br i1 %55, label %47, label %56
56: ; preds = %47, %43
%57 = call i32 @putchar(i32 10)
%58 = add nuw nsw i64 %44, 1
%59 = load i32, i32* %1
%60 = sext i32 %59 to i64
%61 = icmp slt i64 %58, %60
br i1 %61, label %43, label %62
62: ; preds = %56, %0, %24
ret i32 0
}