#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 posn(char *, char);
int verify_character(char input, char type) {
  int val = 0;
  switch (type) {
  case 'F':
    val = posn("ABCDEFGHIJKLMNOPQRSTUVWXYZ", input);
    break;
  case 'L':
    val = posn("ABDEFGHJLNPQRSTUWXYZ", input);
    break;
  case 'N':
    val = posn("0123456789", input);
    break;
  case 'S':
    val = posn(" ", input);
    break;
  }
  if (val == -1) {
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<verify_character>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
movl   $0x0,-0xc(%rbp)
movsbl -0x6(%rbp),%eax
add    $0xffffffba,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xd,%eax
ja     11b0 <verify_character+0xa0>
mov    -0x18(%rbp),%rax
lea    0xeb4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xedc(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <posn@plt>
mov    %eax,-0xc(%rbp)
jmp    11b0 <verify_character+0xa0>
lea    0xedf(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <posn@plt>
mov    %eax,-0xc(%rbp)
jmp    11b0 <verify_character+0xa0>
lea    0xedc(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <posn@plt>
mov    %eax,-0xc(%rbp)
jmp    11b0 <verify_character+0xa0>
lea    0xecf(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <posn@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    11c6 <verify_character+0xb6>
movl   $0x0,-0x4(%rbp)
jmp    11cd <verify_character+0xbd>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_character>:
push   %rax
mov    $0x1,%eax
add    $0xffffffba,%esi
cmp    $0xd,%esi
ja     1164 <verify_character+0x54>
lea    0xf13(%rip),%rcx
lea    0xed4(%rip),%rdx
movslq (%rdx,%rsi,4),%rsi
add    %rdx,%rsi
jmp    *%rsi
lea    0xf17(%rip),%rcx
jmp    114e <verify_character+0x3e>
lea    0xf23(%rip),%rcx
jmp    114e <verify_character+0x3e>
lea    0xf25(%rip),%rcx
movsbl %dil,%esi
mov    %rcx,%rdi
call   1030 <posn@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@.str.1 = [21 x i8] c"ABDEFGHJLNPQRSTUWXYZ\00"
@.str.2 = [11 x i8] c"0123456789\00"
@.str.3 = [2 x i8] c" \00"
define i32 @verify_character(i8 signext %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
%6 = alloca i32
store i8 %0, i8* %4
store i8 %1, i8* %5
store i32 0, i32* %6
%7 = load i8, i8* %5
%8 = sext i8 %7 to i32
switch i32 %8, label %21 [
i32 70, label %9
i32 76, label %12
i32 78, label %15
i32 83, label %18
]
9: ; preds = %2
%10 = load i8, i8* %4
%11 = call i32 @posn(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8 signext %10)
store i32 %11, i32* %6
br label %21
12: ; preds = %2
%13 = load i8, i8* %4
%14 = call i32 @posn(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8 signext %13)
store i32 %14, i32* %6
br label %21
15: ; preds = %2
%16 = load i8, i8* %4
%17 = call i32 @posn(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8 signext %16)
store i32 %17, i32* %6
br label %21
18: ; preds = %2
%19 = load i8, i8* %4
%20 = call i32 @posn(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8 signext %19)
store i32 %20, i32* %6
br label %21
21: ; preds = %2, %18, %15, %12, %9
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %25
24: ; preds = %21
store i32 0, i32* %3
br label %26
25: ; preds = %21
store i32 1, i32* %3
br label %26
26: ; preds = %25, %24
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [27 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@.str.1 = [21 x i8] c"ABDEFGHJLNPQRSTUWXYZ\00"
@.str.2 = [11 x i8] c"0123456789\00"
@.str.3 = [2 x i8] c" \00"
define i32 @verify_character(i8 signext %0, i8 signext %1) {
%3 = sext i8 %1 to i32
switch i32 %3, label %12 [
i32 70, label %7
i32 76, label %4
i32 78, label %5
i32 83, label %6
]
4: ; preds = %2
br label %7
5: ; preds = %2
br label %7
6: ; preds = %2
br label %7
7: ; preds = %2, %6, %5, %4
%8 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), %5 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), %2 ]
%9 = tail call i32 @posn(i8* %8, i8 signext %0)
%10 = icmp ne i32 %9, -1
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %7, %2
%13 = phi i32 [ 1, %2 ], [ %11, %7 ]
ret i32 %13
}