#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*/ addr_fprint(char *);
int /*<<< orphan*/ printf(char *, ...);
int addr_list_fprint(char **h_addr_list) {
  int i, j;
  char *addr_string = (h_addr_list[1]) ? "Addresses: " : "Address:   ";
  printf("%s ", addr_string);
  for (i = 0, j = 0; h_addr_list[i]; i++, j++) {
    addr_fprint(h_addr_list[i]);
    if (j == 4) {
      if (h_addr_list[i + 1]) {
        printf("\n          ");
      }
      j = 0;
    } else {
      if (h_addr_list[i + 1]) {
        printf(", ");
      }
    }
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<addr_list_fprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xed1(%rip),%rax
lea    0xebe(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1215 <addr_list_fprint+0xf5>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <addr_fprint@plt>
cmpl   $0x4,-0x10(%rbp)
jne    11ce <addr_list_fprint+0xae>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11c2 <addr_list_fprint+0xa2>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
jmp    11f9 <addr_list_fprint+0xd9>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11f4 <addr_list_fprint+0xd4>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f9 <addr_list_fprint+0xd9>
jmp    11fe <addr_list_fprint+0xde>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116e <addr_list_fprint+0x4e>
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addr_list_fprint>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%rbx
cmpq   $0x0,0x8(%rdi)
lea    0xec5(%rip),%rax
lea    0xeb2(%rip),%rsi
cmove  %rax,%rsi
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%rdi
test   %rdi,%rdi
je     11c6 <addr_list_fprint+0x96>
add    $0x8,%rbx
mov    $0x1,%r12d
lea    0xea3(%rip),%r14
lea    0xea8(%rip),%r15
xor    %ebp,%ebp
jmp    11a8 <addr_list_fprint+0x78>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x4,%ebp
lea    0x1(%rbp),%eax
cmove  %r12d,%eax
mov    (%rbx),%rdi
add    $0x8,%rbx
mov    %eax,%ebp
test   %rdi,%rdi
je     11c6 <addr_list_fprint+0x96>
call   1050 <addr_fprint@plt>
cmpq   $0x0,(%rbx)
je     1190 <addr_list_fprint+0x60>
cmp    $0x4,%ebp
mov    %r15,%rdi
cmove  %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1190 <addr_list_fprint+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Addresses: \00"
@.str.1 = [12 x i8] c"Address: \00"
@.str.2 = [4 x i8] c"%s \00"
@.str.3 = [12 x i8] c"\0A \00"
@.str.4 = [3 x i8] c", \00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @addr_list_fprint(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i8** %0, i8*** %2
%6 = load i8**, i8*** %2
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = icmp ne i8* %8, null
%10 = zext i1 %9 to i64
%11 = select i1 %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0)
store i8* %11, i8** %5
%12 = load i8*, i8** %5
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %12)
store i32 0, i32* %3
store i32 0, i32* %4
br label %14
14: ; preds = %53, %1
%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 %58
21: ; preds = %14
%22 = load i8**, i8*** %2
%23 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 @addr_fprint(i8* %26)
%28 = load i32, i32* %4
%29 = icmp eq i32 %28, 4
br i1 %29, label %30, label %41
30: ; preds = %21
%31 = load i8**, i8*** %2
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %31, i64 %34
%36 = load i8*, i8** %35
%37 = icmp ne i8* %36, null
br i1 %37, label %38, label %40
38: ; preds = %30
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %40
40: ; preds = %38, %30
store i32 0, i32* %4
br label %52
41: ; preds = %21
%42 = load i8**, i8*** %2
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8*, i8** %42, i64 %45
%47 = load i8*, i8** %46
%48 = icmp ne i8* %47, null
br i1 %48, label %49, label %51
49: ; preds = %41
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %51
51: ; preds = %49, %41
br label %52
52: ; preds = %51, %40
br label %53
53: ; preds = %52
%54 = load i32, i32* %3
%55 = add nsw i32 %54, 1
store i32 %55, i32* %3
%56 = load i32, i32* %4
%57 = add nsw i32 %56, 1
store i32 %57, i32* %4
br label %14
58: ; preds = %14
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Addresses: \00"
@.str.1 = [12 x i8] c"Address: \00"
@.str.2 = [4 x i8] c"%s \00"
@.str.3 = [12 x i8] c"\0A \00"
@.str.4 = [3 x i8] c", \00"
define i32 @addr_list_fprint(i8** nocapture %0) {
%2 = getelementptr inbounds i8*, i8** %0, i64 1
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
%5 = select i1 %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%7 = load i8*, i8** %0
%8 = icmp eq i8* %7, null
br i1 %8, label %28, label %9
9: ; preds = %1, %22
%10 = phi i64 [ %15, %22 ], [ 0, %1 ]
%11 = phi i8* [ %26, %22 ], [ %7, %1 ]
%12 = phi i32 [ %24, %22 ], [ 0, %1 ]
%13 = tail call i32 @addr_fprint(i8* %11)
%14 = icmp eq i32 %12, 4
%15 = add nuw i64 %10, 1
%16 = getelementptr inbounds i8*, i8** %0, i64 %15
%17 = load i8*, i8** %16
%18 = icmp eq i8* %17, null
br i1 %18, label %22, label %19
19: ; preds = %9
%20 = select i1 %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %20)
br label %22
22: ; preds = %9, %19
%23 = add nsw i32 %12, 1
%24 = select i1 %14, i32 1, i32 %23
%25 = getelementptr inbounds i8*, i8** %0, i64 %15
%26 = load i8*, i8** %25
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %9
28: ; preds = %22, %1
%29 = tail call i32 @putchar(i32 10)
ret i32 0
}