#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 */
scalar_t__ strcspn(char const *, char const *);
char *strdup(char const *);
size_t strspn(char const *, char const *);
char *semanage_split_on_space(const char *str) {
  const char *seps = "\f\n\r\t\v ";
  size_t off = 0;
  if (!str)
    return NULL;
  off = strspn(str, seps);
  off += strcspn(str + off, seps);
  off += strspn(str + off, seps);
  return strdup(str + off);
}


x86 assembly (clang, -O0):
<semanage_split_on_space>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xebd(%rip),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1167 <semanage_split_on_space+0x37>
movq   $0x0,-0x8(%rbp)
jmp    11bb <semanage_split_on_space+0x8b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strspn@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
add    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcspn@plt>
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
add    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strspn@plt>
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
add    -0x20(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<semanage_split_on_space>:
test   %rdi,%rdi
je     117d <semanage_split_on_space+0x4d>
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xebc(%rip),%r14
mov    %r14,%rsi
call   1030 <strspn@plt>
mov    %rax,%rbx
lea    (%r15,%rax,1),%rdi
mov    %r14,%rsi
call   1040 <strcspn@plt>
add    %rax,%rbx
lea    (%r15,%rbx,1),%rdi
mov    %r14,%rsi
call   1030 <strspn@plt>
add    %rax,%rbx
add    %r15,%rbx
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <strdup@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"\0C\0A\0D\09\0B \00"
define i8* @semanage_split_on_space(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %4
store i64 0, i64* %5
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %1
store i8* null, i8** %2
br label %31
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = load i8*, i8** %4
%12 = call i64 @strspn(i8* %10, i8* %11)
store i64 %12, i64* %5
%13 = load i8*, i8** %3
%14 = load i64, i64* %5
%15 = getelementptr inbounds i8, i8* %13, i64 %14
%16 = load i8*, i8** %4
%17 = call i64 @strcspn(i8* %15, i8* %16)
%18 = load i64, i64* %5
%19 = add i64 %18, %17
store i64 %19, i64* %5
%20 = load i8*, i8** %3
%21 = load i64, i64* %5
%22 = getelementptr inbounds i8, i8* %20, i64 %21
%23 = load i8*, i8** %4
%24 = call i64 @strspn(i8* %22, i8* %23)
%25 = load i64, i64* %5
%26 = add i64 %25, %24
store i64 %26, i64* %5
%27 = load i8*, i8** %3
%28 = load i64, i64* %5
%29 = getelementptr inbounds i8, i8* %27, i64 %28
%30 = call i8* @strdup(i8* %29)
store i8* %30, i8** %2
br label %31
31: ; preds = %9, %8
%32 = load i8*, i8** %2
ret i8* %32
}

LLVM IR (-O2):
@.str = [7 x i8] c"\0C\0A\0D\09\0B \00"
define noalias i8* @semanage_split_on_space(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = tail call i64 @strspn(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = tail call i64 @strcspn(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = add i64 %6, %4
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = tail call i64 @strspn(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%10 = add i64 %7, %9
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = tail call i8* @strdup(i8* %11)
br label %13
13: ; preds = %1, %3
%14 = phi i8* [ %12, %3 ], [ null, %1 ]
ret i8* %14
}