#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__ conv(char);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  int i, j;
  char swipe;
  char deck[14];
  scanf("%s", deck);
  for (i = 1; i < 13; i++) {
    for (j = 0; j < 13 - i; j++) {
      if (conv(deck[j]) > conv(deck[j + 1])) {
        swipe = deck[j];
        deck[j] = deck[j + 1];
        deck[j + 1] = swipe;
      }
    }
  }
  printf("%s\n", deck);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1b(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0xd,-0x8(%rbp)
jge    1202 <main+0xd2>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xd,%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    11ef <main+0xbf>
movslq -0xc(%rbp),%rax
movsbl -0x1b(%rbp,%rax,1),%edi
call   1030 <conv@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x1b(%rbp,%rax,1),%edi
call   1030 <conv@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jle    11dc <main+0xac>
movslq -0xc(%rbp),%rax
mov    -0x1b(%rbp,%rax,1),%al
mov    %al,-0xd(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x1b(%rbp,%rax,1),%cl
movslq -0xc(%rbp),%rax
mov    %cl,-0x1b(%rbp,%rax,1)
mov    -0xd(%rbp),%cl
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
mov    %cl,-0x1b(%rbp,%rax,1)
jmp    11e1 <main+0xb1>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1167 <main+0x37>
jmp    11f4 <main+0xc4>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <main+0x26>
lea    -0x1b(%rbp),%rsi
lea    0xdf6(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebd(%rip),%rdi
lea    0x2(%rsp),%rsi
call   1050 <scanf@plt>
mov    $0x1,%r14d
mov    $0xc,%r15d
jmp    116e <main+0x3e>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14d
add    $0xffffffffffffffff,%r15
cmp    $0xd,%r14d
je     11b0 <main+0x80>
xor    %ebp,%ebp
jmp    1188 <main+0x58>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rbp
cmp    %rbx,%r15
je     1160 <main+0x30>
movsbl 0x2(%rsp,%rbp,1),%edi
call   1030 <conv@plt>
mov    %rax,%r12
lea    0x1(%rbp),%rbx
movsbl 0x3(%rsp,%rbp,1),%edi
call   1030 <conv@plt>
cmp    %rax,%r12
jle    1180 <main+0x50>
rolw   $0x8,0x2(%rsp,%rbp,1)
jmp    1180 <main+0x50>
lea    0xe4c(%rip),%rdi
lea    0x2(%rsp),%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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