#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*/ OPS_err(int);
int /*<<< orphan*/ Platform_Halt(int);
int Ord__7(unsigned char ch, char hex) {
  int _o_result;
  if (ch <= '9') {
    _o_result = (int)ch - 48;
    return _o_result;
  } else if (hex) {
    _o_result = ((int)ch - 65) + 10;
    return _o_result;
  } else {
    OPS_err(2);
    _o_result = 0;
    return _o_result;
  }
__retchk:
  Platform_Halt(-3);
  return 0;
  ;
}


x86 assembly (clang, -O0):
<Ord__7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1146 <Ord__7+0x36>
movzbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117f <Ord__7+0x6f>
cmpb   $0x0,-0x6(%rbp)
je     1168 <Ord__7+0x58>
movzbl -0x5(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117f <Ord__7+0x6f>
mov    $0x2,%edi
call   1030 <OPS_err@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Ord__7>:
mov    %edi,%eax
cmp    $0x39,%al
ja     111a <Ord__7+0xa>
add    $0xffffffd0,%eax
ret
test   %sil,%sil
je     1123 <Ord__7+0x13>
add    $0xffffffc9,%eax
ret
push   %rax
mov    $0x2,%edi
call   1030 <OPS_err@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @Ord__7(i8 zeroext %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
%6 = alloca i32
store i8 %0, i8* %4
store i8 %1, i8* %5
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8, i8* %4
%12 = zext i8 %11 to i32
%13 = sub nsw i32 %12, 48
store i32 %13, i32* %6
%14 = load i32, i32* %6
store i32 %14, i32* %3
br label %29
15: ; preds = %2
%16 = load i8, i8* %5
%17 = icmp ne i8 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = sub nsw i32 %20, 65
%22 = add nsw i32 %21, 10
store i32 %22, i32* %6
%23 = load i32, i32* %6
store i32 %23, i32* %3
br label %29
24: ; preds = %15
%25 = call i32 @OPS_err(i32 2)
store i32 0, i32* %6
%26 = load i32, i32* %6
store i32 %26, i32* %3
br label %29
27: ; No predecessors!
%28 = call i32 @Platform_Halt(i32 -3)
store i32 0, i32* %3
br label %29
29: ; preds = %27, %24, %18, %10
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
define i32 @Ord__7(i8 zeroext %0, i8 signext %1) {
%3 = zext i8 %0 to i32
%4 = icmp ult i8 %0, 58
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = add nsw i32 %3, -48
br label %13
7: ; preds = %2
%8 = icmp eq i8 %1, 0
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = add nsw i32 %3, -55
br label %13
11: ; preds = %7
%12 = tail call i32 @OPS_err(i32 2)
br label %13
13: ; preds = %11, %9, %5
%14 = phi i32 [ %6, %5 ], [ %10, %9 ], [ 0, %11 ]
ret i32 %14
}