#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*/ *strchr(char *, int);
int isurlsafe(int c) {
  return ((unsigned char)(c - 'a') < 26) || ((unsigned char)(c - 'A') < 26) ||
         ((unsigned char)(c - '0') < 10) || (strchr("-._~", c) != NULL);
}


x86 assembly (clang, -O0):
<isurlsafe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x61,%eax
movzbl %al,%ecx
mov    $0x1,%al
cmp    $0x1a,%ecx
mov    %al,-0x5(%rbp)
jl     1179 <isurlsafe+0x69>
mov    -0x4(%rbp),%eax
sub    $0x41,%eax
movzbl %al,%ecx
mov    $0x1,%al
cmp    $0x1a,%ecx
mov    %al,-0x5(%rbp)
jl     1179 <isurlsafe+0x69>
mov    -0x4(%rbp),%eax
sub    $0x30,%eax
movzbl %al,%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x5(%rbp)
jl     1179 <isurlsafe+0x69>
mov    -0x4(%rbp),%esi
lea    0xe96(%rip),%rdi
call   1030 <strchr@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isurlsafe>:
mov    %edi,%esi
lea    0x9f(%rsi),%ecx
and    $0xfe,%ecx
mov    $0x1,%eax
cmp    $0x1a,%ecx
jb     1166 <isurlsafe+0x56>
lea    0xbf(%rsi),%ecx
and    $0xfe,%ecx
cmp    $0x1a,%ecx
jb     1166 <isurlsafe+0x56>
lea    0xd0(%rsi),%ecx
and    $0xfe,%ecx
cmp    $0xa,%ecx
jb     1166 <isurlsafe+0x56>
push   %rax
lea    0xeae(%rip),%rdi
call   1030 <strchr@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"-._~\00"
define i32 @isurlsafe(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 97
%5 = trunc i32 %4 to i8
%6 = zext i8 %5 to i32
%7 = icmp slt i32 %6, 26
br i1 %7, label %24, label %8
8: ; preds = %1
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 65
%11 = trunc i32 %10 to i8
%12 = zext i8 %11 to i32
%13 = icmp slt i32 %12, 26
br i1 %13, label %24, label %14
14: ; preds = %8
%15 = load i32, i32* %2
%16 = sub nsw i32 %15, 48
%17 = trunc i32 %16 to i8
%18 = zext i8 %17 to i32
%19 = icmp slt i32 %18, 10
br i1 %19, label %24, label %20
20: ; preds = %14
%21 = load i32, i32* %2
%22 = call i32* @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = icmp ne i32* %22, null
br label %24
24: ; preds = %20, %14, %8, %1
%25 = phi i1 [ true, %14 ], [ true, %8 ], [ true, %1 ], [ %23, %20 ]
%26 = zext i1 %25 to i32
ret i32 %26
}

LLVM IR (-O2):
@.str = [5 x i8] c"-._~\00"
define i32 @isurlsafe(i32 %0) {
%2 = add i32 %0, 159
%3 = and i32 %2, 254
%4 = icmp ult i32 %3, 26
br i1 %4, label %17, label %5
5: ; preds = %1
%6 = add i32 %0, 191
%7 = and i32 %6, 254
%8 = icmp ult i32 %7, 26
br i1 %8, label %17, label %9
9: ; preds = %5
%10 = add i32 %0, 208
%11 = and i32 %10, 254
%12 = icmp ult i32 %11, 10
br i1 %12, label %17, label %13
13: ; preds = %9
%14 = tail call i32* @strchr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %0)
%15 = icmp ne i32* %14, null
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %13, %9, %5, %1
%18 = phi i32 [ 1, %9 ], [ 1, %5 ], [ 1, %1 ], [ %16, %13 ]
ret i32 %18
}