char **perl_split_independent(buf)
char *buf;
{
  char **return_buf;
  int cntr = 0;
  char *temp;
  while (*buf == ' ' || *buf == '\t')
    ++buf;
  return_buf = (char **)malloc(sizeof(char *) * (numspaces(buf) + 3));
  return_buf[cntr++] = (char *)mystrdup((char *)strtok(buf, " \t"));
  while ((temp = (char *)strtok(0, "\t ")) != 0) {
    return_buf[cntr] = (char *)mystrdup(temp);
    ++cntr;
  }
  return_buf[cntr] = 0;
  return (return_buf);
}


x86 assembly (clang, -O0):
<perl_split_independent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x21(%rbp)
je     1178 <perl_split_independent+0x38>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1188 <perl_split_independent+0x48>
jmp    1199 <perl_split_independent+0x59>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <perl_split_independent+0x13>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <numspaces@plt>
add    $0x3,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe3e(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,%rdi
mov    $0x0,%al
call   1030 <mystrdup@plt>
movslq %eax,%rdx
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x14(%rbp)
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe0e(%rip),%rsi
call   1060 <strtok@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1230 <perl_split_independent+0xf0>
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1030 <mystrdup@plt>
movslq %eax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ea <perl_split_independent+0xaa>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<perl_split_independent>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
jmp    1154 <perl_split_independent+0x14>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x20,%al
je     1150 <perl_split_independent+0x10>
cmp    $0x9,%al
je     1150 <perl_split_independent+0x10>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <numspaces@plt>
cltq
lea    0x18(,%rax,8),%rdi
call   1040 <malloc@plt>
mov    %rax,%r14
lea    0xe7e(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strtok@plt>
mov    %rax,%rdi
xor    %eax,%eax
call   1030 <mystrdup@plt>
cltq
mov    %rax,(%r14)
lea    0xe63(%rip),%rsi
xor    %edi,%edi
call   1060 <strtok@plt>
test   %rax,%rax
je     11e7 <perl_split_independent+0xa7>
mov    $0x1,%ebx
lea    0xe4b(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %rax,%rdi
xor    %eax,%eax
call   1030 <mystrdup@plt>
cltq
mov    %rax,(%r14,%rbx,8)
add    $0x1,%rbx
xor    %edi,%edi
mov    %r15,%rsi
call   1060 <strtok@plt>
test   %rax,%rax
jne    11c0 <perl_split_independent+0x80>
mov    %ebx,%eax
jmp    11ec <perl_split_independent+0xac>
mov    $0x1,%eax
movq   $0x0,(%r14,%rax,8)
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c" \09\00"
@.str.1 = [3 x i8] c"\09 \00"
define i8** @perl_split_independent(i8* %0) {
%2 = alloca i8*
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %4
br label %6
6: ; preds = %18, %1
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 32
br i1 %10, label %16, label %11
11: ; preds = %6
%12 = load i8*, i8** %2
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 9
br label %16
16: ; preds = %11, %6
%17 = phi i1 [ true, %6 ], [ %15, %11 ]
br i1 %17, label %18, label %21
18: ; preds = %16
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %2
br label %6
21: ; preds = %16
%22 = load i8*, i8** %2
%23 = call i32 (i8*, ...) bitcast (i32 (...)* @numspaces to i32 (i8*, ...)*)(i8* %22)
%24 = add nsw i32 %23, 3
%25 = sext i32 %24 to i64
%26 = mul i64 8, %25
%27 = call i8* @malloc(i64 %26)
%28 = bitcast i8* %27 to i8**
store i8** %28, i8*** %3
%29 = load i8*, i8** %2
%30 = call i8* @strtok(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%31 = call i32 (i8*, ...) bitcast (i32 (...)* @mystrdup to i32 (i8*, ...)*)(i8* %30)
%32 = sext i32 %31 to i64
%33 = inttoptr i64 %32 to i8*
%34 = load i8**, i8*** %3
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
%37 = sext i32 %35 to i64
%38 = getelementptr inbounds i8*, i8** %34, i64 %37
store i8* %33, i8** %38
br label %39
39: ; preds = %42, %21
%40 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i8* %40, i8** %5
%41 = icmp ne i8* %40, null
br i1 %41, label %42, label %53
42: ; preds = %39
%43 = load i8*, i8** %5
%44 = call i32 (i8*, ...) bitcast (i32 (...)* @mystrdup to i32 (i8*, ...)*)(i8* %43)
%45 = sext i32 %44 to i64
%46 = inttoptr i64 %45 to i8*
%47 = load i8**, i8*** %3
%48 = load i32, i32* %4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
store i8* %46, i8** %50
%51 = load i32, i32* %4
%52 = add nsw i32 %51, 1
store i32 %52, i32* %4
br label %39
53: ; preds = %39
%54 = load i8**, i8*** %3
%55 = load i32, i32* %4
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %54, i64 %56
store i8* null, i8** %57
%58 = load i8**, i8*** %3
ret i8** %58
}

LLVM IR (-O2):
@.str = [3 x i8] c" \09\00"
@.str.1 = [3 x i8] c"\09 \00"
define i8** @perl_split_independent(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %7 [
i8 32, label %5
i8 9, label %5
]
5: ; preds = %2, %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
%8 = tail call i32 (i8*, ...) bitcast (i32 (...)* @numspaces to i32 (i8*, ...)*)(i8* %3)
%9 = add nsw i32 %8, 3
%10 = sext i32 %9 to i64
%11 = shl nsw i64 %10, 3
%12 = tail call i8* @malloc(i64 %11)
%13 = bitcast i8* %12 to i8**
%14 = tail call i8* @strtok(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 (i8*, ...) bitcast (i32 (...)* @mystrdup to i32 (i8*, ...)*)(i8* %14)
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i8*
store i8* %17, i8** %13
%18 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i8* %18, null
br i1 %19, label %32, label %20
20: ; preds = %7, %20
%21 = phi i64 [ %27, %20 ], [ 1, %7 ]
%22 = phi i8* [ %28, %20 ], [ %18, %7 ]
%23 = tail call i32 (i8*, ...) bitcast (i32 (...)* @mystrdup to i32 (i8*, ...)*)(i8* %22)
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i8*
%26 = getelementptr inbounds i8*, i8** %13, i64 %21
store i8* %25, i8** %26
%27 = add nuw i64 %21, 1
%28 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp eq i8* %28, null
br i1 %29, label %30, label %20
30: ; preds = %20
%31 = and i64 %27, 4294967295
br label %32
32: ; preds = %30, %7
%33 = phi i64 [ 1, %7 ], [ %31, %30 ]
%34 = getelementptr inbounds i8*, i8** %13, i64 %33
store i8* null, i8** %34
ret i8** %13
}