#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*/ printf(char *, char *);
int /*<<< orphan*/ treeprint(struct tnode *);
int main() {
  struct tnode *root;
  char word[100];
  root = NULL;
  while (getword(word, 100) != EOF)
    if (isalpha(word[0])) {
      printf("%s\n", word);
      root = addtree(root, word);
    }
  treeprint(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   1050 <getword@plt>
mov    0x2e69(%rip),%rcx
cmp    (%rcx),%rax
je     11c1 <main+0x71>
movsbl -0x80(%rbp),%edi
call   1060 <isalpha@plt>
cmp    $0x0,%rax
je     11bc <main+0x6c>
lea    -0x80(%rbp),%rsi
lea    0xe5a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1070 <addtree@plt>
mov    %rax,-0x10(%rbp)
jmp    116a <main+0x1a>
mov    -0x10(%rbp),%rdi
call   1030 <treeprint@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsp,%rdi
mov    $0x64,%esi
call   1050 <getword@plt>
mov    0x2e79(%rip),%r12
cmp    (%r12),%rax
jne    118d <main+0x3d>
xor    %ebx,%ebx
mov    %rbx,%rdi
call   1030 <treeprint@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
xor    %ebx,%ebx
mov    %rsp,%r14
lea    0xe67(%rip),%r15
jmp    11b3 <main+0x63>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x64,%esi
call   1050 <getword@plt>
cmp    (%r12),%rax
je     1177 <main+0x27>
movsbl (%rsp),%edi
call   1060 <isalpha@plt>
test   %rax,%rax
je     11a0 <main+0x50>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <addtree@plt>
mov    %rax,%rbx
jmp    11a0 <main+0x50>

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

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