#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
void string_list_print(FILE *stream, const char **list) {
  if (list) {
    size_t i = 0;
    while (list[i]) {
      fprintf(stream, i ? ", %s" : "%s", list[i]);
      ++i;
    }
  }
}


x86 assembly (clang, -O0):
<string_list_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     118b <string_list_print+0x7b>
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1186 <string_list_print+0x76>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rcx
lea    0xead(%rip),%rsi
lea    0xea4(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1133 <string_list_print+0x23>
jmp    118b <string_list_print+0x7b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_list_print>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %rsi,%rsi
je     1160 <string_list_print+0x50>
mov    %rsi,%r15
mov    (%rsi),%rdx
test   %rdx,%rdx
je     1160 <string_list_print+0x50>
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xecd(%rip),%r12
lea    0xec4(%rip),%r13
nopl   0x0(%rax)
test   %rbx,%rbx
mov    %r13,%rsi
cmove  %r12,%rsi
mov    %r14,%rdi
call   1030 <fprintf@plt>
mov    0x8(%r15,%rbx,8),%rdx
add    $0x1,%rbx
test   %rdx,%rdx
jne    1140 <string_list_print+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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