#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 treenode {
  int dummy;
};

/* Variables and functions */
struct treenode *addnode(struct treenode *, char *);
int /*<<< orphan*/ getch();
char getword(char *, int);
scalar_t__ isalpha(char);
int /*<<< orphan*/ treeprint(struct treenode *);
main() {
  struct treenode *root = NULL;
  char word[100];
  while (getword(word, 100) != '\n') {
    if (isalpha(word[0])) {
      root = addnode(root, word);
    }
    treeprint(root);
  }
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x64,%esi
call   1050 <getword@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11b6 <main+0x66>
movsbl -0x80(%rbp),%edi
call   1060 <isalpha@plt>
cmp    $0x0,%rax
je     11a8 <main+0x58>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1040 <addnode@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <treeprint@plt>
jmp    116a <main+0x1a>
mov    $0x0,%al
call   1070 <getch@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsp,%rdi
mov    $0x64,%esi
call   1050 <getword@plt>
cmp    $0xa,%al
jne    1179 <main+0x29>
xor    %eax,%eax
call   1070 <getch@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret
xor    %ebx,%ebx
mov    %rsp,%r14
jmp    1199 <main+0x49>
mov    %rbx,%rdi
call   1030 <treeprint@plt>
mov    %r14,%rdi
mov    $0x64,%esi
call   1050 <getword@plt>
cmp    $0xa,%al
je     1168 <main+0x18>
movsbl (%rsp),%edi
call   1060 <isalpha@plt>
test   %rax,%rax
je     1180 <main+0x30>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <addnode@plt>
mov    %rax,%rbx
jmp    1180 <main+0x30>

LLVM IR (-O0):
%struct.treenode = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.treenode*
%3 = alloca [100 x i8]
store i32 0, i32* %1
store %struct.treenode* null, %struct.treenode** %2
br label %4
4: ; preds = %18, %0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = call signext i8 @getword(i8* %5, i32 100)
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 10
br i1 %8, label %9, label %21
9: ; preds = %4
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%11 = load i8, i8* %10
%12 = call i64 @isalpha(i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = load %struct.treenode*, %struct.treenode** %2
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%17 = call %struct.treenode* @addnode(%struct.treenode* %15, i8* %16)
store %struct.treenode* %17, %struct.treenode** %2
br label %18
18: ; preds = %14, %9
%19 = load %struct.treenode*, %struct.treenode** %2
%20 = call i32 @treeprint(%struct.treenode* %19)
br label %4
21: ; preds = %4
%22 = call i32 (...) @getch()
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
%struct.treenode = type { i32 }
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call signext i8 @getword(i8* %2, i32 100)
%4 = icmp eq i8 %3, 10
br i1 %4, label %17, label %5
5: ; preds = %0, %12
%6 = phi %struct.treenode* [ %13, %12 ], [ null, %0 ]
%7 = load i8, i8* %2
%8 = call i64 @isalpha(i8 signext %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %5
%11 = call %struct.treenode* @addnode(%struct.treenode* %6, i8* %2)
br label %12
12: ; preds = %10, %5
%13 = phi %struct.treenode* [ %11, %10 ], [ %6, %5 ]
%14 = call i32 @treeprint(%struct.treenode* %13)
%15 = call signext i8 @getword(i8* %2, i32 100)
%16 = icmp eq i8 %15, 10
br i1 %16, label %17, label %5
17: ; preds = %12, %0
%18 = call i32 (...) @getch()
ret i32 0
}