#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);
int /*<<< orphan*/ treeprint(struct tnode *);
main() {
  struct tnode *root;
  char word[100];
  root = NULL;
  while (getword(word, 100) != EOF) {
    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   1040 <getword@plt>
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%rax
je     117e <main+0x4e>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1050 <addtree@plt>
mov    %rax,-0x10(%rbp)
jmp    114a <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   %rbx
sub    $0x70,%rsp
mov    %rsp,%rdi
mov    $0x64,%esi
call   1040 <getword@plt>
mov    0x2e9b(%rip),%r15
cmp    (%r15),%rax
jne    1156 <main+0x26>
xor    %ebx,%ebx
jmp    1180 <main+0x50>
xor    %ebx,%ebx
mov    %rsp,%r14
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <addtree@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x64,%esi
call   1040 <getword@plt>
cmp    (%r15),%rax
jne    1160 <main+0x30>
mov    %rbx,%rdi
call   1030 <treeprint@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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]
store i32 0, i32* %1
store %struct.tnode* null, %struct.tnode** %2
br label %4
4: ; preds = %9, %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 %13
9: ; preds = %4
%10 = load %struct.tnode*, %struct.tnode** %2
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%12 = call %struct.tnode* @addtree(%struct.tnode* %10, i8* %11)
store %struct.tnode* %12, %struct.tnode** %2
br label %4
13: ; preds = %4
%14 = load %struct.tnode*, %struct.tnode** %2
%15 = call i32 @treeprint(%struct.tnode* %14)
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)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %12, label %6
6: ; preds = %0, %6
%7 = phi %struct.tnode* [ %8, %6 ], [ null, %0 ]
%8 = call %struct.tnode* @addtree(%struct.tnode* %7, i8* %2)
%9 = call i64 @getword(i8* %2, i32 100)
%10 = load i64, i64* @EOF
%11 = icmp eq i64 %9, %10
br i1 %11, label %12, label %6
12: ; preds = %6, %0
%13 = phi %struct.tnode* [ null, %0 ], [ %8, %6 ]
%14 = call i32 @treeprint(%struct.tnode* %13)
ret i32 0
}