#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int main() {
  void swap(char *s1, char *s2);
  char str1[50], str2[50], str3[50];
  printf("input 1th string :\n");
  gets(str1);
  printf("input 2th string:\n");
  gets(str2);
  printf("input 3rd string:\n");
  gets(str3);
  if (strcmp(str1, str2) > 0)
    swap(str1, str2);
  if (strcmp(str1, str3) > 0)
    swap(str1, str3);
  if (strcmp(str2, str3) > 0)
    swap(str2, str3);
  printf("Now,the order 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    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1050 <gets@plt>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x80(%rbp),%rdi
call   1050 <gets@plt>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc0(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x40(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jle    11be <main+0x7e>
lea    -0x40(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1060 <swap@plt>
lea    -0x40(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jle    11e8 <main+0xa8>
lea    -0x40(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1060 <swap@plt>
lea    -0x80(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jle    1212 <main+0xd2>
lea    -0x80(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1060 <swap@plt>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    -0x80(%rbp),%rdx
lea    -0xc0(%rbp),%rcx
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xb8,%rsp
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
lea    0x80(%rsp),%r14
mov    %r14,%rdi
call   1060 <gets@plt>
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
call   1060 <gets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jle    11c5 <main+0x75>
lea    0x80(%rsp),%rdi
lea    0x40(%rsp),%rsi
call   1070 <swap@plt>
lea    0x80(%rsp),%rdi
mov    %rsp,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jle    11ea <main+0x9a>
lea    0x80(%rsp),%rdi
mov    %rsp,%rsi
call   1070 <swap@plt>
lea    0x40(%rsp),%rdi
mov    %rsp,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jle    1209 <main+0xb9>
lea    0x40(%rsp),%rdi
mov    %rsp,%rsi
call   1070 <swap@plt>
lea    0xe31(%rip),%rdi
call   1030 <puts@plt>
lea    0xde4(%rip),%rdi
lea    0x80(%rsp),%rsi
lea    0x40(%rsp),%rdx
mov    %rsp,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"input 1th string :\0A\00"
@.str.1 = [19 x i8] c"input 2th string:\0A\00"
@.str.2 = [19 x i8] c"input 3rd string:\0A\00"
@.str.3 = [19 x i8] c"Now,the order is:\0A\00"
@.str.4 = [10 x i8] c"%s\0A%s\0A%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
%4 = alloca [50 x i8]
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%10 = call i32 @gets(i8* %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%12 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%13 = call i32 @gets(i8* %12)
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%16 = call i64 @strcmp(i8* %14, i8* %15)
%17 = icmp sgt i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %0
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%20 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
br label %21
21: ; preds = %18, %0
%22 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%23 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%24 = call i64 @strcmp(i8* %22, i8* %23)
%25 = icmp sgt i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%28 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
br label %29
29: ; preds = %26, %21
%30 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%31 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%32 = call i64 @strcmp(i8* %30, i8* %31)
%33 = icmp sgt i64 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %29
%35 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%36 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
br label %37
37: ; preds = %34, %29
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%39 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%40 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%41 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %39, i8* %40, i8* %41)
ret i32 0
}

LLVM IR (-O2):
@.str.4 = [10 x i8] c"%s\0A%s\0A%s\0A\00"
@str = [19 x i8] c"input 1th string :\00"
@str.5 = [18 x i8] c"input 2th string:\00"
@str.6 = [18 x i8] c"input 3rd string:\00"
@str.7 = [18 x i8] c"Now,the order is:\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%8 = call i32 @gets(i8* %4)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.5, i64 0, i64 0))
%10 = call i32 @gets(i8* %5)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.6, i64 0, i64 0))
%12 = call i32 @gets(i8* %6)
%13 = call i64 @strcmp(i8* %4, i8* %5)
%14 = icmp sgt i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %0
br label %16
16: ; preds = %15, %0
%17 = call i64 @strcmp(i8* %4, i8* %6)
%18 = icmp sgt i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %16
br label %20
20: ; preds = %19, %16
%21 = call i64 @strcmp(i8* %5, i8* %6)
%22 = icmp sgt i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %20
br label %24
24: ; preds = %23, %20
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.7, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* %4, i8* %5, i8* %6)
ret i32 0
}