#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int legalChar(int ch) {
  if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') ||
      (ch >= 'a' && ch <= 'z') || (ch == '-') || (ch == '_')) {
    return EXIT_SUCCESS;
  } else {
    return EXIT_FAILURE;
  }
}


x86 assembly (clang, -O0):
<legalChar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x30,-0x8(%rbp)
jl     111b <legalChar+0x1b>
cmpl   $0x39,-0x8(%rbp)
jle    1157 <legalChar+0x57>
cmpl   $0x41,-0x8(%rbp)
jl     112f <legalChar+0x2f>
cmpl   $0x5a,-0x8(%rbp)
jle    1157 <legalChar+0x57>
cmpl   $0x61,-0x8(%rbp)
jl     1143 <legalChar+0x43>
cmpl   $0x7a,-0x8(%rbp)
jle    1157 <legalChar+0x57>
cmpl   $0x2d,-0x8(%rbp)
je     1157 <legalChar+0x57>
cmpl   $0x5f,-0x8(%rbp)
jne    1168 <legalChar+0x68>
mov    0x2e7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <legalChar+0x74>
mov    0x2e71(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<legalChar>:
lea    -0x30(%rdi),%edx
mov    %edi,%esi
and    $0xffffffdf,%esi
add    $0xffffffbf,%esi
mov    0x2ec6(%rip),%rax
mov    %rax,%rcx
cmp    $0x1a,%esi
jb     1121 <legalChar+0x21>
mov    0x2ebf(%rip),%rcx
cmp    $0xa,%edx
cmovb  %rax,%rcx
cmp    $0x2d,%edi
cmove  %rax,%rcx
cmp    $0x5f,%edi
cmove  %rax,%rcx
mov    (%rcx),%eax
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @legalChar(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 57
br i1 %8, label %27, label %9
9: ; preds = %6, %1
%10 = load i32, i32* %3
%11 = icmp sge i32 %10, 65
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* %3
%14 = icmp sle i32 %13, 90
br i1 %14, label %27, label %15
15: ; preds = %12, %9
%16 = load i32, i32* %3
%17 = icmp sge i32 %16, 97
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %3
%20 = icmp sle i32 %19, 122
br i1 %20, label %27, label %21
21: ; preds = %18, %15
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, 45
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load i32, i32* %3
%26 = icmp eq i32 %25, 95
br i1 %26, label %27, label %29
27: ; preds = %24, %21, %18, %12, %6
%28 = load i32, i32* @EXIT_SUCCESS
store i32 %28, i32* %2
br label %31
29: ; preds = %24
%30 = load i32, i32* @EXIT_FAILURE
store i32 %30, i32* %2
br label %31
31: ; preds = %29, %27
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @legalChar(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = and i32 %0, -33
%5 = add i32 %4, -65
%6 = icmp ult i32 %5, 26
%7 = or i1 %3, %6
%8 = icmp eq i32 %0, 95
%9 = icmp eq i32 %0, 45
%10 = or i1 %8, %9
%11 = or i1 %10, %7
%12 = load i32, i32* @EXIT_SUCCESS
%13 = load i32, i32* @EXIT_FAILURE
%14 = select i1 %11, i32 %12, i32 %13
ret i32 %14
}