#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__ EOF;
int /*<<< orphan*/ printf(char *, char, char, char);
scalar_t__ scanf(char *, char *);
int main() {
  char input[4];
  char temp;
  while (EOF != scanf("%4s", input)) {
    if (input[0] > input[1]) {
      temp = input[0];
      input[0] = input[1];
      input[1] = temp;
    }
    if (input[0] > input[2]) {
      temp = input[0];
      input[0] = input[2];
      input[2] = temp;
    }
    if (input[1] > input[2]) {
      temp = input[1];
      input[1] = input[2];
      input[2] = temp;
    }
    printf("%c %c %c\n", input[0], input[1], input[2]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
lea    -0x8(%rbp),%rsi
lea    0xeb8(%rip),%rdi
call   1040 <scanf@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
je     11e4 <main+0xc4>
movsbl -0x8(%rbp),%eax
movsbl -0x7(%rbp),%ecx
cmp    %ecx,%eax
jle    117f <main+0x5f>
mov    -0x8(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x7(%rbp),%al
mov    %al,-0x8(%rbp)
mov    -0x9(%rbp),%al
mov    %al,-0x7(%rbp)
movsbl -0x8(%rbp),%eax
movsbl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jle    11a1 <main+0x81>
mov    -0x8(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x8(%rbp)
mov    -0x9(%rbp),%al
mov    %al,-0x6(%rbp)
movsbl -0x7(%rbp),%eax
movsbl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jle    11c3 <main+0xa3>
mov    -0x7(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x7(%rbp)
mov    -0x9(%rbp),%al
mov    %al,-0x6(%rbp)
mov    -0x8(%rbp),%cl
mov    -0x7(%rbp),%al
lea    0xe34(%rip),%rdi
movsbl %cl,%esi
movsbl %al,%edx
movsbl -0x6(%rbp),%ecx
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    0x2eb4(%rip),%r12
mov    (%r12),%rbx
lea    0xec1(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmp    %rax,%rbx
jne    115e <main+0x3e>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xe9f(%rip),%r14
lea    0xe94(%rip),%r15
lea    0xc(%rsp),%r13
jmp    11b0 <main+0x90>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %al,0xd(%rsp)
mov    %cl,0xe(%rsp)
mov    %ecx,%ebx
movsbl %sil,%esi
movsbl %al,%edx
movsbl %bl,%ecx
mov    %r14,%rdi
call   1030 <printf@plt>
mov    (%r12),%rbx
mov    %r15,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
cmp    %rax,%rbx
je     114e <main+0x2e>
movzbl 0xc(%rsp),%edx
movzbl 0xd(%rsp),%eax
cmp    %al,%dl
jle    11d0 <main+0xb0>
mov    %al,0xc(%rsp)
mov    %dl,0xd(%rsp)
mov    %edx,%ecx
jmp    11d4 <main+0xb4>
nopw   0x0(%rax,%rax,1)
mov    %eax,%ecx
mov    %edx,%eax
movzbl 0xe(%rsp),%edx
cmp    %dl,%al
jle    11f0 <main+0xd0>
mov    %dl,0xc(%rsp)
mov    %al,0xe(%rsp)
mov    %edx,%esi
cmp    %al,%cl
jg     1180 <main+0x60>
jmp    11f8 <main+0xd8>
nopl   (%rax)
mov    %eax,%esi
mov    %edx,%eax
cmp    %al,%cl
jg     1180 <main+0x60>
mov    %eax,%ebx
mov    %ecx,%eax
jmp    118a <main+0x6a>

LLVM IR (-O0):
@EOF = global i64 0
@.str = [4 x i8] c"%4s\00"
@.str.1 = [10 x i8] c"%c %c %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
%3 = alloca i8
store i32 0, i32* %1
br label %4
4: ; preds = %57, %0
%5 = load i64, i64* @EOF
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%7 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = icmp ne i64 %5, %7
br i1 %8, label %9, label %65
9: ; preds = %4
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp sgt i32 %12, %15
br i1 %16, label %17, label %25
17: ; preds = %9
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%19 = load i8, i8* %18
store i8 %19, i8* %3
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
%21 = load i8, i8* %20
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
store i8 %21, i8* %22
%23 = load i8, i8* %3
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
store i8 %23, i8* %24
br label %25
25: ; preds = %17, %9
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp sgt i32 %28, %31
br i1 %32, label %33, label %41
33: ; preds = %25
%34 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%35 = load i8, i8* %34
store i8 %35, i8* %3
%36 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%37 = load i8, i8* %36
%38 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
store i8 %37, i8* %38
%39 = load i8, i8* %3
%40 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
store i8 %39, i8* %40
br label %41
41: ; preds = %33, %25
%42 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp sgt i32 %44, %47
br i1 %48, label %49, label %57
49: ; preds = %41
%50 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
%51 = load i8, i8* %50
store i8 %51, i8* %3
%52 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%53 = load i8, i8* %52
%54 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
store i8 %53, i8* %54
%55 = load i8, i8* %3
%56 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
store i8 %55, i8* %56
br label %57
57: ; preds = %49, %41
%58 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%59 = load i8, i8* %58
%60 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
%61 = load i8, i8* %60
%62 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%63 = load i8, i8* %62
%64 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8 signext %59, i8 signext %61, i8 signext %63)
br label %4
65: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@EOF = global i64 0
@.str = [4 x i8] c"%4s\00"
@.str.1 = [10 x i8] c"%c %c %c\0A\00"
define i32 @main() {
%1 = alloca [4 x i8]
%2 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%3 = load i64, i64* @EOF
%4 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = icmp eq i64 %3, %4
br i1 %5, label %32, label %6
6: ; preds = %0
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 1
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 2
br label %9
9: ; preds = %6, %25
%10 = load i8, i8* %2
%11 = load i8, i8* %7
%12 = icmp sgt i8 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %9
store i8 %11, i8* %2
store i8 %10, i8* %7
br label %14
14: ; preds = %13, %9
%15 = phi i8 [ %10, %13 ], [ %11, %9 ]
%16 = phi i8 [ %11, %13 ], [ %10, %9 ]
%17 = load i8, i8* %8
%18 = icmp sgt i8 %16, %17
br i1 %18, label %19, label %20
19: ; preds = %14
store i8 %17, i8* %2
store i8 %16, i8* %8
br label %20
20: ; preds = %19, %14
%21 = phi i8 [ %17, %19 ], [ %16, %14 ]
%22 = phi i8 [ %16, %19 ], [ %17, %14 ]
%23 = icmp sgt i8 %15, %22
br i1 %23, label %24, label %25
24: ; preds = %20
store i8 %22, i8* %7
store i8 %15, i8* %8
br label %25
25: ; preds = %24, %20
%26 = phi i8 [ %15, %24 ], [ %22, %20 ]
%27 = phi i8 [ %22, %24 ], [ %15, %20 ]
%28 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8 signext %21, i8 signext %27, i8 signext %26)
%29 = load i64, i64* @EOF
%30 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%31 = icmp eq i64 %29, %30
br i1 %31, label %32, label %9
32: ; preds = %25, %0
ret i32 0
}