#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ system(char *);
int main() {
  int i = 2;
  char input[21];
  char smallest_word[21];
  char largest_word[21];
  printf("Enter word:");
  scanf("%s", smallest_word);
  printf("Enter word:");
  scanf("%s", largest_word);
  if (0 < strcmp(smallest_word, largest_word)) {
    strcpy(input, smallest_word);
    strcpy(smallest_word, largest_word);
    strcpy(largest_word, input);
  }
  do {
    printf("Enter word:");
    scanf("%s", input);
    if (0 > strcmp(input, smallest_word))
      strcpy(smallest_word, input);
    if (0 < strcmp(input, largest_word))
      strcpy(largest_word, input);
  } while (4 != strlen(input));
  printf("Smallest word:%s\n", smallest_word);
  printf("Largest word:%s\n", largest_word);
  system("PAUSE");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe7d(%rip),%rdi
call   1080 <scanf@plt>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xe5f(%rip),%rdi
call   1080 <scanf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1070 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jge    11f4 <main+0x94>
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x60(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    11f9 <main+0x99>
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xdfa(%rip),%rdi
call   1080 <scanf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1070 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    123f <main+0xdf>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1070 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jge    1267 <main+0x107>
lea    -0x60(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    126c <main+0x10c>
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    $0x4,%eax
cmp    %ecx,%eax
jne    11f9 <main+0x99>
lea    -0x40(%rbp),%rsi
lea    0xd80(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xd80(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd83(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x60,%rsp
lea    0xe8c(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe87(%rip),%r12
lea    0x20(%rsp),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   1080 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rsp,%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jle    11eb <main+0x8b>
lea    0x40(%rsp),%r14
lea    0x20(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rsp,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
lea    0xe0e(%rip),%r14
lea    0xe13(%rip),%r15
lea    0x40(%rsp),%rbx
lea    0x20(%rsp),%r12
mov    %rsp,%r13
jmp    121d <main+0xbd>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x4,%eax
je     126a <main+0x10a>
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jns    124d <main+0xed>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jle    1210 <main+0xb0>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
jmp    1210 <main+0xb0>
lea    0xd9e(%rip),%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd9d(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd9d(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Enter word:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [18 x i8] c"Smallest word:%s\0A\00"
@.str.3 = [17 x i8] c"Largest word:%s\0A\00"
@.str.4 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [21 x i8]
%4 = alloca [21 x i8]
%5 = alloca [21 x i8]
store i32 0, i32* %1
store i32 2, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%14 = call i64 @strcmp(i8* %12, i8* %13)
%15 = icmp slt i64 0, %14
br i1 %15, label %16, label %26
16: ; preds = %0
%17 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%18 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%19 = call i32 @strcpy(i8* %17, i8* %18)
%20 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%21 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%22 = call i32 @strcpy(i8* %20, i8* %21)
%23 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%24 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%25 = call i32 @strcpy(i8* %23, i8* %24)
br label %26
26: ; preds = %16, %0
br label %27
27: ; preds = %49, %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%29 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%32 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%33 = call i64 @strcmp(i8* %31, i8* %32)
%34 = icmp sgt i64 0, %33
br i1 %34, label %35, label %39
35: ; preds = %27
%36 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%37 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%38 = call i32 @strcpy(i8* %36, i8* %37)
br label %39
39: ; preds = %35, %27
%40 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%41 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%42 = call i64 @strcmp(i8* %40, i8* %41)
%43 = icmp slt i64 0, %42
br i1 %43, label %44, label %48
44: ; preds = %39
%45 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%46 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%47 = call i32 @strcpy(i8* %45, i8* %46)
br label %48
48: ; preds = %44, %39
br label %49
49: ; preds = %48
%50 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%51 = call i32 @strlen(i8* %50)
%52 = icmp ne i32 4, %51
br i1 %52, label %27, label %53
53: ; preds = %49
%54 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %54)
%56 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %56)
%58 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Enter word:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [18 x i8] c"Smallest word:%s\0A\00"
@.str.3 = [17 x i8] c"Largest word:%s\0A\00"
@.str.4 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca [21 x i8]
%2 = alloca [21 x i8]
%3 = alloca [21 x i8]
%4 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%11 = call i64 @strcmp(i8* %5, i8* %6)
%12 = icmp sgt i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %0
%14 = call i32 @strcpy(i8* %4, i8* %5)
%15 = call i32 @strcpy(i8* %5, i8* %6)
%16 = call i32 @strcpy(i8* %6, i8* %4)
br label %17
17: ; preds = %13, %0
br label %18
18: ; preds = %17, %30
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%21 = call i64 @strcmp(i8* %4, i8* %5)
%22 = icmp slt i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = call i32 @strcpy(i8* %5, i8* %4)
br label %25
25: ; preds = %23, %18
%26 = call i64 @strcmp(i8* %4, i8* %6)
%27 = icmp sgt i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 @strcpy(i8* %6, i8* %4)
br label %30
30: ; preds = %25, %28
%31 = call i32 @strlen(i8* %4)
%32 = icmp eq i32 %31, 4
br i1 %32, label %33, label %18
33: ; preds = %30
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%36 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}