#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 */
int /*<<< orphan*/ c_assertion_message(char *, char *, int);
int decode(char p) {
  if (p >= '0' && p <= '9')
    return p - '0';
  if (p >= 'A' && p <= 'F')
    return p - 'A';
  if (p >= 'a' && p <= 'f')
    return p - 'a';
  do {
    c_assertion_message("* Assertion: should not be reached at %s:%d\n",
                        "/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/"
                        "rig-project/clib/refs/heads/master/clib/cstr.c",
                        657);
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<decode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1147 <decode+0x37>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1147 <decode+0x37>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    11bd <decode+0xad>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1170 <decode+0x60>
movsbl -0x5(%rbp),%eax
cmp    $0x46,%eax
jg     1170 <decode+0x60>
movsbl -0x5(%rbp),%eax
sub    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    11bd <decode+0xad>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1199 <decode+0x89>
movsbl -0x5(%rbp),%eax
cmp    $0x66,%eax
jg     1199 <decode+0x89>
movsbl -0x5(%rbp),%eax
sub    $0x61,%eax
mov    %eax,-0x4(%rbp)
jmp    11bd <decode+0xad>
jmp    119e <decode+0x8e>
lea    0xe5b(%rip),%rdi
lea    0xe81(%rip),%rsi
mov    $0x291,%edx
call   1030 <c_assertion_message@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode>:
mov    %edi,%eax
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
ja     111e <decode+0xe>
add    $0xffffffd0,%eax
ret
lea    -0x41(%rax),%ecx
cmp    $0x5,%cl
ja     112a <decode+0x1a>
add    $0xffffffbf,%eax
ret
lea    -0x61(%rax),%ecx
cmp    $0x5,%cl
ja     1136 <decode+0x26>
add    $0xffffff9f,%eax
ret
push   %rax
lea    0xec2(%rip),%rdi
lea    0xee8(%rip),%rsi
mov    $0x291,%edx
call   1030 <c_assertion_message@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [45 x i8] c"* Assertion: should not be reached at %s:%d\0A\00"
@.str.1 = [137 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/rig-project/clib/refs/heads/master/clib/cstr.c\00"
define i32 @decode(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
store i32 %14, i32* %2
br label %43
15: ; preds = %7, %1
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp sge i32 %17, 65
br i1 %18, label %19, label %27
19: ; preds = %15
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = icmp sle i32 %21, 70
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = sub nsw i32 %25, 65
store i32 %26, i32* %2
br label %43
27: ; preds = %19, %15
%28 = load i8, i8* %3
%29 = sext i8 %28 to i32
%30 = icmp sge i32 %29, 97
br i1 %30, label %31, label %39
31: ; preds = %27
%32 = load i8, i8* %3
%33 = sext i8 %32 to i32
%34 = icmp sle i32 %33, 102
br i1 %34, label %35, label %39
35: ; preds = %31
%36 = load i8, i8* %3
%37 = sext i8 %36 to i32
%38 = sub nsw i32 %37, 97
store i32 %38, i32* %2
br label %43
39: ; preds = %31, %27
br label %40
40: ; preds = %39
%41 = call i32 @c_assertion_message(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.1, i64 0, i64 0), i32 657)
br label %42
42: ; preds = %40
store i32 0, i32* %2
br label %43
43: ; preds = %42, %35, %23, %11
%44 = load i32, i32* %2
ret i32 %44
}

LLVM IR (-O2):
@.str = [45 x i8] c"* Assertion: should not be reached at %s:%d\0A\00"
@.str.1 = [137 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/rig-project/clib/refs/heads/master/clib/cstr.c\00"
define i32 @decode(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add i8 %0, -48
%4 = icmp ult i8 %3, 10
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = add nsw i32 %2, -48
br label %19
7: ; preds = %1
%8 = add i8 %0, -65
%9 = icmp ult i8 %8, 6
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = add nsw i32 %2, -65
br label %19
12: ; preds = %7
%13 = add i8 %0, -97
%14 = icmp ult i8 %13, 6
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = add nsw i32 %2, -97
br label %19
17: ; preds = %12
%18 = tail call i32 @c_assertion_message(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str.1, i64 0, i64 0), i32 657)
br label %19
19: ; preds = %17, %15, %10, %5
%20 = phi i32 [ %6, %5 ], [ %11, %10 ], [ %16, %15 ], [ 0, %17 ]
ret i32 %20
}