#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*/ allocate(int ***, int, int);
int /*<<< orphan*/ deallocate(int ***, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int **array;
  int row, coloumn;
  printf("Enter the number of rows: ");
  scanf("%d", &row);
  printf("Enter the number of coloumns: ");
  scanf("%d", &coloumn);
  allocate(&array, row, coloumn);
  array[2][3] = 5;
  printf("The value in array[2][3] is: %d\n", array[2][3]);
  deallocate(&array, row);
  printf("The value in array[2][3] is: %d\n", array[2][3]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe92(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    -0x18(%rbp),%rdi
call   1060 <allocate@plt>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
movl   $0x5,0xc(%rax)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
mov    0xc(%rax),%esi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    -0x18(%rbp),%rdi
call   1040 <deallocate@plt>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
mov    0xc(%rax),%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xeb2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebf(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1060 <allocate@plt>
mov    0x10(%rsp),%rax
mov    0x10(%rax),%rax
movl   $0x5,0xc(%rax)
lea    0xe8d(%rip),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    %r14,%rdi
call   1040 <deallocate@plt>
mov    0x10(%rsp),%rax
mov    0x10(%rax),%rax
mov    0xc(%rax),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Enter the number of rows: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"Enter the number of coloumns: \00"
@.str.3 = [33 x i8] c"The value in array[2][3] is: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32**
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = call i32 @allocate(i32*** %6, i32 %13, i32 %14)
%16 = load i32**, i32*** %6
%17 = getelementptr inbounds i32*, i32** %16, i64 2
%18 = load i32*, i32** %17
%19 = getelementptr inbounds i32, i32* %18, i64 3
store i32 5, i32* %19
%20 = load i32**, i32*** %6
%21 = getelementptr inbounds i32*, i32** %20, i64 2
%22 = load i32*, i32** %21
%23 = getelementptr inbounds i32, i32* %22, i64 3
%24 = load i32, i32* %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %7
%27 = call i32 @deallocate(i32*** %6, i32 %26)
%28 = load i32**, i32*** %6
%29 = getelementptr inbounds i32*, i32** %28, i64 2
%30 = load i32*, i32** %29
%31 = getelementptr inbounds i32, i32* %30, i64 3
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Enter the number of rows: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"Enter the number of coloumns: \00"
@.str.3 = [33 x i8] c"The value in array[2][3] is: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32**
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32*** %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = call i32 @allocate(i32*** %3, i32 %13, i32 %14)
%16 = load i32**, i32*** %3
%17 = getelementptr inbounds i32*, i32** %16, i64 2
%18 = load i32*, i32** %17
%19 = getelementptr inbounds i32, i32* %18, i64 3
store i32 5, i32* %19
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 5)
%21 = load i32, i32* %4
%22 = call i32 @deallocate(i32*** %3, i32 %21)
%23 = load i32**, i32*** %3
%24 = getelementptr inbounds i32*, i32** %23, i64 2
%25 = load i32*, i32** %24
%26 = getelementptr inbounds i32, i32* %25, i64 3
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %27)
ret i32 0
}