#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*/ strncpy(char *, char *, int);
char *xmalloc(int);
char **xrealloc(char **, size_t);
char **split_in_words(char *line) {
  char *cur = line;
  char **tab = 0;
  size_t l = 0;
  char c;
  while ((c = *cur) != 0) {
    char *w = 0;
    char *start;
    switch (c) {
    case ' ':
    case '\t':
      cur++;
      break;
    case '<':
      w = "<";
      cur++;
      break;
    case '>':
      w = ">";
      cur++;
      break;
    case '|':
      w = "|";
      cur++;
      break;
    default:
      start = cur;
      while (c) {
        c = *++cur;
        switch (c) {
        case 0:
        case ' ':
        case '\t':
        case '<':
        case '>':
        case '|':
          c = 0;
          break;
        default:;
        }
      }
      w = xmalloc((cur - start + 1) * sizeof(char));
      strncpy(w, start, cur - start);
      w[cur - start] = 0;
    }
    if (w) {
      tab = xrealloc(tab, (l + 1) * sizeof(char *));
      tab[l++] = w;
    }
  }
  tab = xrealloc(tab, (l + 1) * sizeof(char *));
  tab[l++] = 0;
  return tab;
}


x86 assembly (clang, -O0):
<split_in_words>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     1361 <split_in_words+0x231>
movq   $0x0,-0x30(%rbp)
movsbl -0x21(%rbp),%eax
mov    %eax,-0x3c(%rbp)
sub    $0x9,%eax
je     11ca <split_in_words+0x9a>
jmp    1186 <split_in_words+0x56>
mov    -0x3c(%rbp),%eax
sub    $0x20,%eax
je     11ca <split_in_words+0x9a>
jmp    1197 <split_in_words+0x67>
mov    -0x3c(%rbp),%eax
sub    $0x3c,%eax
je     11db <split_in_words+0xab>
jmp    11a8 <split_in_words+0x78>
mov    -0x3c(%rbp),%eax
sub    $0x3e,%eax
je     11f7 <split_in_words+0xc7>
jmp    11b9 <split_in_words+0x89>
mov    -0x3c(%rbp),%eax
sub    $0x7c,%eax
je     1213 <split_in_words+0xe3>
jmp    122f <split_in_words+0xff>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    131d <split_in_words+0x1ed>
lea    0xe1e(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    131d <split_in_words+0x1ed>
lea    0xe04(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    131d <split_in_words+0x1ed>
lea    0xdea(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    131d <split_in_words+0x1ed>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
cmpb   $0x0,-0x21(%rbp)
je     12d2 <split_in_words+0x1a2>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x1(%rax),%al
mov    %al,-0x21(%rbp)
movsbl -0x21(%rbp),%eax
mov    %eax,-0x40(%rbp)
test   %eax,%eax
je     12bf <split_in_words+0x18f>
jmp    126a <split_in_words+0x13a>
mov    -0x40(%rbp),%eax
sub    $0x9,%eax
je     12bf <split_in_words+0x18f>
jmp    127b <split_in_words+0x14b>
mov    -0x40(%rbp),%eax
sub    $0x20,%eax
je     12bf <split_in_words+0x18f>
jmp    128c <split_in_words+0x15c>
mov    -0x40(%rbp),%eax
sub    $0x3c,%eax
je     12bf <split_in_words+0x18f>
jmp    129d <split_in_words+0x16d>
mov    -0x40(%rbp),%eax
sub    $0x3e,%eax
je     12bf <split_in_words+0x18f>
jmp    12ae <split_in_words+0x17e>
mov    -0x40(%rbp),%eax
sub    $0x7c,%eax
jne    12c8 <split_in_words+0x198>
jmp    12bf <split_in_words+0x18f>
movb   $0x0,-0x21(%rbp)
jmp    12cd <split_in_words+0x19d>
jmp    12cd <split_in_words+0x19d>
jmp    1237 <split_in_words+0x107>
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <xmalloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1030 <strncpy@plt>
mov    -0x30(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x38(%rbp),%rdx
sub    %rdx,%rcx
movb   $0x0,(%rax,%rcx,1)
cmpq   $0x0,-0x30(%rbp)
je     135c <split_in_words+0x22c>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
add    $0x1,%rsi
shl    $0x3,%rsi
call   1040 <xrealloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x30(%rbp),%rdx
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,-0x20(%rbp)
mov    %rdx,(%rax,%rcx,8)
jmp    1154 <split_in_words+0x24>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
add    $0x1,%rsi
shl    $0x3,%rsi
call   1040 <xrealloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
movq   $0x0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<split_in_words>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     123a <split_in_words+0x10a>
mov    %rdi,%r15
xor    %r13d,%r13d
movabs $0x5000000100000201,%rbp
xor    %r14d,%r14d
jmp    118e <split_in_words+0x5e>
add    $0x1,%r15
lea    0xe9b(%rip),%r12
lea    0x1(%r13),%rbx
lea    0x8(,%r13,8),%rsi
mov    %r14,%rdi
call   1040 <xrealloc@plt>
mov    %rax,%r14
mov    %r12,(%rax,%r13,8)
mov    %rbx,%r13
mov    (%r15),%al
test   %al,%al
je     1240 <split_in_words+0x110>
movsbl %al,%eax
cmp    $0x3b,%eax
jle    11c0 <split_in_words+0x90>
cmp    $0x3c,%eax
je     115a <split_in_words+0x2a>
cmp    $0x3e,%eax
je     11d0 <split_in_words+0xa0>
cmp    $0x7c,%eax
jne    11dd <split_in_words+0xad>
add    $0x1,%r15
lea    0xe54(%rip),%r12
jmp    1165 <split_in_words+0x35>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    $0x9,%eax
je     11ca <split_in_words+0x9a>
cmp    $0x20,%eax
jne    11dd <split_in_words+0xad>
add    $0x1,%r15
jmp    1183 <split_in_words+0x53>
add    $0x1,%r15
lea    0xe27(%rip),%r12
jmp    1165 <split_in_words+0x35>
mov    $0x1,%ecx
mov    $0x2,%edx
nopw   0x0(%rax,%rax,1)
mov    %rcx,%rbx
mov    %edx,%edi
movzbl (%r15,%rcx,1),%eax
movsbl %al,%ecx
cmp    $0x3e,%ecx
ja     1208 <split_in_words+0xd8>
bt     %rcx,%rbp
jb     1218 <split_in_words+0xe8>
cmp    $0x7c,%ecx
je     1218 <split_in_words+0xe8>
lea    0x1(%rbx),%rcx
lea    0x1(%rdi),%edx
test   %al,%al
jne    11f0 <split_in_words+0xc0>
call   1050 <xmalloc@plt>
mov    %rax,%r12
mov    %rax,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <strncpy@plt>
movb   $0x0,(%r12,%rbx,1)
add    %rbx,%r15
jmp    1165 <split_in_words+0x35>
xor    %r14d,%r14d
xor    %r13d,%r13d
lea    0x8(,%r13,8),%rsi
mov    %r14,%rdi
call   1040 <xrealloc@plt>
movq   $0x0,(%rax,%r13,8)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"<\00"
@.str.1 = [2 x i8] c">\00"
@.str.2 = [2 x i8] c"|\00"
define i8** @split_in_words(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i64
%6 = alloca i8
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %2
%9 = load i8*, i8** %2
store i8* %9, i8** %3
store i8** null, i8*** %4
store i64 0, i64* %5
br label %10
10: ; preds = %84, %1
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
store i8 %12, i8* %6
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %85
15: ; preds = %10
store i8* null, i8** %7
%16 = load i8, i8* %6
%17 = sext i8 %16 to i32
switch i32 %17, label %30 [
i32 32, label %18
i32 9, label %18
i32 60, label %21
i32 62, label %24
i32 124, label %27
]
18: ; preds = %15, %15
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %3
br label %70
21: ; preds = %15
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %7
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %3
br label %70
24: ; preds = %15
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %7
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %3
br label %70
27: ; preds = %15
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %7
%28 = load i8*, i8** %3
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %3
br label %70
30: ; preds = %15
%31 = load i8*, i8** %3
store i8* %31, i8** %8
br label %32
32: ; preds = %43, %30
%33 = load i8, i8* %6
%34 = icmp ne i8 %33, 0
br i1 %34, label %35, label %44
35: ; preds = %32
%36 = load i8*, i8** %3
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %3
%38 = load i8, i8* %37
store i8 %38, i8* %6
%39 = load i8, i8* %6
%40 = sext i8 %39 to i32
switch i32 %40, label %42 [
i32 0, label %41
i32 32, label %41
i32 9, label %41
i32 60, label %41
i32 62, label %41
i32 124, label %41
]
41: ; preds = %35, %35, %35, %35, %35, %35
store i8 0, i8* %6
br label %43
42: ; preds = %35
br label %43
43: ; preds = %42, %41
br label %32
44: ; preds = %32
%45 = load i8*, i8** %3
%46 = load i8*, i8** %8
%47 = ptrtoint i8* %45 to i64
%48 = ptrtoint i8* %46 to i64
%49 = sub i64 %47, %48
%50 = add nsw i64 %49, 1
%51 = mul i64 %50, 1
%52 = trunc i64 %51 to i32
%53 = call i8* @xmalloc(i32 %52)
store i8* %53, i8** %7
%54 = load i8*, i8** %7
%55 = load i8*, i8** %8
%56 = load i8*, i8** %3
%57 = load i8*, i8** %8
%58 = ptrtoint i8* %56 to i64
%59 = ptrtoint i8* %57 to i64
%60 = sub i64 %58, %59
%61 = trunc i64 %60 to i32
%62 = call i32 @strncpy(i8* %54, i8* %55, i32 %61)
%63 = load i8*, i8** %7
%64 = load i8*, i8** %3
%65 = load i8*, i8** %8
%66 = ptrtoint i8* %64 to i64
%67 = ptrtoint i8* %65 to i64
%68 = sub i64 %66, %67
%69 = getelementptr inbounds i8, i8* %63, i64 %68
store i8 0, i8* %69
br label %70
70: ; preds = %44, %27, %24, %21, %18
%71 = load i8*, i8** %7
%72 = icmp ne i8* %71, null
br i1 %72, label %73, label %84
73: ; preds = %70
%74 = load i8**, i8*** %4
%75 = load i64, i64* %5
%76 = add i64 %75, 1
%77 = mul i64 %76, 8
%78 = call i8** @xrealloc(i8** %74, i64 %77)
store i8** %78, i8*** %4
%79 = load i8*, i8** %7
%80 = load i8**, i8*** %4
%81 = load i64, i64* %5
%82 = add i64 %81, 1
store i64 %82, i64* %5
%83 = getelementptr inbounds i8*, i8** %80, i64 %81
store i8* %79, i8** %83
br label %84
84: ; preds = %73, %70
br label %10
85: ; preds = %10
%86 = load i8**, i8*** %4
%87 = load i64, i64* %5
%88 = add i64 %87, 1
%89 = mul i64 %88, 8
%90 = call i8** @xrealloc(i8** %86, i64 %89)
store i8** %90, i8*** %4
%91 = load i8**, i8*** %4
%92 = load i64, i64* %5
%93 = add i64 %92, 1
store i64 %93, i64* %5
%94 = getelementptr inbounds i8*, i8** %91, i64 %92
store i8* null, i8** %94
%95 = load i8**, i8*** %4
ret i8** %95
}

LLVM IR (-O2):
@.str = [2 x i8] c"<\00"
@.str.1 = [2 x i8] c">\00"
@.str.2 = [2 x i8] c"|\00"
define i8** @split_in_words(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %47, label %4
4: ; preds = %1, %41
%5 = phi i8 [ %45, %41 ], [ %2, %1 ]
%6 = phi i8* [ %42, %41 ], [ %0, %1 ]
%7 = phi i64 [ %44, %41 ], [ 0, %1 ]
%8 = phi i8** [ %43, %41 ], [ null, %1 ]
%9 = sext i8 %5 to i32
switch i32 %9, label %16 [
i32 32, label %32
i32 9, label %32
i32 60, label %10
i32 62, label %12
i32 124, label %14
]
10: ; preds = %4
%11 = getelementptr inbounds i8, i8* %6, i64 1
br label %34
12: ; preds = %4
%13 = getelementptr inbounds i8, i8* %6, i64 1
br label %34
14: ; preds = %4
%15 = getelementptr inbounds i8, i8* %6, i64 1
br label %34
16: ; preds = %4, %21
%17 = phi i8* [ %18, %21 ], [ %6, %4 ]
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
switch i32 %20, label %21 [
i32 0, label %23
i32 32, label %23
i32 9, label %23
i32 60, label %23
i32 62, label %23
i32 124, label %23
]
21: ; preds = %16
%22 = icmp eq i8 %19, 0
br i1 %22, label %23, label %16
23: ; preds = %16, %16, %16, %16, %16, %16, %21
%24 = ptrtoint i8* %18 to i64
%25 = ptrtoint i8* %6 to i64
%26 = sub i64 %24, %25
%27 = trunc i64 %26 to i32
%28 = add i32 %27, 1
%29 = tail call i8* @xmalloc(i32 %28)
%30 = tail call i32 @strncpy(i8* %29, i8* %6, i32 %27)
%31 = getelementptr inbounds i8, i8* %29, i64 %26
store i8 0, i8* %31
br label %34
32: ; preds = %4, %4
%33 = getelementptr inbounds i8, i8* %6, i64 1
br label %41
34: ; preds = %23, %14, %12, %10
%35 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %10 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %12 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %14 ], [ %29, %23 ]
%36 = phi i8* [ %11, %10 ], [ %13, %12 ], [ %15, %14 ], [ %18, %23 ]
%37 = add i64 %7, 1
%38 = shl i64 %37, 3
%39 = tail call i8** @xrealloc(i8** %8, i64 %38)
%40 = getelementptr inbounds i8*, i8** %39, i64 %7
store i8* %35, i8** %40
br label %41
41: ; preds = %32, %34
%42 = phi i8* [ %36, %34 ], [ %33, %32 ]
%43 = phi i8** [ %39, %34 ], [ %8, %32 ]
%44 = phi i64 [ %37, %34 ], [ %7, %32 ]
%45 = load i8, i8* %42
%46 = icmp eq i8 %45, 0
br i1 %46, label %47, label %4
47: ; preds = %41, %1
%48 = phi i8** [ null, %1 ], [ %43, %41 ]
%49 = phi i64 [ 0, %1 ], [ %44, %41 ]
%50 = shl i64 %49, 3
%51 = add i64 %50, 8
%52 = tail call i8** @xrealloc(i8** %48, i64 %51)
%53 = getelementptr inbounds i8*, i8** %52, i64 %49
store i8* null, i8** %53
ret i8** %52
}