#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);
int /*<<< orphan*/ putchar(char);
void showarr(int ar[][5], int n) {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 5; j++)
      printf("%d\t", ar[i][j]);
    putchar('\n');
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<showarr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    119b <showarr+0x7b>
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    1183 <showarr+0x63>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1149 <showarr+0x29>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <showarr+0x16>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showarr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    11a3 <showarr+0x83>
mov    %rdi,%r12
mov    %esi,%eax
shl    $0x2,%rax
lea    (%rax,%rax,4),%r15
xor    %ebx,%ebx
lea    0xebe(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r12,%rbx,1),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x4(%r12,%rbx,1),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x8(%r12,%rbx,1),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0xc(%r12,%rbx,1),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x10(%r12,%rbx,1),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x14,%rbx
cmp    %rbx,%r15
jne    1150 <showarr+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\09\00"
define void @showarr([5 x i32]* %0, i32 %1) {
%3 = alloca [5 x i32]*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store [5 x i32]* %0, [5 x i32]** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %30, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %33
11: ; preds = %7
store i32 0, i32* %6
br label %12
12: ; preds = %25, %11
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 5
br i1 %14, label %15, label %28
15: ; preds = %12
%16 = load [5 x i32]*, [5 x i32]** %3
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %16, i64 %18
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [5 x i32], [5 x i32]* %19, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %15
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %12
28: ; preds = %12
%29 = call i32 @putchar(i8 signext 10)
br label %30
30: ; preds = %28
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %7
33: ; preds = %7
%34 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
define void @showarr([5 x i32]* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %26
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %24, %6 ]
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %7, i64 0
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %7, i64 1
%12 = load i32, i32* %11
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %7, i64 2
%15 = load i32, i32* %14
%16 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %7, i64 3
%18 = load i32, i32* %17
%19 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds [5 x i32], [5 x i32]* %0, i64 %7, i64 4
%21 = load i32, i32* %20
%22 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = tail call i32 @putchar(i8 signext 10)
%24 = add nuw nsw i64 %7, 1
%25 = icmp eq i64 %24, %5
br i1 %25, label %26, label %6
26: ; preds = %6, %2
%27 = tail call i32 @putchar(i8 signext 10)
ret void
}