#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 */

/* Variables and functions */
int /*<<< orphan*/ add_to_hash(char *);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ print_all();
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ should_stop();
int /*<<< orphan*/ sort_all();
int main() {
  while (1) {
    char *word;
    word = malloc(200);
    scanf("%s", word);
    add_to_hash(word);
    free(word);
    if (should_stop()) {
      break;
    }
  }
  sort_all();
  print_all();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xc8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe68(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <add_to_hash@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1070 <should_stop@plt>
cmp    $0x0,%rax
je     11c5 <main+0x55>
jmp    11ca <main+0x5a>
jmp    117f <main+0xf>
mov    $0x0,%al
call   1080 <sort_all@plt>
mov    $0x0,%al
call   1090 <print_all@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe85(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    $0xc8,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <add_to_hash@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1070 <should_stop@plt>
test   %rax,%rax
je     1180 <main+0x10>
xor    %eax,%eax
call   1080 <sort_all@plt>
xor    %eax,%eax
call   1090 <print_all@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
br label %3
3: ; preds = %0, %14
%4 = call i8* @malloc(i32 200)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i8*, i8** %2
%8 = call i32 @add_to_hash(i8* %7)
%9 = load i8*, i8** %2
%10 = call i32 @free(i8* %9)
%11 = call i64 (...) @should_stop()
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %3
br label %15
14: ; preds = %3
br label %3
15: ; preds = %13
%16 = call i32 (...) @sort_all()
%17 = call i32 (...) @print_all()
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call dereferenceable_or_null(200) i8* @malloc(i32 200)
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @add_to_hash(i8* %2)
%5 = tail call i32 @free(i8* %2)
%6 = tail call i64 (...) @should_stop()
%7 = icmp eq i64 %6, 0
br i1 %7, label %1, label %8
8: ; preds = %1
%9 = tail call i32 (...) @sort_all()
%10 = tail call i32 (...) @print_all()
ret i32 0
}