#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 uint8_t;
typedef int uint32_t;

/* Variables and functions */
scalar_t__ isProbably0840(int const *, int);
scalar_t__ isProbably3E(int const *, int);
scalar_t__ isProbably3F(int const *, int);
scalar_t__ isProbably4KSC(int const *, int);
scalar_t__ isProbablyCV(int const *, int);
scalar_t__ isProbablyDPCplus(int const *, int);
scalar_t__ isProbablyE0(int const *, int);
scalar_t__ isProbablyE7(int const *, int);
scalar_t__ isProbablyFA2(int const *, int);
scalar_t__ isProbablyFE(int const *, int);
scalar_t__ isProbablySC(int const *, int);
scalar_t__ isProbablyUA(int const *, int);
scalar_t__ memcmp(int const *, int const *, int);
int searchForBytes(int const *, int, int *, int, int);
const char *CartIdentify(const uint8_t *rom, uint32_t size) {
  if ((size % 8448) == 0 || size == 6144) {
    return "AR";
  }
  if (size < 2048) {
    return "2K";
  }
  if (size == 2048 || (size == 4096 && memcmp(rom, rom + 2048, 2048) == 0)) {
    return isProbablyCV(rom, size) ? "CV2K" : "2K";
  }
  if (size == 4096) {
    if (isProbablyCV(rom, size))
      return "CV4K";
    if (isProbably4KSC(rom, size))
      return "4KSC";
    return "4K";
  }
  if (size == 8192) {
    uint8_t signature[] = {0x8D, 0xF9, 0x1F};
    int f8 = searchForBytes(rom, size, signature, 3, 2);
    if (isProbablySC(rom, size))
      return "8KSC";
    else if (memcmp(rom, rom + 4096, 4096) == 0)
      return "4K";
    else if (isProbablyE0(rom, size))
      return "8KE0";
    else if (isProbably3E(rom, size))
      return "8K3E";
    else if (isProbably3F(rom, size))
      return "8K3F";
    else if (isProbablyUA(rom, size))
      return "8KUA";
    else if (isProbablyFE(rom, size) && !f8)
      return "8KFE";
    else if (isProbably0840(rom, size))
      return "0840";
    else
      return "8K";
  }
  if (size >= 10240 && size <= 10496) {
    return "DPC";
  }
  if (size == 12288) {
    return "12K";
  }
  if (size == 16384) {
    if (isProbablySC(rom, size))
      return "16KSC";
    else if (isProbablyE7(rom, size))
      return "16KE7";
    else if (isProbably3E(rom, size))
      return "16K3E";
    else
      return "16K";
  }
  if (size == 32768) {
    if (isProbablySC(rom, size))
      return "32KSC";
    else if (isProbably3E(rom, size))
      return "32K3E";
    else if (isProbably3F(rom, size))
      return "32K3F";
    else if (isProbablyDPCplus(rom, size))
      return "DPC+";
    else if (isProbablyFA2(rom, size))
      return "32KFA2";
    else
      return "32K";
  }
  return "";
}


x86 assembly (clang, -O0):
<CartIdentify>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2100,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1210 <CartIdentify+0x30>
cmpl   $0x1800,-0x14(%rbp)
jne    1220 <CartIdentify+0x40>
lea    0xde9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
cmpl   $0x800,-0x14(%rbp)
jge    123d <CartIdentify+0x5d>
lea    0xe09(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
cmpl   $0x800,-0x14(%rbp)
je     127a <CartIdentify+0x9a>
cmpl   $0x1000,-0x14(%rbp)
jne    12a8 <CartIdentify+0xc8>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x2000,%rsi
mov    $0x800,%edx
call   1080 <memcmp@plt>
cmp    $0x0,%rax
jne    12a8 <CartIdentify+0xc8>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10d0 <isProbablyCV@plt>
mov    %rax,%rdx
lea    0xdad(%rip),%rax
lea    0xd6c(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
cmpl   $0x1000,-0x14(%rbp)
jne    1311 <CartIdentify+0x131>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10d0 <isProbablyCV@plt>
cmp    $0x0,%rax
je     12db <CartIdentify+0xfb>
lea    0xd36(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10f0 <isProbably4KSC@plt>
cmp    $0x0,%rax
je     1301 <CartIdentify+0x121>
lea    0xd15(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
lea    0xd02(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
cmpl   $0x2000,-0x14(%rbp)
jne    14a7 <CartIdentify+0x2c7>
mov    0xd53(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xd51(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    -0x20(%rbp),%rdx
mov    $0x3,%ecx
mov    $0x2,%r8d
call   1050 <searchForBytes@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <isProbablySC@plt>
cmp    $0x0,%rax
je     1376 <CartIdentify+0x196>
lea    0xca5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x4000,%rsi
mov    $0x1000,%edx
call   1080 <memcmp@plt>
cmp    $0x0,%rax
jne    13a9 <CartIdentify+0x1c9>
lea    0xc6a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10e0 <isProbablyE0@plt>
cmp    $0x0,%rax
je     13cf <CartIdentify+0x1ef>
lea    0xc51(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10a0 <isProbably3E@plt>
cmp    $0x0,%rax
je     13f5 <CartIdentify+0x215>
lea    0xc30(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1100 <isProbably3F@plt>
cmp    $0x0,%rax
je     141b <CartIdentify+0x23b>
lea    0xc0f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <isProbablyUA@plt>
cmp    $0x0,%rax
je     1441 <CartIdentify+0x261>
lea    0xbee(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10b0 <isProbablyFE@plt>
cmp    $0x0,%rax
je     1471 <CartIdentify+0x291>
cmpl   $0x0,-0x24(%rbp)
jne    1471 <CartIdentify+0x291>
lea    0xbc3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1090 <isProbably0840@plt>
cmp    $0x0,%rax
je     1497 <CartIdentify+0x2b7>
lea    0xba2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
lea    0xb97(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
cmpl   $0x2800,-0x14(%rbp)
jl     14d1 <CartIdentify+0x2f1>
cmpl   $0x2900,-0x14(%rbp)
jg     14d1 <CartIdentify+0x2f1>
lea    0xb70(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
cmpl   $0x3000,-0x14(%rbp)
jne    14ee <CartIdentify+0x30e>
lea    0xb57(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
cmpl   $0x4000,-0x14(%rbp)
jne    157d <CartIdentify+0x39d>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <isProbablySC@plt>
cmp    $0x0,%rax
je     1521 <CartIdentify+0x341>
lea    0xb28(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <isProbablyE7@plt>
cmp    $0x0,%rax
je     1547 <CartIdentify+0x367>
lea    0xb08(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10a0 <isProbably3E@plt>
cmp    $0x0,%rax
je     156d <CartIdentify+0x38d>
lea    0xae8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
lea    0xade(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
cmpl   $0x8000,-0x14(%rbp)
jne    1658 <CartIdentify+0x478>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <isProbablySC@plt>
cmp    $0x0,%rax
je     15b0 <CartIdentify+0x3d0>
lea    0xaaf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10a0 <isProbably3E@plt>
cmp    $0x0,%rax
je     15d6 <CartIdentify+0x3f6>
lea    0xa8f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1100 <isProbably3F@plt>
cmp    $0x0,%rax
je     15fc <CartIdentify+0x41c>
lea    0xa6f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   10c0 <isProbablyDPCplus@plt>
cmp    $0x0,%rax
je     1622 <CartIdentify+0x442>
lea    0xa4f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <isProbablyFA2@plt>
cmp    $0x0,%rax
je     1648 <CartIdentify+0x468>
lea    0xa2e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
lea    0xa25(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1663 <CartIdentify+0x483>
lea    0xa0d(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CartIdentify>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xe13(%rip),%rax
cmp    $0x1800,%esi
je     1503 <CartIdentify+0x323>
mov    %esi,%ebp
movslq %esi,%rcx
imul   $0x3e0f83e1,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x2b,%rdx
add    %esi,%edx
imul   $0x2100,%edx,%edx
sub    %edx,%ecx
je     1503 <CartIdentify+0x323>
cmp    $0x800,%ebp
jge    1234 <CartIdentify+0x54>
lea    0xe0e(%rip),%rax
jmp    1503 <CartIdentify+0x323>
mov    %rdi,%rbx
je     1288 <CartIdentify+0xa8>
cmp    $0x2000,%ebp
je     12ac <CartIdentify+0xcc>
cmp    $0x1000,%ebp
jne    12ff <CartIdentify+0x11f>
lea    0x2000(%rbx),%rsi
mov    %rbx,%rdi
mov    $0x800,%edx
call   1080 <memcmp@plt>
test   %rax,%rax
je     1288 <CartIdentify+0xa8>
mov    %rbx,%rdi
mov    $0x1000,%esi
call   10d0 <isProbablyCV@plt>
test   %rax,%rax
je     1395 <CartIdentify+0x1b5>
lea    0xd85(%rip),%rax
jmp    1503 <CartIdentify+0x323>
mov    %rbx,%rdi
mov    %ebp,%esi
call   10d0 <isProbablyCV@plt>
test   %rax,%rax
lea    0xda1(%rip),%rcx
lea    0xd60(%rip),%rax
cmove  %rcx,%rax
jmp    1503 <CartIdentify+0x323>
mov    0xdce(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xdbb(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x2000,%esi
mov    $0x3,%ecx
mov    $0x2,%r8d
call   1050 <searchForBytes@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x2000,%esi
call   1040 <isProbablySC@plt>
test   %rax,%rax
je     135e <CartIdentify+0x17e>
lea    0xd18(%rip),%rax
jmp    1503 <CartIdentify+0x323>
lea    -0x2800(%rbp),%eax
cmp    $0x101,%eax
jae    1318 <CartIdentify+0x138>
lea    0xd25(%rip),%rax
jmp    1503 <CartIdentify+0x323>
cmp    $0x3000,%ebp
je     13c4 <CartIdentify+0x1e4>
cmp    $0x8000,%ebp
je     13d0 <CartIdentify+0x1f0>
cmp    $0x4000,%ebp
jne    13ee <CartIdentify+0x20e>
mov    %rbx,%rdi
mov    $0x4000,%esi
call   1040 <isProbablySC@plt>
test   %rax,%rax
je     1418 <CartIdentify+0x238>
lea    0xce7(%rip),%rax
jmp    1503 <CartIdentify+0x323>
lea    0x4000(%rbx),%rsi
mov    %rbx,%rdi
mov    $0x1000,%edx
call   1080 <memcmp@plt>
test   %rax,%rax
je     13b8 <CartIdentify+0x1d8>
mov    %rbx,%rdi
mov    $0x2000,%esi
call   10e0 <isProbablyE0@plt>
test   %rax,%rax
je     13fa <CartIdentify+0x21a>
lea    0xc87(%rip),%rax
jmp    1503 <CartIdentify+0x323>
mov    %rbx,%rdi
mov    $0x1000,%esi
call   10f0 <isProbably4KSC@plt>
test   %rax,%rax
lea    0xc5e(%rip),%rcx
lea    0xc5a(%rip),%rax
jmp    12a3 <CartIdentify+0xc3>
lea    0xc4b(%rip),%rax
jmp    1503 <CartIdentify+0x323>
lea    0xc71(%rip),%rax
jmp    1503 <CartIdentify+0x323>
mov    %rbx,%rdi
mov    $0x8000,%esi
call   1040 <isProbablySC@plt>
test   %rax,%rax
je     1436 <CartIdentify+0x256>
lea    0xc6d(%rip),%rax
jmp    1503 <CartIdentify+0x323>
lea    0xc77(%rip),%rax
jmp    1503 <CartIdentify+0x323>
mov    %rbx,%rdi
mov    $0x2000,%esi
call   10a0 <isProbably3E@plt>
test   %rax,%rax
je     1454 <CartIdentify+0x274>
lea    0xc09(%rip),%rax
jmp    1503 <CartIdentify+0x323>
mov    %rbx,%rdi
mov    $0x4000,%esi
call   1060 <isProbablyE7@plt>
test   %rax,%rax
je     1472 <CartIdentify+0x292>
lea    0xc15(%rip),%rax
jmp    1503 <CartIdentify+0x323>
mov    %rbx,%rdi
mov    $0x8000,%esi
call   10a0 <isProbably3E@plt>
test   %rax,%rax
je     1495 <CartIdentify+0x2b5>
lea    0xc0d(%rip),%rax
jmp    1503 <CartIdentify+0x323>
mov    %rbx,%rdi
mov    $0x2000,%esi
call   1100 <isProbably3F@plt>
test   %rax,%rax
je     14b0 <CartIdentify+0x2d0>
lea    0xbb4(%rip),%rax
jmp    1503 <CartIdentify+0x323>
mov    %rbx,%rdi
mov    $0x4000,%esi
call   10a0 <isProbably3E@plt>
test   %rax,%rax
lea    0xbc9(%rip),%rcx
lea    0xbbc(%rip),%rax
jmp    12a3 <CartIdentify+0xc3>
mov    %rbx,%rdi
mov    $0x8000,%esi
call   1100 <isProbably3F@plt>
test   %rax,%rax
je     14cb <CartIdentify+0x2eb>
lea    0xbb4(%rip),%rax
jmp    1503 <CartIdentify+0x323>
mov    %rbx,%rdi
mov    $0x2000,%esi
call   1070 <isProbablyUA@plt>
test   %rax,%rax
je     14e6 <CartIdentify+0x306>
lea    0xb5d(%rip),%rax
jmp    1503 <CartIdentify+0x323>
mov    %rbx,%rdi
mov    $0x8000,%esi
call   10c0 <isProbablyDPCplus@plt>
test   %rax,%rax
je     150a <CartIdentify+0x32a>
lea    0xb84(%rip),%rax
jmp    1503 <CartIdentify+0x323>
mov    %rbx,%rdi
mov    $0x2000,%esi
call   10b0 <isProbablyFE@plt>
test   %rax,%rax
je     152d <CartIdentify+0x34d>
test   %ebp,%ebp
jne    152d <CartIdentify+0x34d>
lea    0xb28(%rip),%rax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rbx,%rdi
mov    $0x8000,%esi
call   1030 <isProbablyFA2@plt>
test   %rax,%rax
lea    0xb53(%rip),%rcx
lea    0xb45(%rip),%rax
jmp    12a3 <CartIdentify+0xc3>
mov    %rbx,%rdi
mov    $0x2000,%esi
call   1090 <isProbably0840@plt>
test   %rax,%rax
lea    0xaf1(%rip),%rcx
lea    0xae5(%rip),%rax
jmp    12a3 <CartIdentify+0xc3>

LLVM IR (-O0):
@.str = [3 x i8] c"AR\00"
@.str.1 = [3 x i8] c"2K\00"
@.str.2 = [5 x i8] c"CV2K\00"
@.str.3 = [5 x i8] c"CV4K\00"
@.str.4 = [5 x i8] c"4KSC\00"
@.str.5 = [3 x i8] c"4K\00"
@__const.CartIdentify.signature = [3 x i32] [i32 141, i32 249, i32 31]
@.str.6 = [5 x i8] c"8KSC\00"
@.str.7 = [5 x i8] c"8KE0\00"
@.str.8 = [5 x i8] c"8K3E\00"
@.str.9 = [5 x i8] c"8K3F\00"
@.str.10 = [5 x i8] c"8KUA\00"
@.str.11 = [5 x i8] c"8KFE\00"
@.str.12 = [5 x i8] c"0840\00"
@.str.13 = [3 x i8] c"8K\00"
@.str.14 = [4 x i8] c"DPC\00"
@.str.15 = [4 x i8] c"12K\00"
@.str.16 = [6 x i8] c"16KSC\00"
@.str.17 = [6 x i8] c"16KE7\00"
@.str.18 = [6 x i8] c"16K3E\00"
@.str.19 = [4 x i8] c"16K\00"
@.str.20 = [6 x i8] c"32KSC\00"
@.str.21 = [6 x i8] c"32K3E\00"
@.str.22 = [6 x i8] c"32K3F\00"
@.str.23 = [5 x i8] c"DPC+\00"
@.str.24 = [7 x i8] c"32KFA2\00"
@.str.25 = [4 x i8] c"32K\00"
@.str.26 = [1 x i8] zeroinitializer
define i8* @CartIdentify(i32* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca [3 x i32]
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
%8 = load i32, i32* %5
%9 = srem i32 %8, 8448
%10 = icmp eq i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load i32, i32* %5
%13 = icmp eq i32 %12, 6144
br i1 %13, label %14, label %15
14: ; preds = %11, %2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %3
br label %183
15: ; preds = %11
%16 = load i32, i32* %5
%17 = icmp slt i32 %16, 2048
br i1 %17, label %18, label %19
18: ; preds = %15
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %183
19: ; preds = %15
%20 = load i32, i32* %5
%21 = icmp eq i32 %20, 2048
br i1 %21, label %31, label %22
22: ; preds = %19
%23 = load i32, i32* %5
%24 = icmp eq i32 %23, 4096
br i1 %24, label %25, label %38
25: ; preds = %22
%26 = load i32*, i32** %4
%27 = load i32*, i32** %4
%28 = getelementptr inbounds i32, i32* %27, i64 2048
%29 = call i64 @memcmp(i32* %26, i32* %28, i32 2048)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %38
31: ; preds = %25, %19
%32 = load i32*, i32** %4
%33 = load i32, i32* %5
%34 = call i64 @isProbablyCV(i32* %32, i32 %33)
%35 = icmp ne i64 %34, 0
%36 = zext i1 %35 to i64
%37 = select i1 %35, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
store i8* %37, i8** %3
br label %183
38: ; preds = %25, %22
%39 = load i32, i32* %5
%40 = icmp eq i32 %39, 4096
br i1 %40, label %41, label %54
41: ; preds = %38
%42 = load i32*, i32** %4
%43 = load i32, i32* %5
%44 = call i64 @isProbablyCV(i32* %42, i32 %43)
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %41
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8** %3
br label %183
47: ; preds = %41
%48 = load i32*, i32** %4
%49 = load i32, i32* %5
%50 = call i64 @isProbably4KSC(i32* %48, i32 %49)
%51 = icmp ne i64 %50, 0
br i1 %51, label %52, label %53
52: ; preds = %47
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8** %3
br label %183
53: ; preds = %47
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8** %3
br label %183
54: ; preds = %38
%55 = load i32, i32* %5
%56 = icmp eq i32 %55, 8192
br i1 %56, label %57, label %115
57: ; preds = %54
%58 = bitcast [3 x i32]* %6 to i8*
%59 = load i32*, i32** %4
%60 = load i32, i32* %5
%61 = getelementptr inbounds [3 x i32], [3 x i32]* %6, i64 0, i64 0
%62 = call i32 @searchForBytes(i32* %59, i32 %60, i32* %61, i32 3, i32 2)
store i32 %62, i32* %7
%63 = load i32*, i32** %4
%64 = load i32, i32* %5
%65 = call i64 @isProbablySC(i32* %63, i32 %64)
%66 = icmp ne i64 %65, 0
br i1 %66, label %67, label %68
67: ; preds = %57
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8** %3
br label %183
68: ; preds = %57
%69 = load i32*, i32** %4
%70 = load i32*, i32** %4
%71 = getelementptr inbounds i32, i32* %70, i64 4096
%72 = call i64 @memcmp(i32* %69, i32* %71, i32 4096)
%73 = icmp eq i64 %72, 0
br i1 %73, label %74, label %75
74: ; preds = %68
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8** %3
br label %183
75: ; preds = %68
%76 = load i32*, i32** %4
%77 = load i32, i32* %5
%78 = call i64 @isProbablyE0(i32* %76, i32 %77)
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %81
80: ; preds = %75
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8** %3
br label %183
81: ; preds = %75
%82 = load i32*, i32** %4
%83 = load i32, i32* %5
%84 = call i64 @isProbably3E(i32* %82, i32 %83)
%85 = icmp ne i64 %84, 0
br i1 %85, label %86, label %87
86: ; preds = %81
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8** %3
br label %183
87: ; preds = %81
%88 = load i32*, i32** %4
%89 = load i32, i32* %5
%90 = call i64 @isProbably3F(i32* %88, i32 %89)
%91 = icmp ne i64 %90, 0
br i1 %91, label %92, label %93
92: ; preds = %87
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8** %3
br label %183
93: ; preds = %87
%94 = load i32*, i32** %4
%95 = load i32, i32* %5
%96 = call i64 @isProbablyUA(i32* %94, i32 %95)
%97 = icmp ne i64 %96, 0
br i1 %97, label %98, label %99
98: ; preds = %93
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8** %3
br label %183
99: ; preds = %93
%100 = load i32*, i32** %4
%101 = load i32, i32* %5
%102 = call i64 @isProbablyFE(i32* %100, i32 %101)
%103 = icmp ne i64 %102, 0
br i1 %103, label %104, label %108
104: ; preds = %99
%105 = load i32, i32* %7
%106 = icmp ne i32 %105, 0
br i1 %106, label %108, label %107
107: ; preds = %104
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8** %3
br label %183
108: ; preds = %104, %99
%109 = load i32*, i32** %4
%110 = load i32, i32* %5
%111 = call i64 @isProbably0840(i32* %109, i32 %110)
%112 = icmp ne i64 %111, 0
br i1 %112, label %113, label %114
113: ; preds = %108
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8** %3
br label %183
114: ; preds = %108
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8** %3
br label %183
115: ; preds = %54
%116 = load i32, i32* %5
%117 = icmp sge i32 %116, 10240
br i1 %117, label %118, label %122
118: ; preds = %115
%119 = load i32, i32* %5
%120 = icmp sle i32 %119, 10496
br i1 %120, label %121, label %122
121: ; preds = %118
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i8** %3
br label %183
122: ; preds = %118, %115
%123 = load i32, i32* %5
%124 = icmp eq i32 %123, 12288
br i1 %124, label %125, label %126
125: ; preds = %122
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i8** %3
br label %183
126: ; preds = %122
%127 = load i32, i32* %5
%128 = icmp eq i32 %127, 16384
br i1 %128, label %129, label %148
129: ; preds = %126
%130 = load i32*, i32** %4
%131 = load i32, i32* %5
%132 = call i64 @isProbablySC(i32* %130, i32 %131)
%133 = icmp ne i64 %132, 0
br i1 %133, label %134, label %135
134: ; preds = %129
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i8** %3
br label %183
135: ; preds = %129
%136 = load i32*, i32** %4
%137 = load i32, i32* %5
%138 = call i64 @isProbablyE7(i32* %136, i32 %137)
%139 = icmp ne i64 %138, 0
br i1 %139, label %140, label %141
140: ; preds = %135
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0), i8** %3
br label %183
141: ; preds = %135
%142 = load i32*, i32** %4
%143 = load i32, i32* %5
%144 = call i64 @isProbably3E(i32* %142, i32 %143)
%145 = icmp ne i64 %144, 0
br i1 %145, label %146, label %147
146: ; preds = %141
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i64 0, i64 0), i8** %3
br label %183
147: ; preds = %141
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0), i8** %3
br label %183
148: ; preds = %126
%149 = load i32, i32* %5
%150 = icmp eq i32 %149, 32768
br i1 %150, label %151, label %182
151: ; preds = %148
%152 = load i32*, i32** %4
%153 = load i32, i32* %5
%154 = call i64 @isProbablySC(i32* %152, i32 %153)
%155 = icmp ne i64 %154, 0
br i1 %155, label %156, label %157
156: ; preds = %151
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i64 0, i64 0), i8** %3
br label %183
157: ; preds = %151
%158 = load i32*, i32** %4
%159 = load i32, i32* %5
%160 = call i64 @isProbably3E(i32* %158, i32 %159)
%161 = icmp ne i64 %160, 0
br i1 %161, label %162, label %163
162: ; preds = %157
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i8** %3
br label %183
163: ; preds = %157
%164 = load i32*, i32** %4
%165 = load i32, i32* %5
%166 = call i64 @isProbably3F(i32* %164, i32 %165)
%167 = icmp ne i64 %166, 0
br i1 %167, label %168, label %169
168: ; preds = %163
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i64 0, i64 0), i8** %3
br label %183
169: ; preds = %163
%170 = load i32*, i32** %4
%171 = load i32, i32* %5
%172 = call i64 @isProbablyDPCplus(i32* %170, i32 %171)
%173 = icmp ne i64 %172, 0
br i1 %173, label %174, label %175
174: ; preds = %169
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.23, i64 0, i64 0), i8** %3
br label %183
175: ; preds = %169
%176 = load i32*, i32** %4
%177 = load i32, i32* %5
%178 = call i64 @isProbablyFA2(i32* %176, i32 %177)
%179 = icmp ne i64 %178, 0
br i1 %179, label %180, label %181
180: ; preds = %175
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.24, i64 0, i64 0), i8** %3
br label %183
181: ; preds = %175
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.25, i64 0, i64 0), i8** %3
br label %183
182: ; preds = %148
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.26, i64 0, i64 0), i8** %3
br label %183
183: ; preds = %182, %181, %180, %174, %168, %162, %156, %147, %146, %140, %134, %125, %121, %114, %113, %107, %98, %92, %86, %80, %74, %67, %53, %52, %46, %31, %18, %14
%184 = load i8*, i8** %3
ret i8* %184
}

LLVM IR (-O2):
@.str = [3 x i8] c"AR\00"
@.str.1 = [3 x i8] c"2K\00"
@.str.2 = [5 x i8] c"CV2K\00"
@.str.3 = [5 x i8] c"CV4K\00"
@.str.4 = [5 x i8] c"4KSC\00"
@.str.5 = [3 x i8] c"4K\00"
@__const.CartIdentify.signature = [3 x i32] [i32 141, i32 249, i32 31]
@.str.6 = [5 x i8] c"8KSC\00"
@.str.7 = [5 x i8] c"8KE0\00"
@.str.8 = [5 x i8] c"8K3E\00"
@.str.9 = [5 x i8] c"8K3F\00"
@.str.10 = [5 x i8] c"8KUA\00"
@.str.11 = [5 x i8] c"8KFE\00"
@.str.12 = [5 x i8] c"0840\00"
@.str.13 = [3 x i8] c"8K\00"
@.str.14 = [4 x i8] c"DPC\00"
@.str.15 = [4 x i8] c"12K\00"
@.str.16 = [6 x i8] c"16KSC\00"
@.str.17 = [6 x i8] c"16KE7\00"
@.str.18 = [6 x i8] c"16K3E\00"
@.str.19 = [4 x i8] c"16K\00"
@.str.20 = [6 x i8] c"32KSC\00"
@.str.21 = [6 x i8] c"32K3E\00"
@.str.22 = [6 x i8] c"32K3F\00"
@.str.23 = [5 x i8] c"DPC+\00"
@.str.24 = [7 x i8] c"32KFA2\00"
@.str.25 = [4 x i8] c"32K\00"
@.str.26 = [1 x i8] zeroinitializer
define i8* @CartIdentify(i32* %0, i32 %1) {
%3 = alloca [3 x i32]
%4 = srem i32 %1, 8448
%5 = icmp eq i32 %4, 0
%6 = icmp eq i32 %1, 6144
%7 = or i1 %6, %5
br i1 %7, label %90, label %8
8: ; preds = %2
%9 = icmp slt i32 %1, 2048
br i1 %9, label %90, label %10
10: ; preds = %8
switch i32 %1, label %59 [
i32 2048, label %15
i32 4096, label %11
i32 8192, label %26
]
11: ; preds = %10
%12 = getelementptr inbounds i32, i32* %0, i64 2048
%13 = tail call i64 @memcmp(i32* %0, i32* %12, i32 2048)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %10, %11
%16 = tail call i64 @isProbablyCV(i32* %0, i32 %1)
%17 = icmp eq i64 %16, 0
%18 = select i1 %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
br label %90
19: ; preds = %11
%20 = tail call i64 @isProbablyCV(i32* %0, i32 4096)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %90
22: ; preds = %19
%23 = tail call i64 @isProbably4KSC(i32* %0, i32 4096)
%24 = icmp eq i64 %23, 0
%25 = select i1 %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
br label %90
26: ; preds = %10
%27 = bitcast [3 x i32]* %3 to i8*
%28 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%29 = call i32 @searchForBytes(i32* %0, i32 8192, i32* %28, i32 3, i32 2)
%30 = call i64 @isProbablySC(i32* %0, i32 8192)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %57
32: ; preds = %26
%33 = getelementptr inbounds i32, i32* %0, i64 4096
%34 = call i64 @memcmp(i32* %0, i32* %33, i32 4096)
%35 = icmp eq i64 %34, 0
br i1 %35, label %57, label %36
36: ; preds = %32
%37 = call i64 @isProbablyE0(i32* %0, i32 8192)
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %57
39: ; preds = %36
%40 = call i64 @isProbably3E(i32* %0, i32 8192)
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %57
42: ; preds = %39
%43 = call i64 @isProbably3F(i32* %0, i32 8192)
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %57
45: ; preds = %42
%46 = call i64 @isProbablyUA(i32* %0, i32 8192)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %57
48: ; preds = %45
%49 = call i64 @isProbablyFE(i32* %0, i32 8192)
%50 = icmp eq i64 %49, 0
%51 = icmp ne i32 %29, 0
%52 = select i1 %50, i1 true, i1 %51
br i1 %52, label %53, label %57
53: ; preds = %48
%54 = call i64 @isProbably0840(i32* %0, i32 8192)
%55 = icmp eq i64 %54, 0
%56 = select i1 %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0)
br label %57
57: ; preds = %53, %48, %45, %42, %39, %36, %32, %26
%58 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), %26 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %32 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), %36 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), %39 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), %42 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), %45 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), %48 ], [ %56, %53 ]
br label %90
59: ; preds = %10
%60 = add nsw i32 %1, -10240
%61 = icmp ult i32 %60, 257
br i1 %61, label %90, label %62
62: ; preds = %59
switch i32 %1, label %89 [
i32 12288, label %90
i32 16384, label %63
i32 32768, label %73
]
63: ; preds = %62
%64 = tail call i64 @isProbablySC(i32* %0, i32 16384)
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %90
66: ; preds = %63
%67 = tail call i64 @isProbablyE7(i32* %0, i32 16384)
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %90
69: ; preds = %66
%70 = tail call i64 @isProbably3E(i32* %0, i32 16384)
%71 = icmp eq i64 %70, 0
%72 = select i1 %71, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i64 0, i64 0)
br label %90
73: ; preds = %62
%74 = tail call i64 @isProbablySC(i32* %0, i32 32768)
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %90
76: ; preds = %73
%77 = tail call i64 @isProbably3E(i32* %0, i32 32768)
%78 = icmp eq i64 %77, 0
br i1 %78, label %79, label %90
79: ; preds = %76
%80 = tail call i64 @isProbably3F(i32* %0, i32 32768)
%81 = icmp eq i64 %80, 0
br i1 %81, label %82, label %90
82: ; preds = %79
%83 = tail call i64 @isProbablyDPCplus(i32* %0, i32 32768)
%84 = icmp eq i64 %83, 0
br i1 %84, label %85, label %90
85: ; preds = %82
%86 = tail call i64 @isProbablyFA2(i32* %0, i32 32768)
%87 = icmp eq i64 %86, 0
%88 = select i1 %87, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.25, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.24, i64 0, i64 0)
br label %90
89: ; preds = %62
br label %90
90: ; preds = %85, %82, %79, %76, %73, %62, %69, %66, %63, %59, %22, %19, %8, %2, %89, %57, %15
%91 = phi i8* [ %18, %15 ], [ %58, %57 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.26, i64 0, i64 0), %89 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %8 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %19 ], [ %25, %22 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), %59 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), %62 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), %63 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0), %66 ], [ %72, %69 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i64 0, i64 0), %73 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), %76 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i64 0, i64 0), %79 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.23, i64 0, i64 0), %82 ], [ %88, %85 ]
ret i8* %91
}