#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 **);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main() {
  char s[20], small[20], large[20];
  while (*s != '\n') {
    printf("Enter word: ");
    scanf("%s", &s);
    if (strlen(s) < strlen(small)) {
      strcpy(small, s);
    }
    if (strlen(s) > strlen(large)) {
      strcpy(large, s);
    }
    if (strlen(s) == 4) {
      break;
    }
  }
  printf("Smallest word: %s\n", small);
  printf("Largest word: %s\n", large);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movsbl -0x20(%rbp),%eax
cmp    $0xa,%eax
je     11f4 <main+0xb4>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xe98(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x64(%rbp)
lea    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x64(%rbp),%eax
cmp    %ecx,%eax
jge    11a9 <main+0x69>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x68(%rbp)
lea    -0x60(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x68(%rbp),%eax
cmp    %ecx,%eax
jle    11d8 <main+0x98>
lea    -0x60(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x4,%eax
jne    11ef <main+0xaf>
jmp    11f4 <main+0xb4>
jmp    114f <main+0xf>
lea    -0x40(%rbp),%rsi
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0xeab(%rip),%r14
lea    0xeb1(%rip),%r15
lea    0x40(%rsp),%rbx
lea    0x20(%rsp),%r12
mov    %rsp,%r13
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r12,%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebp
jge    11a6 <main+0x66>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r13,%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebp
jle    11c7 <main+0x87>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x4,%eax
je     11db <main+0x9b>
cmpb   $0xa,0x40(%rsp)
jne    1170 <main+0x30>
lea    0xe2e(%rip),%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe2e(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"Enter word: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [19 x i8] c"Smallest word: %s\0A\00"
@.str.3 = [18 x i8] c"Largest word: %s\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = bitcast [20 x i8]* %1 to i8**
br label %8
8: ; preds = %0, %22
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 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** %7)
%11 = call i32 @strlen(i8* %4)
%12 = call i32 @strlen(i8* %5)
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = call i32 @strcpy(i8* %5, i8* %4)
br label %16
16: ; preds = %14, %8
%17 = call i32 @strlen(i8* %4)
%18 = call i32 @strlen(i8* %6)
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 @strcpy(i8* %6, i8* %4)
br label %22
22: ; preds = %20, %16
%23 = call i32 @strlen(i8* %4)
%24 = icmp ne i32 %23, 4
%25 = load i8, i8* %4
%26 = icmp ne i8 %25, 10
%27 = select i1 %24, i1 %26, i1 false
br i1 %27, label %8, label %28
28: ; preds = %22
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %6)
ret i32 0
}