#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 */
typedef size_t uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_array(void **a, uint32_t n) {
  uint32_t i, l;
  l = 10;
  for (i = 0; i < n; i++) {
    if (l == 0) {
      printf("\n\t");
      l = 10;
    }
    l--;
    printf(" %p", a[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0xa,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1196 <print_array+0x86>
cmpq   $0x0,-0x20(%rbp)
jne    115f <print_array+0x4f>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0xa,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1130 <print_array+0x20>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1181 <print_array+0x61>
mov    %rsi,%r13
mov    %rdi,%r14
mov    $0xa,%ebp
lea    0xebe(%rip),%r15
lea    0xeba(%rip),%r12
xor    %ebx,%ebx
jmp    116b <print_array+0x4b>
nopl   (%rax)
add    $0xffffffffffffffff,%rbp
mov    (%r14,%rbx,8),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
je     1181 <print_array+0x61>
test   %rbp,%rbp
jne    1150 <print_array+0x30>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%ebp
jmp    1150 <print_array+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"\0A\09\00"
@.str.1 = [4 x i8] c" %p\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @print_array(i8** %0, i64 %1) {
%3 = alloca i8**
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i8** %0, i8*** %3
store i64 %1, i64* %4
store i64 10, i64* %6
store i64 0, i64* %5
br label %7
7: ; preds = %24, %2
%8 = load i64, i64* %5
%9 = load i64, i64* %4
%10 = icmp ult i64 %8, %9
br i1 %10, label %11, label %27
11: ; preds = %7
%12 = load i64, i64* %6
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i64 10, i64* %6
br label %16
16: ; preds = %14, %11
%17 = load i64, i64* %6
%18 = add i64 %17, -1
store i64 %18, i64* %6
%19 = load i8**, i8*** %3
%20 = load i64, i64* %5
%21 = getelementptr inbounds i8*, i8** %19, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %16
%25 = load i64, i64* %5
%26 = add i64 %25, 1
store i64 %26, i64* %5
br label %7
27: ; preds = %7
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"\0A\09\00"
@.str.1 = [4 x i8] c" %p\00"
define void @print_array(i8** nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %18, label %4
4: ; preds = %2, %10
%5 = phi i64 [ %12, %10 ], [ 10, %2 ]
%6 = phi i64 [ %16, %10 ], [ 0, %2 ]
%7 = icmp eq i64 %5, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %4
%11 = phi i64 [ 10, %8 ], [ %5, %4 ]
%12 = add i64 %11, -1
%13 = getelementptr inbounds i8*, i8** %0, i64 %6
%14 = load i8*, i8** %13
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = add nuw i64 %6, 1
%17 = icmp eq i64 %16, %1
br i1 %17, label %18, label %4
18: ; preds = %10, %2
%19 = tail call i32 @putchar(i32 10)
ret void
}