#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 */
char *strstr(char *, char const *);
char *split(char *line, const char *delim) {
  if (!line)
    return NULL;
  char *str = strstr(line, delim);
  if (!str)
    return NULL;
  while (*delim++)
    *str++ = '\0';
  while (*str == ' ')
    str++;
  return str;
}


x86 assembly (clang, -O0):
<split>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1138 <split+0x28>
movq   $0x0,-0x8(%rbp)
jmp    11c3 <split+0xb3>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1161 <split+0x51>
movq   $0x0,-0x8(%rbp)
jmp    11c3 <split+0xb3>
jmp    1166 <split+0x56>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
cmpb   $0x0,(%rax)
je     1195 <split+0x85>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x0,(%rax)
jmp    1166 <split+0x56>
jmp    119a <split+0x8a>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    11bb <split+0xab>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    119a <split+0x8a>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<split>:
push   %rbx
test   %rdi,%rdi
je     115f <split+0x4f>
mov    %rsi,%rbx
call   1030 <strstr@plt>
test   %rax,%rax
je     115f <split+0x4f>
cmpb   $0x0,(%rbx)
je     1140 <split+0x30>
add    $0x1,%rbx
nopl   0x0(%rax)
movb   $0x0,(%rax)
add    $0x1,%rax
cmpb   $0x0,(%rbx)
lea    0x1(%rbx),%rbx
jne    1130 <split+0x20>
add    $0xffffffffffffffff,%rax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0x1(%rax),%rcx
cmpb   $0x20,0x1(%rax)
mov    %rcx,%rax
je     1150 <split+0x40>
jmp    1161 <split+0x51>
xor    %ecx,%ecx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @split(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %2
store i8* null, i8** %3
br label %37
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = load i8*, i8** %5
%13 = call i8* @strstr(i8* %11, i8* %12)
store i8* %13, i8** %6
%14 = load i8*, i8** %6
%15 = icmp ne i8* %14, null
br i1 %15, label %17, label %16
16: ; preds = %10
store i8* null, i8** %3
br label %37
17: ; preds = %10
br label %18
18: ; preds = %23, %17
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %5
%21 = load i8, i8* %19
%22 = icmp ne i8 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i8*, i8** %6
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %6
store i8 0, i8* %24
br label %18
26: ; preds = %18
br label %27
27: ; preds = %32, %26
%28 = load i8*, i8** %6
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 32
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = load i8*, i8** %6
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %6
br label %27
35: ; preds = %27
%36 = load i8*, i8** %6
store i8* %36, i8** %3
br label %37
37: ; preds = %35, %16, %9
%38 = load i8*, i8** %3
ret i8* %38
}

LLVM IR (-O2):
define i8* @split(i8* %0, i8* nocapture %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %24, label %4
4: ; preds = %2
%5 = tail call i8* @strstr(i8* %0, i8* dereferenceable(1) %1)
%6 = icmp eq i8* %5, null
br i1 %6, label %24, label %7
7: ; preds = %4
%8 = load i8, i8* %1
%9 = icmp eq i8 %8, 0
br i1 %9, label %17, label %10
10: ; preds = %7, %10
%11 = phi i8* [ %14, %10 ], [ %5, %7 ]
%12 = phi i8* [ %13, %10 ], [ %1, %7 ]
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = getelementptr inbounds i8, i8* %11, i64 1
store i8 0, i8* %11
%15 = load i8, i8* %13
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %10
17: ; preds = %10, %7
%18 = phi i8* [ %5, %7 ], [ %14, %10 ]
br label %19
19: ; preds = %17, %19
%20 = phi i8* [ %23, %19 ], [ %18, %17 ]
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 32
%23 = getelementptr inbounds i8, i8* %20, i64 1
br i1 %22, label %19, label %24
24: ; preds = %19, %4, %2
%25 = phi i8* [ null, %2 ], [ null, %4 ], [ %20, %19 ]
ret i8* %25
}