#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);
scalar_t__ getword(char *, int, int *);
scalar_t__ isalpha(char);
int /*<<< orphan*/ isnoise(char *);
int /*<<< orphan*/ treeprint(struct tnode *);
int main() {
  struct tnode *root;
  char word[100];
  int startline = 1;
  int *line = &startline;
  root = NULL;
  while (getword(word, 100, line) != EOF)
    if (isalpha(word[0])) {
      if (!isnoise(word))
        root = addtree(root, word, *line);
    }
  treeprint(root);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x84(%rbp)
lea    -0x84(%rbp),%rax
mov    %rax,-0x90(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x90(%rbp),%rdx
mov    $0x64,%esi
call   1040 <getword@plt>
mov    0x2e4a(%rip),%rcx
cmp    (%rcx),%rax
je     11f0 <main+0xa0>
movsbl -0x80(%rbp),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%rax
je     11eb <main+0x9b>
lea    -0x80(%rbp),%rdi
call   1070 <isnoise@plt>
cmp    $0x0,%eax
jne    11e6 <main+0x96>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    -0x90(%rbp),%rax
mov    (%rax),%edx
call   1060 <addtree@plt>
mov    %rax,-0x10(%rbp)
jmp    11eb <main+0x9b>
jmp    1182 <main+0x32>
mov    -0x10(%rbp),%rdi
call   1030 <treeprint@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x78,%rsp
movl   $0x1,0xc(%rsp)
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rdx
mov    $0x64,%esi
call   1040 <getword@plt>
mov    0x2e6a(%rip),%r12
cmp    (%r12),%rax
jne    119d <main+0x4d>
xor    %r14d,%r14d
mov    %r14,%rdi
call   1030 <treeprint@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
xor    %r14d,%r14d
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%r15
jmp    11c6 <main+0x76>
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r15,%rdx
call   1040 <getword@plt>
cmp    (%r12),%rax
je     1187 <main+0x37>
movsbl 0x10(%rsp),%edi
call   1050 <isalpha@plt>
test   %rax,%rax
je     11b0 <main+0x60>
mov    %rbx,%rdi
call   1070 <isnoise@plt>
test   %eax,%eax
jne    11b0 <main+0x60>
mov    0xc(%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <addtree@plt>
mov    %rax,%r14
jmp    11b0 <main+0x60>

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]
%4 = alloca i32
%5 = alloca i32*
store i32 0, i32* %1
store i32 1, i32* %4
store i32* %4, i32** %5
store %struct.tnode* null, %struct.tnode** %2
br label %6
6: ; preds = %28, %0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%8 = load i32*, i32** %5
%9 = call i64 @getword(i8* %7, i32 100, i32* %8)
%10 = load i64, i64* @EOF
%11 = icmp ne i64 %9, %10
br i1 %11, label %12, label %29
12: ; preds = %6
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%14 = load i8, i8* %13
%15 = call i64 @isalpha(i8 signext %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %28
17: ; preds = %12
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%19 = call i32 @isnoise(i8* %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %27, label %21
21: ; preds = %17
%22 = load %struct.tnode*, %struct.tnode** %2
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%24 = load i32*, i32** %5
%25 = load i32, i32* %24
%26 = call %struct.tnode* @addtree(%struct.tnode* %22, i8* %23, i32 %25)
store %struct.tnode* %26, %struct.tnode** %2
br label %27
27: ; preds = %21, %17
br label %28
28: ; preds = %27, %12
br label %6
29: ; preds = %6
%30 = load %struct.tnode*, %struct.tnode** %2
%31 = call i32 @treeprint(%struct.tnode* %30)
ret i32 0
}

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