#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*/ line_Comment();
int hex(int c) {
  if ((';' == c) || ('#' == c)) {
    line_Comment();
    return -1;
  }
  if ('0' > c)
    return -1;
  if ('9' >= c)
    return (c - 48);
  c = c & 0xDF;
  if ('A' > c)
    return -1;
  if ('F' >= c)
    return (c - 55);
  return -1;
}


x86 assembly (clang, -O0):
<hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x3b,%eax
cmp    -0x8(%rbp),%eax
je     1137 <hex+0x27>
mov    $0x23,%eax
cmp    -0x8(%rbp),%eax
jne    114a <hex+0x3a>
mov    $0x0,%al
call   1030 <line_Comment@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c8 <hex+0xb8>
mov    $0x30,%eax
cmp    -0x8(%rbp),%eax
jle    1164 <hex+0x54>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c8 <hex+0xb8>
mov    $0x39,%eax
cmp    -0x8(%rbp),%eax
jl     1180 <hex+0x70>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    11c8 <hex+0xb8>
mov    -0x8(%rbp),%eax
and    $0xdf,%eax
mov    %eax,-0x8(%rbp)
mov    $0x41,%eax
cmp    -0x8(%rbp),%eax
jle    11a5 <hex+0x95>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c8 <hex+0xb8>
mov    $0x46,%eax
cmp    -0x8(%rbp),%eax
jl     11c1 <hex+0xb1>
mov    -0x8(%rbp),%eax
sub    $0x37,%eax
mov    %eax,-0x4(%rbp)
jmp    11c8 <hex+0xb8>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex>:
cmp    $0x3b,%edi
je     111a <hex+0xa>
cmp    $0x23,%edi
jne    112c <hex+0x1c>
push   %rax
xor    %eax,%eax
call   1030 <line_Comment@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
ret
mov    $0xffffffff,%eax
cmp    $0x30,%edi
jl     1158 <hex+0x48>
cmp    $0x39,%edi
ja     1141 <hex+0x31>
add    $0xffffffd0,%edi
mov    %edi,%eax
ret
and    $0xdf,%edi
lea    -0x41(%rdi),%eax
add    $0xffffffc9,%edi
cmp    $0x6,%eax
mov    $0xffffffff,%eax
cmovb  %edi,%eax
ret

LLVM IR (-O0):
define i32 @hex(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 59, %4
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp eq i32 35, %7
br i1 %8, label %9, label %11
9: ; preds = %6, %1
%10 = call i32 (...) @line_Comment()
store i32 -1, i32* %2
br label %34
11: ; preds = %6
%12 = load i32, i32* %3
%13 = icmp sgt i32 48, %12
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 -1, i32* %2
br label %34
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp sge i32 57, %16
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %3
%20 = sub nsw i32 %19, 48
store i32 %20, i32* %2
br label %34
21: ; preds = %15
%22 = load i32, i32* %3
%23 = and i32 %22, 223
store i32 %23, i32* %3
%24 = load i32, i32* %3
%25 = icmp sgt i32 65, %24
br i1 %25, label %26, label %27
26: ; preds = %21
store i32 -1, i32* %2
br label %34
27: ; preds = %21
%28 = load i32, i32* %3
%29 = icmp sge i32 70, %28
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32, i32* %3
%32 = sub nsw i32 %31, 55
store i32 %32, i32* %2
br label %34
33: ; preds = %27
store i32 -1, i32* %2
br label %34
34: ; preds = %33, %30, %26, %18, %14, %9
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @hex(i32 %0) {
switch i32 %0, label %4 [
i32 59, label %2
i32 35, label %2
]
2: ; preds = %1, %1
%3 = tail call i32 (...) @line_Comment()
br label %16
4: ; preds = %1
%5 = icmp slt i32 %0, 48
br i1 %5, label %16, label %6
6: ; preds = %4
%7 = icmp ult i32 %0, 58
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = add nsw i32 %0, -48
br label %16
10: ; preds = %6
%11 = and i32 %0, 223
%12 = add nsw i32 %11, -65
%13 = icmp ult i32 %12, 6
%14 = add nsw i32 %11, -55
%15 = select i1 %13, i32 %14, i32 -1
br label %16
16: ; preds = %10, %4, %8, %2
%17 = phi i32 [ -1, %2 ], [ %9, %8 ], [ -1, %4 ], [ %15, %10 ]
ret i32 %17
}