#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 /*<<< orphan*/ show(int ***, int, int);
main() {
  int i, j, r, c, a[20][20], b[20][20];
  printf("Enter rows\n");
  scanf("%d", &r);
  printf("Enter col\n");
  scanf("%d", &c);
  printf("Enter the elements\n");
  for (i = 0; i < r; i++) {
    for (j = 0; j < c; j++)
      scanf("%d", &a[i][j]);
  }
  show(&a, r, c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xca0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11f6 <main+0xc6>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11e3 <main+0xb3>
movslq -0x8(%rbp),%rax
lea    -0x660(%rbp),%rsi
imul   $0x50,%rax,%rax
add    %rax,%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe3c(%rip),%rdi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a0 <main+0x70>
jmp    11e8 <main+0xb8>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118d <main+0x5d>
lea    -0x660(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <show@plt>
mov    -0x4(%rbp),%eax
add    $0xca0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x650,%rsp
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
lea    0xead(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe98(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
test   %esi,%esi
jle    11f3 <main+0xc3>
lea    0x10(%rsp),%r15
xor    %r12d,%r12d
lea    0xe60(%rip),%r14
jmp    11c0 <main+0x90>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r12
movslq %esi,%rax
add    $0x50,%r15
cmp    %rax,%r12
jge    11f3 <main+0xc3>
test   %edx,%edx
jle    11b0 <main+0x80>
mov    %r15,%r13
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rdx
add    $0x4,%r13
cmp    %rdx,%rbx
jl     11d0 <main+0xa0>
mov    0xc(%rsp),%esi
jmp    11b0 <main+0x80>
lea    0x10(%rsp),%rdi
call   1040 <show@plt>
xor    %eax,%eax
add    $0x650,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [11 x i8] c"Enter rows\00"
@str.4 = [10 x i8] c"Enter col\00"
@str.5 = [19 x i8] c"Enter the elements\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x [20 x i32]]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast [20 x [20 x i32]]* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 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 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.4, 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 ([19 x i8], [19 x i8]* @str.5, i64 0, i64 0))
%12 = load i32, i32* %1
%13 = icmp sgt i32 %12, 0
%14 = load i32, i32* %2
br i1 %13, label %15, label %36
15: ; preds = %0, %30
%16 = phi i32 [ %31, %30 ], [ %12, %0 ]
%17 = phi i32 [ %32, %30 ], [ %14, %0 ]
%18 = phi i64 [ %33, %30 ], [ 0, %0 ]
%19 = icmp sgt i32 %17, 0
br i1 %19, label %20, label %30
20: ; preds = %15, %20
%21 = phi i64 [ %24, %20 ], [ 0, %15 ]
%22 = getelementptr inbounds [20 x [20 x i32]], [20 x [20 x i32]]* %3, i64 0, i64 %18, i64 %21
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = add nuw nsw i64 %21, 1
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = icmp slt i64 %24, %26
br i1 %27, label %20, label %28
28: ; preds = %20
%29 = load i32, i32* %1
br label %30
30: ; preds = %28, %15
%31 = phi i32 [ %29, %28 ], [ %16, %15 ]
%32 = phi i32 [ %25, %28 ], [ %17, %15 ]
%33 = add nuw nsw i64 %18, 1
%34 = sext i32 %31 to i64
%35 = icmp slt i64 %33, %34
br i1 %35, label %15, label %36
36: ; preds = %30, %0
%37 = phi i32 [ %14, %0 ], [ %32, %30 ]
%38 = phi i32 [ %12, %0 ], [ %31, %30 ]
%39 = bitcast [20 x [20 x i32]]* %3 to i32***
%40 = call i32 @show(i32*** %39, i32 %38, i32 %37)
ret i32 0
}