#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 */
char toupper(char);
int GGtobin(char c) {
  static char lets[16] = {'A', 'P', 'Z', 'L', 'G', 'I', 'T', 'Y',
                          'E', 'O', 'X', 'U', 'K', 'S', 'V', 'N'};
  int x;
  for (x = 0; x < 16; x++)
    if (lets[x] == toupper(c))
      return (x);
  return (0);
}


x86 assembly (clang, -O0):
<GGtobin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    1178 <GGtobin+0x68>
movslq -0xc(%rbp),%rcx
lea    0x2ef6(%rip),%rax
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x10(%rbp)
movsbl -0x5(%rbp),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x10(%rbp),%eax
movsbl %cl,%ecx
cmp    %ecx,%eax
jne    1165 <GGtobin+0x55>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117f <GGtobin+0x6f>
jmp    116a <GGtobin+0x5a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <GGtobin+0x15>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GGtobin>:
push   %rbx
mov    %edi,%ebx
call   1030 <toupper@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x41,%cl
je     1265 <GGtobin+0x155>
movsbl %bl,%ebx
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x50,%cl
je     1265 <GGtobin+0x155>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    $0x2,%eax
cmp    $0x5a,%cl
je     1265 <GGtobin+0x155>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    $0x3,%eax
cmp    $0x4c,%cl
je     1265 <GGtobin+0x155>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    $0x4,%eax
cmp    $0x47,%cl
je     1265 <GGtobin+0x155>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    $0x5,%eax
cmp    $0x49,%cl
je     1265 <GGtobin+0x155>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    $0x6,%eax
cmp    $0x54,%cl
je     1265 <GGtobin+0x155>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    $0x7,%eax
cmp    $0x59,%cl
je     1265 <GGtobin+0x155>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    $0x8,%eax
cmp    $0x45,%cl
je     1265 <GGtobin+0x155>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    $0x9,%eax
cmp    $0x4f,%cl
je     1265 <GGtobin+0x155>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    $0xa,%eax
cmp    $0x58,%cl
je     1265 <GGtobin+0x155>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    $0xb,%eax
cmp    $0x55,%cl
je     1265 <GGtobin+0x155>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    $0xc,%eax
cmp    $0x4b,%cl
je     1265 <GGtobin+0x155>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    $0xd,%eax
cmp    $0x53,%cl
je     1265 <GGtobin+0x155>
mov    %ebx,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    $0xe,%eax
cmp    $0x56,%cl
je     1265 <GGtobin+0x155>
mov    %ebx,%edi
call   1030 <toupper@plt>
xor    %ecx,%ecx
cmp    $0x4e,%al
mov    $0xf,%eax
cmovne %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@GGtobin.lets = internal global [16 x i8] c"APZLGITYEOXUKSVN"
define i32 @GGtobin(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i32
store i8 %0, i8* %3
store i32 0, i32* %4
br label %5
5: ; preds = %21, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 16
br i1 %7, label %8, label %24
8: ; preds = %5
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [16 x i8], [16 x i8]* @GGtobin.lets, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = load i8, i8* %3
%15 = call signext i8 @toupper(i8 signext %14)
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %13, %16
br i1 %17, label %18, label %20
18: ; preds = %8
%19 = load i32, i32* %4
store i32 %19, i32* %2
br label %25
20: ; preds = %8
br label %21
21: ; preds = %20
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %5
24: ; preds = %5
store i32 0, i32* %2
br label %25
25: ; preds = %24, %18
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
define i32 @GGtobin(i8 signext %0) {
%2 = tail call signext i8 @toupper(i8 signext %0)
%3 = icmp eq i8 %2, 65
br i1 %3, label %50, label %4
4: ; preds = %1
%5 = tail call signext i8 @toupper(i8 signext %0)
%6 = icmp eq i8 %5, 80
br i1 %6, label %50, label %7
7: ; preds = %4
%8 = tail call signext i8 @toupper(i8 signext %0)
%9 = icmp eq i8 %8, 90
br i1 %9, label %50, label %10
10: ; preds = %7
%11 = tail call signext i8 @toupper(i8 signext %0)
%12 = icmp eq i8 %11, 76
br i1 %12, label %50, label %13
13: ; preds = %10
%14 = tail call signext i8 @toupper(i8 signext %0)
%15 = icmp eq i8 %14, 71
br i1 %15, label %50, label %16
16: ; preds = %13
%17 = tail call signext i8 @toupper(i8 signext %0)
%18 = icmp eq i8 %17, 73
br i1 %18, label %50, label %19
19: ; preds = %16
%20 = tail call signext i8 @toupper(i8 signext %0)
%21 = icmp eq i8 %20, 84
br i1 %21, label %50, label %22
22: ; preds = %19
%23 = tail call signext i8 @toupper(i8 signext %0)
%24 = icmp eq i8 %23, 89
br i1 %24, label %50, label %25
25: ; preds = %22
%26 = tail call signext i8 @toupper(i8 signext %0)
%27 = icmp eq i8 %26, 69
br i1 %27, label %50, label %28
28: ; preds = %25
%29 = tail call signext i8 @toupper(i8 signext %0)
%30 = icmp eq i8 %29, 79
br i1 %30, label %50, label %31
31: ; preds = %28
%32 = tail call signext i8 @toupper(i8 signext %0)
%33 = icmp eq i8 %32, 88
br i1 %33, label %50, label %34
34: ; preds = %31
%35 = tail call signext i8 @toupper(i8 signext %0)
%36 = icmp eq i8 %35, 85
br i1 %36, label %50, label %37
37: ; preds = %34
%38 = tail call signext i8 @toupper(i8 signext %0)
%39 = icmp eq i8 %38, 75
br i1 %39, label %50, label %40
40: ; preds = %37
%41 = tail call signext i8 @toupper(i8 signext %0)
%42 = icmp eq i8 %41, 83
br i1 %42, label %50, label %43
43: ; preds = %40
%44 = tail call signext i8 @toupper(i8 signext %0)
%45 = icmp eq i8 %44, 86
br i1 %45, label %50, label %46
46: ; preds = %43
%47 = tail call signext i8 @toupper(i8 signext %0)
%48 = icmp eq i8 %47, 78
%49 = select i1 %48, i32 15, i32 0
br label %50
50: ; preds = %46, %43, %40, %37, %34, %31, %28, %25, %22, %19, %16, %13, %10, %7, %4, %1
%51 = phi i32 [ 0, %1 ], [ 1, %4 ], [ 2, %7 ], [ 3, %10 ], [ 4, %13 ], [ 5, %16 ], [ 6, %19 ], [ 7, %22 ], [ 8, %25 ], [ 9, %28 ], [ 10, %31 ], [ 11, %34 ], [ 12, %37 ], [ 13, %40 ], [ 14, %43 ], [ %49, %46 ]
ret i32 %51
}