#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 print_arr(int **arr, int length) {
  printf("[ ");
  int *row;
  for (int i = 0; i < length - 1; i++) {
    row = *(arr + i);
    printf(" [%d, %d]", *row, *(row + 1));
  }
  row = *(arr + length - 1);
  printf(" [%d, %d] ]\n", *row, *(row + 1));
}


x86 assembly (clang, -O0):
<print_arr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    117e <print_arr+0x6e>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%edx
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1134 <print_arr+0x24>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    -0x8(%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%edx
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_arr>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r12
lea    0xeda(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x2,%r14d
jl     115c <print_arr+0x4c>
lea    -0x1(%r14),%r13d
lea    0xec5(%rip),%r15
xor    %ebx,%ebx
mov    (%r12,%rbx,8),%rax
mov    (%rax),%esi
mov    0x4(%rax),%edx
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1140 <print_arr+0x30>
movslq %r14d,%rax
mov    -0x8(%r12,%rax,8),%rax
mov    (%rax),%esi
mov    0x4(%rax),%edx
lea    0xe9d(%rip),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

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

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