#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 *getenv(char *);
scalar_t__ strcmp(char *, char *);
scalar_t__ strncmp(char *, char *, int);
int DetectKanjiCode(unsigned char *str) {
  static int whatcode = 8;
  int oldcode = 8;
  int c, i;
  char *lang = NULL;
  c = '\1';
  i = 0;
  if (whatcode != 7 && whatcode != 8) {
    oldcode = whatcode;
    whatcode = 8;
  }
  while ((whatcode == 7 || whatcode == 8) && c != '\0') {
    if ((c = str[i++]) != '\0') {
      if (c == 27) {
        c = str[i++];
        if (c == '$') {
          c = str[i++];
          if (c == 'B')
            whatcode = 1;
          else if (c == '@')
            whatcode = 2;
        } else if (c == '(') {
          c = str[i++];
          if (c == 'I')
            whatcode = 3;
        } else if (c == 'K')
          whatcode = 4;
      } else if ((c >= 129 && c <= 141) || (c >= 143 && c <= 159))
        whatcode = 6;
      else if (c == 142) {
        c = str[i++];
        if ((c >= 64 && c <= 126) || (c >= 128 && c <= 160) ||
            (c >= 224 && c <= 252))
          whatcode = 6;
        else if (c >= 161 && c <= 223)
          whatcode = 7;
      } else if (c >= 161 && c <= 223) {
        c = str[i++];
        if (c >= 240 && c <= 254)
          whatcode = 5;
        else if (c >= 161 && c <= 223)
          whatcode = 7;
        else if (c >= 224 && c <= 239) {
          whatcode = 7;
          while (c >= 64 && c != '\0' && whatcode == 7) {
            if (c >= 129) {
              if (c <= 141 || (c >= 143 && c <= 159))
                whatcode = 6;
              else if (c >= 253 && c <= 254)
                whatcode = 5;
            }
            c = str[i++];
          }
        } else if (c <= 159)
          whatcode = 6;
      } else if (c >= 240 && c <= 254)
        whatcode = 5;
      else if (c >= 224 && c <= 239) {
        c = str[i++];
        if ((c >= 64 && c <= 126) || (c >= 128 && c <= 160))
          whatcode = 6;
        else if (c >= 253 && c <= 254)
          whatcode = 5;
        else if (c >= 161 && c <= 252)
          whatcode = 7;
      }
    }
  }
  if (whatcode == 7 && oldcode != 8)
    whatcode = oldcode;
  if (whatcode == 7) {
    if (getenv("LC_ALL"))
      lang = getenv("LC_ALL");
    else if (getenv("LC_CTYPE"))
      lang = getenv("LC_CTYPE");
    else if (getenv("LANG"))
      lang = getenv("LANG");
    if (lang) {
      if (strcmp(lang, "ja_JP.SJIS") == 0 ||
          strcmp(lang, "ja_JP.mscode") == 0 || strcmp(lang, "ja_JP.PCK") == 0)
        whatcode = 6;
      else if (strncmp(lang, "ja", 2) == 0)
        whatcode = 5;
    }
  }
  if (whatcode == 7)
    whatcode = 5;
  return whatcode;
}


x86 assembly (clang, -O0):
<DetectKanjiCode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x8,-0xc(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x7,0x2ed8(%rip)
je     1186 <DetectKanjiCode+0x56>
cmpl   $0x8,0x2ecb(%rip)
je     1186 <DetectKanjiCode+0x56>
mov    0x2ebf(%rip),%eax
mov    %eax,-0xc(%rbp)
movl   $0x8,0x2eb2(%rip)
jmp    118b <DetectKanjiCode+0x5b>
cmpl   $0x7,0x2ea6(%rip)
je     11aa <DetectKanjiCode+0x7a>
xor    %eax,%eax
cmpl   $0x8,0x2e97(%rip)
mov    %al,-0x21(%rbp)
jne    11b4 <DetectKanjiCode+0x84>
cmpl   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11c4 <DetectKanjiCode+0x94>
jmp    166b <DetectKanjiCode+0x53b>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     1666 <DetectKanjiCode+0x536>
cmpl   $0x1b,-0x10(%rbp)
jne    12c2 <DetectKanjiCode+0x192>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x24,-0x10(%rbp)
jne    1263 <DetectKanjiCode+0x133>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x42,-0x10(%rbp)
jne    1245 <DetectKanjiCode+0x115>
movl   $0x1,0x2df8(%rip)
jmp    125e <DetectKanjiCode+0x12e>
cmpl   $0x40,-0x10(%rbp)
jne    1259 <DetectKanjiCode+0x129>
movl   $0x2,0x2ddf(%rip)
jmp    125e <DetectKanjiCode+0x12e>
jmp    12bd <DetectKanjiCode+0x18d>
cmpl   $0x28,-0x10(%rbp)
jne    129f <DetectKanjiCode+0x16f>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x49,-0x10(%rbp)
jne    129a <DetectKanjiCode+0x16a>
movl   $0x3,0x2d9e(%rip)
jmp    12b8 <DetectKanjiCode+0x188>
cmpl   $0x4b,-0x10(%rbp)
jne    12b3 <DetectKanjiCode+0x183>
movl   $0x4,0x2d85(%rip)
jmp    12b8 <DetectKanjiCode+0x188>
jmp    12bd <DetectKanjiCode+0x18d>
jmp    1661 <DetectKanjiCode+0x531>
cmpl   $0x81,-0x10(%rbp)
jl     12dc <DetectKanjiCode+0x1ac>
cmpl   $0x8d,-0x10(%rbp)
jle    12f6 <DetectKanjiCode+0x1c6>
cmpl   $0x8f,-0x10(%rbp)
jl     1305 <DetectKanjiCode+0x1d5>
cmpl   $0x9f,-0x10(%rbp)
jg     1305 <DetectKanjiCode+0x1d5>
movl   $0x6,0x2d38(%rip)
jmp    165c <DetectKanjiCode+0x52c>
cmpl   $0x8e,-0x10(%rbp)
jne    13b0 <DetectKanjiCode+0x280>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x40,-0x10(%rbp)
jl     133f <DetectKanjiCode+0x20f>
cmpl   $0x7e,-0x10(%rbp)
jle    1373 <DetectKanjiCode+0x243>
cmpl   $0x80,-0x10(%rbp)
jl     1359 <DetectKanjiCode+0x229>
cmpl   $0xa0,-0x10(%rbp)
jle    1373 <DetectKanjiCode+0x243>
cmpl   $0xe0,-0x10(%rbp)
jl     1382 <DetectKanjiCode+0x252>
cmpl   $0xfc,-0x10(%rbp)
jg     1382 <DetectKanjiCode+0x252>
movl   $0x6,0x2cbb(%rip)
jmp    13ab <DetectKanjiCode+0x27b>
cmpl   $0xa1,-0x10(%rbp)
jl     13a6 <DetectKanjiCode+0x276>
cmpl   $0xdf,-0x10(%rbp)
jg     13a6 <DetectKanjiCode+0x276>
movl   $0x7,0x2c92(%rip)
jmp    13ab <DetectKanjiCode+0x27b>
jmp    1657 <DetectKanjiCode+0x527>
cmpl   $0xa1,-0x10(%rbp)
jl     1553 <DetectKanjiCode+0x423>
cmpl   $0xdf,-0x10(%rbp)
jg     1553 <DetectKanjiCode+0x423>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0xf0,-0x10(%rbp)
jl     140c <DetectKanjiCode+0x2dc>
cmpl   $0xfe,-0x10(%rbp)
jg     140c <DetectKanjiCode+0x2dc>
movl   $0x5,0x2c31(%rip)
jmp    154e <DetectKanjiCode+0x41e>
cmpl   $0xa1,-0x10(%rbp)
jl     1435 <DetectKanjiCode+0x305>
cmpl   $0xdf,-0x10(%rbp)
jg     1435 <DetectKanjiCode+0x305>
movl   $0x7,0x2c08(%rip)
jmp    1549 <DetectKanjiCode+0x419>
cmpl   $0xe0,-0x10(%rbp)
jl     1528 <DetectKanjiCode+0x3f8>
cmpl   $0xef,-0x10(%rbp)
jg     1528 <DetectKanjiCode+0x3f8>
movl   $0x7,0x2bdf(%rip)
xor    %eax,%eax
cmpl   $0x40,-0x10(%rbp)
mov    %al,-0x22(%rbp)
jl     1484 <DetectKanjiCode+0x354>
xor    %eax,%eax
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x22(%rbp)
je     1484 <DetectKanjiCode+0x354>
cmpl   $0x7,0x2bba(%rip)
sete   %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
test   $0x1,%al
jne    1494 <DetectKanjiCode+0x364>
jmp    1523 <DetectKanjiCode+0x3f3>
cmpl   $0x81,-0x10(%rbp)
jl     1505 <DetectKanjiCode+0x3d5>
cmpl   $0x8d,-0x10(%rbp)
jle    14c8 <DetectKanjiCode+0x398>
cmpl   $0x8f,-0x10(%rbp)
jl     14d7 <DetectKanjiCode+0x3a7>
cmpl   $0x9f,-0x10(%rbp)
jg     14d7 <DetectKanjiCode+0x3a7>
movl   $0x6,0x2b66(%rip)
jmp    1500 <DetectKanjiCode+0x3d0>
cmpl   $0xfd,-0x10(%rbp)
jl     14fb <DetectKanjiCode+0x3cb>
cmpl   $0xfe,-0x10(%rbp)
jg     14fb <DetectKanjiCode+0x3cb>
movl   $0x5,0x2b3d(%rip)
jmp    1500 <DetectKanjiCode+0x3d0>
jmp    1505 <DetectKanjiCode+0x3d5>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x10(%rbp)
jmp    1459 <DetectKanjiCode+0x329>
jmp    1544 <DetectKanjiCode+0x414>
cmpl   $0x9f,-0x10(%rbp)
jg     153f <DetectKanjiCode+0x40f>
movl   $0x6,0x2af9(%rip)
jmp    1544 <DetectKanjiCode+0x414>
jmp    1549 <DetectKanjiCode+0x419>
jmp    154e <DetectKanjiCode+0x41e>
jmp    1652 <DetectKanjiCode+0x522>
cmpl   $0xf0,-0x10(%rbp)
jl     157c <DetectKanjiCode+0x44c>
cmpl   $0xfe,-0x10(%rbp)
jg     157c <DetectKanjiCode+0x44c>
movl   $0x5,0x2ac1(%rip)
jmp    164d <DetectKanjiCode+0x51d>
cmpl   $0xe0,-0x10(%rbp)
jl     1648 <DetectKanjiCode+0x518>
cmpl   $0xef,-0x10(%rbp)
jg     1648 <DetectKanjiCode+0x518>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x40,-0x10(%rbp)
jl     15c3 <DetectKanjiCode+0x493>
cmpl   $0x7e,-0x10(%rbp)
jle    15dd <DetectKanjiCode+0x4ad>
cmpl   $0x80,-0x10(%rbp)
jl     15ec <DetectKanjiCode+0x4bc>
cmpl   $0xa0,-0x10(%rbp)
jg     15ec <DetectKanjiCode+0x4bc>
movl   $0x6,0x2a51(%rip)
jmp    1643 <DetectKanjiCode+0x513>
cmpl   $0xfd,-0x10(%rbp)
jl     1615 <DetectKanjiCode+0x4e5>
cmpl   $0xfe,-0x10(%rbp)
jg     1615 <DetectKanjiCode+0x4e5>
movl   $0x5,0x2a28(%rip)
jmp    163e <DetectKanjiCode+0x50e>
cmpl   $0xa1,-0x10(%rbp)
jl     1639 <DetectKanjiCode+0x509>
cmpl   $0xfc,-0x10(%rbp)
jg     1639 <DetectKanjiCode+0x509>
movl   $0x7,0x29ff(%rip)
jmp    163e <DetectKanjiCode+0x50e>
jmp    1643 <DetectKanjiCode+0x513>
jmp    1648 <DetectKanjiCode+0x518>
jmp    164d <DetectKanjiCode+0x51d>
jmp    1652 <DetectKanjiCode+0x522>
jmp    1657 <DetectKanjiCode+0x527>
jmp    165c <DetectKanjiCode+0x52c>
jmp    1661 <DetectKanjiCode+0x531>
jmp    1666 <DetectKanjiCode+0x536>
jmp    118b <DetectKanjiCode+0x5b>
cmpl   $0x7,0x29c6(%rip)
jne    168b <DetectKanjiCode+0x55b>
cmpl   $0x8,-0xc(%rbp)
je     168b <DetectKanjiCode+0x55b>
mov    -0xc(%rbp),%eax
mov    %eax,0x29ad(%rip)
cmpl   $0x7,0x29a6(%rip)
jne    17be <DetectKanjiCode+0x68e>
lea    0x961(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     16c3 <DetectKanjiCode+0x593>
lea    0x94b(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
jmp    171e <DetectKanjiCode+0x5ee>
lea    0x93d(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     16ee <DetectKanjiCode+0x5be>
lea    0x927(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
jmp    1719 <DetectKanjiCode+0x5e9>
lea    0x91b(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     1714 <DetectKanjiCode+0x5e4>
lea    0x905(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x20(%rbp)
jmp    1719 <DetectKanjiCode+0x5e9>
jmp    171e <DetectKanjiCode+0x5ee>
cmpq   $0x0,-0x20(%rbp)
je     17b9 <DetectKanjiCode+0x689>
mov    -0x20(%rbp),%rdi
lea    0x8e1(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1777 <DetectKanjiCode+0x647>
mov    -0x20(%rbp),%rdi
lea    0x8d2(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1777 <DetectKanjiCode+0x647>
mov    -0x20(%rbp),%rdi
lea    0x8c5(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1786 <DetectKanjiCode+0x656>
movl   $0x6,0x28b7(%rip)
jmp    17b4 <DetectKanjiCode+0x684>
mov    -0x20(%rbp),%rdi
lea    0x8a6(%rip),%rsi
mov    $0x2,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    17af <DetectKanjiCode+0x67f>
movl   $0x5,0x2889(%rip)
jmp    17b4 <DetectKanjiCode+0x684>
jmp    17b9 <DetectKanjiCode+0x689>
jmp    17be <DetectKanjiCode+0x68e>
cmpl   $0x7,0x2873(%rip)
jne    17d5 <DetectKanjiCode+0x6a5>
movl   $0x5,0x2863(%rip)
mov    0x285d(%rip),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DetectKanjiCode>:
push   %rbp
push   %rbx
push   %rax
mov    0x2eff(%rip),%eax
lea    -0x9(%rax),%ecx
mov    $0x8,%r8d
cmp    $0xfffffffd,%ecx
ja     1159 <DetectKanjiCode+0x29>
movl   $0x8,0x2ee7(%rip)
mov    %eax,%r8d
mov    $0x8,%eax
xor    %ebx,%ebx
mov    %eax,%r9d
xchg   %ax,%ax
movslq %ebx,%rcx
lea    0x1(%rcx),%rdx
movzbl (%rdi,%rcx,1),%esi
cmp    $0x1b,%esi
je     11e0 <DetectKanjiCode+0xb0>
test   %sil,%sil
je     1391 <DetectKanjiCode+0x261>
lea    0x7f(%rsi),%ecx
mov    $0x6,%ebp
cmp    $0xd,%cl
jb     1479 <DetectKanjiCode+0x349>
lea    0x71(%rsi),%ecx
cmp    $0x11,%cl
jb     1479 <DetectKanjiCode+0x349>
cmp    $0x8e,%sil
jne    1210 <DetectKanjiCode+0xe0>
mov    (%rdi,%rdx,1),%cl
lea    0x20(%rcx),%edx
cmp    $0x1d,%dl
jb     1479 <DetectKanjiCode+0x349>
cmp    $0xa1,%cl
jl     1479 <DetectKanjiCode+0x349>
lea    -0x40(%rcx),%edx
cmp    $0x3f,%dl
jb     1479 <DetectKanjiCode+0x349>
add    $0x2,%ebx
movzbl %cl,%esi
add    $0x5f,%cl
cmp    $0x3e,%cl
jbe    1340 <DetectKanjiCode+0x210>
jmp    1380 <DetectKanjiCode+0x250>
nopw   0x0(%rax,%rax,1)
add    $0x2,%rcx
movzbl (%rdi,%rdx,1),%esi
cmp    $0x24,%esi
je     12b8 <DetectKanjiCode+0x188>
cmp    $0x28,%sil
je     12d0 <DetectKanjiCode+0x1a0>
mov    %ecx,%ebx
cmp    $0x4b,%sil
jne    1380 <DetectKanjiCode+0x250>
jmp    145f <DetectKanjiCode+0x32f>
nopl   0x0(%rax)
lea    0x5f(%rsi),%ecx
cmp    $0x3e,%cl
ja     12e5 <DetectKanjiCode+0x1b5>
movzbl (%rdi,%rdx,1),%esi
lea    0x10(%rsi),%ecx
cmp    $0xf,%cl
jb     1458 <DetectKanjiCode+0x328>
add    $0x2,%ebx
lea    0x5f(%rsi),%ecx
cmp    $0x3e,%cl
jbe    1340 <DetectKanjiCode+0x210>
mov    %esi,%ecx
and    $0xf0,%cl
cmp    $0xe0,%cl
jne    135b <DetectKanjiCode+0x22b>
movl   $0x7,0x2de5(%rip)
movslq %ebx,%rbx
jmp    1271 <DetectKanjiCode+0x141>
nopl   0x0(%rax,%rax,1)
movzbl (%rdi,%rbx,1),%esi
add    $0x1,%rbx
cmp    $0x3f,%esi
jbe    1366 <DetectKanjiCode+0x236>
cmp    $0x81,%esi
jb     1260 <DetectKanjiCode+0x130>
mov    $0x6,%eax
cmp    $0x8e,%esi
jb     12a5 <DetectKanjiCode+0x175>
je     1290 <DetectKanjiCode+0x160>
cmp    $0xa0,%esi
jb     12a5 <DetectKanjiCode+0x175>
cmp    $0xfd,%esi
jb     1260 <DetectKanjiCode+0x130>
cmp    $0xff,%esi
je     1260 <DetectKanjiCode+0x130>
mov    $0x5,%eax
mov    %eax,0x2d8d(%rip)
mov    (%rdi,%rbx,1),%sil
add    $0x1,%rbx
jmp    136b <DetectKanjiCode+0x23b>
movzbl (%rdi,%rcx,1),%esi
cmp    $0x42,%esi
je     1466 <DetectKanjiCode+0x336>
cmp    $0x40,%sil
jne    12dd <DetectKanjiCode+0x1ad>
jmp    1474 <DetectKanjiCode+0x344>
movzbl (%rdi,%rcx,1),%esi
cmp    $0x49,%esi
je     146d <DetectKanjiCode+0x33d>
add    $0x3,%ebx
jmp    1380 <DetectKanjiCode+0x250>
lea    0x10(%rsi),%ecx
cmp    $0xf,%cl
jb     1458 <DetectKanjiCode+0x328>
mov    %esi,%ecx
and    $0xf0,%cl
cmp    $0xe0,%cl
jne    1357 <DetectKanjiCode+0x227>
movzbl (%rdi,%rdx,1),%esi
cmp    $0xa1,%sil
jl     1479 <DetectKanjiCode+0x349>
lea    -0x40(%rsi),%ecx
cmp    $0x3f,%cl
jb     1479 <DetectKanjiCode+0x349>
lea    0x3(%rsi),%ecx
mov    $0x5,%ebp
cmp    $0x2,%cl
jb     1479 <DetectKanjiCode+0x349>
add    $0x2,%ebx
lea    0x5f(%rsi),%ecx
cmp    $0x5b,%cl
ja     1380 <DetectKanjiCode+0x250>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movl   $0x7,0x2cee(%rip)
mov    $0x7,%eax
mov    $0x7,%r9d
jmp    1380 <DetectKanjiCode+0x250>
mov    %edx,%ebx
jmp    1380 <DetectKanjiCode+0x250>
cmp    $0xa0,%sil
jae    1380 <DetectKanjiCode+0x250>
jmp    1479 <DetectKanjiCode+0x349>
mov    $0x7,%eax
movzbl %sil,%esi
mov    %eax,%r9d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x7(%r9),%ecx
cmp    $0x1,%ecx
ja     1391 <DetectKanjiCode+0x261>
test   %esi,%esi
jne    1160 <DetectKanjiCode+0x30>
cmp    $0x7,%r9d
jne    13a7 <DetectKanjiCode+0x277>
cmp    $0x8,%r8d
je     13a7 <DetectKanjiCode+0x277>
mov    %r8d,0x2c94(%rip)
mov    %r8d,%eax
cmp    $0x7,%eax
jne    1481 <DetectKanjiCode+0x351>
lea    0xc49(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    13ec <DetectKanjiCode+0x2bc>
lea    0xc3c(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    13ec <DetectKanjiCode+0x2bc>
lea    0xc31(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1458 <DetectKanjiCode+0x328>
lea    0xc22(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
mov    $0x6,%ebp
test   %rax,%rax
je     1479 <DetectKanjiCode+0x349>
lea    0xc14(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1479 <DetectKanjiCode+0x349>
lea    0xc0d(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1479 <DetectKanjiCode+0x349>
lea    0xc03(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1040 <strncmp@plt>
mov    $0x5,%ebp
test   %rax,%rax
je     1479 <DetectKanjiCode+0x349>
mov    0x2be7(%rip),%eax
cmp    $0x7,%eax
jne    1481 <DetectKanjiCode+0x351>
jmp    1479 <DetectKanjiCode+0x349>
mov    $0x5,%ebp
jmp    1479 <DetectKanjiCode+0x349>
mov    $0x4,%ebp
jmp    1479 <DetectKanjiCode+0x349>
mov    $0x1,%ebp
jmp    1479 <DetectKanjiCode+0x349>
mov    $0x3,%ebp
jmp    1479 <DetectKanjiCode+0x349>
mov    $0x2,%ebp
mov    %ebp,0x2bb9(%rip)
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@DetectKanjiCode.whatcode = internal global i32 8
@.str = [7 x i8] c"LC_ALL\00"
@.str.1 = [9 x i8] c"LC_CTYPE\00"
@.str.2 = [5 x i8] c"LANG\00"
@.str.3 = [11 x i8] c"ja_JP.SJIS\00"
@.str.4 = [13 x i8] c"ja_JP.mscode\00"
@.str.5 = [10 x i8] c"ja_JP.PCK\00"
@.str.6 = [3 x i8] c"ja\00"
define i32 @DetectKanjiCode(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %2
store i32 8, i32* %3
store i8* null, i8** %6
store i32 1, i32* %4
store i32 0, i32* %5
%7 = load i32, i32* @DetectKanjiCode.whatcode
%8 = icmp ne i32 %7, 7
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i32, i32* @DetectKanjiCode.whatcode
%11 = icmp ne i32 %10, 8
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = load i32, i32* @DetectKanjiCode.whatcode
store i32 %13, i32* %3
store i32 8, i32* @DetectKanjiCode.whatcode
br label %14
14: ; preds = %12, %9, %1
br label %15
15: ; preds = %278, %14
%16 = load i32, i32* @DetectKanjiCode.whatcode
%17 = icmp eq i32 %16, 7
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* @DetectKanjiCode.whatcode
%20 = icmp eq i32 %19, 8
br i1 %20, label %21, label %24
21: ; preds = %18, %15
%22 = load i32, i32* %4
%23 = icmp ne i32 %22, 0
br label %24
24: ; preds = %21, %18
%25 = phi i1 [ false, %18 ], [ %23, %21 ]
br i1 %25, label %26, label %279
26: ; preds = %24
%27 = load i8*, i8** %2
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
%30 = sext i32 %28 to i64
%31 = getelementptr inbounds i8, i8* %27, i64 %30
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
store i32 %33, i32* %4
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %278
35: ; preds = %26
%36 = load i32, i32* %4
%37 = icmp eq i32 %36, 27
br i1 %37, label %38, label %87
38: ; preds = %35
%39 = load i8*, i8** %2
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
%42 = sext i32 %40 to i64
%43 = getelementptr inbounds i8, i8* %39, i64 %42
%44 = load i8, i8* %43
%45 = zext i8 %44 to i32
store i32 %45, i32* %4
%46 = load i32, i32* %4
%47 = icmp eq i32 %46, 36
br i1 %47, label %48, label %65
48: ; preds = %38
%49 = load i8*, i8** %2
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
%52 = sext i32 %50 to i64
%53 = getelementptr inbounds i8, i8* %49, i64 %52
%54 = load i8, i8* %53
%55 = zext i8 %54 to i32
store i32 %55, i32* %4
%56 = load i32, i32* %4
%57 = icmp eq i32 %56, 66
br i1 %57, label %58, label %59
58: ; preds = %48
store i32 1, i32* @DetectKanjiCode.whatcode
br label %64
59: ; preds = %48
%60 = load i32, i32* %4
%61 = icmp eq i32 %60, 64
br i1 %61, label %62, label %63
62: ; preds = %59
store i32 2, i32* @DetectKanjiCode.whatcode
br label %63
63: ; preds = %62, %59
br label %64
64: ; preds = %63, %58
br label %86
65: ; preds = %38
%66 = load i32, i32* %4
%67 = icmp eq i32 %66, 40
br i1 %67, label %68, label %80
68: ; preds = %65
%69 = load i8*, i8** %2
%70 = load i32, i32* %5
%71 = add nsw i32 %70, 1
store i32 %71, i32* %5
%72 = sext i32 %70 to i64
%73 = getelementptr inbounds i8, i8* %69, i64 %72
%74 = load i8, i8* %73
%75 = zext i8 %74 to i32
store i32 %75, i32* %4
%76 = load i32, i32* %4
%77 = icmp eq i32 %76, 73
br i1 %77, label %78, label %79
78: ; preds = %68
store i32 3, i32* @DetectKanjiCode.whatcode
br label %79
79: ; preds = %78, %68
br label %85
80: ; preds = %65
%81 = load i32, i32* %4
%82 = icmp eq i32 %81, 75
br i1 %82, label %83, label %84
83: ; preds = %80
store i32 4, i32* @DetectKanjiCode.whatcode
br label %84
84: ; preds = %83, %80
br label %85
85: ; preds = %84, %79
br label %86
86: ; preds = %85, %64
br label %277
87: ; preds = %35
%88 = load i32, i32* %4
%89 = icmp sge i32 %88, 129
br i1 %89, label %90, label %93
90: ; preds = %87
%91 = load i32, i32* %4
%92 = icmp sle i32 %91, 141
br i1 %92, label %99, label %93
93: ; preds = %90, %87
%94 = load i32, i32* %4
%95 = icmp sge i32 %94, 143
br i1 %95, label %96, label %100
96: ; preds = %93
%97 = load i32, i32* %4
%98 = icmp sle i32 %97, 159
br i1 %98, label %99, label %100
99: ; preds = %96, %90
store i32 6, i32* @DetectKanjiCode.whatcode
br label %276
100: ; preds = %96, %93
%101 = load i32, i32* %4
%102 = icmp eq i32 %101, 142
br i1 %102, label %103, label %138
103: ; preds = %100
%104 = load i8*, i8** %2
%105 = load i32, i32* %5
%106 = add nsw i32 %105, 1
store i32 %106, i32* %5
%107 = sext i32 %105 to i64
%108 = getelementptr inbounds i8, i8* %104, i64 %107
%109 = load i8, i8* %108
%110 = zext i8 %109 to i32
store i32 %110, i32* %4
%111 = load i32, i32* %4
%112 = icmp sge i32 %111, 64
br i1 %112, label %113, label %116
113: ; preds = %103
%114 = load i32, i32* %4
%115 = icmp sle i32 %114, 126
br i1 %115, label %128, label %116
116: ; preds = %113, %103
%117 = load i32, i32* %4
%118 = icmp sge i32 %117, 128
br i1 %118, label %119, label %122
119: ; preds = %116
%120 = load i32, i32* %4
%121 = icmp sle i32 %120, 160
br i1 %121, label %128, label %122
122: ; preds = %119, %116
%123 = load i32, i32* %4
%124 = icmp sge i32 %123, 224
br i1 %124, label %125, label %129
125: ; preds = %122
%126 = load i32, i32* %4
%127 = icmp sle i32 %126, 252
br i1 %127, label %128, label %129
128: ; preds = %125, %119, %113
store i32 6, i32* @DetectKanjiCode.whatcode
br label %137
129: ; preds = %125, %122
%130 = load i32, i32* %4
%131 = icmp sge i32 %130, 161
br i1 %131, label %132, label %136
132: ; preds = %129
%133 = load i32, i32* %4
%134 = icmp sle i32 %133, 223
br i1 %134, label %135, label %136
135: ; preds = %132
store i32 7, i32* @DetectKanjiCode.whatcode
br label %136
136: ; preds = %135, %132, %129
br label %137
137: ; preds = %136, %128
br label %275
138: ; preds = %100
%139 = load i32, i32* %4
%140 = icmp sge i32 %139, 161
br i1 %140, label %141, label %222
141: ; preds = %138
%142 = load i32, i32* %4
%143 = icmp sle i32 %142, 223
br i1 %143, label %144, label %222
144: ; preds = %141
%145 = load i8*, i8** %2
%146 = load i32, i32* %5
%147 = add nsw i32 %146, 1
store i32 %147, i32* %5
%148 = sext i32 %146 to i64
%149 = getelementptr inbounds i8, i8* %145, i64 %148
%150 = load i8, i8* %149
%151 = zext i8 %150 to i32
store i32 %151, i32* %4
%152 = load i32, i32* %4
%153 = icmp sge i32 %152, 240
br i1 %153, label %154, label %158
154: ; preds = %144
%155 = load i32, i32* %4
%156 = icmp sle i32 %155, 254
br i1 %156, label %157, label %158
157: ; preds = %154
store i32 5, i32* @DetectKanjiCode.whatcode
br label %221
158: ; preds = %154, %144
%159 = load i32, i32* %4
%160 = icmp sge i32 %159, 161
br i1 %160, label %161, label %165
161: ; preds = %158
%162 = load i32, i32* %4
%163 = icmp sle i32 %162, 223
br i1 %163, label %164, label %165
164: ; preds = %161
store i32 7, i32* @DetectKanjiCode.whatcode
br label %220
165: ; preds = %161, %158
%166 = load i32, i32* %4
%167 = icmp sge i32 %166, 224
br i1 %167, label %168, label %214
168: ; preds = %165
%169 = load i32, i32* %4
%170 = icmp sle i32 %169, 239
br i1 %170, label %171, label %214
171: ; preds = %168
store i32 7, i32* @DetectKanjiCode.whatcode
br label %172
172: ; preds = %205, %171
%173 = load i32, i32* %4
%174 = icmp sge i32 %173, 64
br i1 %174, label %175, label %181
175: ; preds = %172
%176 = load i32, i32* %4
%177 = icmp ne i32 %176, 0
br i1 %177, label %178, label %181
178: ; preds = %175
%179 = load i32, i32* @DetectKanjiCode.whatcode
%180 = icmp eq i32 %179, 7
br label %181
181: ; preds = %178, %175, %172
%182 = phi i1 [ false, %175 ], [ false, %172 ], [ %180, %178 ]
br i1 %182, label %183, label %213
183: ; preds = %181
%184 = load i32, i32* %4
%185 = icmp sge i32 %184, 129
br i1 %185, label %186, label %205
186: ; preds = %183
%187 = load i32, i32* %4
%188 = icmp sle i32 %187, 141
br i1 %188, label %195, label %189
189: ; preds = %186
%190 = load i32, i32* %4
%191 = icmp sge i32 %190, 143
br i1 %191, label %192, label %196
192: ; preds = %189
%193 = load i32, i32* %4
%194 = icmp sle i32 %193, 159
br i1 %194, label %195, label %196
195: ; preds = %192, %186
store i32 6, i32* @DetectKanjiCode.whatcode
br label %204
196: ; preds = %192, %189
%197 = load i32, i32* %4
%198 = icmp sge i32 %197, 253
br i1 %198, label %199, label %203
199: ; preds = %196
%200 = load i32, i32* %4
%201 = icmp sle i32 %200, 254
br i1 %201, label %202, label %203
202: ; preds = %199
store i32 5, i32* @DetectKanjiCode.whatcode
br label %203
203: ; preds = %202, %199, %196
br label %204
204: ; preds = %203, %195
br label %205
205: ; preds = %204, %183
%206 = load i8*, i8** %2
%207 = load i32, i32* %5
%208 = add nsw i32 %207, 1
store i32 %208, i32* %5
%209 = sext i32 %207 to i64
%210 = getelementptr inbounds i8, i8* %206, i64 %209
%211 = load i8, i8* %210
%212 = zext i8 %211 to i32
store i32 %212, i32* %4
br label %172
213: ; preds = %181
br label %219
214: ; preds = %168, %165
%215 = load i32, i32* %4
%216 = icmp sle i32 %215, 159
br i1 %216, label %217, label %218
217: ; preds = %214
store i32 6, i32* @DetectKanjiCode.whatcode
br label %218
218: ; preds = %217, %214
br label %219
219: ; preds = %218, %213
br label %220
220: ; preds = %219, %164
br label %221
221: ; preds = %220, %157
br label %274
222: ; preds = %141, %138
%223 = load i32, i32* %4
%224 = icmp sge i32 %223, 240
br i1 %224, label %225, label %229
225: ; preds = %222
%226 = load i32, i32* %4
%227 = icmp sle i32 %226, 254
br i1 %227, label %228, label %229
228: ; preds = %225
store i32 5, i32* @DetectKanjiCode.whatcode
br label %273
229: ; preds = %225, %222
%230 = load i32, i32* %4
%231 = icmp sge i32 %230, 224
br i1 %231, label %232, label %272
232: ; preds = %229
%233 = load i32, i32* %4
%234 = icmp sle i32 %233, 239
br i1 %234, label %235, label %272
235: ; preds = %232
%236 = load i8*, i8** %2
%237 = load i32, i32* %5
%238 = add nsw i32 %237, 1
store i32 %238, i32* %5
%239 = sext i32 %237 to i64
%240 = getelementptr inbounds i8, i8* %236, i64 %239
%241 = load i8, i8* %240
%242 = zext i8 %241 to i32
store i32 %242, i32* %4
%243 = load i32, i32* %4
%244 = icmp sge i32 %243, 64
br i1 %244, label %245, label %248
245: ; preds = %235
%246 = load i32, i32* %4
%247 = icmp sle i32 %246, 126
br i1 %247, label %254, label %248
248: ; preds = %245, %235
%249 = load i32, i32* %4
%250 = icmp sge i32 %249, 128
br i1 %250, label %251, label %255
251: ; preds = %248
%252 = load i32, i32* %4
%253 = icmp sle i32 %252, 160
br i1 %253, label %254, label %255
254: ; preds = %251, %245
store i32 6, i32* @DetectKanjiCode.whatcode
br label %271
255: ; preds = %251, %248
%256 = load i32, i32* %4
%257 = icmp sge i32 %256, 253
br i1 %257, label %258, label %262
258: ; preds = %255
%259 = load i32, i32* %4
%260 = icmp sle i32 %259, 254
br i1 %260, label %261, label %262
261: ; preds = %258
store i32 5, i32* @DetectKanjiCode.whatcode
br label %270
262: ; preds = %258, %255
%263 = load i32, i32* %4
%264 = icmp sge i32 %263, 161
br i1 %264, label %265, label %269
265: ; preds = %262
%266 = load i32, i32* %4
%267 = icmp sle i32 %266, 252
br i1 %267, label %268, label %269
268: ; preds = %265
store i32 7, i32* @DetectKanjiCode.whatcode
br label %269
269: ; preds = %268, %265, %262
br label %270
270: ; preds = %269, %261
br label %271
271: ; preds = %270, %254
br label %272
272: ; preds = %271, %232, %229
br label %273
273: ; preds = %272, %228
br label %274
274: ; preds = %273, %221
br label %275
275: ; preds = %274, %137
br label %276
276: ; preds = %275, %99
br label %277
277: ; preds = %276, %86
br label %278
278: ; preds = %277, %26
br label %15
279: ; preds = %24
%280 = load i32, i32* @DetectKanjiCode.whatcode
%281 = icmp eq i32 %280, 7
br i1 %281, label %282, label %287
282: ; preds = %279
%283 = load i32, i32* %3
%284 = icmp ne i32 %283, 8
br i1 %284, label %285, label %287
285: ; preds = %282
%286 = load i32, i32* %3
store i32 %286, i32* @DetectKanjiCode.whatcode
br label %287
287: ; preds = %285, %282, %279
%288 = load i32, i32* @DetectKanjiCode.whatcode
%289 = icmp eq i32 %288, 7
br i1 %289, label %290, label %331
290: ; preds = %287
%291 = call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%292 = icmp ne i8* %291, null
br i1 %292, label %293, label %295
293: ; preds = %290
%294 = call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* %294, i8** %6
br label %307
295: ; preds = %290
%296 = call i8* @getenv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%297 = icmp ne i8* %296, null
br i1 %297, label %298, label %300
298: ; preds = %295
%299 = call i8* @getenv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store i8* %299, i8** %6
br label %306
300: ; preds = %295
%301 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%302 = icmp ne i8* %301, null
br i1 %302, label %303, label %305
303: ; preds = %300
%304 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i8* %304, i8** %6
br label %305
305: ; preds = %303, %300
br label %306
306: ; preds = %305, %298
br label %307
307: ; preds = %306, %293
%308 = load i8*, i8** %6
%309 = icmp ne i8* %308, null
br i1 %309, label %310, label %330
310: ; preds = %307
%311 = load i8*, i8** %6
%312 = call i64 @strcmp(i8* %311, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%313 = icmp eq i64 %312, 0
br i1 %313, label %322, label %314
314: ; preds = %310
%315 = load i8*, i8** %6
%316 = call i64 @strcmp(i8* %315, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%317 = icmp eq i64 %316, 0
br i1 %317, label %322, label %318
318: ; preds = %314
%319 = load i8*, i8** %6
%320 = call i64 @strcmp(i8* %319, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%321 = icmp eq i64 %320, 0
br i1 %321, label %322, label %323
322: ; preds = %318, %314, %310
store i32 6, i32* @DetectKanjiCode.whatcode
br label %329
323: ; preds = %318
%324 = load i8*, i8** %6
%325 = call i64 @strncmp(i8* %324, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%326 = icmp eq i64 %325, 0
br i1 %326, label %327, label %328
327: ; preds = %323
store i32 5, i32* @DetectKanjiCode.whatcode
br label %328
328: ; preds = %327, %323
br label %329
329: ; preds = %328, %322
br label %330
330: ; preds = %329, %307
br label %331
331: ; preds = %330, %287
%332 = load i32, i32* @DetectKanjiCode.whatcode
%333 = icmp eq i32 %332, 7
br i1 %333, label %334, label %335
334: ; preds = %331
store i32 5, i32* @DetectKanjiCode.whatcode
br label %335
335: ; preds = %334, %331
%336 = load i32, i32* @DetectKanjiCode.whatcode
ret i32 %336
}

LLVM IR (-O2):
@DetectKanjiCode.whatcode = internal unnamed_addr global i32 8
@.str = [7 x i8] c"LC_ALL\00"
@.str.1 = [9 x i8] c"LC_CTYPE\00"
@.str.2 = [5 x i8] c"LANG\00"
@.str.3 = [11 x i8] c"ja_JP.SJIS\00"
@.str.4 = [13 x i8] c"ja_JP.mscode\00"
@.str.5 = [10 x i8] c"ja_JP.PCK\00"
@.str.6 = [3 x i8] c"ja\00"
define i32 @DetectKanjiCode(i8* nocapture %0) {
%2 = load i32, i32* @DetectKanjiCode.whatcode
%3 = add i32 %2, -9
%4 = icmp ult i32 %3, -2
br i1 %4, label %5, label %6
5: ; preds = %1
store i32 8, i32* @DetectKanjiCode.whatcode
br label %6
6: ; preds = %1, %5
%7 = phi i32 [ %2, %5 ], [ 8, %1 ]
%8 = phi i32 [ 8, %5 ], [ %2, %1 ]
br label %9
9: ; preds = %6, %141
%10 = phi i32 [ %142, %141 ], [ %8, %6 ]
%11 = phi i32 [ %145, %141 ], [ 0, %6 ]
%12 = phi i32 [ %143, %141 ], [ %8, %6 ]
%13 = add nsw i32 %11, 1
%14 = sext i32 %11 to i64
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
switch i8 %16, label %40 [
i8 0, label %150
i8 27, label %18
]
18: ; preds = %9
%19 = add nsw i32 %11, 2
%20 = sext i32 %13 to i64
%21 = getelementptr inbounds i8, i8* %0, i64 %20
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
switch i8 %22, label %141 [
i8 36, label %24
i8 40, label %33
i8 75, label %185
]
24: ; preds = %18
%25 = sext i32 %19 to i64
%26 = getelementptr inbounds i8, i8* %0, i64 %25
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 66
br i1 %28, label %185, label %29
29: ; preds = %24
%30 = add nsw i32 %11, 3
%31 = zext i8 %27 to i32
%32 = icmp eq i8 %27, 64
br i1 %32, label %185, label %141
33: ; preds = %18
%34 = add nsw i32 %11, 3
%35 = sext i32 %19 to i64
%36 = getelementptr inbounds i8, i8* %0, i64 %35
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = icmp eq i8 %37, 73
br i1 %39, label %185, label %141
40: ; preds = %9
%41 = add i8 %16, 127
%42 = icmp ult i8 %41, 13
%43 = add i8 %16, 113
%44 = icmp ult i8 %43, 17
%45 = or i1 %42, %44
br i1 %45, label %185, label %46
46: ; preds = %40
%47 = icmp eq i8 %16, -114
br i1 %47, label %48, label %65
48: ; preds = %46
%49 = add nsw i32 %11, 2
%50 = sext i32 %13 to i64
%51 = getelementptr inbounds i8, i8* %0, i64 %50
%52 = load i8, i8* %51
%53 = zext i8 %52 to i32
%54 = add i8 %52, -64
%55 = icmp ult i8 %54, 63
%56 = icmp slt i8 %52, -95
%57 = or i1 %56, %55
%58 = add i8 %52, 32
%59 = icmp ult i8 %58, 29
%60 = or i1 %59, %57
br i1 %60, label %185, label %61
61: ; preds = %48
%62 = add i8 %52, 95
%63 = icmp ult i8 %62, 63
br i1 %63, label %64, label %141
64: ; preds = %61
store i32 7, i32* @DetectKanjiCode.whatcode
br label %141
65: ; preds = %46
%66 = add i8 %16, 95
%67 = icmp ult i8 %66, 63
br i1 %67, label %68, label %112
68: ; preds = %65
%69 = add i32 %11, 2
%70 = sext i32 %13 to i64
%71 = getelementptr inbounds i8, i8* %0, i64 %70
%72 = load i8, i8* %71
%73 = zext i8 %72 to i32
%74 = add i8 %72, 16
%75 = icmp ult i8 %74, 15
br i1 %75, label %185, label %76
76: ; preds = %68
%77 = add i8 %72, 95
%78 = icmp ult i8 %77, 63
br i1 %78, label %79, label %80
79: ; preds = %76
store i32 7, i32* @DetectKanjiCode.whatcode
br label %141
80: ; preds = %76
%81 = and i8 %72, -16
%82 = icmp eq i8 %81, -32
br i1 %82, label %83, label %110
83: ; preds = %80
store i32 7, i32* @DetectKanjiCode.whatcode
%84 = sext i32 %69 to i64
br label %85
85: ; preds = %83, %104
%86 = phi i64 [ %84, %83 ], [ %105, %104 ]
%87 = phi i32 [ %73, %83 ], [ %108, %104 ]
%88 = icmp ugt i32 %87, 128
br i1 %88, label %89, label %104
89: ; preds = %85
%90 = icmp ult i32 %87, 142
br i1 %90, label %99, label %91
91: ; preds = %89
%92 = icmp ne i32 %87, 142
%93 = icmp ult i32 %87, 160
%94 = and i1 %92, %93
br i1 %94, label %99, label %95
95: ; preds = %91
%96 = icmp ugt i32 %87, 252
%97 = icmp ne i32 %87, 255
%98 = and i1 %96, %97
br i1 %98, label %99, label %104
99: ; preds = %95, %89, %91
%100 = phi i32 [ 6, %91 ], [ 6, %89 ], [ 5, %95 ]
store i32 %100, i32* @DetectKanjiCode.whatcode
%101 = add i64 %86, 1
%102 = getelementptr inbounds i8, i8* %0, i64 %86
%103 = load i8, i8* %102
br label %135
104: ; preds = %95, %85
%105 = add i64 %86, 1
%106 = getelementptr inbounds i8, i8* %0, i64 %86
%107 = load i8, i8* %106
%108 = zext i8 %107 to i32
%109 = icmp ugt i8 %107, 63
br i1 %109, label %85, label %135
110: ; preds = %80
%111 = icmp ult i8 %72, -96
br i1 %111, label %185, label %141
112: ; preds = %65
%113 = add i8 %16, 16
%114 = icmp ult i8 %113, 15
br i1 %114, label %185, label %115
115: ; preds = %112
%116 = and i8 %16, -16
%117 = icmp eq i8 %116, -32
br i1 %117, label %118, label %141
118: ; preds = %115
%119 = add nsw i32 %11, 2
%120 = sext i32 %13 to i64
%121 = getelementptr inbounds i8, i8* %0, i64 %120
%122 = load i8, i8* %121
%123 = zext i8 %122 to i32
%124 = add i8 %122, -64
%125 = icmp ult i8 %124, 63
%126 = icmp slt i8 %122, -95
%127 = or i1 %126, %125
br i1 %127, label %185, label %128
128: ; preds = %118
%129 = add i8 %122, 3
%130 = icmp ult i8 %129, 2
br i1 %130, label %185, label %131
131: ; preds = %128
%132 = add i8 %122, 95
%133 = icmp ult i8 %132, 92
br i1 %133, label %134, label %141
134: ; preds = %131
store i32 7, i32* @DetectKanjiCode.whatcode
br label %141
135: ; preds = %104, %99
%136 = phi i8 [ %103, %99 ], [ %107, %104 ]
%137 = phi i64 [ %101, %99 ], [ %105, %104 ]
%138 = phi i32 [ %100, %99 ], [ 7, %104 ]
%139 = zext i8 %136 to i32
%140 = trunc i64 %137 to i32
br label %141
141: ; preds = %135, %18, %33, %29, %61, %64, %131, %134, %115, %110, %79
%142 = phi i32 [ %10, %29 ], [ %10, %33 ], [ 7, %64 ], [ %10, %61 ], [ 7, %79 ], [ %10, %110 ], [ 7, %134 ], [ %10, %131 ], [ %10, %115 ], [ %10, %18 ], [ %138, %135 ]
%143 = phi i32 [ %12, %29 ], [ %12, %33 ], [ 7, %64 ], [ %12, %61 ], [ 7, %79 ], [ %12, %110 ], [ 7, %134 ], [ %12, %131 ], [ %12, %115 ], [ %12, %18 ], [ %138, %135 ]
%144 = phi i32 [ %31, %29 ], [ %38, %33 ], [ %53, %64 ], [ %53, %61 ], [ %73, %79 ], [ %73, %110 ], [ %123, %134 ], [ %123, %131 ], [ %17, %115 ], [ %23, %18 ], [ %139, %135 ]
%145 = phi i32 [ %30, %29 ], [ %34, %33 ], [ %49, %64 ], [ %49, %61 ], [ %69, %79 ], [ %69, %110 ], [ %119, %134 ], [ %119, %131 ], [ %13, %115 ], [ %19, %18 ], [ %140, %135 ]
%146 = add nsw i32 %143, -7
%147 = icmp ult i32 %146, 2
%148 = icmp ne i32 %144, 0
%149 = select i1 %147, i1 %148, i1 false
br i1 %149, label %9, label %150
150: ; preds = %9, %141
%151 = phi i32 [ %142, %141 ], [ %10, %9 ]
%152 = phi i32 [ %143, %141 ], [ %12, %9 ]
%153 = icmp eq i32 %152, 7
%154 = icmp ne i32 %7, 8
%155 = select i1 %153, i1 %154, i1 false
br i1 %155, label %156, label %157
156: ; preds = %150
store i32 %7, i32* @DetectKanjiCode.whatcode
br label %157
157: ; preds = %150, %156
%158 = phi i32 [ %7, %156 ], [ %151, %150 ]
%159 = icmp eq i32 %158, 7
br i1 %159, label %160, label %187
160: ; preds = %157
%161 = tail call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%162 = icmp eq i8* %161, null
br i1 %162, label %163, label %169
163: ; preds = %160
%164 = tail call i8* @getenv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%165 = icmp eq i8* %164, null
br i1 %165, label %166, label %169
166: ; preds = %163
%167 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%168 = icmp eq i8* %167, null
br i1 %168, label %185, label %169
169: ; preds = %163, %160, %166
%170 = phi i8* [ %167, %166 ], [ %164, %163 ], [ %161, %160 ]
%171 = tail call i64 @strcmp(i8* %170, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%172 = icmp eq i64 %171, 0
br i1 %172, label %185, label %173
173: ; preds = %169
%174 = tail call i64 @strcmp(i8* %170, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%175 = icmp eq i64 %174, 0
br i1 %175, label %185, label %176
176: ; preds = %173
%177 = tail call i64 @strcmp(i8* %170, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%178 = icmp eq i64 %177, 0
br i1 %178, label %185, label %179
179: ; preds = %176
%180 = tail call i64 @strncmp(i8* %170, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%181 = icmp eq i64 %180, 0
%182 = load i32, i32* @DetectKanjiCode.whatcode
%183 = icmp eq i32 %182, 7
%184 = select i1 %181, i1 true, i1 %183
br i1 %184, label %185, label %187
185: ; preds = %128, %118, %112, %110, %68, %48, %40, %18, %33, %29, %24, %166, %179, %169, %173, %176
%186 = phi i32 [ 6, %176 ], [ 6, %173 ], [ 6, %169 ], [ 5, %179 ], [ 5, %166 ], [ 1, %24 ], [ 2, %29 ], [ 3, %33 ], [ 4, %18 ], [ 6, %40 ], [ 6, %48 ], [ 5, %68 ], [ 6, %110 ], [ 5, %112 ], [ 6, %118 ], [ 5, %128 ]
store i32 %186, i32* @DetectKanjiCode.whatcode
br label %187
187: ; preds = %179, %185, %157
%188 = phi i32 [ %158, %157 ], [ %186, %185 ], [ %182, %179 ]
ret i32 %188
}