#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 int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
uint8_t _xctoi(uint8_t c) {
  uint8_t i;
  assert(c >= '0');
  i = c - '0';
  if (i <= 9)
    return i;
  assert(c >= 'A');
  i = c - 'A';
  if (i <= 5)
    return i + 10;
  assert(c >= 'a');
  i = c - 'a';
  if (i <= 5)
    return i + 10;
  assert(c <= 'f');
  return 0;
}


x86 assembly (clang, -O0):
<_xctoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x30,-0x8(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jg     114a <_xctoi+0x3a>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11c6 <_xctoi+0xb6>
cmpl   $0x41,-0x8(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%eax
sub    $0x41,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jg     117c <_xctoi+0x6c>
mov    -0xc(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    11c6 <_xctoi+0xb6>
cmpl   $0x61,-0x8(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%eax
sub    $0x61,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jg     11ae <_xctoi+0x9e>
mov    -0xc(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    11c6 <_xctoi+0xb6>
cmpl   $0x66,-0x8(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_xctoi>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x30,%ebx
setge  %dil
call   1030 <assert@plt>
cmp    $0x39,%ebx
jg     112b <_xctoi+0x1b>
add    $0xffffffd0,%ebx
jmp    1164 <_xctoi+0x54>
xor    %edi,%edi
cmp    $0x41,%ebx
setae  %dil
call   1030 <assert@plt>
cmp    $0x46,%ebx
ja     1143 <_xctoi+0x33>
add    $0xffffffc9,%ebx
jmp    1164 <_xctoi+0x54>
xor    %edi,%edi
cmp    $0x61,%ebx
setae  %dil
call   1030 <assert@plt>
cmp    $0x66,%ebx
ja     115b <_xctoi+0x4b>
add    $0xffffffa9,%ebx
jmp    1164 <_xctoi+0x54>
xor    %ebx,%ebx
xor    %edi,%edi
call   1030 <assert@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @_xctoi(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 48
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 48
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = icmp sle i32 %11, 9
br i1 %12, label %13, label %15
13: ; preds = %1
%14 = load i32, i32* %4
store i32 %14, i32* %2
br label %44
15: ; preds = %1
%16 = load i32, i32* %3
%17 = icmp sge i32 %16, 65
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load i32, i32* %3
%21 = sub nsw i32 %20, 65
store i32 %21, i32* %4
%22 = load i32, i32* %4
%23 = icmp sle i32 %22, 5
br i1 %23, label %24, label %27
24: ; preds = %15
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 10
store i32 %26, i32* %2
br label %44
27: ; preds = %15
%28 = load i32, i32* %3
%29 = icmp sge i32 %28, 97
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = load i32, i32* %3
%33 = sub nsw i32 %32, 97
store i32 %33, i32* %4
%34 = load i32, i32* %4
%35 = icmp sle i32 %34, 5
br i1 %35, label %36, label %39
36: ; preds = %27
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 10
store i32 %38, i32* %2
br label %44
39: ; preds = %27
%40 = load i32, i32* %3
%41 = icmp sle i32 %40, 102
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
store i32 0, i32* %2
br label %44
44: ; preds = %39, %36, %24, %13
%45 = load i32, i32* %2
ret i32 %45
}

LLVM IR (-O2):
define i32 @_xctoi(i32 %0) {
%2 = icmp sgt i32 %0, 47
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = icmp slt i32 %0, 58
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = add nsw i32 %0, -48
br label %24
8: ; preds = %1
%9 = icmp ugt i32 %0, 64
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = icmp ult i32 %0, 71
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = add nsw i32 %0, -55
br label %24
15: ; preds = %8
%16 = icmp ugt i32 %0, 96
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
%19 = icmp ult i32 %0, 103
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = add nsw i32 %0, -87
br label %24
22: ; preds = %15
%23 = tail call i32 @assert(i32 0)
br label %24
24: ; preds = %22, %20, %13, %6
%25 = phi i32 [ %7, %6 ], [ %14, %13 ], [ %21, %20 ], [ 0, %22 ]
ret i32 %25
}