#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 */
struct words_tree {
  int dummy;
};

/* Variables and functions */
struct words_tree *add_word_to_words_tree(struct words_tree *, char *, int);
int getword(char *, char *, int);
scalar_t__ is_stop_word(char *);
struct words_tree *add_line_to_words_tree(struct words_tree *wd_tree,
                                          char *cline, int line_num) {
  int pos = 0;
  char word[100];
  while ((pos = getword(word, cline, pos)) > 0) {
    if (is_stop_word(word) == 0) {
      wd_tree = add_word_to_words_tree(wd_tree, word, line_num);
    }
  }
  return wd_tree;
}


x86 assembly (clang, -O0):
<add_line_to_words_tree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1040 <getword@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jle    1195 <add_line_to_words_tree+0x65>
lea    -0x80(%rbp),%rdi
call   1030 <is_stop_word@plt>
cmp    $0x0,%rax
jne    1190 <add_line_to_words_tree+0x60>
mov    -0x8(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <add_word_to_words_tree@plt>
mov    %rax,-0x8(%rbp)
jmp    114d <add_line_to_words_tree+0x1d>
mov    -0x8(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_line_to_words_tree>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x70,%rsp
mov    %edx,%r14d
mov    %rsi,%r12
mov    %rdi,%r15
mov    %rsp,%rdi
xor    %edx,%edx
call   1040 <getword@plt>
test   %eax,%eax
jle    1193 <add_line_to_words_tree+0x63>
mov    %eax,%ebp
mov    %rsp,%rbx
jmp    1173 <add_line_to_words_tree+0x43>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
call   1040 <getword@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    1193 <add_line_to_words_tree+0x63>
mov    %rbx,%rdi
call   1030 <is_stop_word@plt>
test   %rax,%rax
jne    1160 <add_line_to_words_tree+0x30>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1050 <add_word_to_words_tree@plt>
mov    %rax,%r15
jmp    1160 <add_line_to_words_tree+0x30>
mov    %r15,%rax
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.words_tree = type { i32 }
define %struct.words_tree* @add_line_to_words_tree(%struct.words_tree* %0, i8* %1, i32 %2) {
%4 = alloca %struct.words_tree*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca [100 x i8]
store %struct.words_tree* %0, %struct.words_tree** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %9
9: ; preds = %24, %3
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%11 = load i8*, i8** %5
%12 = load i32, i32* %7
%13 = call i32 @getword(i8* %10, i8* %11, i32 %12)
store i32 %13, i32* %7
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %25
15: ; preds = %9
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%17 = call i64 @is_stop_word(i8* %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = load %struct.words_tree*, %struct.words_tree** %4
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%22 = load i32, i32* %6
%23 = call %struct.words_tree* @add_word_to_words_tree(%struct.words_tree* %20, i8* %21, i32 %22)
store %struct.words_tree* %23, %struct.words_tree** %4
br label %24
24: ; preds = %19, %15
br label %9
25: ; preds = %9
%26 = load %struct.words_tree*, %struct.words_tree** %4
ret %struct.words_tree* %26
}

LLVM IR (-O2):
%struct.words_tree = type { i32 }
define %struct.words_tree* @add_line_to_words_tree(%struct.words_tree* %0, i8* %1, i32 %2) {
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%6 = call i32 @getword(i8* %5, i8* %1, i32 0)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %19
8: ; preds = %3, %15
%9 = phi i32 [ %17, %15 ], [ %6, %3 ]
%10 = phi %struct.words_tree* [ %16, %15 ], [ %0, %3 ]
%11 = call i64 @is_stop_word(i8* %5)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = call %struct.words_tree* @add_word_to_words_tree(%struct.words_tree* %10, i8* %5, i32 %2)
br label %15
15: ; preds = %13, %8
%16 = phi %struct.words_tree* [ %14, %13 ], [ %10, %8 ]
%17 = call i32 @getword(i8* %5, i8* %1, i32 %9)
%18 = icmp sgt i32 %17, 0
br i1 %18, label %8, label %19
19: ; preds = %15, %3
%20 = phi %struct.words_tree* [ %0, %3 ], [ %16, %15 ]
ret %struct.words_tree* %20
}