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

/* Variables and functions */
scalar_t__ EOF;
struct Tnode *addtree(struct Tnode *, char *);
scalar_t__ getword(char *, int);
scalar_t__ isalpha(char);
int /*<<< orphan*/ treeMakeEmpty(struct Tnode *);
int /*<<< orphan*/ treePrint(struct Tnode *);
int main() {
  struct Tnode *root = NULL;
  char word[100];
  while (getword(word, 100) != EOF) {
    if (isalpha(word[0])) {
      root = addtree(root, word);
    }
  }
  treePrint(root);
  treeMakeEmpty(root);
  return 0;
}


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   1040 <getword@plt>
mov    0x2e69(%rip),%rcx
cmp    (%rcx),%rax
je     11b1 <main+0x61>
movsbl -0x80(%rbp),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%rax
je     11ac <main+0x5c>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1060 <addtree@plt>
mov    %rax,-0x10(%rbp)
jmp    116a <main+0x1a>
mov    -0x10(%rbp),%rdi
call   1070 <treePrint@plt>
mov    -0x10(%rbp),%rdi
call   1030 <treeMakeEmpty@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %rsp,%rdi
mov    $0x64,%esi
call   1040 <getword@plt>
mov    0x2e7b(%rip),%r15
cmp    (%r15),%rax
jne    1190 <main+0x40>
xor    %ebx,%ebx
mov    %rbx,%rdi
call   1070 <treePrint@plt>
mov    %rbx,%rdi
call   1030 <treeMakeEmpty@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %ebx,%ebx
mov    %rsp,%r14
jmp    11b2 <main+0x62>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x64,%esi
call   1040 <getword@plt>
cmp    (%r15),%rax
je     1174 <main+0x24>
movsbl (%rsp),%edi
call   1050 <isalpha@plt>
test   %rax,%rax
je     11a0 <main+0x50>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <addtree@plt>
mov    %rax,%rbx
jmp    11a0 <main+0x50>

LLVM IR (-O0):
%struct.Tnode = type { i32 }
@EOF = global i64 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.Tnode*
%3 = alloca [100 x i8]
store i32 0, i32* %1
store %struct.Tnode* null, %struct.Tnode** %2
br label %4
4: ; preds = %18, %0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = call i64 @getword(i8* %5, i32 100)
%7 = load i64, i64* @EOF
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %19
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.Tnode*, %struct.Tnode** %2
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%17 = call %struct.Tnode* @addtree(%struct.Tnode* %15, i8* %16)
store %struct.Tnode* %17, %struct.Tnode** %2
br label %18
18: ; preds = %14, %9
br label %4
19: ; preds = %4
%20 = load %struct.Tnode*, %struct.Tnode** %2
%21 = call i32 @treePrint(%struct.Tnode* %20)
%22 = load %struct.Tnode*, %struct.Tnode** %2
%23 = call i32 @treeMakeEmpty(%struct.Tnode* %22)
ret i32 0
}

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