#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__ cardValue(char);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  char cards[14];
  char hold;
  int i, j;
  for (i = 0; i < 13; i++) {
    scanf("%12s", &cards[i]);
  }
  for (i = 0; i < strlen(cards); i++) {
    for (j = i + 1; j < strlen(cards); j++) {
      if (cardValue(cards[i]) > cardValue(cards[j])) {
        hold = cards[i];
        cards[i] = cards[j];
        cards[j] = hold;
      }
    }
  }
  for (i = 0; i < 13; i++) {
    printf("%c ", cards[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0xd,-0x18(%rbp)
jge    1185 <main+0x45>
movslq -0x18(%rbp),%rax
lea    -0x12(%rbp),%rsi
add    %rax,%rsi
lea    0xe8e(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1156 <main+0x16>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
lea    -0x12(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jge    1249 <main+0x109>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
lea    -0x12(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
jge    1236 <main+0xf6>
movslq -0x18(%rbp),%rax
movsbl -0x12(%rbp,%rax,1),%edi
call   1030 <cardValue@plt>
mov    %rax,-0x30(%rbp)
movslq -0x1c(%rbp),%rax
movsbl -0x12(%rbp,%rax,1),%edi
call   1030 <cardValue@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
jle    1223 <main+0xe3>
movslq -0x18(%rbp),%rax
mov    -0x12(%rbp,%rax,1),%al
mov    %al,-0x13(%rbp)
movslq -0x1c(%rbp),%rax
mov    -0x12(%rbp,%rax,1),%cl
movslq -0x18(%rbp),%rax
mov    %cl,-0x12(%rbp,%rax,1)
mov    -0x13(%rbp),%cl
movslq -0x1c(%rbp),%rax
mov    %cl,-0x12(%rbp,%rax,1)
jmp    1228 <main+0xe8>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b1 <main+0x71>
jmp    123b <main+0xfb>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118c <main+0x4c>
movl   $0x0,-0x18(%rbp)
cmpl   $0xd,-0x18(%rbp)
jge    127f <main+0x13f>
movslq -0x18(%rbp),%rax
movsbl -0x12(%rbp,%rax,1),%esi
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1250 <main+0x110>
lea    0xd83(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe9b(%rip),%rbx
lea    0xa(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <scanf@plt>
lea    0xb(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xd(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xe(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xf(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x11(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x12(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x13(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x15(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0x16(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    12b3 <main+0x163>
mov    $0x1,%r15d
xor    %r12d,%r12d
lea    0xa(%rsp),%r14
jmp    1253 <main+0x103>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1050 <strlen@plt>
cltq
add    $0x1,%r15
cmp    %rax,%r12
jge    12b3 <main+0x163>
mov    %r12,%r13
add    $0x1,%r12
mov    %r14,%rdi
call   1050 <strlen@plt>
cltq
cmp    %rax,%r12
jge    1240 <main+0xf0>
mov    %r15,%rbp
jmp    1280 <main+0x130>
xchg   %ax,%ax
add    $0x1,%rbp
mov    %r14,%rdi
call   1050 <strlen@plt>
cmp    %ebp,%eax
jle    1240 <main+0xf0>
movsbl 0xa(%rsp,%r13,1),%edi
call   1040 <cardValue@plt>
mov    %rax,%rbx
movsbl 0xa(%rsp,%rbp,1),%edi
call   1040 <cardValue@plt>
cmp    %rax,%rbx
jle    1270 <main+0x120>
movzbl 0xa(%rsp,%r13,1),%eax
movzbl 0xa(%rsp,%rbp,1),%ecx
mov    %cl,0xa(%rsp,%r13,1)
mov    %al,0xa(%rsp,%rbp,1)
jmp    1270 <main+0x120>
movsbl 0xa(%rsp),%esi
lea    0xd46(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xb(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xd(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xe(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xf(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x11(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x12(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x13(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x15(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x16(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%12s\00"
@.str.1 = [4 x i8] c"%c \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 ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 1
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 2
%7 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 3
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 4
%11 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 5
%13 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 6
%15 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 7
%17 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 8
%19 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 9
%21 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %20)
%22 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 10
%23 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 11
%25 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 12
%27 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %26)
%28 = call i32 @strlen(i8* %2)
%29 = icmp sgt i32 %28, 0
br i1 %29, label %76, label %35
30: ; preds = %96, %76
%31 = call i32 @strlen(i8* %2)
%32 = sext i32 %31 to i64
%33 = icmp slt i64 %79, %32
%34 = add nuw nsw i64 %78, 1
br i1 %33, label %76, label %35
35: ; preds = %30, %0
%36 = load i8, i8* %2
%37 = sext i8 %36 to i32
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %37)
%39 = load i8, i8* %4
%40 = sext i8 %39 to i32
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = load i8, i8* %6
%43 = sext i8 %42 to i32
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %43)
%45 = load i8, i8* %8
%46 = sext i8 %45 to i32
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %46)
%48 = load i8, i8* %10
%49 = sext i8 %48 to i32
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %49)
%51 = load i8, i8* %12
%52 = sext i8 %51 to i32
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %52)
%54 = load i8, i8* %14
%55 = sext i8 %54 to i32
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %55)
%57 = load i8, i8* %16
%58 = sext i8 %57 to i32
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %58)
%60 = load i8, i8* %18
%61 = sext i8 %60 to i32
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %61)
%63 = load i8, i8* %20
%64 = sext i8 %63 to i32
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %64)
%66 = load i8, i8* %22
%67 = sext i8 %66 to i32
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %67)
%69 = load i8, i8* %24
%70 = sext i8 %69 to i32
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %70)
%72 = load i8, i8* %26
%73 = sext i8 %72 to i32
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %73)
%75 = call i32 @putchar(i32 10)
ret i32 0
76: ; preds = %0, %30
%77 = phi i64 [ %79, %30 ], [ 0, %0 ]
%78 = phi i64 [ %34, %30 ], [ 1, %0 ]
%79 = add nuw nsw i64 %77, 1
%80 = call i32 @strlen(i8* %2)
%81 = sext i32 %80 to i64
%82 = icmp slt i64 %79, %81
br i1 %82, label %83, label %30
83: ; preds = %76
%84 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 %77
br label %85
85: ; preds = %83, %96
%86 = phi i64 [ %78, %83 ], [ %97, %96 ]
%87 = load i8, i8* %84
%88 = call i64 @cardValue(i8 signext %87)
%89 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 %86
%90 = load i8, i8* %89
%91 = call i64 @cardValue(i8 signext %90)
%92 = icmp sgt i64 %88, %91
br i1 %92, label %93, label %96
93: ; preds = %85
%94 = load i8, i8* %84
%95 = load i8, i8* %89
store i8 %95, i8* %84
store i8 %94, i8* %89
br label %96
96: ; preds = %85, %93
%97 = add nuw nsw i64 %86, 1
%98 = call i32 @strlen(i8* %2)
%99 = trunc i64 %97 to i32
%100 = icmp sgt i32 %98, %99
br i1 %100, label %85, label %30
}