int cardPower(char card) {
  int power = 0;
  if (card >= 'A' && card <= 'Z') {
    if (card == 'A') {
      power = 14;
    } else if (card == 'K') {
      power = 13;
    } else if (card == 'Q') {
      power = 12;
    } else if (card == 'J') {
      power = 11;
    } else {
      power = 10;
    }
  } else {
    power = card - '0';
  }
  return power;
}


x86 assembly (clang, -O0):
<cardPower>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     11aa <cardPower+0xaa>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     11aa <cardPower+0xaa>
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jne    1144 <cardPower+0x44>
movl   $0xe,-0x8(%rbp)
jmp    11a5 <cardPower+0xa5>
movsbl -0x1(%rbp),%eax
cmp    $0x4b,%eax
jne    115d <cardPower+0x5d>
movl   $0xd,-0x8(%rbp)
jmp    11a0 <cardPower+0xa0>
movsbl -0x1(%rbp),%eax
cmp    $0x51,%eax
jne    1176 <cardPower+0x76>
movl   $0xc,-0x8(%rbp)
jmp    119b <cardPower+0x9b>
movsbl -0x1(%rbp),%eax
cmp    $0x4a,%eax
jne    118f <cardPower+0x8f>
movl   $0xb,-0x8(%rbp)
jmp    1196 <cardPower+0x96>
movl   $0xa,-0x8(%rbp)
jmp    119b <cardPower+0x9b>
jmp    11a0 <cardPower+0xa0>
jmp    11a5 <cardPower+0xa5>
jmp    11b4 <cardPower+0xb4>
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cardPower>:
lea    -0x41(%rdi),%ecx
cmp    $0x19,%cl
ja     112b <cardPower+0x2b>
cmp    $0x10,%cl
ja     1133 <cardPower+0x33>
mov    $0xe,%eax
movzbl %cl,%ecx
lea    0xee4(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0xb,%eax
ret
movsbl %dil,%eax
add    $0xffffffd0,%eax
ret
mov    $0xa,%eax
ret
mov    $0xd,%eax
ret
mov    $0xc,%eax
ret

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

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