#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 */
scalar_t__ char_in_range(char const, char, char);
int /*<<< orphan*/ *strchr(char const *const, char const);
int whitelisted_char_for_devnode(const char c, const char *const white) {
  return (char_in_range(c, '0', '9') || char_in_range(c, 'A', 'Z') ||
          char_in_range(c, 'a', 'z') || strchr("#+-.:=@_", c) ||
          (white != NULL && strchr(white, c) != NULL))
             ? 1
             : 0;
}


x86 assembly (clang, -O0):
<whitelisted_char_for_devnode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x30,%esi
mov    $0x39,%edx
movsbl -0x1(%rbp),%edi
call   1040 <char_in_range@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jne    11f0 <whitelisted_char_for_devnode+0xd0>
mov    $0x41,%esi
mov    $0x5a,%edx
movsbl -0x1(%rbp),%edi
call   1040 <char_in_range@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jne    11f0 <whitelisted_char_for_devnode+0xd0>
mov    $0x61,%esi
mov    $0x7a,%edx
movsbl -0x1(%rbp),%edi
call   1040 <char_in_range@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jne    11f0 <whitelisted_char_for_devnode+0xd0>
lea    0xe58(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jne    11f0 <whitelisted_char_for_devnode+0xd0>
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x12(%rbp)
je     11ea <whitelisted_char_for_devnode+0xca>
mov    -0x10(%rbp),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<whitelisted_char_for_devnode>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x30,%esi
mov    $0x39,%edx
call   1040 <char_in_range@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    11a0 <whitelisted_char_for_devnode+0x80>
movsbl %bpl,%ebp
mov    %ebp,%edi
mov    $0x41,%esi
mov    $0x5a,%edx
call   1040 <char_in_range@plt>
test   %rax,%rax
jne    11a0 <whitelisted_char_for_devnode+0x80>
mov    %ebp,%edi
mov    $0x61,%esi
mov    $0x7a,%edx
call   1040 <char_in_range@plt>
test   %rax,%rax
jne    11a0 <whitelisted_char_for_devnode+0x80>
lea    0xe87(%rip),%rdi
mov    %ebp,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    11a0 <whitelisted_char_for_devnode+0x80>
test   %r14,%r14
je     119e <whitelisted_char_for_devnode+0x7e>
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <strchr@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
jmp    11a0 <whitelisted_char_for_devnode+0x80>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"#+-.:=@_\00"
define i32 @whitelisted_char_for_devnode(i8 signext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
store i8 %0, i8* %3
store i8* %1, i8** %4
%5 = load i8, i8* %3
%6 = call i64 @char_in_range(i8 signext %5, i8 signext 48, i8 signext 57)
%7 = icmp ne i64 %6, 0
br i1 %7, label %30, label %8
8: ; preds = %2
%9 = load i8, i8* %3
%10 = call i64 @char_in_range(i8 signext %9, i8 signext 65, i8 signext 90)
%11 = icmp ne i64 %10, 0
br i1 %11, label %30, label %12
12: ; preds = %8
%13 = load i8, i8* %3
%14 = call i64 @char_in_range(i8 signext %13, i8 signext 97, i8 signext 122)
%15 = icmp ne i64 %14, 0
br i1 %15, label %30, label %16
16: ; preds = %12
%17 = load i8, i8* %3
%18 = call i32* @strchr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %17)
%19 = icmp ne i32* %18, null
br i1 %19, label %30, label %20
20: ; preds = %16
%21 = load i8*, i8** %4
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i8*, i8** %4
%25 = load i8, i8* %3
%26 = call i32* @strchr(i8* %24, i8 signext %25)
%27 = icmp ne i32* %26, null
br label %28
28: ; preds = %23, %20
%29 = phi i1 [ false, %20 ], [ %27, %23 ]
br label %30
30: ; preds = %28, %16, %12, %8, %2
%31 = phi i1 [ true, %16 ], [ true, %12 ], [ true, %8 ], [ true, %2 ], [ %29, %28 ]
%32 = zext i1 %31 to i64
%33 = select i1 %31, i32 1, i32 0
ret i32 %33
}

LLVM IR (-O2):
@.str = [9 x i8] c"#+-.:=@_\00"
define i32 @whitelisted_char_for_devnode(i8 signext %0, i8* %1) {
%3 = tail call i64 @char_in_range(i8 signext %0, i8 signext 48, i8 signext 57)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %20
5: ; preds = %2
%6 = tail call i64 @char_in_range(i8 signext %0, i8 signext 65, i8 signext 90)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = tail call i64 @char_in_range(i8 signext %0, i8 signext 97, i8 signext 122)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = tail call i32* @strchr(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 signext %0)
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = icmp eq i8* %1, null
br i1 %15, label %20, label %16
16: ; preds = %14
%17 = tail call i32* @strchr(i8* %1, i8 signext %0)
%18 = icmp ne i32* %17, null
%19 = zext i1 %18 to i32
br label %20
20: ; preds = %14, %16, %11, %8, %5, %2
%21 = phi i32 [ 1, %11 ], [ 1, %8 ], [ 1, %5 ], [ 1, %2 ], [ 0, %14 ], [ %19, %16 ]
ret i32 %21
}