#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 debug_print_list(char **list) {
  int i;
  if (!list || !list[0]) {
    printf("debug_print_list: empty list\n");
    return;
  }
  for (i = 0; list[i]; i++)
    ;
  printf("debug_print_list: there are %d items\n", i);
  for (i = 0; list[i]; i++) {
    printf("%s<br>\n", list[i]);
  }
}


x86 assembly (clang, -O0):
<debug_print_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1135 <debug_print_list+0x25>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1148 <debug_print_list+0x38>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c8 <debug_print_list+0xb8>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1175 <debug_print_list+0x65>
jmp    1167 <debug_print_list+0x57>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114f <debug_print_list+0x3f>
mov    -0xc(%rbp),%esi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11c8 <debug_print_list+0xb8>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118d <debug_print_list+0x7d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_print_list>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     118e <debug_print_list+0x6e>
mov    %rdi,%rbx
cmpq   $0x0,(%rdi)
je     118e <debug_print_list+0x6e>
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpq   $0x0,0x8(%rbx,%rsi,8)
lea    0x1(%rsi),%rsi
jne    1140 <debug_print_list+0x20>
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%rsi
test   %rsi,%rsi
je     1186 <debug_print_list+0x66>
add    $0x8,%rbx
lea    0xeb9(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1170 <debug_print_list+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe99(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@.str.1 = [38 x i8] c"debug_print_list: there are %d items\0A\00"
@.str.2 = [8 x i8] c"%s<br>\0A\00"
@str = [29 x i8] c"debug_print_list: empty list\00"
define void @debug_print_list(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3, %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %27
8: ; preds = %3, %8
%9 = phi i64 [ %13, %8 ], [ 1, %3 ]
%10 = getelementptr inbounds i8*, i8** %0, i64 %9
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
%13 = add nuw i64 %9, 1
br i1 %12, label %14, label %8
14: ; preds = %8
%15 = trunc i64 %9 to i32
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load i8*, i8** %0
%18 = icmp eq i8* %17, null
br i1 %18, label %27, label %19
19: ; preds = %14, %19
%20 = phi i64 [ %23, %19 ], [ 0, %14 ]
%21 = phi i8* [ %25, %19 ], [ %17, %14 ]
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %21)
%23 = add nuw i64 %20, 1
%24 = getelementptr inbounds i8*, i8** %0, i64 %23
%25 = load i8*, i8** %24
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %19
27: ; preds = %19, %14, %6
ret void
}