#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 *);
int /*<<< orphan*/ free(struct Tnode **);
scalar_t__ getword(char *, int);
scalar_t__ isalpha(char);
int /*<<< orphan*/ printArray(struct Tnode **);
int /*<<< orphan*/ treeMakeEmpty(struct Tnode *);
int /*<<< orphan*/ treeToArray(struct Tnode **, struct Tnode ***);
int main() {
  struct Tnode *root = NULL;
  struct Tnode **nodeArray = NULL;
  char word[100];
  while (getword(word, 100) != EOF) {
    if (isalpha(word[0])) {
      root = addtree(root, word);
    }
  }
  treeToArray(&root, &nodeArray);
  printArray(nodeArray);
  treeMakeEmpty(root);
  free(nodeArray);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x64,%esi
call   1050 <getword@plt>
mov    0x2e41(%rip),%rcx
cmp    (%rcx),%rax
je     11d9 <main+0x69>
movsbl -0x80(%rbp),%edi
call   1070 <isalpha@plt>
cmp    $0x0,%rax
je     11d4 <main+0x64>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1080 <addtree@plt>
mov    %rax,-0x10(%rbp)
jmp    1192 <main+0x22>
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <treeToArray@plt>
mov    -0x18(%rbp),%rdi
call   1090 <printArray@plt>
mov    -0x10(%rbp),%rdi
call   1040 <treeMakeEmpty@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x64,%esi
call   1050 <getword@plt>
mov    0x2e45(%rip),%r15
cmp    (%r15),%rax
jne    11e0 <main+0x70>
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1060 <treeToArray@plt>
mov    (%rsp),%rdi
call   1090 <printArray@plt>
mov    0x8(%rsp),%rdi
call   1040 <treeMakeEmpty@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %ebx,%ebx
lea    0x10(%rsp),%r14
jmp    1202 <main+0x92>
nopl   0x0(%rax)
mov    %r14,%rdi
mov    $0x64,%esi
call   1050 <getword@plt>
cmp    (%r15),%rax
je     11a8 <main+0x38>
movsbl 0x10(%rsp),%edi
call   1070 <isalpha@plt>
test   %rax,%rax
je     11f0 <main+0x80>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <addtree@plt>
mov    %rax,%rbx
mov    %rax,0x8(%rsp)
jmp    11f0 <main+0x80>

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

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