#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*/ AddrSizeTable;

/* Variables and functions */
scalar_t__ StrCaseCmp(char const *, char const *);
unsigned char AddrSizeFromStr(const char *Str) {
  static const struct {
    const char *Name;
    unsigned char AddrSize;
  } AddrSizeTable[] = {
      {"abs", 0x02},    {"absolute", 0x02}, {"default", 0x00},
      {"direct", 0x01}, {"dword", 0x04},    {"far", 0x03},
      {"long", 0x04},   {"near", 0x02},     {"zeropage", 0x01},
      {"zp", 0x01},
  };
  unsigned I;
  for (I = 0; I < sizeof(AddrSizeTable) / sizeof(AddrSizeTable[0]); ++I) {
    if (StrCaseCmp(Str, AddrSizeTable[I].Name) == 0) {
      return AddrSizeTable[I].AddrSize;
    }
  }
  return 0xFF;
}


x86 assembly (clang, -O0):
<AddrSizeFromStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    $0xa,%rax
jae    118a <AddrSizeFromStr+0x7a>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
lea    0x2c40(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rsi
call   1030 <StrCaseCmp@plt>
cmp    $0x0,%rax
jne    1177 <AddrSizeFromStr+0x67>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
lea    0x2c1b(%rip),%rax
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%al
mov    %al,-0x1(%rbp)
jmp    118e <AddrSizeFromStr+0x7e>
jmp    117c <AddrSizeFromStr+0x6c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1123 <AddrSizeFromStr+0x13>
movb   $0xff,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AddrSizeFromStr>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
call   1030 <StrCaseCmp@plt>
test   %rax,%rax
je     11f9 <AddrSizeFromStr+0xe9>
lea    0xed4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <StrCaseCmp@plt>
test   %rax,%rax
je     11fd <AddrSizeFromStr+0xed>
lea    0xec5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <StrCaseCmp@plt>
test   %rax,%rax
je     1204 <AddrSizeFromStr+0xf4>
lea    0xeb5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <StrCaseCmp@plt>
test   %rax,%rax
je     120b <AddrSizeFromStr+0xfb>
lea    0xea4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <StrCaseCmp@plt>
test   %rax,%rax
je     1212 <AddrSizeFromStr+0x102>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
call   1030 <StrCaseCmp@plt>
test   %rax,%rax
je     1219 <AddrSizeFromStr+0x109>
lea    0xe82(%rip),%rsi
mov    %rbx,%rdi
call   1030 <StrCaseCmp@plt>
test   %rax,%rax
je     1220 <AddrSizeFromStr+0x110>
lea    0xe73(%rip),%rsi
mov    %rbx,%rdi
call   1030 <StrCaseCmp@plt>
test   %rax,%rax
je     1227 <AddrSizeFromStr+0x117>
lea    0xe64(%rip),%rsi
mov    %rbx,%rdi
call   1030 <StrCaseCmp@plt>
test   %rax,%rax
je     122e <AddrSizeFromStr+0x11e>
lea    0xe59(%rip),%rsi
mov    %rbx,%rdi
call   1030 <StrCaseCmp@plt>
mov    %rax,%rcx
mov    $0xff,%al
test   %rcx,%rcx
jne    1242 <AddrSizeFromStr+0x132>
mov    $0x9,%eax
jmp    1233 <AddrSizeFromStr+0x123>
xor    %eax,%eax
jmp    1233 <AddrSizeFromStr+0x123>
mov    $0x1,%eax
jmp    1233 <AddrSizeFromStr+0x123>
mov    $0x2,%eax
jmp    1233 <AddrSizeFromStr+0x123>
mov    $0x3,%eax
jmp    1233 <AddrSizeFromStr+0x123>
mov    $0x4,%eax
jmp    1233 <AddrSizeFromStr+0x123>
mov    $0x5,%eax
jmp    1233 <AddrSizeFromStr+0x123>
mov    $0x6,%eax
jmp    1233 <AddrSizeFromStr+0x123>
mov    $0x7,%eax
jmp    1233 <AddrSizeFromStr+0x123>
mov    $0x8,%eax
shl    $0x4,%rax
lea    0x2b42(%rip),%rcx
mov    0x8(%rax,%rcx,1),%al
pop    %rbx
ret

LLVM IR (-O0):
%struct.anon = type { i8*, i8 }
@AddrSizeFromStr.AddrSizeTable = internal constant [10 x %struct.anon] [%struct.anon { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8 2 }, %struct.anon { i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8 2 }, %struct.anon { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8 0 }, %struct.anon { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8 1 }, %struct.anon { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8 4 }, %struct.anon { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8 3 }, %struct.anon { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8 4 }, %struct.anon { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8 2 }, %struct.anon { i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i32 0, i32 0), i8 1 }, %struct.anon { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i32 0, i32 0), i8 1 }]
@.str = [4 x i8] c"abs\00"
@.str.1 = [9 x i8] c"absolute\00"
@.str.2 = [8 x i8] c"default\00"
@.str.3 = [7 x i8] c"direct\00"
@.str.4 = [6 x i8] c"dword\00"
@.str.5 = [4 x i8] c"far\00"
@.str.6 = [5 x i8] c"long\00"
@.str.7 = [5 x i8] c"near\00"
@.str.8 = [9 x i8] c"zeropage\00"
@.str.9 = [3 x i8] c"zp\00"
define zeroext i8 @AddrSizeFromStr(i8* %0) {
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %25, %1
%6 = load i32, i32* %4
%7 = zext i32 %6 to i64
%8 = icmp ult i64 %7, 10
br i1 %8, label %9, label %28
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i32, i32* %4
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds [10 x %struct.anon], [10 x %struct.anon]* @AddrSizeFromStr.AddrSizeTable, i64 0, i64 %12
%14 = getelementptr inbounds %struct.anon, %struct.anon* %13, i32 0, i32 0
%15 = load i8*, i8** %14
%16 = call i64 @StrCaseCmp(i8* %10, i8* %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %9
%19 = load i32, i32* %4
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds [10 x %struct.anon], [10 x %struct.anon]* @AddrSizeFromStr.AddrSizeTable, i64 0, i64 %20
%22 = getelementptr inbounds %struct.anon, %struct.anon* %21, i32 0, i32 1
%23 = load i8, i8* %22
store i8 %23, i8* %2
br label %29
24: ; preds = %9
br label %25
25: ; preds = %24
%26 = load i32, i32* %4
%27 = add i32 %26, 1
store i32 %27, i32* %4
br label %5
28: ; preds = %5
store i8 -1, i8* %2
br label %29
29: ; preds = %28, %18
%30 = load i8, i8* %2
ret i8 %30
}

LLVM IR (-O2):
%struct.anon = type { i8*, i8 }
@AddrSizeFromStr.AddrSizeTable = internal unnamed_addr constant [10 x %struct.anon] [%struct.anon { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8 2 }, %struct.anon { i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i32 0, i32 0), i8 2 }, %struct.anon { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8 0 }, %struct.anon { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8 1 }, %struct.anon { i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8 4 }, %struct.anon { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8 3 }, %struct.anon { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8 4 }, %struct.anon { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8 2 }, %struct.anon { i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i32 0, i32 0), i8 1 }, %struct.anon { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i32 0, i32 0), i8 1 }]
@.str = [4 x i8] c"abs\00"
@.str.1 = [9 x i8] c"absolute\00"
@.str.2 = [8 x i8] c"default\00"
@.str.3 = [7 x i8] c"direct\00"
@.str.4 = [6 x i8] c"dword\00"
@.str.5 = [4 x i8] c"far\00"
@.str.6 = [5 x i8] c"long\00"
@.str.7 = [5 x i8] c"near\00"
@.str.8 = [9 x i8] c"zeropage\00"
@.str.9 = [3 x i8] c"zp\00"
define zeroext i8 @AddrSizeFromStr(i8* %0) {
%2 = tail call i64 @StrCaseCmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %32, %29, %26, %23, %20, %17, %14, %11, %8, %1
%5 = phi i64 [ 0, %1 ], [ 1, %8 ], [ 2, %11 ], [ 3, %14 ], [ 4, %17 ], [ 5, %20 ], [ 6, %23 ], [ 7, %26 ], [ 8, %29 ], [ 9, %32 ]
%6 = getelementptr inbounds [10 x %struct.anon], [10 x %struct.anon]* @AddrSizeFromStr.AddrSizeTable, i64 0, i64 %5, i32 1
%7 = load i8, i8* %6
br label %35
8: ; preds = %1
%9 = tail call i64 @StrCaseCmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %4, label %11
11: ; preds = %8
%12 = tail call i64 @StrCaseCmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %4, label %14
14: ; preds = %11
%15 = tail call i64 @StrCaseCmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %4, label %17
17: ; preds = %14
%18 = tail call i64 @StrCaseCmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %4, label %20
20: ; preds = %17
%21 = tail call i64 @StrCaseCmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %4, label %23
23: ; preds = %20
%24 = tail call i64 @StrCaseCmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %4, label %26
26: ; preds = %23
%27 = tail call i64 @StrCaseCmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %4, label %29
29: ; preds = %26
%30 = tail call i64 @StrCaseCmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %4, label %32
32: ; preds = %29
%33 = tail call i64 @StrCaseCmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %4, label %35
35: ; preds = %32, %4
%36 = phi i8 [ %7, %4 ], [ -1, %32 ]
ret i8 %36
}