#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 *, char, char);
int /*<<< orphan*/ scanf(char *, char *, char *);
int main(void) {
  char c0_dig, c0_suit, c1_dig, c1_suit;
  int c0_val, c1_val;
  scanf("%c %c ", &c0_dig, &c0_suit);
  scanf("%c %c ", &c1_dig, &c1_suit);
  switch (c0_dig) {
  case 'A':
    c0_val = 14;
    break;
  case 'K':
    c0_val = 13;
    break;
  case 'Q':
    c0_val = 12;
    break;
  case 'J':
    c0_val = 11;
    break;
  case '0':
    c0_val = 10;
    break;
  default:
    c0_val = c0_dig - '0';
  }
  switch (c1_dig) {
  case 'A':
    c1_val = 14;
    break;
  case 'K':
    c1_val = 13;
    break;
  case 'Q':
    c1_val = 12;
    break;
  case 'J':
    c1_val = 11;
    break;
  case '0':
    c1_val = 10;
    break;
  default:
    c1_val = c1_dig - '0';
  }
  if (c0_val > c1_val || (c0_val == c1_val && c0_suit < c1_suit))
    printf("%c %c\n", c0_dig, c0_suit);
  else
    printf("%c %c\n", c1_dig, c1_suit);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xfda(%rip),%rdi
mov    %rdi,-0x20(%rbp)
lea    -0x5(%rbp),%rsi
lea    -0x6(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x20(%rbp),%rdi
lea    -0x7(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <scanf@plt>
movsbl -0x5(%rbp),%eax
add    $0xffffffd0,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x21,%eax
ja     11be <main+0x9e>
mov    -0x18(%rbp),%rax
lea    0xe87(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0xe,-0xc(%rbp)
jmp    11c8 <main+0xa8>
movl   $0xd,-0xc(%rbp)
jmp    11c8 <main+0xa8>
movl   $0xc,-0xc(%rbp)
jmp    11c8 <main+0xa8>
movl   $0xb,-0xc(%rbp)
jmp    11c8 <main+0xa8>
movl   $0xa,-0xc(%rbp)
jmp    11c8 <main+0xa8>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
movsbl -0x7(%rbp),%eax
add    $0xffffffd0,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x21,%eax
ja     122e <main+0x10e>
mov    -0x28(%rbp),%rax
lea    0xe9f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0xe,-0x10(%rbp)
jmp    1238 <main+0x118>
movl   $0xd,-0x10(%rbp)
jmp    1238 <main+0x118>
movl   $0xc,-0x10(%rbp)
jmp    1238 <main+0x118>
movl   $0xb,-0x10(%rbp)
jmp    1238 <main+0x118>
movl   $0xa,-0x10(%rbp)
jmp    1238 <main+0x118>
movsbl -0x7(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1260 <main+0x140>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    127b <main+0x15b>
movsbl -0x6(%rbp),%eax
movsbl -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    127b <main+0x15b>
mov    -0x5(%rbp),%al
lea    0xead(%rip),%rdi
movsbl %al,%esi
movsbl -0x6(%rbp),%edx
call   1030 <printf@plt>
jmp    1291 <main+0x171>
mov    -0x7(%rbp),%al
lea    0xe92(%rip),%rdi
movsbl %al,%esi
movsbl -0x8(%rbp),%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xfe4(%rip),%rbx
lea    0xf(%rsp),%rsi
lea    0xd(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xe(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <scanf@plt>
movsbl 0xf(%rsp),%esi
lea    -0x30(%rsi),%eax
cmp    $0x21,%eax
ja     1179 <main+0x59>
mov    $0xe,%ecx
lea    0xe97(%rip),%rdx
movslq (%rdx,%rax,4),%rdi
add    %rdx,%rdi
jmp    *%rdi
mov    $0xa,%ecx
jmp    1190 <main+0x70>
mov    %eax,%ecx
jmp    1190 <main+0x70>
mov    $0xb,%ecx
jmp    1190 <main+0x70>
mov    $0xd,%ecx
jmp    1190 <main+0x70>
mov    $0xc,%ecx
movsbl 0xe(%rsp),%r8d
lea    -0x30(%r8),%edi
cmp    $0x21,%edi
ja     11bf <main+0x9f>
mov    $0xe,%edx
lea    0xedd(%rip),%rbx
movslq (%rbx,%rdi,4),%rax
add    %rbx,%rax
jmp    *%rax
mov    $0xa,%edx
cmp    %edx,%ecx
jg     11db <main+0xbb>
jmp    11ea <main+0xca>
mov    %edi,%edx
cmp    %edx,%ecx
jg     11db <main+0xbb>
jmp    11ea <main+0xca>
mov    $0xb,%edx
cmp    %edx,%ecx
jg     11db <main+0xbb>
jmp    11ea <main+0xca>
mov    $0xd,%edx
cmp    %edx,%ecx
jle    11ea <main+0xca>
mov    0xd(%rsp),%cl
jmp    11f8 <main+0xd8>
mov    $0xc,%edx
cmp    %edx,%ecx
jg     11db <main+0xbb>
jne    1204 <main+0xe4>
mov    0xd(%rsp),%cl
mov    0xc(%rsp),%dl
cmp    %dl,%cl
jge    1208 <main+0xe8>
movsbl %cl,%edx
lea    0xf15(%rip),%rdi
jmp    1215 <main+0xf5>
mov    0xc(%rsp),%dl
movsbl %dl,%edx
lea    0xf05(%rip),%rdi
mov    %r8d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%c %c \00"
@.str.1 = [7 x i8] c"%c %c\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
%7 = load i8, i8* %1
%8 = sext i8 %7 to i32
switch i32 %8, label %13 [
i32 65, label %15
i32 75, label %9
i32 81, label %10
i32 74, label %11
i32 48, label %12
]
9: ; preds = %0
br label %15
10: ; preds = %0
br label %15
11: ; preds = %0
br label %15
12: ; preds = %0
br label %15
13: ; preds = %0
%14 = add nsw i32 %8, -48
br label %15
15: ; preds = %0, %13, %12, %11, %10, %9
%16 = phi i32 [ %14, %13 ], [ 10, %12 ], [ 11, %11 ], [ 12, %10 ], [ 13, %9 ], [ 14, %0 ]
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
switch i32 %18, label %23 [
i32 65, label %25
i32 75, label %19
i32 81, label %20
i32 74, label %21
i32 48, label %22
]
19: ; preds = %15
br label %25
20: ; preds = %15
br label %25
21: ; preds = %15
br label %25
22: ; preds = %15
br label %25
23: ; preds = %15
%24 = add nsw i32 %18, -48
br label %25
25: ; preds = %15, %23, %22, %21, %20, %19
%26 = phi i32 [ %24, %23 ], [ 10, %22 ], [ 11, %21 ], [ 12, %20 ], [ 13, %19 ], [ 14, %15 ]
%27 = icmp sgt i32 %16, %26
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = load i8, i8* %2
br label %38
30: ; preds = %25
%31 = icmp eq i32 %16, %26
br i1 %31, label %34, label %32
32: ; preds = %30
%33 = load i8, i8* %4
br label %41
34: ; preds = %30
%35 = load i8, i8* %2
%36 = load i8, i8* %4
%37 = icmp slt i8 %35, %36
br i1 %37, label %38, label %41
38: ; preds = %28, %34
%39 = phi i8 [ %29, %28 ], [ %35, %34 ]
%40 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8 signext %7, i8 signext %39)
br label %44
41: ; preds = %32, %34
%42 = phi i8 [ %33, %32 ], [ %36, %34 ]
%43 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8 signext %17, i8 signext %42)
br label %44
44: ; preds = %41, %38
ret i32 0
}