#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_strarray(char *const *array) {
  if (array == NULL) {
    printf("No results\n");
    return;
  }
  for (unsigned int i = 0; array[i] != NULL; ++i) {
    printf("%s ", array[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<debug_strarray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113a <debug_strarray+0x2a>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1188 <debug_strarray+0x78>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     117a <debug_strarray+0x6a>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    (%rax,%rcx,8),%rsi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1141 <debug_strarray+0x31>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_strarray>:
test   %rdi,%rdi
je     1176 <debug_strarray+0x46>
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rsi
test   %rsi,%rsi
je     1168 <debug_strarray+0x38>
mov    $0x1,%ebp
lea    0xeb0(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%eax
mov    (%rbx,%rax,8),%rsi
add    $0x1,%ebp
test   %rsi,%rsi
jne    1150 <debug_strarray+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>
lea    0xe87(%rip),%rdi
jmp    1040 <puts@plt>

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%s \00"
@str = [11 x i8] c"No results\00"
define void @debug_strarray(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 %8, label %10
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %19
8: ; preds = %10, %3
%9 = tail call i32 @putchar(i32 10)
br label %19
10: ; preds = %3, %10
%11 = phi i8* [ %17, %10 ], [ %4, %3 ]
%12 = phi i32 [ %14, %10 ], [ 0, %3 ]
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%14 = add i32 %12, 1
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %0, i64 %15
%17 = load i8*, i8** %16
%18 = icmp eq i8* %17, null
br i1 %18, label %8, label %10
19: ; preds = %8, %6
ret void
}