#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 */
scalar_t__ cmp(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ swap(char *, char *);
int main(void) {
  char str1[81];
  char str2[81];
  char str3[81];
  printf("Please enter the first string: \n");
  scanf("%s", str1);
  printf("Please enter the second string: \n");
  scanf("%s", str2);
  printf("Please enter the third string: \n");
  scanf("%s", str3);
  if (cmp(str1, str2) > 0)
    swap(str1, str2);
  if (cmp(str1, str3) > 0)
    swap(str1, str3);
  if (cmp(str2, str3) > 0)
    swap(str2, str3);
  printf("==================\n");
  printf("The result is: \n");
  printf("%s\n%s\n%s\n", str1, str2, str3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1050 <scanf@plt>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc0(%rbp),%rsi
lea    0xe95(%rip),%rdi
call   1050 <scanf@plt>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x120(%rbp),%rsi
lea    0xe74(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x60(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1040 <cmp@plt>
cmp    $0x0,%rax
jle    11dc <main+0x9c>
lea    -0x60(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1060 <swap@plt>
lea    -0x60(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1040 <cmp@plt>
cmp    $0x0,%rax
jle    1206 <main+0xc6>
lea    -0x60(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1060 <swap@plt>
lea    -0xc0(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1040 <cmp@plt>
cmp    $0x0,%rax
jle    1236 <main+0xf6>
lea    -0xc0(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1060 <swap@plt>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
lea    -0x120(%rbp),%rcx
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x120,%rsp
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
lea    0xe91(%rip),%rbx
lea    0xc0(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <scanf@plt>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
lea    0x60(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <cmp@plt>
test   %rax,%rax
jle    11d7 <main+0x87>
lea    0xc0(%rsp),%rdi
lea    0x60(%rsp),%rsi
call   1070 <swap@plt>
lea    0xc0(%rsp),%rdi
mov    %rsp,%rsi
call   1050 <cmp@plt>
test   %rax,%rax
jle    11fc <main+0xac>
lea    0xc0(%rsp),%rdi
mov    %rsp,%rsi
call   1070 <swap@plt>
lea    0x60(%rsp),%rdi
mov    %rsp,%rsi
call   1050 <cmp@plt>
test   %rax,%rax
jle    121b <main+0xcb>
lea    0x60(%rsp),%rdi
mov    %rsp,%rsi
call   1070 <swap@plt>
lea    0xe4c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe53(%rip),%rdi
call   1030 <puts@plt>
lea    0xdc9(%rip),%rdi
lea    0xc0(%rsp),%rsi
lea    0x60(%rsp),%rdx
mov    %rsp,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Please enter the first string: \0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [34 x i8] c"Please enter the second string: \0A\00"
@.str.3 = [33 x i8] c"Please enter the third string: \0A\00"
@.str.4 = [20 x i8] c"==================\0A\00"
@.str.5 = [17 x i8] c"The result is: \0A\00"
@.str.6 = [10 x i8] c"%s\0A%s\0A%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [81 x i8]
%3 = alloca [81 x i8]
%4 = alloca [81 x i8]
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [81 x i8], [81 x i8]* %2, 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 ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%9 = getelementptr inbounds [81 x i8], [81 x i8]* %3, 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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%12 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds [81 x i8], [81 x i8]* %3, i64 0, i64 0
%16 = call i64 @cmp(i8* %14, i8* %15)
%17 = icmp sgt i64 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %0
%19 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%20 = getelementptr inbounds [81 x i8], [81 x i8]* %3, i64 0, i64 0
%21 = call i32 @swap(i8* %19, i8* %20)
br label %22
22: ; preds = %18, %0
%23 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%24 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 0
%25 = call i64 @cmp(i8* %23, i8* %24)
%26 = icmp sgt i64 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %22
%28 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%29 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 0
%30 = call i32 @swap(i8* %28, i8* %29)
br label %31
31: ; preds = %27, %22
%32 = getelementptr inbounds [81 x i8], [81 x i8]* %3, i64 0, i64 0
%33 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 0
%34 = call i64 @cmp(i8* %32, i8* %33)
%35 = icmp sgt i64 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %31
%37 = getelementptr inbounds [81 x i8], [81 x i8]* %3, i64 0, i64 0
%38 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 0
%39 = call i32 @swap(i8* %37, i8* %38)
br label %40
40: ; preds = %36, %31
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%43 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%44 = getelementptr inbounds [81 x i8], [81 x i8]* %3, i64 0, i64 0
%45 = getelementptr inbounds [81 x i8], [81 x i8]* %4, i64 0, i64 0
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %43, i8* %44, i8* %45)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@.str.6 = [10 x i8] c"%s\0A%s\0A%s\0A\00"
@str = [32 x i8] c"Please enter the first string: \00"
@str.7 = [33 x i8] c"Please enter the second string: \00"
@str.8 = [32 x i8] c"Please enter the third string: \00"
@str.9 = [19 x i8] c"==================\00"
@str.10 = [16 x i8] c"The result is: \00"
define i32 @main() {
%1 = alloca [81 x i8]
%2 = alloca [81 x i8]
%3 = alloca [81 x i8]
%4 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [81 x i8], [81 x i8]* %3, i64 0, i64 0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 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* %4)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.7, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.8, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%13 = call i64 @cmp(i8* %4, i8* %5)
%14 = icmp sgt i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 @swap(i8* %4, i8* %5)
br label %17
17: ; preds = %15, %0
%18 = call i64 @cmp(i8* %4, i8* %6)
%19 = icmp sgt i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @swap(i8* %4, i8* %6)
br label %22
22: ; preds = %20, %17
%23 = call i64 @cmp(i8* %5, i8* %6)
%24 = icmp sgt i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 @swap(i8* %5, i8* %6)
br label %27
27: ; preds = %25, %22
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.9, i64 0, i64 0))
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.10, i64 0, i64 0))
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %4, i8* %5, i8* %6)
ret i32 0
}