#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 *, ...);
void display(int ***m1, int ***m2, int *r1, int *c1, int *r2, int *c2) {
  int i = 0, j = 0;
  printf("\n First matrix : \n");
  for (i = 0; i < *r1; i++) {
    for (j = 0; j < *c1; j++) {
      printf("%d ", *(*(*m1 + i) + j));
    }
    printf("\n");
  }
  printf("\n Second matrix : \n");
  for (i = 0; i < *r2; i++) {
    for (j = 0; j < *c2; j++) {
      printf("%d ", *(*(*m2 + i) + j));
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    11c6 <display+0xb6>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jge    11aa <display+0x9a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1169 <display+0x59>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1153 <display+0x43>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jge    124e <display+0x13e>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x30(%rbp),%rcx
cmp    (%rcx),%eax
jge    1232 <display+0x122>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11f1 <display+0xe1>
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11db <display+0xcb>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r12
mov    %r8,0x8(%rsp)
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rsi,(%rsp)
mov    %rdi,%rbp
lea    0xeaa(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,0x10(%rsp)
cmpl   $0x0,(%r14)
jle    11d4 <display+0xa4>
lea    0xe8f(%rip),%r14
xor    %r13d,%r13d
jmp    119b <display+0x6b>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r13
mov    0x10(%rsp),%rax
movslq (%rax),%rax
cmp    %rax,%r13
jge    11d4 <display+0xa4>
cmpl   $0x0,(%rbx)
jle    1180 <display+0x50>
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x0(%rbp),%rax
mov    (%rax,%r13,8),%rax
mov    (%rax,%r15,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15
movslq (%rbx),%rax
cmp    %rax,%r15
jl     11b0 <display+0x80>
jmp    1180 <display+0x50>
lea    0xe3b(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%r15
cmpl   $0x0,(%r15)
mov    (%rsp),%r13
jle    1244 <display+0x114>
lea    0xe0a(%rip),%r14
xor    %ebp,%ebp
jmp    1216 <display+0xe6>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
movslq (%r15),%rax
cmp    %rax,%rbp
jge    1244 <display+0x114>
cmpl   $0x0,(%r12)
jle    1200 <display+0xd0>
xor    %ebx,%ebx
nop
mov    0x0(%r13),%rax
mov    (%rax,%rbp,8),%rax
mov    (%rax,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
movslq (%r12),%rax
cmp    %rax,%rbx
jl     1220 <display+0xf0>
jmp    1200 <display+0xd0>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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