#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 noiseword(char *);
int /*<<< orphan*/ printtree(struct tnode *);
int main(int argc, char **argv) {
  struct tnode *root;
  char word[100];
  int linenumber;
  linenumber = 1;
  root = NULL;
  while (getword(word, 100) != EOF) {
    if (isalpha(word[0]) && noiseword(word) == -1)
      root = addtree(root, word, linenumber);
    else if (word[0] == '\n')
      linenumber++;
  }
  printtree(root);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x84(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x64,%esi
call   1040 <getword@plt>
mov    0x2e58(%rip),%rcx
cmp    (%rcx),%rax
je     1200 <main+0xb0>
movsbl -0x80(%rbp),%edi
call   1060 <isalpha@plt>
cmp    $0x0,%rax
je     11da <main+0x8a>
lea    -0x80(%rbp),%rdi
call   1030 <noiseword@plt>
cmp    $0xffffffff,%eax
jne    11da <main+0x8a>
mov    -0x18(%rbp),%rdi
lea    -0x80(%rbp),%rsi
mov    -0x84(%rbp),%edx
call   1070 <addtree@plt>
mov    %rax,-0x18(%rbp)
jmp    11fb <main+0xab>
movsbl -0x80(%rbp),%eax
cmp    $0xa,%eax
jne    11f6 <main+0xa6>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11fb <main+0xab>
jmp    117b <main+0x2b>
mov    -0x18(%rbp),%rdi
call   1050 <printtree@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   1050 <printtree@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   1060 <isalpha@plt>
test   %rax,%rax
je     11a0 <main+0x50>
mov    %rbx,%rdi
call   1030 <noiseword@plt>
cmp    $0xffffffff,%eax
jne    11a0 <main+0x50>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1070 <addtree@plt>
mov    %rax,%r14
jmp    11ab <main+0x5b>

LLVM IR (-O0):
%struct.tnode = type { i32 }
@EOF = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.tnode*
%7 = alloca [100 x i8]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %8
store %struct.tnode* null, %struct.tnode** %6
br label %9
9: ; preds = %37, %2
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%11 = call i64 @getword(i8* %10, i32 100)
%12 = load i64, i64* @EOF
%13 = icmp ne i64 %11, %12
br i1 %13, label %14, label %38
14: ; preds = %9
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%16 = load i8, i8* %15
%17 = call i64 @isalpha(i8 signext %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %28
19: ; preds = %14
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%21 = call i32 @noiseword(i8* %20)
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = load %struct.tnode*, %struct.tnode** %6
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%26 = load i32, i32* %8
%27 = call %struct.tnode* @addtree(%struct.tnode* %24, i8* %25, i32 %26)
store %struct.tnode* %27, %struct.tnode** %6
br label %37
28: ; preds = %19, %14
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 10
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
br label %36
36: ; preds = %33, %28
br label %37
37: ; preds = %36, %23
br label %9
38: ; preds = %9
%39 = load %struct.tnode*, %struct.tnode** %6
%40 = call i32 @printtree(%struct.tnode* %39)
ret i32 0
}

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