#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 */
struct uc_program {
  int dummy;
};

/* Variables and functions */
int uc_program_current_character(struct uc_program *);
char uc_integer_digit(struct uc_program *program) {
  switch (uc_program_current_character(program)) {
  case 'A':
    return '0';
  case 'B':
    return '1';
  case 'C':
    return '2';
  case 'D':
    return '3';
  case 'F':
    return '4';
  case 'G':
    return '5';
  case 'H':
    return '6';
  case 'I':
    return '7';
  case 'J':
    return '8';
  case 'K':
    return '9';
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<uc_integer_digit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <uc_program_current_character@plt>
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xa,%eax
ja     11a5 <uc_integer_digit+0x95>
mov    -0x18(%rbp),%rax
lea    0xebe(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x30,-0x1(%rbp)
jmp    11a9 <uc_integer_digit+0x99>
movb   $0x31,-0x1(%rbp)
jmp    11a9 <uc_integer_digit+0x99>
movb   $0x32,-0x1(%rbp)
jmp    11a9 <uc_integer_digit+0x99>
movb   $0x33,-0x1(%rbp)
jmp    11a9 <uc_integer_digit+0x99>
movb   $0x34,-0x1(%rbp)
jmp    11a9 <uc_integer_digit+0x99>
movb   $0x35,-0x1(%rbp)
jmp    11a9 <uc_integer_digit+0x99>
movb   $0x36,-0x1(%rbp)
jmp    11a9 <uc_integer_digit+0x99>
movb   $0x37,-0x1(%rbp)
jmp    11a9 <uc_integer_digit+0x99>
movb   $0x38,-0x1(%rbp)
jmp    11a9 <uc_integer_digit+0x99>
movb   $0x39,-0x1(%rbp)
jmp    11a9 <uc_integer_digit+0x99>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uc_integer_digit>:
push   %rax
call   1030 <uc_program_current_character@plt>
add    $0xffffffbf,%eax
cmp    $0xa,%eax
ja     112c <uc_integer_digit+0x1c>
cltq
lea    0xed9(%rip),%rcx
mov    (%rax,%rcx,1),%al
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.uc_program = type { i32 }
define signext i8 @uc_integer_digit(%struct.uc_program* %0) {
%2 = alloca i8
%3 = alloca %struct.uc_program*
store %struct.uc_program* %0, %struct.uc_program** %3
%4 = load %struct.uc_program*, %struct.uc_program** %3
%5 = call i32 @uc_program_current_character(%struct.uc_program* %4)
switch i32 %5, label %16 [
i32 65, label %6
i32 66, label %7
i32 67, label %8
i32 68, label %9
i32 70, label %10
i32 71, label %11
i32 72, label %12
i32 73, label %13
i32 74, label %14
i32 75, label %15
]
6: ; preds = %1
store i8 48, i8* %2
br label %17
7: ; preds = %1
store i8 49, i8* %2
br label %17
8: ; preds = %1
store i8 50, i8* %2
br label %17
9: ; preds = %1
store i8 51, i8* %2
br label %17
10: ; preds = %1
store i8 52, i8* %2
br label %17
11: ; preds = %1
store i8 53, i8* %2
br label %17
12: ; preds = %1
store i8 54, i8* %2
br label %17
13: ; preds = %1
store i8 55, i8* %2
br label %17
14: ; preds = %1
store i8 56, i8* %2
br label %17
15: ; preds = %1
store i8 57, i8* %2
br label %17
16: ; preds = %1
store i8 0, i8* %2
br label %17
17: ; preds = %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6
%18 = load i8, i8* %2
ret i8 %18
}

LLVM IR (-O2):
%struct.uc_program = type { i32 }
@switch.table.uc_integer_digit = [11 x i8] c"0123\00456789"
define signext i8 @uc_integer_digit(%struct.uc_program* %0) {
%2 = tail call i32 @uc_program_current_character(%struct.uc_program* %0)
%3 = add i32 %2, -65
%4 = icmp ult i32 %3, 11
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [11 x i8], [11 x i8]* @switch.table.uc_integer_digit, i64 0, i64 %6
%8 = load i8, i8* %7
br label %9
9: ; preds = %1, %5
%10 = phi i8 [ %8, %5 ], [ 0, %1 ]
ret i8 %10
}