#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*/ free(char *);
int /*<<< orphan*/ parse_allocation_assoc(char *);
int /*<<< orphan*/ parse_error(char const *, char *);
int /*<<< orphan*/ selfn_strdup(char **, char const *);
char *strtok_r(char *, char *, char **);
void selfn_allocation_assoc(const char *arg) {
  char *cp = NULL, *str = NULL;
  char *saveptr = NULL;
  if (arg == NULL)
    parse_error(arg, "NULL pointer!");
  if (*arg == '\0')
    parse_error(arg, "Empty string!");
  selfn_strdup(&cp, arg);
  for (str = cp;; str = NULL) {
    char *token = NULL;
    token = strtok_r(str, ";", &saveptr);
    if (token == NULL)
      break;
    parse_allocation_assoc(token);
  }
  free(cp);
}


x86 assembly (clang, -O0):
<selfn_allocation_assoc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    118f <selfn_allocation_assoc+0x3f>
mov    -0x8(%rbp),%rdi
lea    0xe76(%rip),%rsi
call   1070 <parse_error@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11af <selfn_allocation_assoc+0x5f>
mov    -0x8(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1070 <parse_error@plt>
mov    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1050 <selfn_strdup@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe45(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1040 <strtok_r@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11f4 <selfn_allocation_assoc+0xa4>
jmp    120a <selfn_allocation_assoc+0xba>
mov    -0x28(%rbp),%rdi
call   1060 <parse_allocation_assoc@plt>
movq   $0x0,-0x18(%rbp)
jmp    11c4 <selfn_allocation_assoc+0x74>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<selfn_allocation_assoc>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
test   %rdi,%rdi
je     11dc <selfn_allocation_assoc+0x8c>
cmpb   $0x0,(%rbx)
je     11ef <selfn_allocation_assoc+0x9f>
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1050 <selfn_strdup@plt>
mov    0x8(%rsp),%rdi
lea    0xe8d(%rip),%rsi
lea    0x10(%rsp),%rdx
call   1040 <strtok_r@plt>
test   %rax,%rax
je     11ca <selfn_allocation_assoc+0x7a>
lea    0xe77(%rip),%r14
lea    0x10(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %rax,%rdi
call   1060 <parse_allocation_assoc@plt>
xor    %edi,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <strtok_r@plt>
test   %rax,%rax
jne    11b0 <selfn_allocation_assoc+0x60>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe1d(%rip),%rsi
xor    %edi,%edi
call   1070 <parse_error@plt>
cmpb   $0x0,(%rbx)
jne    1176 <selfn_allocation_assoc+0x26>
lea    0xe18(%rip),%rsi
mov    %rbx,%rdi
call   1070 <parse_error@plt>
jmp    1176 <selfn_allocation_assoc+0x26>

LLVM IR (-O0):
@.str = [14 x i8] c"NULL pointer!\00"
@.str.1 = [14 x i8] c"Empty string!\00"
@.str.2 = [2 x i8] c";\00"
define void @selfn_allocation_assoc(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %2
store i8* null, i8** %3
store i8* null, i8** %4
store i8* null, i8** %5
%7 = load i8*, i8** %2
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32 @parse_error(i8* %10, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %1
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i8*, i8** %2
%19 = call i32 @parse_error(i8* %18, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %17, %12
%21 = load i8*, i8** %2
%22 = call i32 @selfn_strdup(i8** %3, i8* %21)
%23 = load i8*, i8** %3
store i8* %23, i8** %4
br label %24
24: ; preds = %33, %20
store i8* null, i8** %6
%25 = load i8*, i8** %4
%26 = call i8* @strtok_r(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %5)
store i8* %26, i8** %6
%27 = load i8*, i8** %6
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %30
29: ; preds = %24
br label %34
30: ; preds = %24
%31 = load i8*, i8** %6
%32 = call i32 @parse_allocation_assoc(i8* %31)
br label %33
33: ; preds = %30
store i8* null, i8** %4
br label %24
34: ; preds = %29
%35 = load i8*, i8** %3
%36 = call i32 @free(i8* %35)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"NULL pointer!\00"
@.str.1 = [14 x i8] c"Empty string!\00"
@.str.2 = [2 x i8] c";\00"
define void @selfn_allocation_assoc(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%5 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%6 = icmp eq i8* %0, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 @parse_error(i8* null, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i8, i8* %0
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @parse_error(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
%15 = call i32 @selfn_strdup(i8** %2, i8* %0)
%16 = load i8*, i8** %2
%17 = call i8* @strtok_r(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %3)
%18 = icmp eq i8* %17, null
br i1 %18, label %24, label %19
19: ; preds = %14, %19
%20 = phi i8* [ %22, %19 ], [ %17, %14 ]
%21 = call i32 @parse_allocation_assoc(i8* %20)
%22 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %3)
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %19
24: ; preds = %19, %14
%25 = load i8*, i8** %2
%26 = call i32 @free(i8* %25)
ret void
}