#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 addr_list_sep(char const);
int /*<<< orphan*/ assert(char const *);
int addr_list_size(const char *list) {
  int size = 0;
  int spc = 1;
  assert(list);
  for (; *list; ++list) {
    int hit_spc = addr_list_sep(*list);
    if (spc) {
      if (!hit_spc) {
        spc = 0;
        ++size;
      }
    } else {
      if (hit_spc)
        spc = 1;
    }
  }
  return size;
}


x86 assembly (clang, -O0):
<addr_list_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11b4 <addr_list_size+0x94>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <addr_list_sep@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1188 <addr_list_size+0x68>
cmpl   $0x0,-0x14(%rbp)
jne    1183 <addr_list_size+0x63>
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    119e <addr_list_size+0x7e>
cmpl   $0x0,-0x14(%rbp)
je     1199 <addr_list_size+0x79>
movl   $0x1,-0x10(%rbp)
jmp    119e <addr_list_size+0x7e>
jmp    11a3 <addr_list_size+0x83>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1143 <addr_list_size+0x23>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addr_list_size>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1040 <assert@plt>
mov    (%rbx),%al
test   %al,%al
je     116e <addr_list_size+0x4e>
add    $0x1,%rbx
xor    %r14d,%r14d
mov    $0x1,%ebp
jmp    1153 <addr_list_size+0x33>
test   %eax,%eax
setne  %al
movzbl %al,%ebp
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1171 <addr_list_size+0x51>
movsbl %al,%edi
call   1030 <addr_list_sep@plt>
test   %ebp,%ebp
je     1140 <addr_list_size+0x20>
xor    %ecx,%ecx
test   %eax,%eax
setne  %al
sete   %cl
add    %ecx,%r14d
jmp    1145 <addr_list_size+0x25>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @addr_list_size(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 1, i32* %4
%6 = load i8*, i8** %2
%7 = call i32 @assert(i8* %6)
br label %8
8: ; preds = %31, %1
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %34
12: ; preds = %8
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = call i32 @addr_list_sep(i8 signext %14)
store i32 %15, i32* %5
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %12
%19 = load i32, i32* %5
%20 = icmp ne i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %18
store i32 0, i32* %4
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %24
24: ; preds = %21, %18
br label %30
25: ; preds = %12
%26 = load i32, i32* %5
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %25
store i32 1, i32* %4
br label %29
29: ; preds = %28, %25
br label %30
30: ; preds = %29, %24
br label %31
31: ; preds = %30
%32 = load i8*, i8** %2
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %2
br label %8
34: ; preds = %8
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
define i32 @addr_list_size(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %26, label %5
5: ; preds = %1, %19
%6 = phi i8 [ %24, %19 ], [ %3, %1 ]
%7 = phi i8* [ %23, %19 ], [ %0, %1 ]
%8 = phi i32 [ %22, %19 ], [ 1, %1 ]
%9 = phi i32 [ %20, %19 ], [ 0, %1 ]
%10 = tail call i32 @addr_list_sep(i8 signext %6)
%11 = icmp eq i32 %8, 0
br i1 %11, label %17, label %12
12: ; preds = %5
%13 = icmp eq i32 %10, 0
%14 = zext i1 %13 to i32
%15 = add nsw i32 %9, %14
%16 = xor i1 %13, true
br label %19
17: ; preds = %5
%18 = icmp ne i32 %10, 0
br label %19
19: ; preds = %17, %12
%20 = phi i32 [ %15, %12 ], [ %9, %17 ]
%21 = phi i1 [ %16, %12 ], [ %18, %17 ]
%22 = zext i1 %21 to i32
%23 = getelementptr inbounds i8, i8* %7, i64 1
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %5
26: ; preds = %19, %1
%27 = phi i32 [ 0, %1 ], [ %20, %19 ]
ret i32 %27
}