#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 *chomp(char *);
void word_split(char **linep, char **paramsp) {
  char *p;
  *paramsp = "\0";
  p = *linep;
  if (p == 0) {
    return;
  }
  p = chomp(p);
  if (*p == 0) {
    *linep = ((void *)0);
    return;
  }
  *linep = p;
  while (*p != 0 && *p != ' ') {
    ++p;
  }
  while (*p == ' ') {
    *p++ = 0;
  }
  if (*p != 0) {
    *paramsp = p;
  }
}


x86 assembly (clang, -O0):
<word_split>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
lea    0xed5(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1149 <word_split+0x39>
jmp    120e <word_split+0xfe>
mov    -0x18(%rbp),%rdi
call   1030 <chomp@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1176 <word_split+0x66>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
jmp    120e <word_split+0xfe>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     11a6 <word_split+0x96>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11b6 <word_split+0xa6>
jmp    11c7 <word_split+0xb7>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1181 <word_split+0x71>
jmp    11cc <word_split+0xbc>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    11f3 <word_split+0xe3>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
jmp    11cc <word_split+0xbc>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     120e <word_split+0xfe>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<word_split>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee2(%rip),%rax
mov    %rax,(%rsi)
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1170 <word_split+0x60>
mov    %rsi,%r14
call   1030 <chomp@plt>
cmpb   $0x0,(%rax)
je     1169 <word_split+0x59>
mov    %rax,(%rbx)
nopl   0x0(%rax)
movzbl (%rax),%ecx
test   $0xdf,%cl
je     115b <word_split+0x4b>
add    $0x1,%rax
jmp    1140 <word_split+0x30>
xchg   %ax,%ax
movb   $0x0,(%rax)
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
cmp    $0x20,%cl
je     1150 <word_split+0x40>
test   %cl,%cl
je     1170 <word_split+0x60>
mov    %rax,(%r14)
jmp    1170 <word_split+0x60>
movq   $0x0,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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