#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*/ fflush(int /*<<< orphan*/);
char getchar();
scalar_t__ isalnum(char);
int /*<<< orphan*/ isspace(char);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main() {
  char string[100], word[20], max[20], min[20], c;
  int i = 0, j = 0, flag = 0;
  printf("Enter string: ");
  i = 0;
  do {
    fflush(stdin);
    c = getchar();
    string[i++] = c;
  } while (c != '\n');
  string[i - 1] = '\0';
  for (i = 0; i < strlen(string); i++) {
    while (i < strlen(string) && !isspace(string[i]) && isalnum(string[i]))
      word[j++] = string[i++];
    if (j != 0) {
      word[j] = '\0';
      if (!flag) {
        flag = !flag;
        strcpy(max, word);
        strcpy(min, word);
      }
      if (strlen(word) > strlen(max))
        strcpy(max, word);
      if (strlen(word) < strlen(min))
        strcpy(min, word);
      j = 0;
    }
  }
  printf("The largest word is '%s' and smallest word is '%s' in '%s'.\n", max,
         min, string);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xd8(%rbp)
movl   $0x0,-0xdc(%rbp)
movl   $0x0,-0xe0(%rbp)
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xd8(%rbp)
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    $0x0,%al
call   1080 <getchar@plt>
mov    %al,-0xd1(%rbp)
mov    -0xd1(%rbp),%cl
mov    -0xd8(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xd8(%rbp)
cltq
mov    %cl,-0x70(%rbp,%rax,1)
movsbl -0xd1(%rbp),%eax
cmp    $0xa,%eax
jne    11b8 <main+0x48>
mov    -0xd8(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x70(%rbp,%rax,1)
movl   $0x0,-0xd8(%rbp)
mov    -0xd8(%rbp),%eax
mov    %eax,-0xe4(%rbp)
lea    -0x70(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0xe4(%rbp),%eax
cmp    %ecx,%eax
jge    1407 <main+0x297>
jmp    1244 <main+0xd4>
mov    -0xd8(%rbp),%eax
mov    %eax,-0xec(%rbp)
lea    -0x70(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0xec(%rbp),%ecx
mov    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0xe5(%rbp)
jge    12b3 <main+0x143>
movslq -0xd8(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%edi
call   1070 <isspace@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xe5(%rbp)
jne    12b3 <main+0x143>
movslq -0xd8(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%edi
call   1060 <isalnum@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xe5(%rbp)
mov    -0xe5(%rbp),%al
test   $0x1,%al
jne    12c6 <main+0x156>
jmp    12fc <main+0x18c>
mov    -0xd8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xd8(%rbp)
cltq
mov    -0x70(%rbp,%rax,1),%cl
mov    -0xdc(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xdc(%rbp)
cltq
mov    %cl,-0x90(%rbp,%rax,1)
jmp    1244 <main+0xd4>
cmpl   $0x0,-0xdc(%rbp)
je     13ee <main+0x27e>
movslq -0xdc(%rbp),%rax
movb   $0x0,-0x90(%rbp,%rax,1)
cmpl   $0x0,-0xe0(%rbp)
jne    1362 <main+0x1f2>
cmpl   $0x0,-0xe0(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xe0(%rbp)
lea    -0xb0(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0xd0(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x90(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xf0(%rbp)
lea    -0xb0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0xf0(%rbp),%eax
cmp    %ecx,%eax
jle    13a3 <main+0x233>
lea    -0xb0(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x90(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xf4(%rbp)
lea    -0xd0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0xf4(%rbp),%eax
cmp    %ecx,%eax
jge    13e4 <main+0x274>
lea    -0xd0(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0xdc(%rbp)
jmp    13f3 <main+0x283>
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    121a <main+0xaa>
lea    -0xb0(%rbp),%rsi
lea    -0xd0(%rbp),%rdx
lea    -0x70(%rbp),%rcx
lea    0xbef(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
lea    0xe78(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffffffffffff,%rbx
mov    0x2e4b(%rip),%rbp
nopl   (%rax)
mov    0x0(%rbp),%edi
call   1090 <fflush@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
mov    %al,0x61(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    11a0 <main+0x30>
mov    %ebx,%eax
movb   $0x0,0x60(%rsp,%rax,1)
lea    0x60(%rsp),%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    12d4 <main+0x164>
xor    %r14d,%r14d
lea    0x60(%rsp),%r13
lea    0x20(%rsp),%r15
lea    0x40(%rsp),%r12
xor    %ebx,%ebx
jmp    1203 <main+0x93>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    %r13,%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebx
jge    12d4 <main+0x164>
mov    %r13,%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebx
jge    11f0 <main+0x80>
movslq %ebx,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl 0x60(%rsp,%rbx,1),%edi
call   1070 <isspace@plt>
test   %eax,%eax
jne    125d <main+0xed>
movsbl 0x60(%rsp,%rbx,1),%edi
call   1060 <isalnum@plt>
test   %rax,%rax
je     125d <main+0xed>
movzbl 0x60(%rsp,%rbx,1),%eax
add    $0x1,%rbx
mov    %al,0x20(%rsp,%rbp,1)
add    $0x1,%rbp
mov    %r13,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1220 <main+0xb0>
test   %ebp,%ebp
je     11f0 <main+0x80>
mov    %ebp,%eax
movb   $0x0,0x20(%rsp,%rax,1)
test   %r14d,%r14d
jne    1283 <main+0x113>
mov    %rsp,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %rsp,%rdi
call   1040 <strlen@plt>
cmp    %eax,%ebp
jle    12a4 <main+0x134>
mov    %rsp,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    $0x1,%r14d
cmp    %eax,%ebp
jge    11f0 <main+0x80>
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
jmp    11f0 <main+0x80>
lea    0xd34(%rip),%rdi
mov    %rsp,%rsi
lea    0x40(%rsp),%rdx
lea    0x60(%rsp),%rcx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter string: \00"
@stdin = global i32 0
@.str.1 = [61 x i8] c"The largest word is '%s' and smallest word is '%s' in '%s'.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [20 x i8]
%4 = alloca [20 x i8]
%5 = alloca [20 x i8]
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %11
11: ; preds = %20, %0
%12 = load i32, i32* @stdin
%13 = call i32 @fflush(i32 %12)
%14 = call signext i8 (...) @getchar()
store i8 %14, i8* %6
%15 = load i8, i8* %6
%16 = load i32, i32* %7
%17 = add nsw i32 %16, 1
store i32 %17, i32* %7
%18 = sext i32 %16 to i64
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %18
store i8 %15, i8* %19
br label %20
20: ; preds = %11
%21 = load i8, i8* %6
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 10
br i1 %23, label %11, label %24
24: ; preds = %20
%25 = load i32, i32* %7
%26 = sub nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %27
store i8 0, i8* %28
store i32 0, i32* %7
br label %29
29: ; preds = %108, %24
%30 = load i32, i32* %7
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%32 = call i32 @strlen(i8* %31)
%33 = icmp slt i32 %30, %32
br i1 %33, label %34, label %111
34: ; preds = %29
br label %35
35: ; preds = %56, %34
%36 = load i32, i32* %7
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%38 = call i32 @strlen(i8* %37)
%39 = icmp slt i32 %36, %38
br i1 %39, label %40, label %54
40: ; preds = %35
%41 = load i32, i32* %7
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = call i32 @isspace(i8 signext %44)
%46 = icmp ne i32 %45, 0
br i1 %46, label %54, label %47
47: ; preds = %40
%48 = load i32, i32* %7
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = call i64 @isalnum(i8 signext %51)
%53 = icmp ne i64 %52, 0
br label %54
54: ; preds = %47, %40, %35
%55 = phi i1 [ false, %40 ], [ false, %35 ], [ %53, %47 ]
br i1 %55, label %56, label %66
56: ; preds = %54
%57 = load i32, i32* %7
%58 = add nsw i32 %57, 1
store i32 %58, i32* %7
%59 = sext i32 %57 to i64
%60 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %59
%61 = load i8, i8* %60
%62 = load i32, i32* %8
%63 = add nsw i32 %62, 1
store i32 %63, i32* %8
%64 = sext i32 %62 to i64
%65 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 %64
store i8 %61, i8* %65
br label %35
66: ; preds = %54
%67 = load i32, i32* %8
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %107
69: ; preds = %66
%70 = load i32, i32* %8
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 %71
store i8 0, i8* %72
%73 = load i32, i32* %9
%74 = icmp ne i32 %73, 0
br i1 %74, label %86, label %75
75: ; preds = %69
%76 = load i32, i32* %9
%77 = icmp ne i32 %76, 0
%78 = xor i1 %77, true
%79 = zext i1 %78 to i32
store i32 %79, i32* %9
%80 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%81 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%82 = call i32 @strcpy(i8* %80, i8* %81)
%83 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%84 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%85 = call i32 @strcpy(i8* %83, i8* %84)
br label %86
86: ; preds = %75, %69
%87 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%88 = call i32 @strlen(i8* %87)
%89 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%90 = call i32 @strlen(i8* %89)
%91 = icmp sgt i32 %88, %90
br i1 %91, label %92, label %96
92: ; preds = %86
%93 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%94 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%95 = call i32 @strcpy(i8* %93, i8* %94)
br label %96
96: ; preds = %92, %86
%97 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%98 = call i32 @strlen(i8* %97)
%99 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%100 = call i32 @strlen(i8* %99)
%101 = icmp slt i32 %98, %100
br i1 %101, label %102, label %106
102: ; preds = %96
%103 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%104 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%105 = call i32 @strcpy(i8* %103, i8* %104)
br label %106
106: ; preds = %102, %96
store i32 0, i32* %8
br label %107
107: ; preds = %106, %66
br label %108
108: ; preds = %107
%109 = load i32, i32* %7
%110 = add nsw i32 %109, 1
store i32 %110, i32* %7
br label %29
111: ; preds = %29
%112 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%113 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%114 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i8* %112, i8* %113, i8* %114)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Enter string: \00"
@stdin = global i32 0
@.str.1 = [61 x i8] c"The largest word is '%s' and smallest word is '%s' in '%s'.\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = alloca [20 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %10, %0
%11 = phi i64 [ %15, %10 ], [ 0, %0 ]
%12 = load i32, i32* @stdin
%13 = tail call i32 @fflush(i32 %12)
%14 = tail call signext i8 (...) @getchar()
%15 = add nuw i64 %11, 1
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %11
store i8 %14, i8* %16
%17 = icmp eq i8 %14, 10
br i1 %17, label %18, label %10
18: ; preds = %10
%19 = and i64 %11, 4294967295
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %19
store i8 0, i8* %20
%21 = call i32 @strlen(i8* %5)
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %80
23: ; preds = %18, %74
%24 = phi i32 [ %76, %74 ], [ 0, %18 ]
%25 = phi i32 [ %77, %74 ], [ 0, %18 ]
%26 = call i32 @strlen(i8* %5)
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %74
28: ; preds = %23
%29 = sext i32 %25 to i64
br label %30
30: ; preds = %28, %41
%31 = phi i64 [ %29, %28 ], [ %42, %41 ]
%32 = phi i64 [ 0, %28 ], [ %44, %41 ]
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %31
%34 = load i8, i8* %33
%35 = call i32 @isspace(i8 signext %34)
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %49
37: ; preds = %30
%38 = load i8, i8* %33
%39 = call i64 @isalnum(i8 signext %38)
%40 = icmp eq i64 %39, 0
br i1 %40, label %49, label %41
41: ; preds = %37
%42 = add nsw i64 %31, 1
%43 = load i8, i8* %33
%44 = add nuw nsw i64 %32, 1
%45 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %32
store i8 %43, i8* %45
%46 = call i32 @strlen(i8* %5)
%47 = sext i32 %46 to i64
%48 = icmp slt i64 %42, %47
br i1 %48, label %30, label %49
49: ; preds = %37, %30, %41
%50 = phi i64 [ %31, %37 ], [ %31, %30 ], [ %42, %41 ]
%51 = phi i64 [ %32, %37 ], [ %32, %30 ], [ %44, %41 ]
%52 = trunc i64 %51 to i32
%53 = trunc i64 %50 to i32
%54 = icmp eq i32 %52, 0
br i1 %54, label %74, label %55
55: ; preds = %49
%56 = and i64 %51, 4294967295
%57 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %56
store i8 0, i8* %57
%58 = icmp eq i32 %24, 0
br i1 %58, label %59, label %62
59: ; preds = %55
%60 = call i32 @strcpy(i8* %7, i8* %6)
%61 = call i32 @strcpy(i8* %8, i8* %6)
br label %62
62: ; preds = %59, %55
%63 = call i32 @strlen(i8* %6)
%64 = call i32 @strlen(i8* %7)
%65 = icmp sgt i32 %63, %64
br i1 %65, label %66, label %68
66: ; preds = %62
%67 = call i32 @strcpy(i8* %7, i8* %6)
br label %68
68: ; preds = %66, %62
%69 = call i32 @strlen(i8* %6)
%70 = call i32 @strlen(i8* %8)
%71 = icmp slt i32 %69, %70
br i1 %71, label %72, label %74
72: ; preds = %68
%73 = call i32 @strcpy(i8* %8, i8* %6)
br label %74
74: ; preds = %23, %68, %72, %49
%75 = phi i32 [ %53, %49 ], [ %53, %72 ], [ %53, %68 ], [ %25, %23 ]
%76 = phi i32 [ %24, %49 ], [ 1, %72 ], [ 1, %68 ], [ %24, %23 ]
%77 = add nsw i32 %75, 1
%78 = call i32 @strlen(i8* %5)
%79 = icmp slt i32 %77, %78
br i1 %79, label %23, label %80
80: ; preds = %74, %18
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i8* %7, i8* %8, i8* %5)
ret i32 0
}