#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__ ft_isalpha(char);
int /*<<< orphan*/ ft_isascii(char);
int /*<<< orphan*/ ft_isdigit(char);
int /*<<< orphan*/ is_operator(char);
int is_authorized(char c) {
  static char authorized[6] = {'\n', '\v', '\t', '\r', '\f', ' '};
  int i;
  int valid;
  valid = 0;
  i = 0;
  while (i < 6) {
    if (c == authorized[i])
      valid++;
    i++;
  }
  if (!valid) {
    valid = (ft_isalpha(c) || !ft_isascii(c) || !is_operator(c));
    if (valid && !ft_isdigit(c))
      valid = 0;
    else
      valid = 1;
  }
  return (valid);
}


x86 assembly (clang, -O0):
<is_authorized>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jge    1198 <is_authorized+0x58>
movsbl -0x1(%rbp),%eax
movslq -0x8(%rbp),%rdx
lea    0x2ecb(%rip),%rcx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    118a <is_authorized+0x4a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115c <is_authorized+0x1c>
cmpl   $0x0,-0xc(%rbp)
jne    1229 <is_authorized+0xe9>
movsbl -0x1(%rbp),%edi
call   1040 <ft_isalpha@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xd(%rbp)
jne    11ea <is_authorized+0xaa>
movsbl -0x1(%rbp),%edi
call   1060 <ft_isascii@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0xd(%rbp)
je     11ea <is_authorized+0xaa>
movsbl -0x1(%rbp),%edi
call   1050 <is_operator@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     121d <is_authorized+0xdd>
movsbl -0x1(%rbp),%edi
call   1030 <ft_isdigit@plt>
cmp    $0x0,%eax
jne    121d <is_authorized+0xdd>
movl   $0x0,-0xc(%rbp)
jmp    1224 <is_authorized+0xe4>
movl   $0x1,-0xc(%rbp)
jmp    1229 <is_authorized+0xe9>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_authorized>:
push   %rbx
movd   %edi,%xmm0
punpcklbw %xmm0,%xmm0
pshuflw $0x0,%xmm0,%xmm0
xor    %ecx,%ecx
cmp    $0xc,%dil
sete   %cl
xor    %edx,%edx
cmp    $0x20,%dil
sete   %dl
pcmpeqb 0xe98(%rip),%xmm0
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm0
movmskps %xmm0,%eax
mov    %eax,%ebx
shr    %bl
and    $0x5,%bl
sub    %bl,%al
mov    %eax,%ebx
and    $0x33,%bl
shr    $0x2,%al
and    $0x33,%al
add    %bl,%al
mov    %eax,%ebx
shr    $0x4,%bl
add    %al,%bl
and    $0xf,%bl
movzbl %bl,%eax
add    %ecx,%eax
add    %edx,%eax
je     119d <is_authorized+0x5d>
pop    %rbx
ret
movsbl %dil,%ebx
mov    %ebx,%edi
call   1040 <ft_isalpha@plt>
test   %rax,%rax
je     11bc <is_authorized+0x7c>
mov    %ebx,%edi
call   1030 <ft_isdigit@plt>
test   %eax,%eax
jne    11d2 <is_authorized+0x92>
xor    %eax,%eax
pop    %rbx
ret
mov    %ebx,%edi
call   1060 <ft_isascii@plt>
test   %eax,%eax
je     11ad <is_authorized+0x6d>
mov    %ebx,%edi
call   1050 <is_operator@plt>
test   %eax,%eax
je     11ad <is_authorized+0x6d>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@is_authorized.authorized = internal global [6 x i8] c"\0A\0B\09\0D\0C "
define i32 @is_authorized(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
store i8 %0, i8* %2
store i32 0, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %20, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 6
br i1 %7, label %8, label %23
8: ; preds = %5
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [6 x i8], [6 x i8]* @is_authorized.authorized, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %10, %15
br i1 %16, label %17, label %20
17: ; preds = %8
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %20
20: ; preds = %17, %8
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %5
23: ; preds = %5
%24 = load i32, i32* %4
%25 = icmp ne i32 %24, 0
br i1 %25, label %51, label %26
26: ; preds = %23
%27 = load i8, i8* %2
%28 = call i64 @ft_isalpha(i8 signext %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %39, label %30
30: ; preds = %26
%31 = load i8, i8* %2
%32 = call i32 @ft_isascii(i8 signext %31)
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %39
34: ; preds = %30
%35 = load i8, i8* %2
%36 = call i32 @is_operator(i8 signext %35)
%37 = icmp ne i32 %36, 0
%38 = xor i1 %37, true
br label %39
39: ; preds = %34, %30, %26
%40 = phi i1 [ true, %30 ], [ true, %26 ], [ %38, %34 ]
%41 = zext i1 %40 to i32
store i32 %41, i32* %4
%42 = load i32, i32* %4
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %49
44: ; preds = %39
%45 = load i8, i8* %2
%46 = call i32 @ft_isdigit(i8 signext %45)
%47 = icmp ne i32 %46, 0
br i1 %47, label %49, label %48
48: ; preds = %44
store i32 0, i32* %4
br label %50
49: ; preds = %44, %39
store i32 1, i32* %4
br label %50
50: ; preds = %49, %48
br label %51
51: ; preds = %50, %23
%52 = load i32, i32* %4
ret i32 %52
}

LLVM IR (-O2):
define i32 @is_authorized(i8 signext %0) {
%2 = insertelement <4 x i8> poison, i8 %0, i64 0
%3 = shufflevector <4 x i8> %2, <4 x i8> poison, <4 x i32> zeroinitializer
%4 = icmp eq <4 x i8> %3, <i8 10, i8 11, i8 9, i8 13>
%5 = icmp eq i8 %0, 12
%6 = zext i1 %5 to i32
%7 = icmp eq i8 %0, 32
%8 = zext i1 %7 to i32
%9 = bitcast <4 x i1> %4 to i4
%10 = call i4 @llvm.ctpop.i4(i4 %9)
%11 = zext i4 %10 to i32
%12 = add nuw nsw i32 %11, %6
%13 = add nuw nsw i32 %12, %8
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %28
15: ; preds = %1
%16 = tail call i64 @ft_isalpha(i8 signext %0)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = tail call i32 @ft_isascii(i8 signext %0)
%20 = icmp eq i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = tail call i32 @is_operator(i8 signext %0)
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %15, %18, %21
%25 = tail call i32 @ft_isdigit(i8 signext %0)
%26 = icmp eq i32 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %24, %21
br label %28
28: ; preds = %24, %27, %1
%29 = phi i32 [ %13, %1 ], [ 1, %27 ], [ 0, %24 ]
ret i32 %29
}