#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;
scalar_t__ getword(char *, int);
scalar_t__ isalpha(char);
int /*<<< orphan*/ listprint();
int /*<<< orphan*/ listsort();
int /*<<< orphan*/ liststore(struct tnode *);
int /*<<< orphan*/ lowerstr(char *);
struct tnode *treeadd(struct tnode *, char *);
int main(void) {
  struct tnode *troot = NULL;
  char word[50] = "";
  while (getword(word, 50) != EOF)
    if (isalpha(word[0])) {
      lowerstr(word);
      troot = treeadd(troot, word);
    }
  liststore(troot);
  listsort();
  listprint();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1040 <memset@plt>
lea    -0x50(%rbp),%rdi
mov    $0x32,%esi
call   1050 <getword@plt>
mov    0x2e2c(%rip),%rcx
cmp    (%rcx),%rax
je     11f7 <main+0x77>
movsbl -0x50(%rbp),%edi
call   1070 <isalpha@plt>
cmp    $0x0,%rax
je     11f2 <main+0x72>
lea    -0x50(%rbp),%rdi
call   1030 <lowerstr@plt>
mov    -0x10(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   10a0 <treeadd@plt>
mov    %rax,-0x10(%rbp)
jmp    11a7 <main+0x27>
mov    -0x10(%rbp),%rdi
call   1060 <liststore@plt>
mov    $0x0,%al
call   1080 <listsort@plt>
mov    $0x0,%al
call   1090 <listprint@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movw   $0x0,0x30(%rsp)
mov    %rsp,%rdi
mov    $0x32,%esi
call   1040 <getword@plt>
mov    0x2e43(%rip),%r15
cmp    (%r15),%rax
jne    11ce <main+0x5e>
xor    %ebx,%ebx
mov    %rbx,%rdi
call   1050 <liststore@plt>
xor    %eax,%eax
call   1070 <listsort@plt>
xor    %eax,%eax
call   1080 <listprint@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %ebx,%ebx
mov    %rsp,%r14
jmp    11f2 <main+0x82>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    $0x32,%esi
call   1040 <getword@plt>
cmp    (%r15),%rax
je     11ac <main+0x3c>
movsbl (%rsp),%edi
call   1060 <isalpha@plt>
test   %rax,%rax
je     11e0 <main+0x70>
mov    %r14,%rdi
call   1030 <lowerstr@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <treeadd@plt>
mov    %rax,%rbx
jmp    11e0 <main+0x70>

LLVM IR (-O0):
%struct.tnode = type { i32 }
@EOF = global i64 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.tnode*
%3 = alloca [50 x i8]
store i32 0, i32* %1
store %struct.tnode* null, %struct.tnode** %2
%4 = bitcast [50 x i8]* %3 to i8*
br label %5
5: ; preds = %21, %0
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%7 = call i64 @getword(i8* %6, i32 50)
%8 = load i64, i64* @EOF
%9 = icmp ne i64 %7, %8
br i1 %9, label %10, label %22
10: ; preds = %5
%11 = getelementptr inbounds [50 x i8], [50 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 %21
15: ; preds = %10
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%17 = call i32 @lowerstr(i8* %16)
%18 = load %struct.tnode*, %struct.tnode** %2
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%20 = call %struct.tnode* @treeadd(%struct.tnode* %18, i8* %19)
store %struct.tnode* %20, %struct.tnode** %2
br label %21
21: ; preds = %15, %10
br label %5
22: ; preds = %5
%23 = load %struct.tnode*, %struct.tnode** %2
%24 = call i32 @liststore(%struct.tnode* %23)
%25 = call i32 (...) @listsort()
%26 = call i32 (...) @listprint()
ret i32 0
}

LLVM IR (-O2):
%struct.tnode = type { i32 }
@EOF = global i64 0
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = call i64 @getword(i8* %2, i32 50)
%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 @lowerstr(i8* %2)
%13 = call %struct.tnode* @treeadd(%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 50)
%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 @liststore(%struct.tnode* %20)
%22 = call i32 (...) @listsort()
%23 = call i32 (...) @listprint()
ret i32 0
}