#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*/ assert(int);
char _Card_rank_letter(int rank) {
  assert(0 < rank && rank <= 13);
  switch (rank) {
  case 1:
    return 'A';
  case 10:
    return 'T';
  case 11:
    return 'J';
  case 12:
    return 'Q';
  case 13:
    return 'K';
  default:
    return '0' + rank;
  }
}


x86 assembly (clang, -O0):
<_Card_rank_letter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x8(%rbp),%ecx
mov    %al,-0x9(%rbp)
jge    1135 <_Card_rank_letter+0x25>
cmpl   $0xd,-0x8(%rbp)
setle  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
movzbl %al,%edi
and    $0x1,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xc,%eax
ja     1199 <_Card_rank_letter+0x89>
mov    -0x18(%rbp),%rax
lea    0xe9d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x41,-0x1(%rbp)
jmp    11a2 <_Card_rank_letter+0x92>
movb   $0x54,-0x1(%rbp)
jmp    11a2 <_Card_rank_letter+0x92>
movb   $0x4a,-0x1(%rbp)
jmp    11a2 <_Card_rank_letter+0x92>
movb   $0x51,-0x1(%rbp)
jmp    11a2 <_Card_rank_letter+0x92>
movb   $0x4b,-0x1(%rbp)
jmp    11a2 <_Card_rank_letter+0x92>
mov    -0x8(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_Card_rank_letter>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
lea    -0x1(%r14),%ebx
xor    %edi,%edi
cmp    $0xd,%ebx
setb   %dil
call   1030 <assert@plt>
cmp    $0xc,%ebx
ja     1144 <_Card_rank_letter+0x34>
mov    $0x41,%al
lea    0xec9(%rip),%rcx
movslq (%rcx,%rbx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x54,%al
jmp    1157 <_Card_rank_letter+0x47>
add    $0x30,%r14b
mov    %r14d,%eax
jmp    1157 <_Card_rank_letter+0x47>
mov    $0x4a,%al
jmp    1157 <_Card_rank_letter+0x47>
mov    $0x51,%al
jmp    1157 <_Card_rank_letter+0x47>
mov    $0x4b,%al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define signext i8 @_Card_rank_letter(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 0, %4
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 13
br label %9
9: ; preds = %6, %1
%10 = phi i1 [ false, %1 ], [ %8, %6 ]
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32, i32* %3
switch i32 %13, label %19 [
i32 1, label %14
i32 10, label %15
i32 11, label %16
i32 12, label %17
i32 13, label %18
]
14: ; preds = %9
store i8 65, i8* %2
br label %23
15: ; preds = %9
store i8 84, i8* %2
br label %23
16: ; preds = %9
store i8 74, i8* %2
br label %23
17: ; preds = %9
store i8 81, i8* %2
br label %23
18: ; preds = %9
store i8 75, i8* %2
br label %23
19: ; preds = %9
%20 = load i32, i32* %3
%21 = add nsw i32 48, %20
%22 = trunc i32 %21 to i8
store i8 %22, i8* %2
br label %23
23: ; preds = %19, %18, %17, %16, %15, %14
%24 = load i8, i8* %2
ret i8 %24
}

LLVM IR (-O2):
define signext i8 @_Card_rank_letter(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 13
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
switch i32 %0, label %10 [
i32 1, label %13
i32 10, label %6
i32 11, label %7
i32 12, label %8
i32 13, label %9
]
6: ; preds = %1
br label %13
7: ; preds = %1
br label %13
8: ; preds = %1
br label %13
9: ; preds = %1
br label %13
10: ; preds = %1
%11 = trunc i32 %0 to i8
%12 = add i8 %11, 48
br label %13
13: ; preds = %1, %10, %9, %8, %7, %6
%14 = phi i8 [ %12, %10 ], [ 75, %9 ], [ 81, %8 ], [ 74, %7 ], [ 84, %6 ], [ 65, %1 ]
ret i8 %14
}