#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 *, short);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
void display_smatrix(short **m, long nrl, long nrh, long ncl, long nch,
                     char *format, char *name) {
  long i, j;
  if (name != NULL)
    puts(name);
  for (i = nrl; i <= nrh; i++) {
    for (j = ncl; j <= nch; j++) {
      printf(format, m[i][j]);
    }
    putchar('\n');
  }
}


x86 assembly (clang, -O0):
<display_smatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cmpq   $0x0,0x10(%rbp)
je     1168 <display_smatrix+0x38>
mov    0x10(%rbp),%rdi
call   1040 <puts@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x18(%rbp),%rax
jg     11dd <display_smatrix+0xad>
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x28(%rbp),%rax
jg     11c2 <display_smatrix+0x92>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x40(%rbp),%rcx
movswl (%rax,%rcx,2),%esi
call   1050 <printf@plt>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1186 <display_smatrix+0x56>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1170 <display_smatrix+0x40>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_smatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r13
mov    %r8,0x8(%rsp)
mov    %rcx,%r12
mov    %rdx,0x10(%rsp)
mov    %rsi,%rbp
mov    %rdi,%rbx
mov    0x50(%rsp),%rdi
test   %rdi,%rdi
je     1163 <display_smatrix+0x33>
call   1040 <puts@plt>
cmp    0x10(%rsp),%rbp
jle    1179 <display_smatrix+0x49>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rsp),%rax
lea    0x1(%rax),%r14
jmp    11a8 <display_smatrix+0x78>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbp),%rax
cmp    0x10(%rsp),%rbp
mov    %rax,%rbp
je     116a <display_smatrix+0x3a>
cmp    0x8(%rsp),%r12
jg     1190 <display_smatrix+0x60>
mov    %r12,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rbx,%rbp,8),%rax
movswl (%rax,%r15,2),%esi
mov    %r13,%rdi
call   1050 <printf@plt>
add    $0x1,%r15
cmp    %r15,%r14
jne    11c0 <display_smatrix+0x90>
jmp    1190 <display_smatrix+0x60>

LLVM IR (-O0):
define void @display_smatrix(i16** %0, i64 %1, i64 %2, i64 %3, i64 %4, i8* %5, i8* %6) {
%8 = alloca i16**
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i64
store i16** %0, i16*** %8
store i64 %1, i64* %9
store i64 %2, i64* %10
store i64 %3, i64* %11
store i64 %4, i64* %12
store i8* %5, i8** %13
store i8* %6, i8** %14
%17 = load i8*, i8** %14
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %22
19: ; preds = %7
%20 = load i8*, i8** %14
%21 = call i32 @puts(i8* %20)
br label %22
22: ; preds = %19, %7
%23 = load i64, i64* %9
store i64 %23, i64* %15
br label %24
24: ; preds = %49, %22
%25 = load i64, i64* %15
%26 = load i64, i64* %10
%27 = icmp sle i64 %25, %26
br i1 %27, label %28, label %52
28: ; preds = %24
%29 = load i64, i64* %11
store i64 %29, i64* %16
br label %30
30: ; preds = %44, %28
%31 = load i64, i64* %16
%32 = load i64, i64* %12
%33 = icmp sle i64 %31, %32
br i1 %33, label %34, label %47
34: ; preds = %30
%35 = load i8*, i8** %13
%36 = load i16**, i16*** %8
%37 = load i64, i64* %15
%38 = getelementptr inbounds i16*, i16** %36, i64 %37
%39 = load i16*, i16** %38
%40 = load i64, i64* %16
%41 = getelementptr inbounds i16, i16* %39, i64 %40
%42 = load i16, i16* %41
%43 = call i32 @printf(i8* %35, i16 signext %42)
br label %44
44: ; preds = %34
%45 = load i64, i64* %16
%46 = add nsw i64 %45, 1
store i64 %46, i64* %16
br label %30
47: ; preds = %30
%48 = call i32 @putchar(i8 signext 10)
br label %49
49: ; preds = %47
%50 = load i64, i64* %15
%51 = add nsw i64 %50, 1
store i64 %51, i64* %15
br label %24
52: ; preds = %24
ret void
}

LLVM IR (-O2):
define void @display_smatrix(i16** nocapture %0, i64 %1, i64 %2, i64 %3, i64 %4, i8* %5, i8* %6) {
%8 = icmp eq i8* %6, null
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = tail call i32 @puts(i8* %6)
br label %11
11: ; preds = %9, %7
%12 = icmp sgt i64 %1, %2
br i1 %12, label %31, label %13
13: ; preds = %11
%14 = icmp sgt i64 %3, %4
br label %15
15: ; preds = %13, %27
%16 = phi i64 [ %1, %13 ], [ %29, %27 ]
br i1 %14, label %27, label %17
17: ; preds = %15
%18 = getelementptr inbounds i16*, i16** %0, i64 %16
br label %19
19: ; preds = %17, %19
%20 = phi i64 [ %3, %17 ], [ %25, %19 ]
%21 = load i16*, i16** %18
%22 = getelementptr inbounds i16, i16* %21, i64 %20
%23 = load i16, i16* %22
%24 = tail call i32 @printf(i8* %5, i16 signext %23)
%25 = add i64 %20, 1
%26 = icmp eq i64 %20, %4
br i1 %26, label %27, label %19
27: ; preds = %19, %15
%28 = tail call i32 @putchar(i8 signext 10)
%29 = add i64 %16, 1
%30 = icmp eq i64 %16, %2
br i1 %30, label %31, label %15
31: ; preds = %27, %11
ret void
}