int change(char d) {
  int t;
  if ((d == 'T') || (d == 'J') || (d == 'Q') || (d == 'K') || (d == 'A')) {
    switch (d) {
    case 'T':
      t = 10;
      break;
    case 'J':
      t = 11;
      break;
    case 'Q':
      t = 12;
      break;
    case 'K':
      t = 13;
      break;
    case 'A':
      t = 14;
      break;
    }
  } else {
    t = d - 48;
  }
  return t;
}


x86 assembly (clang, -O0):
<change>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x54,%eax
je     114b <change+0x4b>
movsbl -0x1(%rbp),%eax
cmp    $0x4a,%eax
je     114b <change+0x4b>
movsbl -0x1(%rbp),%eax
cmp    $0x51,%eax
je     114b <change+0x4b>
movsbl -0x1(%rbp),%eax
cmp    $0x4b,%eax
je     114b <change+0x4b>
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jne    11b1 <change+0xb1>
movsbl -0x1(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x13,%eax
ja     11ac <change+0xac>
mov    -0x10(%rbp),%rax
lea    0xe94(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0xa,-0x8(%rbp)
jmp    11ac <change+0xac>
movl   $0xb,-0x8(%rbp)
jmp    11ac <change+0xac>
movl   $0xc,-0x8(%rbp)
jmp    11ac <change+0xac>
movl   $0xd,-0x8(%rbp)
jmp    11ac <change+0xac>
movl   $0xe,-0x8(%rbp)
jmp    11bb <change+0xbb>
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<change>:
lea    -0x41(%rdi),%eax
cmp    $0x13,%al
ja     1138 <change+0x38>
movzbl %al,%eax
mov    $0x90601,%ecx
bt     %rax,%rcx
jae    1138 <change+0x38>
mov    $0xa,%eax
add    $0xffffffbf,%edi
cmp    $0x10,%edi
ja     113d <change+0x3d>
lea    0xed7(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0xe,%eax
ret
add    $0xffffffd0,%edi
mov    %edi,%eax
ret
mov    $0xb,%eax
ret
mov    $0xd,%eax
ret
mov    $0xc,%eax
ret

LLVM IR (-O0):
define i32 @change(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 84
br i1 %6, label %23, label %7
7: ; preds = %1
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 74
br i1 %10, label %23, label %11
11: ; preds = %7
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 81
br i1 %14, label %23, label %15
15: ; preds = %11
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 75
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 65
br i1 %22, label %23, label %32
23: ; preds = %19, %15, %11, %7, %1
%24 = load i8, i8* %2
%25 = sext i8 %24 to i32
switch i32 %25, label %31 [
i32 84, label %26
i32 74, label %27
i32 81, label %28
i32 75, label %29
i32 65, label %30
]
26: ; preds = %23
store i32 10, i32* %3
br label %31
27: ; preds = %23
store i32 11, i32* %3
br label %31
28: ; preds = %23
store i32 12, i32* %3
br label %31
29: ; preds = %23
store i32 13, i32* %3
br label %31
30: ; preds = %23
store i32 14, i32* %3
br label %31
31: ; preds = %23, %30, %29, %28, %27, %26
br label %36
32: ; preds = %19
%33 = load i8, i8* %2
%34 = sext i8 %33 to i32
%35 = sub nsw i32 %34, 48
store i32 %35, i32* %3
br label %36
36: ; preds = %32, %31
%37 = load i32, i32* %3
ret i32 %37
}

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