#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 code_table_3_1(unsigned char **);
unsigned char *flag_table_3_3_location(unsigned char **sec) {
  int grid_template, center;
  unsigned char *gds;
  grid_template = code_table_3_1(sec);
  center = ((int)((sec[1][5] << 8) + (sec[1][6])));
  gds = sec[3];
  switch (grid_template) {
  case 0:
  case 1:
  case 2:
  case 3:
  case 40:
  case 41:
  case 42:
  case 43:
  case 140:
  case 204:
    return gds + 54;
    break;
  case 4:
  case 5:
  case 10:
  case 12:
  case 20:
  case 30:
  case 31:
  case 90:
  case 110:
    return gds + 46;
    break;
  case 32768:
    if (center == 7)
      return gds + 54;
    return NULL;
  case 32769:
    if (center == 7)
      return gds + 54;
    return NULL;
  case 40110:
    if ((center == 34) || (center == 35))
      return gds + 46;
    return NULL;
    break;
  default:
    break;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<flag_table_3_3_location>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <code_table_3_1@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movzwl 0x5(%rax),%eax
shl    $0x10,%eax
bswap  %eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x4,%eax
jb     124c <flag_table_3_3_location+0x13c>
jmp    115c <flag_table_3_3_location+0x4c>
mov    -0x24(%rbp),%eax
add    $0xfffffffc,%eax
sub    $0x2,%eax
jb     125d <flag_table_3_3_location+0x14d>
jmp    1170 <flag_table_3_3_location+0x60>
mov    -0x24(%rbp),%eax
sub    $0xa,%eax
je     125d <flag_table_3_3_location+0x14d>
jmp    1181 <flag_table_3_3_location+0x71>
mov    -0x24(%rbp),%eax
sub    $0xc,%eax
je     125d <flag_table_3_3_location+0x14d>
jmp    1192 <flag_table_3_3_location+0x82>
mov    -0x24(%rbp),%eax
sub    $0x14,%eax
je     125d <flag_table_3_3_location+0x14d>
jmp    11a3 <flag_table_3_3_location+0x93>
mov    -0x24(%rbp),%eax
add    $0xffffffe2,%eax
sub    $0x2,%eax
jb     125d <flag_table_3_3_location+0x14d>
jmp    11b7 <flag_table_3_3_location+0xa7>
mov    -0x24(%rbp),%eax
add    $0xffffffd8,%eax
sub    $0x4,%eax
jb     124c <flag_table_3_3_location+0x13c>
jmp    11cb <flag_table_3_3_location+0xbb>
mov    -0x24(%rbp),%eax
sub    $0x5a,%eax
je     125d <flag_table_3_3_location+0x14d>
jmp    11dc <flag_table_3_3_location+0xcc>
mov    -0x24(%rbp),%eax
sub    $0x6e,%eax
je     125d <flag_table_3_3_location+0x14d>
jmp    11ed <flag_table_3_3_location+0xdd>
mov    -0x24(%rbp),%eax
sub    $0x8c,%eax
je     124c <flag_table_3_3_location+0x13c>
jmp    1200 <flag_table_3_3_location+0xf0>
mov    -0x24(%rbp),%eax
sub    $0xcc,%eax
je     124c <flag_table_3_3_location+0x13c>
jmp    1213 <flag_table_3_3_location+0x103>
mov    -0x24(%rbp),%eax
sub    $0x8000,%eax
je     126e <flag_table_3_3_location+0x15e>
jmp    1226 <flag_table_3_3_location+0x116>
mov    -0x24(%rbp),%eax
sub    $0x8001,%eax
je     1296 <flag_table_3_3_location+0x186>
jmp    1239 <flag_table_3_3_location+0x129>
mov    -0x24(%rbp),%eax
sub    $0x9cae,%eax
je     12be <flag_table_3_3_location+0x1ae>
jmp    12f0 <flag_table_3_3_location+0x1e0>
mov    -0x20(%rbp),%rax
add    $0x36,%rax
mov    %rax,-0x8(%rbp)
jmp    12fd <flag_table_3_3_location+0x1ed>
mov    -0x20(%rbp),%rax
add    $0x2e,%rax
mov    %rax,-0x8(%rbp)
jmp    12fd <flag_table_3_3_location+0x1ed>
cmpl   $0x7,-0x18(%rbp)
jne    1289 <flag_table_3_3_location+0x179>
mov    -0x20(%rbp),%rax
add    $0x36,%rax
mov    %rax,-0x8(%rbp)
jmp    12fd <flag_table_3_3_location+0x1ed>
movq   $0x0,-0x8(%rbp)
jmp    12fd <flag_table_3_3_location+0x1ed>
cmpl   $0x7,-0x18(%rbp)
jne    12b1 <flag_table_3_3_location+0x1a1>
mov    -0x20(%rbp),%rax
add    $0x36,%rax
mov    %rax,-0x8(%rbp)
jmp    12fd <flag_table_3_3_location+0x1ed>
movq   $0x0,-0x8(%rbp)
jmp    12fd <flag_table_3_3_location+0x1ed>
cmpl   $0x22,-0x18(%rbp)
je     12d2 <flag_table_3_3_location+0x1c2>
cmpl   $0x23,-0x18(%rbp)
jne    12e3 <flag_table_3_3_location+0x1d3>
mov    -0x20(%rbp),%rax
add    $0x2e,%rax
mov    %rax,-0x8(%rbp)
jmp    12fd <flag_table_3_3_location+0x1ed>
movq   $0x0,-0x8(%rbp)
jmp    12fd <flag_table_3_3_location+0x1ed>
jmp    12f5 <flag_table_3_3_location+0x1e5>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flag_table_3_3_location>:
push   %rbx
mov    %rdi,%rbx
call   1030 <code_table_3_1@plt>
mov    %eax,%ecx
mov    0x18(%rbx),%rdx
xor    %eax,%eax
cmp    $0xcb,%ecx
jg     1152 <flag_table_3_3_location+0x42>
cmp    $0x8c,%ecx
ja     1150 <flag_table_3_3_location+0x40>
mov    %ecx,%ecx
lea    0xec6(%rip),%rsi
movslq (%rsi,%rcx,4),%rcx
add    %rsi,%rcx
jmp    *%rcx
add    $0x36,%rdx
jmp    114d <flag_table_3_3_location+0x3d>
add    $0x2e,%rdx
mov    %rdx,%rax
pop    %rbx
ret
mov    0x8(%rbx),%rsi
movzwl 0x5(%rsi),%esi
shl    $0x10,%esi
bswap  %esi
cmp    $0x8000,%ecx
jg     1179 <flag_table_3_3_location+0x69>
cmp    $0xcc,%ecx
je     1143 <flag_table_3_3_location+0x33>
cmp    $0x8000,%ecx
je     1197 <flag_table_3_3_location+0x87>
jmp    1150 <flag_table_3_3_location+0x40>
cmp    $0x8001,%ecx
je     1197 <flag_table_3_3_location+0x87>
cmp    $0x9cae,%ecx
jne    1150 <flag_table_3_3_location+0x40>
and    $0xfffffffe,%esi
add    $0x2e,%rdx
xor    %eax,%eax
cmp    $0x22,%esi
jmp    11a0 <flag_table_3_3_location+0x90>
add    $0x36,%rdx
xor    %eax,%eax
cmp    $0x7,%esi
cmove  %rdx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @flag_table_3_3_location(i8** %0) {
%2 = alloca i8*
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i8** %0, i8*** %3
%7 = load i8**, i8*** %3
%8 = call i32 @code_table_3_1(i8** %7)
store i32 %8, i32* %4
%9 = load i8**, i8*** %3
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8, i8* %11, i64 5
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = shl i32 %14, 8
%16 = load i8**, i8*** %3
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = getelementptr inbounds i8, i8* %18, i64 6
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = add nsw i32 %15, %21
store i32 %22, i32* %5
%23 = load i8**, i8*** %3
%24 = getelementptr inbounds i8*, i8** %23, i64 3
%25 = load i8*, i8** %24
store i8* %25, i8** %6
%26 = load i32, i32* %4
switch i32 %26, label %57 [
i32 0, label %27
i32 1, label %27
i32 2, label %27
i32 3, label %27
i32 40, label %27
i32 41, label %27
i32 42, label %27
i32 43, label %27
i32 140, label %27
i32 204, label %27
i32 4, label %30
i32 5, label %30
i32 10, label %30
i32 12, label %30
i32 20, label %30
i32 30, label %30
i32 31, label %30
i32 90, label %30
i32 110, label %30
i32 32768, label %33
i32 32769, label %40
i32 40110, label %47
]
27: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
%28 = load i8*, i8** %6
%29 = getelementptr inbounds i8, i8* %28, i64 54
store i8* %29, i8** %2
br label %59
30: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1
%31 = load i8*, i8** %6
%32 = getelementptr inbounds i8, i8* %31, i64 46
store i8* %32, i8** %2
br label %59
33: ; preds = %1
%34 = load i32, i32* %5
%35 = icmp eq i32 %34, 7
br i1 %35, label %36, label %39
36: ; preds = %33
%37 = load i8*, i8** %6
%38 = getelementptr inbounds i8, i8* %37, i64 54
store i8* %38, i8** %2
br label %59
39: ; preds = %33
store i8* null, i8** %2
br label %59
40: ; preds = %1
%41 = load i32, i32* %5
%42 = icmp eq i32 %41, 7
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = load i8*, i8** %6
%45 = getelementptr inbounds i8, i8* %44, i64 54
store i8* %45, i8** %2
br label %59
46: ; preds = %40
store i8* null, i8** %2
br label %59
47: ; preds = %1
%48 = load i32, i32* %5
%49 = icmp eq i32 %48, 34
br i1 %49, label %53, label %50
50: ; preds = %47
%51 = load i32, i32* %5
%52 = icmp eq i32 %51, 35
br i1 %52, label %53, label %56
53: ; preds = %50, %47
%54 = load i8*, i8** %6
%55 = getelementptr inbounds i8, i8* %54, i64 46
store i8* %55, i8** %2
br label %59
56: ; preds = %50
store i8* null, i8** %2
br label %59
57: ; preds = %1
br label %58
58: ; preds = %57
store i8* null, i8** %2
br label %59
59: ; preds = %58, %56, %53, %46, %43, %39, %36, %30, %27
%60 = load i8*, i8** %2
ret i8* %60
}

LLVM IR (-O2):
define i8* @flag_table_3_3_location(i8** %0) {
%2 = tail call i32 @code_table_3_1(i8** %0)
%3 = getelementptr inbounds i8*, i8** %0, i64 1
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 5
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 8
%9 = getelementptr inbounds i8, i8* %4, i64 6
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = or i32 %8, %11
%13 = getelementptr inbounds i8*, i8** %0, i64 3
%14 = load i8*, i8** %13
switch i32 %2, label %32 [
i32 0, label %15
i32 1, label %15
i32 2, label %15
i32 3, label %15
i32 40, label %15
i32 41, label %15
i32 42, label %15
i32 43, label %15
i32 140, label %15
i32 204, label %15
i32 4, label %17
i32 5, label %17
i32 10, label %17
i32 12, label %17
i32 20, label %17
i32 30, label %17
i32 31, label %17
i32 90, label %17
i32 110, label %17
i32 32768, label %19
i32 32769, label %23
i32 40110, label %27
]
15: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
%16 = getelementptr inbounds i8, i8* %14, i64 54
br label %32
17: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1
%18 = getelementptr inbounds i8, i8* %14, i64 46
br label %32
19: ; preds = %1
%20 = icmp eq i32 %12, 7
%21 = getelementptr inbounds i8, i8* %14, i64 54
%22 = select i1 %20, i8* %21, i8* null
br label %32
23: ; preds = %1
%24 = icmp eq i32 %12, 7
%25 = getelementptr inbounds i8, i8* %14, i64 54
%26 = select i1 %24, i8* %25, i8* null
br label %32
27: ; preds = %1
%28 = and i32 %12, 65534
%29 = icmp eq i32 %28, 34
%30 = getelementptr inbounds i8, i8* %14, i64 46
%31 = select i1 %29, i8* %30, i8* null
br label %32
32: ; preds = %27, %23, %19, %1, %17, %15
%33 = phi i8* [ %18, %17 ], [ %16, %15 ], [ null, %1 ], [ %22, %19 ], [ %26, %23 ], [ %31, %27 ]
ret i8* %33
}