#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 */
typedef char uint;

/* Variables and functions */
uint card(char type, char number) {
  type -= 48;
  switch (number) {
  case 'o':
    number = 10;
    break;
  case 'j':
    number = 11;
    break;
  case 'q':
    number = 12;
    break;
  case 'k':
    number = 13;
    break;
  case 'a':
    number = 14;
    break;
  default:
    number -= 48;
  }
  return type * 100 + number;
}


x86 assembly (clang, -O0):
<card>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    -0x1(%rbp),%al
add    $0xd0,%al
mov    %al,-0x1(%rbp)
movsbl -0x2(%rbp),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x10,%eax
ja     116f <card+0x6f>
mov    -0x10(%rbp),%rax
lea    0xec7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0xa,-0x2(%rbp)
jmp    1179 <card+0x79>
movb   $0xb,-0x2(%rbp)
jmp    1179 <card+0x79>
movb   $0xc,-0x2(%rbp)
jmp    1179 <card+0x79>
movb   $0xd,-0x2(%rbp)
jmp    1179 <card+0x79>
movb   $0xe,-0x2(%rbp)
jmp    1179 <card+0x79>
movsbl -0x2(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
imul   $0x64,%eax,%eax
movsbl -0x2(%rbp),%ecx
add    %ecx,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<card>:
lea    -0x61(%rsi),%eax
cmp    $0x10,%eax
ja     1124 <card+0x24>
mov    $0xa,%ecx
lea    0xeec(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
mov    $0xe,%ecx
jmp    1141 <card+0x41>
add    $0xd0,%sil
movsbl %sil,%ecx
jmp    1141 <card+0x41>
mov    $0xb,%ecx
jmp    1141 <card+0x41>
mov    $0xd,%ecx
jmp    1141 <card+0x41>
mov    $0xc,%ecx
add    $0xd0,%dil
movzbl %dil,%eax
imul   $0x64,%eax,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @card(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %6, 48
%8 = trunc i32 %7 to i8
store i8 %8, i8* %3
%9 = load i8, i8* %4
%10 = sext i8 %9 to i32
switch i32 %10, label %16 [
i32 111, label %11
i32 106, label %12
i32 113, label %13
i32 107, label %14
i32 97, label %15
]
11: ; preds = %2
store i8 10, i8* %4
br label %21
12: ; preds = %2
store i8 11, i8* %4
br label %21
13: ; preds = %2
store i8 12, i8* %4
br label %21
14: ; preds = %2
store i8 13, i8* %4
br label %21
15: ; preds = %2
store i8 14, i8* %4
br label %21
16: ; preds = %2
%17 = load i8, i8* %4
%18 = sext i8 %17 to i32
%19 = sub nsw i32 %18, 48
%20 = trunc i32 %19 to i8
store i8 %20, i8* %4
br label %21
21: ; preds = %16, %15, %14, %13, %12, %11
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = mul nsw i32 %23, 100
%25 = load i8, i8* %4
%26 = sext i8 %25 to i32
%27 = add nsw i32 %24, %26
%28 = trunc i32 %27 to i8
ret i8 %28
}

LLVM IR (-O2):
define signext i8 @card(i8 signext %0, i8 signext %1) {
%3 = sext i8 %1 to i32
switch i32 %3, label %8 [
i32 111, label %12
i32 106, label %4
i32 113, label %5
i32 107, label %6
i32 97, label %7
]
4: ; preds = %2
br label %12
5: ; preds = %2
br label %12
6: ; preds = %2
br label %12
7: ; preds = %2
br label %12
8: ; preds = %2
%9 = shl nsw i32 %3, 24
%10 = add i32 %9, -805306368
%11 = ashr exact i32 %10, 24
br label %12
12: ; preds = %2, %8, %7, %6, %5, %4
%13 = phi i32 [ %11, %8 ], [ 14, %7 ], [ 13, %6 ], [ 12, %5 ], [ 11, %4 ], [ 10, %2 ]
%14 = add i8 %0, -48
%15 = zext i8 %14 to i32
%16 = mul nuw nsw i32 %15, 100
%17 = add nsw i32 %13, %16
%18 = trunc i32 %17 to i8
ret i8 %18
}