#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*/ freemem(struct tnode *);
scalar_t__ getword(char *, int, int /*<<< orphan*/);
scalar_t__ isalpha(char);
int /*<<< orphan*/ noiseword(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ treeprint(struct tnode *);
int main(void) {
  struct tnode *root;
  char word[100];
  root = NULL;
  while (getword(word, 100, 0) != EOF)
    if (isalpha(word[0]) && (!noiseword(word)))
      root = addtree(root, word);
  printf("\n");
  treeprint(root);
  printf("\n");
  freemem(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
xor    %edx,%edx
call   1060 <getword@plt>
mov    0x2e47(%rip),%rcx
cmp    (%rcx),%rax
je     11e5 <main+0x75>
movsbl -0x80(%rbp),%edi
call   1070 <isalpha@plt>
cmp    $0x0,%rax
je     11e0 <main+0x70>
lea    -0x80(%rbp),%rdi
call   1030 <noiseword@plt>
cmp    $0x0,%eax
jne    11e0 <main+0x70>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1080 <addtree@plt>
mov    %rax,-0x10(%rbp)
jmp    118a <main+0x1a>
lea    0xe14(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <treeprint@plt>
lea    0xdff(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1090 <freemem@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
xor    %r14d,%r14d
mov    $0x64,%esi
xor    %edx,%edx
call   1060 <getword@plt>
mov    0x2e56(%rip),%r15
cmp    (%r15),%rax
jne    11c7 <main+0x57>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r14,%rdi
call   1050 <treeprint@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r14,%rdi
call   1090 <freemem@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %r14d,%r14d
mov    %rsp,%rbx
jmp    11e4 <main+0x74>
nop
mov    %rbx,%rdi
mov    $0x64,%esi
xor    %edx,%edx
call   1060 <getword@plt>
cmp    (%r15),%rax
je     1197 <main+0x27>
movsbl (%rsp),%edi
call   1070 <isalpha@plt>
test   %rax,%rax
je     11d0 <main+0x60>
mov    %rbx,%rdi
call   1030 <noiseword@plt>
test   %eax,%eax
jne    11d0 <main+0x60>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <addtree@plt>
mov    %rax,%r14
jmp    11d0 <main+0x60>

LLVM IR (-O0):
%struct.tnode = type { i32 }
@EOF = global i64 0
@.str = [2 x i8] c"\0A\00"
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 = %22, %0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = call i64 @getword(i8* %5, i32 100, i32 0)
%7 = load i64, i64* @EOF
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %23
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 %22
14: ; preds = %9
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%16 = call i32 @noiseword(i8* %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %14
%19 = load %struct.tnode*, %struct.tnode** %2
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%21 = call %struct.tnode* @addtree(%struct.tnode* %19, i8* %20)
store %struct.tnode* %21, %struct.tnode** %2
br label %22
22: ; preds = %18, %14, %9
br label %4
23: ; preds = %4
%24 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%25 = load %struct.tnode*, %struct.tnode** %2
%26 = call i32 @treeprint(%struct.tnode* %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%28 = load %struct.tnode*, %struct.tnode** %2
%29 = call i32 @freemem(%struct.tnode* %28)
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, i32 0)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %21, label %6
6: ; preds = %0, %16
%7 = phi %struct.tnode* [ %17, %16 ], [ null, %0 ]
%8 = load i8, i8* %2
%9 = call i64 @isalpha(i8 signext %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %6
%12 = call i32 @noiseword(i8* %2)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call %struct.tnode* @addtree(%struct.tnode* %7, i8* %2)
br label %16
16: ; preds = %14, %11, %6
%17 = phi %struct.tnode* [ %7, %11 ], [ %15, %14 ], [ %7, %6 ]
%18 = call i64 @getword(i8* %2, i32 100, i32 0)
%19 = load i64, i64* @EOF
%20 = icmp eq i64 %18, %19
br i1 %20, label %21, label %6
21: ; preds = %16, %0
%22 = phi %struct.tnode* [ null, %0 ], [ %17, %16 ]
%23 = call i32 @putchar(i32 10)
%24 = call i32 @treeprint(%struct.tnode* %22)
%25 = call i32 @putchar(i32 10)
%26 = call i32 @freemem(%struct.tnode* %22)
ret i32 0
}