#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_list(int **list, int len) {
  int i = 0;
  if (!list || !*list) {
    printf("_print_list: List is empty \n");
  }
  for (i = 0; i < len; i++) {
    printf("_printlist: %d\n", *(*list + i));
  }
}


x86 assembly (clang, -O0):
<_print_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113f <_print_list+0x2f>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    114d <_print_list+0x3d>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118a <_print_list+0x7a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1154 <_print_list+0x44>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_print_list>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%r15
test   %rdi,%rdi
je     1137 <_print_list+0x17>
cmpq   $0x0,(%r15)
jne    1143 <_print_list+0x23>
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
test   %ebp,%ebp
jle    1179 <_print_list+0x59>
mov    %ebp,%ebp
lea    0xeb0(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15),%rax
mov    (%rax,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1160 <_print_list+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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