#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_class(char *);
int /*<<< orphan*/ parse_error(char const *, char *);
int /*<<< orphan*/ selfn_strdup(char **, char const *);
scalar_t__ strlen(char const *);
char *strtok_r(char *, char *, char **);
void selfn_allocation_class(const char *arg) {
  char *cp = NULL, *str = NULL;
  char *saveptr = NULL;
  if (arg == NULL)
    parse_error(arg, "NULL pointer!");
  if (strlen(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_class(token);
  }
  free(cp);
}


x86 assembly (clang, -O0):
<selfn_allocation_class>:
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    119f <selfn_allocation_class+0x3f>
mov    -0x8(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1080 <parse_error@plt>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%rax
jg     11c2 <selfn_allocation_class+0x62>
mov    -0x8(%rbp),%rdi
lea    0xe51(%rip),%rsi
call   1080 <parse_error@plt>
mov    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1060 <selfn_strdup@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe32(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1050 <strtok_r@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1207 <selfn_allocation_class+0xa7>
jmp    121d <selfn_allocation_class+0xbd>
mov    -0x28(%rbp),%rdi
call   1070 <parse_allocation_class@plt>
movq   $0x0,-0x18(%rbp)
jmp    11d7 <selfn_allocation_class+0x77>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<selfn_allocation_class>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
test   %rdi,%rdi
jne    118f <selfn_allocation_class+0x2f>
lea    0xe78(%rip),%rsi
xor    %edi,%edi
call   1080 <parse_error@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %rax,%rax
jg     11ab <selfn_allocation_class+0x4b>
lea    0xe6b(%rip),%rsi
mov    %rbx,%rdi
call   1080 <parse_error@plt>
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1060 <selfn_strdup@plt>
mov    0x8(%rsp),%rdi
lea    0xe58(%rip),%rsi
lea    0x10(%rsp),%rdx
call   1050 <strtok_r@plt>
test   %rax,%rax
je     11fa <selfn_allocation_class+0x9a>
lea    0xe42(%rip),%r14
lea    0x10(%rsp),%rbx
nop
mov    %rax,%rdi
call   1070 <parse_allocation_class@plt>
xor    %edi,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <strtok_r@plt>
test   %rax,%rax
jne    11e0 <selfn_allocation_class+0x80>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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_class(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 = call i64 @strlen(i8* %13)
%15 = icmp sle i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i8*, i8** %2
%18 = call i32 @parse_error(i8* %17, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %16, %12
%20 = load i8*, i8** %2
%21 = call i32 @selfn_strdup(i8** %3, i8* %20)
%22 = load i8*, i8** %3
store i8* %22, i8** %4
br label %23
23: ; preds = %32, %19
store i8* null, i8** %6
%24 = load i8*, i8** %4
%25 = call i8* @strtok_r(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %5)
store i8* %25, i8** %6
%26 = load i8*, i8** %6
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %29
28: ; preds = %23
br label %33
29: ; preds = %23
%30 = load i8*, i8** %6
%31 = call i32 @parse_allocation_class(i8* %30)
br label %32
32: ; preds = %29
store i8* null, i8** %4
br label %23
33: ; preds = %28
%34 = load i8*, i8** %3
%35 = call i32 @free(i8* %34)
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_class(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 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%11 = icmp slt i64 %10, 1
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_class(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
}