#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 printbcword() {
  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);
  return 0;
}


x86 assembly (clang, -O0):
<printbcword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x2,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe94(%rip),%rdi
call   1070 <scanf@plt>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xe76(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1060 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jge    11dd <printbcword+0x8d>
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    11e2 <printbcword+0x92>
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xe11(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1060 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    1228 <printbcword+0xd8>
lea    -0x40(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1060 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jge    1250 <printbcword+0x100>
lea    -0x60(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    1255 <printbcword+0x105>
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    $0x4,%eax
cmp    %ecx,%eax
jne    11e2 <printbcword+0x92>
lea    -0x40(%rbp),%rsi
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printbcword>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x60,%rsp
lea    0xe9c(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe97(%rip),%r12
lea    0x20(%rsp),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   1070 <scanf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jle    11db <printbcword+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    0xe1e(%rip),%r14
lea    0xe23(%rip),%r15
lea    0x40(%rsp),%rbx
lea    0x20(%rsp),%r12
mov    %rsp,%r13
jmp    120d <printbcword+0xbd>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x4,%eax
je     125a <printbcword+0x10a>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jns    123d <printbcword+0xed>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jle    1200 <printbcword+0xb0>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
jmp    1200 <printbcword+0xb0>
lea    0xdae(%rip),%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdad(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1050 <printf@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"
define i32 @printbcword() {
%1 = alloca i32
%2 = alloca [21 x i8]
%3 = alloca [21 x i8]
%4 = alloca [21 x i8]
store i32 2, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%13 = call i64 @strcmp(i8* %11, i8* %12)
%14 = icmp slt i64 0, %13
br i1 %14, label %15, label %25
15: ; preds = %0
%16 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%17 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%18 = call i32 @strcpy(i8* %16, i8* %17)
%19 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%20 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%21 = call i32 @strcpy(i8* %19, i8* %20)
%22 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%23 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%24 = call i32 @strcpy(i8* %22, i8* %23)
br label %25
25: ; preds = %15, %0
br label %26
26: ; preds = %48, %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%28 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %28)
%30 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%31 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%32 = call i64 @strcmp(i8* %30, i8* %31)
%33 = icmp sgt i64 0, %32
br i1 %33, label %34, label %38
34: ; preds = %26
%35 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%36 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%37 = call i32 @strcpy(i8* %35, i8* %36)
br label %38
38: ; preds = %34, %26
%39 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%40 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%41 = call i64 @strcmp(i8* %39, i8* %40)
%42 = icmp slt i64 0, %41
br i1 %42, label %43, label %47
43: ; preds = %38
%44 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%45 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%46 = call i32 @strcpy(i8* %44, i8* %45)
br label %47
47: ; preds = %43, %38
br label %48
48: ; preds = %47
%49 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%50 = call i32 @strlen(i8* %49)
%51 = icmp ne i32 4, %50
br i1 %51, label %26, label %52
52: ; preds = %48
%53 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %53)
%55 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %55)
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"
define i32 @printbcword() {
%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)
ret i32 0
}