#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);
scalar_t__ isalpha(char);
int isnoiseword(char *);
int /*<<< orphan*/ treeprint(struct tnode *);
main() {
  struct tnode *root;
  char word[100];
  int line = 1;
  root = NULL;
  while (getword(word, 100) != EOF)
    if (isalpha(word[0]) && isnoiseword(word) == -1)
      root = addtree(root, word, line);
    else if (word[0] == '\n')
      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)
movq   $0x0,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x64,%esi
call   1040 <getword@plt>
mov    0x2e5f(%rip),%rcx
cmp    (%rcx),%rax
je     11f9 <main+0xa9>
movsbl -0x80(%rbp),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%rax
je     11d3 <main+0x83>
lea    -0x80(%rbp),%rdi
call   1070 <isnoiseword@plt>
cmp    $0xffffffff,%eax
jne    11d3 <main+0x83>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    -0x84(%rbp),%edx
call   1060 <addtree@plt>
mov    %rax,-0x10(%rbp)
jmp    11f4 <main+0xa4>
movsbl -0x80(%rbp),%eax
cmp    $0xa,%eax
jne    11ef <main+0x9f>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11f4 <main+0xa4>
jmp    1174 <main+0x24>
mov    -0x10(%rbp),%rdi
call   1030 <treeprint@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsp,%rdi
mov    $0x64,%esi
call   1040 <getword@plt>
mov    0x2e7a(%rip),%r15
cmp    (%r15),%rax
jne    118b <main+0x3b>
xor    %r14d,%r14d
mov    %r14,%rdi
call   1030 <treeprint@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%ebp
xor    %r14d,%r14d
mov    %rsp,%rbx
jmp    11bd <main+0x6d>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
cmpb   $0xa,(%rsp)
sete   %al
add    %eax,%ebp
mov    %rbx,%rdi
mov    $0x64,%esi
call   1040 <getword@plt>
cmp    (%r15),%rax
je     1176 <main+0x26>
movsbl (%rsp),%edi
call   1050 <isalpha@plt>
test   %rax,%rax
je     11a0 <main+0x50>
mov    %rbx,%rdi
call   1070 <isnoiseword@plt>
cmp    $0xffffffff,%eax
jne    11a0 <main+0x50>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1060 <addtree@plt>
mov    %rax,%r14
jmp    11ab <main+0x5b>

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