#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[13], b[13] = "23456789TJQKA", temp;
  printf("Enter cards:");
  scanf("%s", &a);
  for (i = 0; i < strlen(a) - 1; i++) {
    t = 0;
    for (z = 0; z < strlen(b) - 1; 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,-0x32(%rbp)
mov    0xea8(%rip),%eax
mov    %eax,-0x2a(%rbp)
mov    0xea3(%rip),%al
mov    %al,-0x26(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x25(%rbp),%rsi
lea    0xe95(%rip),%rdi
call   1060 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x3c(%rbp)
lea    -0x25(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1248 <main+0x108>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x40(%rbp)
lea    -0x32(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1211 <main+0xd1>
movslq -0x8(%rbp),%rax
movsbl -0x25(%rbp,%rax,1),%eax
movslq -0xc(%rbp),%rcx
movsbl -0x32(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    11fe <main+0xbe>
movl   $0x1,-0x10(%rbp)
jmp    1203 <main+0xc3>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11be <main+0x7e>
cmpl   $0x0,-0x10(%rbp)
jne    1235 <main+0xf5>
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1335 <main+0x1f5>
jmp    123a <main+0xfa>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1191 <main+0x51>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x44(%rbp)
lea    -0x25(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
cmp    %ecx,%eax
jge    131c <main+0x1dc>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x48(%rbp)
lea    -0x25(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1309 <main+0x1c9>
movslq -0x18(%rbp),%rax
movsbl -0x25(%rbp,%rax,1),%edi
call   1050 <s@plt>
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x25(%rbp,%rax,1),%edi
call   1050 <s@plt>
mov    %rax,%rcx
mov    -0x50(%rbp),%rax
cmp    %rcx,%rax
jle    12f6 <main+0x1b6>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x25(%rbp,%rax,1),%eax
mov    %eax,-0x38(%rbp)
movslq -0x18(%rbp),%rax
mov    -0x25(%rbp,%rax,1),%cl
mov    -0x18(%rbp),%eax
add    $0x1,%eax
cltq
mov    %cl,-0x25(%rbp,%rax,1)
mov    -0x38(%rbp),%eax
mov    %al,%cl
movslq -0x18(%rbp),%rax
mov    %cl,-0x25(%rbp,%rax,1)
jmp    12fb <main+0x1bb>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1272 <main+0x132>
jmp    130e <main+0x1ce>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    124f <main+0x10f>
lea    -0x25(%rbp),%rsi
lea    0xd04(%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 $0x414b514a54393837,%rax
51 4b 41
mov    %rax,0x1d(%rsp)
movabs $0x3938373635343332,%rax
37 38 39
mov    %rax,0x18(%rsp)
lea    0xe8a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe89(%rip),%rdi
lea    0xb(%rsp),%rbx
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     1222 <main+0xd2>
xor    %r13d,%r13d
lea    0x18(%rsp),%r15
mov    $0x1,%r12d
lea    0xb(%rsp),%r14
xchg   %ax,%ax
mov    %r15,%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     12b9 <main+0x169>
xor    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl 0xb(%rsp,%r13,1),%eax
cmp    0x18(%rsp,%rbp,1),%al
cmove  %r12d,%ebx
add    $0x1,%rbp
mov    %r15,%rdi
call   1040 <strlen@plt>
add    $0xffffffff,%eax
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    0xb(%rsp),%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    12ad <main+0x15d>
xor    %r15d,%r15d
lea    0xb(%rsp),%r14
jmp    1251 <main+0x101>
xchg   %ax,%ax
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 0xb(%rsp,%rbp,1),%edi
call   1060 <s@plt>
mov    %rax,%r12
lea    0x1(%rbp),%rbx
movsbl 0xc(%rsp,%rbp,1),%edi
call   1060 <s@plt>
cmp    %rax,%r12
jle    1270 <main+0x120>
rolw   $0x8,0xb(%rsp,%rbp,1)
jmp    1270 <main+0x120>
lea    0xb(%rsp),%rdi
call   1030 <puts@plt>
jmp    12c7 <main+0x177>
lea    0xd5d(%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 = [13 x i8] c"23456789TJQKA"
@.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 [13 x i8]
%8 = alloca [13 x i8]
%9 = alloca i8
%10 = alloca i32
store i32 0, i32* %1
%11 = bitcast [13 x i8]* %8 to i8*
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%13 = bitcast [13 x i8]* %7 to i8**
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %13)
store i32 0, i32* %2
br label %15
15: ; preds = %51, %0
%16 = load i32, i32* %2
%17 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 0
%18 = call i32 @strlen(i8* %17)
%19 = sub nsw i32 %18, 1
%20 = icmp slt i32 %16, %19
br i1 %20, label %21, label %54
21: ; preds = %15
store i32 0, i32* %4
store i32 0, i32* %3
br label %22
22: ; preds = %42, %21
%23 = load i32, i32* %3
%24 = getelementptr inbounds [13 x i8], [13 x i8]* %8, i64 0, i64 0
%25 = call i32 @strlen(i8* %24)
%26 = sub nsw i32 %25, 1
%27 = icmp slt i32 %23, %26
br i1 %27, label %28, label %45
28: ; preds = %22
%29 = load i32, i32* %2
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [13 x i8], [13 x i8]* %8, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %33, %38
br i1 %39, label %40, label %41
40: ; preds = %28
store i32 1, i32* %4
br label %41
41: ; preds = %40, %28
br label %42
42: ; preds = %41
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
store i32 %44, i32* %3
br label %22
45: ; preds = %22
%46 = load i32, i32* %4
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = 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 %111
50: ; preds = %45
br label %51
51: ; preds = %50
%52 = load i32, i32* %2
%53 = add nsw i32 %52, 1
store i32 %53, i32* %2
br label %15
54: ; preds = %15
store i32 0, i32* %5
br label %55
55: ; preds = %105, %54
%56 = load i32, i32* %5
%57 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 0
%58 = call i32 @strlen(i8* %57)
%59 = icmp slt i32 %56, %58
br i1 %59, label %60, label %108
60: ; preds = %55
store i32 0, i32* %6
br label %61
61: ; preds = %101, %60
%62 = load i32, i32* %6
%63 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 0
%64 = call i32 @strlen(i8* %63)
%65 = sub nsw i32 %64, 1
%66 = icmp slt i32 %62, %65
br i1 %66, label %67, label %104
67: ; preds = %61
%68 = load i32, i32* %6
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 %69
%71 = load i8, i8* %70
%72 = call i64 @s(i8 signext %71)
%73 = load i32, i32* %6
%74 = add nsw i32 %73, 1
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 %75
%77 = load i8, i8* %76
%78 = call i64 @s(i8 signext %77)
%79 = icmp sgt i64 %72, %78
br i1 %79, label %80, label %100
80: ; preds = %67
%81 = load i32, i32* %6
%82 = add nsw i32 %81, 1
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 %83
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
store i32 %86, i32* %10
%87 = load i32, i32* %6
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 %88
%90 = load i8, i8* %89
%91 = load i32, i32* %6
%92 = add nsw i32 %91, 1
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 %93
store i8 %90, i8* %94
%95 = load i32, i32* %10
%96 = trunc i32 %95 to i8
%97 = load i32, i32* %6
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 %98
store i8 %96, i8* %99
br label %100
100: ; preds = %80, %67
br label %101
101: ; preds = %100
%102 = load i32, i32* %6
%103 = add nsw i32 %102, 1
store i32 %103, i32* %6
br label %61
104: ; preds = %61
br label %105
105: ; preds = %104
%106 = load i32, i32* %5
%107 = add nsw i32 %106, 1
store i32 %107, i32* %5
br label %55
108: ; preds = %55
%109 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 0
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %109)
store i32 0, i32* %1
br label %111
111: ; preds = %108, %48
%112 = load i32, i32* %1
ret i32 %112
}

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