#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 */
typedef int /*<<< orphan*/ regs;

/* Variables and functions */
scalar_t__ strcmp(char const *, char *);
int isregister(const char *name) {
  static char *regs[] = {
      "al",  "bl",  "cl",  "dl",  "ah",  "bh",  "ch",  "dh",  "ax",
      "bx",  "cx",  "dx",  "si",  "di",  "bp",  "sp",  "cs",  "ds",
      "es",  "fs",  "gs",  "ss",  "eax", "ebx", "ecx", "edx", "esi",
      "edi", "ebp", "esp", "cr0", "cr1", "cr2", "cr3", "st",
  };
  int reg;
  for (reg = 0; reg < (sizeof(regs) / sizeof((regs)[0])); reg++) {
    if (strcmp(name, regs[reg]) == 0) {
      return reg < 8 ? 1 : reg < 22 ? 2 : 4;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<isregister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    $0x23,%rax
jae    119e <isregister+0x8e>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rcx
lea    0x2ef0(%rip),%rax
mov    (%rax,%rcx,8),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    118b <isregister+0x7b>
cmpl   $0x8,-0x14(%rbp)
jge    116a <isregister+0x5a>
mov    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1180 <isregister+0x70>
mov    -0x14(%rbp),%edx
mov    $0x4,%eax
mov    $0x2,%ecx
cmp    $0x16,%edx
cmovl  %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a5 <isregister+0x95>
jmp    1190 <isregister+0x80>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <isregister+0x13>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isregister>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xede(%rip),%r15
xor    %r12d,%r12d
mov    %r15,%rbx
nopl   0x0(%rax,%rax,1)
movslq (%rbx),%rsi
add    %r15,%rsi
mov    %r14,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1155 <isregister+0x45>
add    $0x1,%r12
add    $0x4,%rbx
cmp    $0x23,%r12
jne    1130 <isregister+0x20>
xor    %eax,%eax
jmp    116e <isregister+0x5e>
xor    %eax,%eax
cmp    $0x16,%r12d
setae  %al
cmp    $0x8,%r12d
lea    0x2(%rax,%rax,1),%ecx
mov    $0x1,%eax
cmovae %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@isregister.regs = internal global [35 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.26, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.27, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.28, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.29, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.30, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.31, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.32, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.33, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.34, i32 0, i32 0)]
@.str = [3 x i8] c"al\00"
@.str.1 = [3 x i8] c"bl\00"
@.str.2 = [3 x i8] c"cl\00"
@.str.3 = [3 x i8] c"dl\00"
@.str.4 = [3 x i8] c"ah\00"
@.str.5 = [3 x i8] c"bh\00"
@.str.6 = [3 x i8] c"ch\00"
@.str.7 = [3 x i8] c"dh\00"
@.str.8 = [3 x i8] c"ax\00"
@.str.9 = [3 x i8] c"bx\00"
@.str.10 = [3 x i8] c"cx\00"
@.str.11 = [3 x i8] c"dx\00"
@.str.12 = [3 x i8] c"si\00"
@.str.13 = [3 x i8] c"di\00"
@.str.14 = [3 x i8] c"bp\00"
@.str.15 = [3 x i8] c"sp\00"
@.str.16 = [3 x i8] c"cs\00"
@.str.17 = [3 x i8] c"ds\00"
@.str.18 = [3 x i8] c"es\00"
@.str.19 = [3 x i8] c"fs\00"
@.str.20 = [3 x i8] c"gs\00"
@.str.21 = [3 x i8] c"ss\00"
@.str.22 = [4 x i8] c"eax\00"
@.str.23 = [4 x i8] c"ebx\00"
@.str.24 = [4 x i8] c"ecx\00"
@.str.25 = [4 x i8] c"edx\00"
@.str.26 = [4 x i8] c"esi\00"
@.str.27 = [4 x i8] c"edi\00"
@.str.28 = [4 x i8] c"ebp\00"
@.str.29 = [4 x i8] c"esp\00"
@.str.30 = [4 x i8] c"cr0\00"
@.str.31 = [4 x i8] c"cr1\00"
@.str.32 = [4 x i8] c"cr2\00"
@.str.33 = [4 x i8] c"cr3\00"
@.str.34 = [3 x i8] c"st\00"
define i32 @isregister(i8* %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 = %29, %1
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = icmp ult i64 %7, 35
br i1 %8, label %9, label %32
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [35 x i8*], [35 x i8*]* @isregister.regs, i64 0, i64 %12
%14 = load i8*, i8** %13
%15 = call i64 @strcmp(i8* %10, i8* %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %28
17: ; preds = %9
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 8
br i1 %19, label %20, label %21
20: ; preds = %17
br label %26
21: ; preds = %17
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 22
%24 = zext i1 %23 to i64
%25 = select i1 %23, i32 2, i32 4
br label %26
26: ; preds = %21, %20
%27 = phi i32 [ 1, %20 ], [ %25, %21 ]
store i32 %27, i32* %2
br label %33
28: ; preds = %9
br label %29
29: ; preds = %28
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %5
32: ; preds = %5
store i32 0, i32* %2
br label %33
33: ; preds = %32, %26
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
@reltable.isregister = internal unnamed_addr constant [35 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.2 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.3 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.4 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.5 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.6 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.7 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.8 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.9 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.10 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.11 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.12 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.13 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.14 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.15 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.16 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.17 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.18 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.19 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.20 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.21 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.22 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.23 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.24 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.25 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.26 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.27 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.28 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.29 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.30 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.31 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.32 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.33 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.34 to i64), i64 ptrtoint ([35 x i32]* @reltable.isregister to i64)) to i32)]
@.str = [3 x i8] c"al\00"
@.str.1 = [3 x i8] c"bl\00"
@.str.2 = [3 x i8] c"cl\00"
@.str.3 = [3 x i8] c"dl\00"
@.str.4 = [3 x i8] c"ah\00"
@.str.5 = [3 x i8] c"bh\00"
@.str.6 = [3 x i8] c"ch\00"
@.str.7 = [3 x i8] c"dh\00"
@.str.8 = [3 x i8] c"ax\00"
@.str.9 = [3 x i8] c"bx\00"
@.str.10 = [3 x i8] c"cx\00"
@.str.11 = [3 x i8] c"dx\00"
@.str.12 = [3 x i8] c"si\00"
@.str.13 = [3 x i8] c"di\00"
@.str.14 = [3 x i8] c"bp\00"
@.str.15 = [3 x i8] c"sp\00"
@.str.16 = [3 x i8] c"cs\00"
@.str.17 = [3 x i8] c"ds\00"
@.str.18 = [3 x i8] c"es\00"
@.str.19 = [3 x i8] c"fs\00"
@.str.20 = [3 x i8] c"gs\00"
@.str.21 = [3 x i8] c"ss\00"
@.str.22 = [4 x i8] c"eax\00"
@.str.23 = [4 x i8] c"ebx\00"
@.str.24 = [4 x i8] c"ecx\00"
@.str.25 = [4 x i8] c"edx\00"
@.str.26 = [4 x i8] c"esi\00"
@.str.27 = [4 x i8] c"edi\00"
@.str.28 = [4 x i8] c"ebp\00"
@.str.29 = [4 x i8] c"esp\00"
@.str.30 = [4 x i8] c"cr0\00"
@.str.31 = [4 x i8] c"cr1\00"
@.str.32 = [4 x i8] c"cr2\00"
@.str.33 = [4 x i8] c"cr3\00"
@.str.34 = [3 x i8] c"st\00"
define i32 @isregister(i8* %0) {
br label %2
2: ; preds = %1, %14
%3 = phi i64 [ 0, %1 ], [ %15, %14 ]
%4 = shl i64 %3, 2
%5 = call i8* @llvm.load.relative.i64(i8* bitcast ([35 x i32]* @reltable.isregister to i8*), i64 %4)
%6 = tail call i64 @strcmp(i8* %0, i8* %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = trunc i64 %3 to i32
%10 = icmp ult i32 %9, 8
%11 = icmp ult i32 %9, 22
%12 = select i1 %11, i32 2, i32 4
%13 = select i1 %10, i32 1, i32 %12
br label %17
14: ; preds = %2
%15 = add nuw nsw i64 %3, 1
%16 = icmp eq i64 %15, 35
br i1 %16, label %17, label %2
17: ; preds = %14, %8
%18 = phi i32 [ %13, %8 ], [ 0, %14 ]
ret i32 %18
}