#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*/ add_only(char *);
int strlen(char *);
void break_up_list(char *rhs) {
  int i = 0, j = 0, l = strlen(rhs);
  char s[20], c;
  while (i < l) {
    c = rhs[i];
    if (c == ' ' || c == ',') {
      s[j] = 0;
      add_only(s);
      j = 0;
    } else {
      s[j] = c;
      j++;
    }
    i++;
  }
  s[j] = 0;
  add_only(s);
}


x86 assembly (clang, -O0):
<break_up_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ba <break_up_list+0x9a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x31(%rbp)
movsbl -0x31(%rbp),%eax
cmp    $0x20,%eax
je     117a <break_up_list+0x5a>
movsbl -0x31(%rbp),%eax
cmp    $0x2c,%eax
jne    1198 <break_up_list+0x78>
movslq -0x10(%rbp),%rax
movb   $0x0,-0x30(%rbp,%rax,1)
lea    -0x30(%rbp),%rdi
call   1040 <add_only@plt>
movl   $0x0,-0x10(%rbp)
jmp    11ac <break_up_list+0x8c>
mov    -0x31(%rbp),%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0x30(%rbp,%rax,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <break_up_list+0x26>
movslq -0x10(%rbp),%rax
movb   $0x0,-0x30(%rbp,%rax,1)
lea    -0x30(%rbp),%rdi
call   1040 <add_only@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<break_up_list>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r15
call   1030 <strlen@plt>
test   %eax,%eax
jle    1180 <break_up_list+0x60>
mov    %eax,%r12d
xor    %ebx,%ebx
mov    %rsp,%r14
xor    %eax,%eax
jmp    1167 <break_up_list+0x47>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movb   $0x0,(%rsp,%rax,1)
mov    %r14,%rdi
call   1040 <add_only@plt>
xor    %eax,%eax
add    $0x1,%rbx
cmp    %rbx,%r12
je     1182 <break_up_list+0x62>
movzbl (%r15,%rbx,1),%ecx
cltq
cmp    $0x2c,%cl
je     1150 <break_up_list+0x30>
cmp    $0x20,%cl
je     1150 <break_up_list+0x30>
mov    %cl,(%rsp,%rax,1)
add    $0x1,%eax
jmp    115e <break_up_list+0x3e>
xor    %eax,%eax
cltq
movb   $0x0,(%rsp,%rax,1)
mov    %rsp,%rdi
call   1040 <add_only@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @break_up_list(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [20 x i8]
%7 = alloca i8
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
%8 = load i8*, i8** %2
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %5
br label %10
10: ; preds = %40, %1
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %43
14: ; preds = %10
%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
store i8 %19, i8* %7
%20 = load i8, i8* %7
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 32
br i1 %22, label %27, label %23
23: ; preds = %14
%24 = load i8, i8* %7
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 44
br i1 %26, label %27, label %33
27: ; preds = %23, %14
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 %29
store i8 0, i8* %30
%31 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%32 = call i32 @add_only(i8* %31)
store i32 0, i32* %4
br label %40
33: ; preds = %23
%34 = load i8, i8* %7
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 %36
store i8 %34, i8* %37
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %40
40: ; preds = %33, %27
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
br label %10
43: ; preds = %10
%44 = load i32, i32* %4
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 %45
store i8 0, i8* %46
%47 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%48 = call i32 @add_only(i8* %47)
ret void
}

LLVM IR (-O2):
define void @break_up_list(i8* %0) {
%2 = alloca [20 x i8]
%3 = tail call i32 @strlen(i8* %0)
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %25
6: ; preds = %1
%7 = zext i32 %3 to i64
br label %8
8: ; preds = %6, %21
%9 = phi i64 [ 0, %6 ], [ %23, %21 ]
%10 = phi i32 [ 0, %6 ], [ %22, %21 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %9
%12 = load i8, i8* %11
switch i8 %12, label %17 [
i8 44, label %13
i8 32, label %13
]
13: ; preds = %8, %8
%14 = sext i32 %10 to i64
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %14
store i8 0, i8* %15
%16 = call i32 @add_only(i8* %4)
br label %21
17: ; preds = %8
%18 = sext i32 %10 to i64
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %18
store i8 %12, i8* %19
%20 = add nsw i32 %10, 1
br label %21
21: ; preds = %17, %13
%22 = phi i32 [ 0, %13 ], [ %20, %17 ]
%23 = add nuw nsw i64 %9, 1
%24 = icmp eq i64 %23, %7
br i1 %24, label %25, label %8
25: ; preds = %21, %1
%26 = phi i32 [ 0, %1 ], [ %22, %21 ]
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %27
store i8 0, i8* %28
%29 = call i32 @add_only(i8* %4)
ret void
}