#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*/ printf(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char **parse_split(char *line) {
  static char *words[20 + 1];
  static char copy[100 + 1];
  int inside, nwords;
  char *p, c;
  if (strlen(line) > 100 - 1) {
    words[0] = NULL;
    printf("Error in parse_split(): line is longer than %d chars\n", 100);
    return words;
  }
  strcpy(copy, line);
  nwords = 0;
  inside = 0;
  for (p = line; (c = *p) != '\0'; ++p) {
    if (c == ' ' || c == '\t' || c == '\n') {
      if (inside) {
        *p = '\0';
        inside = 0;
        if (nwords == 20) {
          words[20] = NULL;
          return words;
        }
      }
    } else if (!inside) {
      words[nwords++] = p;
      inside = 1;
    }
  }
  words[nwords] = NULL;
  return words;
}


x86 assembly (clang, -O0):
<parse_split>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x63,%eax
jle    117a <parse_split+0x4a>
movq   $0x0,0x2ef7(%rip)
lea    0xea0(%rip),%rdi
mov    $0x64,%esi
call   1050 <printf@plt>
lea    0x2edf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    128a <parse_split+0x15a>
mov    -0x10(%rbp),%rsi
lea    0x2f7b(%rip),%rdi
call   1030 <strcpy@plt>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     126c <parse_split+0x13c>
movsbl -0x21(%rbp),%eax
cmp    $0x20,%eax
je     11dc <parse_split+0xac>
movsbl -0x21(%rbp),%eax
cmp    $0x9,%eax
je     11dc <parse_split+0xac>
movsbl -0x21(%rbp),%eax
cmp    $0xa,%eax
jne    1223 <parse_split+0xf3>
cmpl   $0x0,-0x14(%rbp)
je     121e <parse_split+0xee>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x14(%rbp)
cmpl   $0x14,-0x18(%rbp)
jne    1219 <parse_split+0xe9>
movq   $0x0,0x2ee7(%rip)
lea    0x2e40(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    128a <parse_split+0x15a>
jmp    121e <parse_split+0xee>
jmp    1256 <parse_split+0x126>
cmpl   $0x0,-0x14(%rbp)
jne    1251 <parse_split+0x121>
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x18(%rbp)
movslq %eax,%rcx
lea    0x2e0a(%rip),%rax
mov    %rdx,(%rax,%rcx,8)
movl   $0x1,-0x14(%rbp)
jmp    1256 <parse_split+0x126>
jmp    125b <parse_split+0x12b>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11a0 <parse_split+0x70>
movslq -0x18(%rbp),%rcx
lea    0x2dd9(%rip),%rax
movq   $0x0,(%rax,%rcx,8)
lea    0x2dca(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_split>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
cmp    $0x64,%eax
jl     115f <parse_split+0x2f>
movq   $0x0,0x2f07(%rip)
lea    0xeb0(%rip),%rdi
mov    $0x64,%esi
call   1050 <printf@plt>
jmp    11e0 <parse_split+0xb0>
lea    0x2f9a(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
xor    %edx,%edx
lea    0x2ed9(%rip),%rax
xor    %ecx,%ecx
jmp    118c <parse_split+0x5c>
nopl   0x0(%rax,%rax,1)
xor    %esi,%esi
test   %edx,%edx
jne    11c0 <parse_split+0x90>
add    $0x1,%rbx
mov    %esi,%edx
movzbl (%rbx),%esi
lea    -0x9(%rsi),%edi
cmp    $0x2,%dil
jb     1180 <parse_split+0x50>
cmp    $0x20,%sil
je     1180 <parse_split+0x50>
test   %sil,%sil
je     11d5 <parse_split+0xa5>
mov    $0x1,%esi
test   %edx,%edx
jne    1186 <parse_split+0x56>
movslq %ecx,%rdx
add    $0x1,%ecx
mov    %rbx,(%rax,%rdx,8)
jmp    1186 <parse_split+0x56>
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%rbx)
cmp    $0x14,%ecx
jne    1186 <parse_split+0x56>
movq   $0x0,0x2f1d(%rip)
jmp    11e0 <parse_split+0xb0>
movslq %ecx,%rcx
movq   $0x0,(%rax,%rcx,8)
lea    0x2e69(%rip),%rax
pop    %rbx
ret

LLVM IR (-O0):
@parse_split.words = internal global [21 x i8*] zeroinitializer
@parse_split.copy = internal global [101 x i8] zeroinitializer
@.str = [54 x i8] c"Error in parse_split(): line is longer than %d chars\0A\00"
define i8** @parse_split(i8* %0) {
%2 = alloca i8**
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8
store i8* %0, i8** %3
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
%10 = icmp sgt i32 %9, 99
br i1 %10, label %11, label %13
11: ; preds = %1
store i8* null, i8** getelementptr inbounds ([21 x i8*], [21 x i8*]* @parse_split.words, i64 0, i64 0)
%12 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 100)
store i8** getelementptr inbounds ([21 x i8*], [21 x i8*]* @parse_split.words, i64 0, i64 0), i8*** %2
br label %62
13: ; preds = %1
%14 = load i8*, i8** %3
%15 = call i32 @strcpy(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @parse_split.copy, i64 0, i64 0), i8* %14)
store i32 0, i32* %5
store i32 0, i32* %4
%16 = load i8*, i8** %3
store i8* %16, i8** %6
br label %17
17: ; preds = %55, %13
%18 = load i8*, i8** %6
%19 = load i8, i8* %18
store i8 %19, i8* %7
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %58
22: ; preds = %17
%23 = load i8, i8* %7
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 32
br i1 %25, label %34, label %26
26: ; preds = %22
%27 = load i8, i8* %7
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 9
br i1 %29, label %34, label %30
30: ; preds = %26
%31 = load i8, i8* %7
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 10
br i1 %33, label %34, label %44
34: ; preds = %30, %26, %22
%35 = load i32, i32* %4
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %43
37: ; preds = %34
%38 = load i8*, i8** %6
store i8 0, i8* %38
store i32 0, i32* %4
%39 = load i32, i32* %5
%40 = icmp eq i32 %39, 20
br i1 %40, label %41, label %42
41: ; preds = %37
store i8* null, i8** getelementptr inbounds ([21 x i8*], [21 x i8*]* @parse_split.words, i64 0, i64 20)
store i8** getelementptr inbounds ([21 x i8*], [21 x i8*]* @parse_split.words, i64 0, i64 0), i8*** %2
br label %62
42: ; preds = %37
br label %43
43: ; preds = %42, %34
br label %54
44: ; preds = %30
%45 = load i32, i32* %4
%46 = icmp ne i32 %45, 0
br i1 %46, label %53, label %47
47: ; preds = %44
%48 = load i8*, i8** %6
%49 = load i32, i32* %5
%50 = add nsw i32 %49, 1
store i32 %50, i32* %5
%51 = sext i32 %49 to i64
%52 = getelementptr inbounds [21 x i8*], [21 x i8*]* @parse_split.words, i64 0, i64 %51
store i8* %48, i8** %52
store i32 1, i32* %4
br label %53
53: ; preds = %47, %44
br label %54
54: ; preds = %53, %43
br label %55
55: ; preds = %54
%56 = load i8*, i8** %6
%57 = getelementptr inbounds i8, i8* %56, i32 1
store i8* %57, i8** %6
br label %17
58: ; preds = %17
%59 = load i32, i32* %5
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [21 x i8*], [21 x i8*]* @parse_split.words, i64 0, i64 %60
store i8* null, i8** %61
store i8** getelementptr inbounds ([21 x i8*], [21 x i8*]* @parse_split.words, i64 0, i64 0), i8*** %2
br label %62
62: ; preds = %58, %41, %11
%63 = load i8**, i8*** %2
ret i8** %63
}

LLVM IR (-O2):
@parse_split.words = internal global [21 x i8*] zeroinitializer
@parse_split.copy = internal global [101 x i8] zeroinitializer
@.str = [54 x i8] c"Error in parse_split(): line is longer than %d chars\0A\00"
define i8** @parse_split(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 99
br i1 %3, label %4, label %6
4: ; preds = %1
store i8* null, i8** getelementptr inbounds ([21 x i8*], [21 x i8*]* @parse_split.words, i64 0, i64 0)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 100)
br label %31
6: ; preds = %1
%7 = tail call i32 @strcpy(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @parse_split.copy, i64 0, i64 0), i8* %0)
br label %8
8: ; preds = %24, %6
%9 = phi i32 [ 0, %6 ], [ %25, %24 ]
%10 = phi i32 [ 0, %6 ], [ %26, %24 ]
%11 = phi i8* [ %0, %6 ], [ %27, %24 ]
%12 = load i8, i8* %11
switch i8 %12, label %18 [
i8 0, label %28
i8 32, label %13
i8 10, label %13
i8 9, label %13
]
13: ; preds = %8, %8, %8
%14 = icmp eq i32 %9, 0
br i1 %14, label %24, label %15
15: ; preds = %13
store i8 0, i8* %11
%16 = icmp eq i32 %10, 20
br i1 %16, label %17, label %24
17: ; preds = %15
store i8* null, i8** getelementptr inbounds ([21 x i8*], [21 x i8*]* @parse_split.words, i64 0, i64 20)
br label %31
18: ; preds = %8
%19 = icmp eq i32 %9, 0
br i1 %19, label %20, label %24
20: ; preds = %18
%21 = add nsw i32 %10, 1
%22 = sext i32 %10 to i64
%23 = getelementptr inbounds [21 x i8*], [21 x i8*]* @parse_split.words, i64 0, i64 %22
store i8* %11, i8** %23
br label %24
24: ; preds = %15, %13, %20, %18
%25 = phi i32 [ 0, %15 ], [ 0, %13 ], [ 1, %18 ], [ 1, %20 ]
%26 = phi i32 [ %10, %15 ], [ %10, %13 ], [ %10, %18 ], [ %21, %20 ]
%27 = getelementptr inbounds i8, i8* %11, i64 1
br label %8
28: ; preds = %8
%29 = sext i32 %10 to i64
%30 = getelementptr inbounds [21 x i8*], [21 x i8*]* @parse_split.words, i64 0, i64 %29
store i8* null, i8** %30
br label %31
31: ; preds = %28, %17, %4
ret i8** getelementptr inbounds ([21 x i8*], [21 x i8*]* @parse_split.words, i64 0, i64 0)
}