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

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


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    0x2e79(%rip),%rcx
cmp    (%rcx),%rax
je     11a1 <main+0x61>
movsbl -0x80(%rbp),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%rax
je     119c <main+0x5c>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1060 <addtree@plt>
mov    %rax,-0x10(%rbp)
jmp    115a <main+0x1a>
mov    -0x10(%rbp),%rdi
call   1030 <treeprint@plt>
mov    -0x4(%rbp),%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    0x2e8b(%rip),%r15
cmp    (%r15),%rax
jne    1178 <main+0x38>
xor    %ebx,%ebx
mov    %rbx,%rdi
call   1030 <treeprint@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %ebx,%ebx
mov    %rsp,%r14
jmp    1192 <main+0x52>
nop
mov    %r14,%rdi
mov    $0x64,%esi
call   1040 <getword@plt>
cmp    (%r15),%rax
je     1164 <main+0x24>
movsbl (%rsp),%edi
call   1050 <isalpha@plt>
test   %rax,%rax
je     1180 <main+0x40>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <addtree@plt>
mov    %rax,%rbx
jmp    1180 <main+0x40>

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

LLVM IR (-O2):
%struct.tree = 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.tree* [ %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.tree* @addtree(%struct.tree* %7, i8* %2)
br label %13
13: ; preds = %11, %6
%14 = phi %struct.tree* [ %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.tree* [ null, %0 ], [ %14, %13 ]
%20 = call i32 @treeprint(%struct.tree* %19)
ret i32 0
}