#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*/ printf(char *, ...);
scalar_t__ s(char);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  int i, z, t, x, y;
  char a[14], b[14] = "23456789TJQKA";
  printf("Enter cards:");
  scanf("%s", a);
  for (i = 0; i < strlen(a) - 1; i++) {
    t = 0;
    for (z = 0; z < strlen(b); z++) {
      if (a[i] == b[z]) {
        t = 1;
      }
    }
    if (t == 0) {
      printf("Invalid cards");
      return 0;
    }
  }
  for (x = 0; x < strlen(a); x++) {
    for (y = 0; y < strlen(a) - 1; y++) {
      if (s(a[y]) > s(a[y + 1])) {
        int temp = a[y + 1];
        a[y + 1] = a[y];
        a[y] = temp;
      }
    }
  }
  printf("%s\n", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x34(%rbp)
mov    0xea8(%rip),%eax
mov    %eax,-0x2c(%rbp)
mov    0xea2(%rip),%ax
mov    %ax,-0x28(%rbp)
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x26(%rbp),%rsi
lea    0xe94(%rip),%rdi
call   1060 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x3c(%rbp)
lea    -0x26(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1247 <main+0x107>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x40(%rbp)
lea    -0x34(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
cmp    %ecx,%eax
jge    1210 <main+0xd0>
movslq -0x8(%rbp),%rax
movsbl -0x26(%rbp,%rax,1),%eax
movslq -0xc(%rbp),%rcx
movsbl -0x34(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    11fd <main+0xbd>
movl   $0x1,-0x10(%rbp)
jmp    1202 <main+0xc2>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c0 <main+0x80>
cmpl   $0x0,-0x10(%rbp)
jne    1234 <main+0xf4>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1334 <main+0x1f4>
jmp    1239 <main+0xf9>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1193 <main+0x53>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x44(%rbp)
lea    -0x26(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
cmp    %ecx,%eax
jge    131b <main+0x1db>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x48(%rbp)
lea    -0x26(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1308 <main+0x1c8>
movslq -0x18(%rbp),%rax
movsbl -0x26(%rbp,%rax,1),%edi
call   1050 <s@plt>
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x26(%rbp,%rax,1),%edi
call   1050 <s@plt>
mov    %rax,%rcx
mov    -0x50(%rbp),%rax
cmp    %rcx,%rax
jle    12f5 <main+0x1b5>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x26(%rbp,%rax,1),%eax
mov    %eax,-0x38(%rbp)
movslq -0x18(%rbp),%rax
mov    -0x26(%rbp,%rax,1),%cl
mov    -0x18(%rbp),%eax
add    $0x1,%eax
cltq
mov    %cl,-0x26(%rbp,%rax,1)
mov    -0x38(%rbp),%eax
mov    %al,%cl
movslq -0x18(%rbp),%rax
mov    %cl,-0x26(%rbp,%rax,1)
jmp    12fa <main+0x1ba>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1271 <main+0x131>
jmp    130d <main+0x1cd>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    124e <main+0x10e>
lea    -0x26(%rbp),%rsi
lea    0xd06(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movabs $0x414b514a543938,%rax
mov    %rax,0x1e(%rsp)
movabs $0x3938373635343332,%rax
37 38 39
mov    %rax,0x18(%rsp)
lea    0xe8b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe8a(%rip),%rdi
lea    0xa(%rsp),%rbx
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     121f <main+0xcf>
xor    %r13d,%r13d
lea    0x18(%rsp),%r15
mov    $0x1,%r12d
lea    0xa(%rsp),%r14
xchg   %ax,%ax
mov    %r15,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    12b9 <main+0x169>
xor    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0xa(%rsp,%r13,1),%eax
cmp    0x18(%rsp,%rbp,1),%al
cmove  %r12d,%ebx
add    $0x1,%rbp
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbp
jl     11e0 <main+0x90>
test   %ebx,%ebx
je     12b9 <main+0x169>
add    $0x1,%r13
mov    %r14,%rdi
call   1040 <strlen@plt>
add    $0xffffffff,%eax
cltq
cmp    %rax,%r13
jl     11c0 <main+0x70>
lea    0xa(%rsp),%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    12ad <main+0x15d>
xor    %r15d,%r15d
lea    0xa(%rsp),%r14
jmp    1251 <main+0x101>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
mov    %r14,%rdi
call   1040 <strlen@plt>
cmp    %eax,%r15d
jge    12ad <main+0x15d>
mov    %r14,%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     1240 <main+0xf0>
xor    %ebp,%ebp
jmp    1285 <main+0x135>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1040 <strlen@plt>
add    $0xffffffff,%eax
cltq
mov    %rbx,%rbp
cmp    %rax,%rbx
jge    1240 <main+0xf0>
movsbl 0xa(%rsp,%rbp,1),%edi
call   1060 <s@plt>
mov    %rax,%r12
lea    0x1(%rbp),%rbx
movsbl 0xb(%rsp,%rbp,1),%edi
call   1060 <s@plt>
cmp    %rax,%r12
jle    1270 <main+0x120>
rolw   $0x8,0xa(%rsp,%rbp,1)
jmp    1270 <main+0x120>
lea    0xa(%rsp),%rdi
call   1030 <puts@plt>
jmp    12c7 <main+0x177>
lea    0xd5e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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