#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 */
float toupper(unsigned char);
unsigned char Bdf_Hex2Bin(unsigned char c) {
  int b;
  if (c == '0') {
    b = 0;
  } else if (c == '1') {
    b = 1;
  } else if (c == '2') {
    b = 2;
  } else if (c == '3') {
    b = 3;
  } else if (c == '4') {
    b = 4;
  } else if (c == '5') {
    b = 5;
  } else if (c == '6') {
    b = 6;
  } else if (c == '7') {
    b = 7;
  } else if (c == '8') {
    b = 8;
  } else if (c == '9') {
    b = 9;
  } else if (toupper(c) == 'A') {
    b = 10;
  } else if (toupper(c) == 'B') {
    b = 11;
  } else if (toupper(c) == 'C') {
    b = 12;
  } else if (toupper(c) == 'D') {
    b = 13;
  } else if (toupper(c) == 'E') {
    b = 14;
  } else if (toupper(c) == 'F') {
    b = 15;
  }
  return b;
}


x86 assembly (clang, -O0):
<Bdf_Hex2Bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jne    1137 <Bdf_Hex2Bin+0x27>
movl   $0x0,-0x8(%rbp)
jmp    1366 <Bdf_Hex2Bin+0x256>
movzbl -0x1(%rbp),%eax
cmp    $0x31,%eax
jne    1150 <Bdf_Hex2Bin+0x40>
movl   $0x1,-0x8(%rbp)
jmp    1361 <Bdf_Hex2Bin+0x251>
movzbl -0x1(%rbp),%eax
cmp    $0x32,%eax
jne    1169 <Bdf_Hex2Bin+0x59>
movl   $0x2,-0x8(%rbp)
jmp    135c <Bdf_Hex2Bin+0x24c>
movzbl -0x1(%rbp),%eax
cmp    $0x33,%eax
jne    1182 <Bdf_Hex2Bin+0x72>
movl   $0x3,-0x8(%rbp)
jmp    1357 <Bdf_Hex2Bin+0x247>
movzbl -0x1(%rbp),%eax
cmp    $0x34,%eax
jne    119b <Bdf_Hex2Bin+0x8b>
movl   $0x4,-0x8(%rbp)
jmp    1352 <Bdf_Hex2Bin+0x242>
movzbl -0x1(%rbp),%eax
cmp    $0x35,%eax
jne    11b4 <Bdf_Hex2Bin+0xa4>
movl   $0x5,-0x8(%rbp)
jmp    134d <Bdf_Hex2Bin+0x23d>
movzbl -0x1(%rbp),%eax
cmp    $0x36,%eax
jne    11cd <Bdf_Hex2Bin+0xbd>
movl   $0x6,-0x8(%rbp)
jmp    1348 <Bdf_Hex2Bin+0x238>
movzbl -0x1(%rbp),%eax
cmp    $0x37,%eax
jne    11e6 <Bdf_Hex2Bin+0xd6>
movl   $0x7,-0x8(%rbp)
jmp    1343 <Bdf_Hex2Bin+0x233>
movzbl -0x1(%rbp),%eax
cmp    $0x38,%eax
jne    11ff <Bdf_Hex2Bin+0xef>
movl   $0x8,-0x8(%rbp)
jmp    133e <Bdf_Hex2Bin+0x22e>
movzbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jne    1218 <Bdf_Hex2Bin+0x108>
movl   $0x9,-0x8(%rbp)
jmp    1339 <Bdf_Hex2Bin+0x229>
movzbl -0x1(%rbp),%edi
call   1030 <toupper@plt>
movss  0xdd7(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1244 <Bdf_Hex2Bin+0x134>
jp     1244 <Bdf_Hex2Bin+0x134>
movl   $0xa,-0x8(%rbp)
jmp    1334 <Bdf_Hex2Bin+0x224>
movzbl -0x1(%rbp),%edi
call   1030 <toupper@plt>
movss  0xdaf(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1270 <Bdf_Hex2Bin+0x160>
jp     1270 <Bdf_Hex2Bin+0x160>
movl   $0xb,-0x8(%rbp)
jmp    132f <Bdf_Hex2Bin+0x21f>
movzbl -0x1(%rbp),%edi
call   1030 <toupper@plt>
movss  0xd87(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    129c <Bdf_Hex2Bin+0x18c>
jp     129c <Bdf_Hex2Bin+0x18c>
movl   $0xc,-0x8(%rbp)
jmp    132a <Bdf_Hex2Bin+0x21a>
movzbl -0x1(%rbp),%edi
call   1030 <toupper@plt>
movss  0xd5f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    12c8 <Bdf_Hex2Bin+0x1b8>
jp     12c8 <Bdf_Hex2Bin+0x1b8>
movl   $0xd,-0x8(%rbp)
jmp    1325 <Bdf_Hex2Bin+0x215>
movzbl -0x1(%rbp),%edi
call   1030 <toupper@plt>
movss  0xd37(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    12f4 <Bdf_Hex2Bin+0x1e4>
jp     12f4 <Bdf_Hex2Bin+0x1e4>
movl   $0xe,-0x8(%rbp)
jmp    1320 <Bdf_Hex2Bin+0x210>
movzbl -0x1(%rbp),%edi
call   1030 <toupper@plt>
movss  0xd0f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    131b <Bdf_Hex2Bin+0x20b>
jp     131b <Bdf_Hex2Bin+0x20b>
movl   $0xf,-0x8(%rbp)
jmp    1320 <Bdf_Hex2Bin+0x210>
jmp    1325 <Bdf_Hex2Bin+0x215>
jmp    132a <Bdf_Hex2Bin+0x21a>
jmp    132f <Bdf_Hex2Bin+0x21f>
jmp    1334 <Bdf_Hex2Bin+0x224>
jmp    1339 <Bdf_Hex2Bin+0x229>
jmp    133e <Bdf_Hex2Bin+0x22e>
jmp    1343 <Bdf_Hex2Bin+0x233>
jmp    1348 <Bdf_Hex2Bin+0x238>
jmp    134d <Bdf_Hex2Bin+0x23d>
jmp    1352 <Bdf_Hex2Bin+0x242>
jmp    1357 <Bdf_Hex2Bin+0x247>
jmp    135c <Bdf_Hex2Bin+0x24c>
jmp    1361 <Bdf_Hex2Bin+0x251>
jmp    1366 <Bdf_Hex2Bin+0x256>
mov    -0x8(%rbp),%eax
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Bdf_Hex2Bin>:
push   %rbx
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
jb     1130 <Bdf_Hex2Bin+0x20>
movzbl %dil,%ebx
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    $0xa,%al
ucomiss 0xed4(%rip),%xmm0
jne    1132 <Bdf_Hex2Bin+0x22>
jp     1132 <Bdf_Hex2Bin+0x22>
pop    %rbx
ret
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    $0xb,%al
ucomiss 0xec2(%rip),%xmm0
jne    1146 <Bdf_Hex2Bin+0x36>
jnp    1130 <Bdf_Hex2Bin+0x20>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    $0xc,%al
ucomiss 0xeb2(%rip),%xmm0
jne    115a <Bdf_Hex2Bin+0x4a>
jnp    1130 <Bdf_Hex2Bin+0x20>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    $0xd,%al
ucomiss 0xea2(%rip),%xmm0
jne    116e <Bdf_Hex2Bin+0x5e>
jnp    1130 <Bdf_Hex2Bin+0x20>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    $0xe,%al
ucomiss 0xe92(%rip),%xmm0
jne    1182 <Bdf_Hex2Bin+0x72>
jnp    1130 <Bdf_Hex2Bin+0x20>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    $0xf,%al
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i8 @Bdf_Hex2Bin(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = icmp eq i32 %5, 48
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %3
br label %98
8: ; preds = %1
%9 = load i8, i8* %2
%10 = zext i8 %9 to i32
%11 = icmp eq i32 %10, 49
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 1, i32* %3
br label %97
13: ; preds = %8
%14 = load i8, i8* %2
%15 = zext i8 %14 to i32
%16 = icmp eq i32 %15, 50
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 2, i32* %3
br label %96
18: ; preds = %13
%19 = load i8, i8* %2
%20 = zext i8 %19 to i32
%21 = icmp eq i32 %20, 51
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 3, i32* %3
br label %95
23: ; preds = %18
%24 = load i8, i8* %2
%25 = zext i8 %24 to i32
%26 = icmp eq i32 %25, 52
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 4, i32* %3
br label %94
28: ; preds = %23
%29 = load i8, i8* %2
%30 = zext i8 %29 to i32
%31 = icmp eq i32 %30, 53
br i1 %31, label %32, label %33
32: ; preds = %28
store i32 5, i32* %3
br label %93
33: ; preds = %28
%34 = load i8, i8* %2
%35 = zext i8 %34 to i32
%36 = icmp eq i32 %35, 54
br i1 %36, label %37, label %38
37: ; preds = %33
store i32 6, i32* %3
br label %92
38: ; preds = %33
%39 = load i8, i8* %2
%40 = zext i8 %39 to i32
%41 = icmp eq i32 %40, 55
br i1 %41, label %42, label %43
42: ; preds = %38
store i32 7, i32* %3
br label %91
43: ; preds = %38
%44 = load i8, i8* %2
%45 = zext i8 %44 to i32
%46 = icmp eq i32 %45, 56
br i1 %46, label %47, label %48
47: ; preds = %43
store i32 8, i32* %3
br label %90
48: ; preds = %43
%49 = load i8, i8* %2
%50 = zext i8 %49 to i32
%51 = icmp eq i32 %50, 57
br i1 %51, label %52, label %53
52: ; preds = %48
store i32 9, i32* %3
br label %89
53: ; preds = %48
%54 = load i8, i8* %2
%55 = call float @toupper(i8 zeroext %54)
%56 = fcmp oeq float %55, 6.500000e+01
br i1 %56, label %57, label %58
57: ; preds = %53
store i32 10, i32* %3
br label %88
58: ; preds = %53
%59 = load i8, i8* %2
%60 = call float @toupper(i8 zeroext %59)
%61 = fcmp oeq float %60, 6.600000e+01
br i1 %61, label %62, label %63
62: ; preds = %58
store i32 11, i32* %3
br label %87
63: ; preds = %58
%64 = load i8, i8* %2
%65 = call float @toupper(i8 zeroext %64)
%66 = fcmp oeq float %65, 6.700000e+01
br i1 %66, label %67, label %68
67: ; preds = %63
store i32 12, i32* %3
br label %86
68: ; preds = %63
%69 = load i8, i8* %2
%70 = call float @toupper(i8 zeroext %69)
%71 = fcmp oeq float %70, 6.800000e+01
br i1 %71, label %72, label %73
72: ; preds = %68
store i32 13, i32* %3
br label %85
73: ; preds = %68
%74 = load i8, i8* %2
%75 = call float @toupper(i8 zeroext %74)
%76 = fcmp oeq float %75, 6.900000e+01
br i1 %76, label %77, label %78
77: ; preds = %73
store i32 14, i32* %3
br label %84
78: ; preds = %73
%79 = load i8, i8* %2
%80 = call float @toupper(i8 zeroext %79)
%81 = fcmp oeq float %80, 7.000000e+01
br i1 %81, label %82, label %83
82: ; preds = %78
store i32 15, i32* %3
br label %83
83: ; preds = %82, %78
br label %84
84: ; preds = %83, %77
br label %85
85: ; preds = %84, %72
br label %86
86: ; preds = %85, %67
br label %87
87: ; preds = %86, %62
br label %88
88: ; preds = %87, %57
br label %89
89: ; preds = %88, %52
br label %90
90: ; preds = %89, %47
br label %91
91: ; preds = %90, %42
br label %92
92: ; preds = %91, %37
br label %93
93: ; preds = %92, %32
br label %94
94: ; preds = %93, %27
br label %95
95: ; preds = %94, %22
br label %96
96: ; preds = %95, %17
br label %97
97: ; preds = %96, %12
br label %98
98: ; preds = %97, %7
%99 = load i32, i32* %3
%100 = trunc i32 %99 to i8
ret i8 %100
}

LLVM IR (-O2):
define zeroext i8 @Bdf_Hex2Bin(i8 zeroext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
br i1 %3, label %21, label %4
4: ; preds = %1
%5 = tail call float @toupper(i8 zeroext %0)
%6 = fcmp oeq float %5, 6.500000e+01
br i1 %6, label %21, label %7
7: ; preds = %4
%8 = tail call float @toupper(i8 zeroext %0)
%9 = fcmp oeq float %8, 6.600000e+01
br i1 %9, label %21, label %10
10: ; preds = %7
%11 = tail call float @toupper(i8 zeroext %0)
%12 = fcmp oeq float %11, 6.700000e+01
br i1 %12, label %21, label %13
13: ; preds = %10
%14 = tail call float @toupper(i8 zeroext %0)
%15 = fcmp oeq float %14, 6.800000e+01
br i1 %15, label %21, label %16
16: ; preds = %13
%17 = tail call float @toupper(i8 zeroext %0)
%18 = fcmp oeq float %17, 6.900000e+01
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = tail call float @toupper(i8 zeroext %0)
br label %21
21: ; preds = %1, %19, %16, %13, %10, %7, %4
%22 = phi i8 [ 10, %4 ], [ 11, %7 ], [ 12, %10 ], [ 13, %13 ], [ 14, %16 ], [ 15, %19 ], [ %2, %1 ]
ret i8 %22
}