#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 */
struct charset {
  int dummy;
};
typedef int /*<<< orphan*/ s;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
struct charset *charset_find(char *);
int charset_mbtowc(struct charset *, int *, char *, int);
int charset_wctomb(struct charset *, char *, int);
int /*<<< orphan*/ safe_strncpy(char *, char *, int);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ test_any(struct charset *);
void test_utf8() {
  struct charset *charset;
  int wc;
  char s[8];
  charset = charset_find("UTF-8");
  test_any(charset);
  wc = 0;
  assert(charset_mbtowc(charset, &wc, "\177", 1) == 1 && wc == 127);
  assert(charset_mbtowc(charset, &wc, "\200", 2) == -1);
  assert(charset_mbtowc(charset, &wc, "\301\277", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\302\200", 1) == -1);
  assert(charset_mbtowc(charset, &wc, "\302\200", 2) == 2 && wc == 128);
  assert(charset_mbtowc(charset, &wc, "\302\200", 3) == 2 && wc == 128);
  assert(charset_mbtowc(charset, &wc, "\340\237\200", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\340\240\200", 9) == 3 && wc == 1 << 11);
  assert(charset_mbtowc(charset, &wc, "\360\217\277\277", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\360\220\200\200", 9) == 4 &&
         wc == 1 << 16);
  assert(charset_mbtowc(charset, &wc, "\370\207\277\277\277", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\370\210\200\200\200", 9) == 5 &&
         wc == 1 << 21);
  assert(charset_mbtowc(charset, &wc, "\374\203\277\277\277\277", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\374\204\200\200\200\200", 9) == 6 &&
         wc == 1 << 26);
  assert(charset_mbtowc(charset, &wc, "\375\277\277\277\277\277", 9) == 6 &&
         wc == 0x7fffffff);
  assert(charset_mbtowc(charset, &wc, "\302\000", 2) == -1);
  assert(charset_mbtowc(charset, &wc, "\302\300", 2) == -1);
  assert(charset_mbtowc(charset, &wc, "\340\040\200", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\340\340\200", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\340\240\000", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\340\240\300", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\360\020\200\200", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\360\320\200\200", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\360\220\000\200", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\360\220\300\200", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\360\220\200\000", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\360\220\200\300", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\375\077\277\277\277\277", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\375\377\277\277\277\277", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\375\277\077\277\277\277", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\375\277\377\277\277\277", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\375\277\277\277\077\277", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\375\277\277\277\377\277", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\375\277\277\277\277\077", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\375\277\277\277\277\377", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\376\277\277\277\277\277", 9) == -1);
  assert(charset_mbtowc(charset, &wc, "\377\277\277\277\277\277", 9) == -1);
  safe_strncpy(s, ".......", sizeof(s));
  assert(charset_wctomb(charset, s, 1 << 31) == -1 && !strcmp(s, "......."));
  assert(charset_wctomb(charset, s, 127) == 1 && !strcmp(s, "\177......"));
  assert(charset_wctomb(charset, s, 128) == 2 && !strcmp(s, "\302\200....."));
  assert(charset_wctomb(charset, s, 0x7ff) == 2 && !strcmp(s, "\337\277....."));
  assert(charset_wctomb(charset, s, 0x800) == 3 &&
         !strcmp(s, "\340\240\200...."));
  assert(charset_wctomb(charset, s, 0xffff) == 3 &&
         !strcmp(s, "\357\277\277...."));
  assert(charset_wctomb(charset, s, 0x10000) == 4 &&
         !strcmp(s, "\360\220\200\200..."));
  assert(charset_wctomb(charset, s, 0x1fffff) == 4 &&
         !strcmp(s, "\367\277\277\277..."));
  assert(charset_wctomb(charset, s, 0x200000) == 5 &&
         !strcmp(s, "\370\210\200\200\200.."));
  assert(charset_wctomb(charset, s, 0x3ffffff) == 5 &&
         !strcmp(s, "\373\277\277\277\277.."));
  assert(charset_wctomb(charset, s, 0x4000000) == 6 &&
         !strcmp(s, "\374\204\200\200\200\200."));
  assert(charset_wctomb(charset, s, 0x7fffffff) == 6 &&
         !strcmp(s, "\375\277\277\277\277\277."));
}


x86 assembly (clang, -O0):
<test_utf8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xe81(%rip),%rdi
call   1040 <charset_find@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1090 <test_any@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xe5f(%rip),%rdx
mov    $0x1,%ecx
call   1050 <charset_mbtowc@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0x15(%rbp)
jne    11cb <test_utf8+0x5b>
cmpl   $0x7f,-0xc(%rbp)
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xe5f(%rip),%rdx
mov    $0x2,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xdf8(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xdd2(%rip),%rdx
mov    $0x1,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xda9(%rip),%rdx
mov    $0x2,%ecx
call   1050 <charset_mbtowc@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x2,%ecx
mov    %al,-0x16(%rbp)
jne    1289 <test_utf8+0x119>
cmpl   $0x80,-0xc(%rbp)
sete   %al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xd66(%rip),%rdx
mov    $0x3,%ecx
call   1050 <charset_mbtowc@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x2,%ecx
mov    %al,-0x17(%rbp)
jne    12cc <test_utf8+0x15c>
cmpl   $0x80,-0xc(%rbp)
sete   %al
mov    %al,-0x17(%rbp)
mov    -0x17(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xd26(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xd01(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x3,%ecx
mov    %al,-0x18(%rbp)
jne    1338 <test_utf8+0x1c8>
cmpl   $0x800,-0xc(%rbp)
sete   %al
mov    %al,-0x18(%rbp)
mov    -0x18(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xcc2(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xc9e(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x4,%ecx
mov    %al,-0x19(%rbp)
jne    13a4 <test_utf8+0x234>
cmpl   $0x10000,-0xc(%rbp)
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xc60(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xc3d(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x5,%ecx
mov    %al,-0x1a(%rbp)
jne    1410 <test_utf8+0x2a0>
cmpl   $0x200000,-0xc(%rbp)
sete   %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xc00(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xbde(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x6,%ecx
mov    %al,-0x1b(%rbp)
jne    147c <test_utf8+0x30c>
cmpl   $0x4000000,-0xc(%rbp)
sete   %al
mov    %al,-0x1b(%rbp)
mov    -0x1b(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xba2(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x6,%ecx
mov    %al,-0x1c(%rbp)
jne    14bf <test_utf8+0x34f>
cmpl   $0x7fffffff,-0xc(%rbp)
sete   %al
mov    %al,-0x1c(%rbp)
mov    -0x1c(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xc2f(%rip),%rdx
mov    $0x2,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xb3d(%rip),%rdx
mov    $0x2,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xb17(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xaf2(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xb98(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xaa4(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xa7f(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xa5b(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xaea(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xa0e(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0xa9d(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0x9c1(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0x99d(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0x97b(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0x959(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0x937(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0x915(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0x8f3(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0x8d1(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0x8af(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0x88d(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    0x86b(%rip),%rdx
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
lea    -0x14(%rbp),%rdi
lea    0x84d(%rip),%rsi
mov    $0x8,%edx
call   1060 <safe_strncpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x80000000,%edx
call   1030 <charset_wctomb@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
mov    %al,-0x1d(%rbp)
jne    18a4 <test_utf8+0x734>
lea    -0x14(%rbp),%rdi
lea    0x816(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x7f,%edx
call   1030 <charset_wctomb@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0x1e(%rbp)
jne    18ee <test_utf8+0x77e>
lea    -0x14(%rbp),%rdi
lea    0x7d4(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x80,%edx
call   1030 <charset_wctomb@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x2,%ecx
mov    %al,-0x1f(%rbp)
jne    1938 <test_utf8+0x7c8>
lea    -0x14(%rbp),%rdi
lea    0x792(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x1f(%rbp)
mov    -0x1f(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x7ff,%edx
call   1030 <charset_wctomb@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x2,%ecx
mov    %al,-0x20(%rbp)
jne    1982 <test_utf8+0x812>
lea    -0x14(%rbp),%rdi
lea    0x750(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x20(%rbp)
mov    -0x20(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x800,%edx
call   1030 <charset_wctomb@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x3,%ecx
mov    %al,-0x21(%rbp)
jne    19cc <test_utf8+0x85c>
lea    -0x14(%rbp),%rdi
lea    0x70e(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0xffff,%edx
call   1030 <charset_wctomb@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x3,%ecx
mov    %al,-0x22(%rbp)
jne    1a16 <test_utf8+0x8a6>
lea    -0x14(%rbp),%rdi
lea    0x6cc(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x10000,%edx
call   1030 <charset_wctomb@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x4,%ecx
mov    %al,-0x23(%rbp)
jne    1a60 <test_utf8+0x8f0>
lea    -0x14(%rbp),%rdi
lea    0x68a(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x23(%rbp)
mov    -0x23(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x1fffff,%edx
call   1030 <charset_wctomb@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x4,%ecx
mov    %al,-0x24(%rbp)
jne    1aaa <test_utf8+0x93a>
lea    -0x14(%rbp),%rdi
lea    0x648(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x24(%rbp)
mov    -0x24(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x200000,%edx
call   1030 <charset_wctomb@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x5,%ecx
mov    %al,-0x25(%rbp)
jne    1af4 <test_utf8+0x984>
lea    -0x14(%rbp),%rdi
lea    0x606(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x3ffffff,%edx
call   1030 <charset_wctomb@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x5,%ecx
mov    %al,-0x26(%rbp)
jne    1b3e <test_utf8+0x9ce>
lea    -0x14(%rbp),%rdi
lea    0x5c4(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x26(%rbp)
mov    -0x26(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x4000000,%edx
call   1030 <charset_wctomb@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x6,%ecx
mov    %al,-0x27(%rbp)
jne    1b88 <test_utf8+0xa18>
lea    -0x14(%rbp),%rdi
lea    0x582(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x27(%rbp)
mov    -0x27(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x8(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x7fffffff,%edx
call   1030 <charset_wctomb@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x6,%ecx
mov    %al,-0x28(%rbp)
jne    1bd2 <test_utf8+0xa62>
lea    -0x14(%rbp),%rdi
lea    0x540(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x28(%rbp)
mov    -0x28(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_utf8>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movabs $0x2e2e2e2e2e2e2e,%r12
lea    0xe83(%rip),%rdi
call   1040 <charset_find@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <test_any@plt>
movl   $0x0,0xc(%rsp)
lea    0xe6a(%rip),%rdx
lea    0xc(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%ecx
call   1050 <charset_mbtowc@plt>
xor    $0x1,%eax
mov    0xc(%rsp),%ecx
xor    $0x7f,%ecx
xor    %edi,%edi
or     %eax,%ecx
sete   %dil
call   1070 <assert@plt>
lea    0xe77(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xe14(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xdf2(%rip),%r15
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    $0x1,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    $0x2,%ecx
call   1050 <charset_mbtowc@plt>
xor    $0x2,%eax
mov    $0x80,%ebp
mov    0xc(%rsp),%ecx
xor    %ebp,%ecx
xor    %edi,%edi
or     %eax,%ecx
sete   %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    $0x3,%ecx
call   1050 <charset_mbtowc@plt>
xor    0xc(%rsp),%ebp
xor    $0x2,%eax
xor    %edi,%edi
or     %eax,%ebp
sete   %dil
call   1070 <assert@plt>
lea    0xd78(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xd57(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
mov    $0x800,%ecx
xor    0xc(%rsp),%ecx
xor    $0x3,%eax
xor    %edi,%edi
or     %eax,%ecx
sete   %dil
call   1070 <assert@plt>
lea    0xd2b(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xd0b(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
mov    $0x10000,%ecx
xor    0xc(%rsp),%ecx
xor    $0x4,%eax
xor    %edi,%edi
or     %eax,%ecx
sete   %dil
call   1070 <assert@plt>
lea    0xce0(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xcc1(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
mov    $0x200000,%ecx
xor    0xc(%rsp),%ecx
xor    $0x5,%eax
xor    %edi,%edi
or     %eax,%ecx
sete   %dil
call   1070 <assert@plt>
lea    0xc97(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xc79(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
mov    $0x4000000,%ecx
xor    0xc(%rsp),%ecx
xor    $0x6,%eax
xor    %edi,%edi
or     %eax,%ecx
sete   %dil
call   1070 <assert@plt>
lea    0xc50(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
mov    $0x7fffffff,%ecx
xor    0xc(%rsp),%ecx
xor    $0x6,%eax
xor    %edi,%edi
or     %eax,%ecx
sete   %dil
call   1070 <assert@plt>
lea    0xcf0(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xc02(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xbe0(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xbbf(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xc69(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xb79(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xb58(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xb38(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xbcb(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xaf3(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xb86(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xaae(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xa8e(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xa70(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xa52(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xa34(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xa16(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0x9f8(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0x9da(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0x9bc(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0x99e(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0x980(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%ecx
call   1050 <charset_mbtowc@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1070 <assert@plt>
lea    0x962(%rip),%rsi
lea    0x4(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x8,%edx
call   1060 <safe_strncpy@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x80000000,%edx
call   1030 <charset_wctomb@plt>
xor    %ebp,%ebp
mov    $0x0,%edi
cmp    $0xffffffff,%eax
jne    1781 <test_utf8+0x621>
xor    %edi,%edi
cmp    %r12,0x4(%rsp)
sete   %dil
call   1070 <assert@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x7f,%edx
call   1030 <charset_wctomb@plt>
cmp    $0x1,%eax
jne    17ad <test_utf8+0x64d>
lea    0x51(%r12),%rax
xor    %ebp,%ebp
cmp    %rax,0x4(%rsp)
sete   %bpl
mov    %ebp,%edi
call   1070 <assert@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x80,%edx
call   1030 <charset_wctomb@plt>
xor    %ebp,%ebp
mov    $0x0,%edi
cmp    $0x2,%eax
jne    17e5 <test_utf8+0x685>
lea    0x5294(%r12),%rax
xor    %edi,%edi
cmp    %rax,0x4(%rsp)
sete   %dil
call   1070 <assert@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x7ff,%edx
call   1030 <charset_wctomb@plt>
cmp    $0x2,%eax
jne    1814 <test_utf8+0x6b4>
lea    0x91b1(%r12),%rax
xor    %ebp,%ebp
cmp    %rax,0x4(%rsp)
sete   %bpl
mov    %ebp,%edi
call   1070 <assert@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x800,%edx
call   1030 <charset_wctomb@plt>
xor    %ebp,%ebp
mov    $0x0,%edi
cmp    $0x3,%eax
jne    184c <test_utf8+0x6ec>
lea    0x5272b2(%r12),%rax
xor    %edi,%edi
cmp    %rax,0x4(%rsp)
sete   %dil
call   1070 <assert@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xffff,%edx
call   1030 <charset_wctomb@plt>
cmp    $0x3,%eax
jne    187b <test_utf8+0x71b>
lea    0x9191c1(%r12),%rax
xor    %ebp,%ebp
cmp    %rax,0x4(%rsp)
sete   %bpl
mov    %ebp,%edi
call   1070 <assert@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x10000,%edx
call   1030 <charset_wctomb@plt>
xor    %ebp,%ebp
mov    $0x0,%edi
cmp    $0x4,%eax
jne    18b2 <test_utf8+0x752>
add    $0x525262c2,%r12
xor    %edi,%edi
cmp    %r12,0x4(%rsp)
sete   %dil
call   1070 <assert@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x1fffff,%edx
call   1030 <charset_wctomb@plt>
cmp    $0x4,%eax
jne    18e3 <test_utf8+0x783>
movabs $0x2e2e2ebfbfbff7,%rax
xor    %ebp,%ebp
cmp    %rax,0x4(%rsp)
sete   %bpl
mov    %ebp,%edi
call   1070 <assert@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x200000,%edx
call   1030 <charset_wctomb@plt>
xor    %ebp,%ebp
mov    $0x0,%edi
cmp    $0x5,%eax
jne    191d <test_utf8+0x7bd>
movabs $0x2e2e80808088f8,%rax
xor    %edi,%edi
cmp    %rax,0x4(%rsp)
sete   %dil
call   1070 <assert@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x3ffffff,%edx
call   1030 <charset_wctomb@plt>
cmp    $0x5,%eax
jne    194e <test_utf8+0x7ee>
movabs $0x2e2ebfbfbfbffb,%rax
xor    %ebp,%ebp
cmp    %rax,0x4(%rsp)
sete   %bpl
mov    %ebp,%edi
call   1070 <assert@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4000000,%edx
call   1030 <charset_wctomb@plt>
xor    %ebp,%ebp
mov    $0x0,%edi
cmp    $0x6,%eax
jne    1988 <test_utf8+0x828>
movabs $0x2e8080808084fc,%rax
xor    %edi,%edi
cmp    %rax,0x4(%rsp)
sete   %dil
call   1070 <assert@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x7fffffff,%edx
call   1030 <charset_wctomb@plt>
cmp    $0x6,%eax
jne    19b9 <test_utf8+0x859>
movabs $0x2ebfbfbfbfbffd,%rax
xor    %ebp,%ebp
cmp    %rax,0x4(%rsp)
sete   %bpl
mov    %ebp,%edi
call   1070 <assert@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.charset = type { i32 }
@.str = [6 x i8] c"UTF-8\00"
@.str.1 = [2 x i8] c"\7F\00"
@.str.2 = [2 x i8] c"\80\00"
@.str.3 = [3 x i8] c"\C1\BF\00"
@.str.4 = [3 x i8] c"\C2\80\00"
@.str.5 = [4 x i8] c"\E0\9F\80\00"
@.str.6 = [4 x i8] c"\E0\A0\80\00"
@.str.7 = [5 x i8] c"\F0\8F\BF\BF\00"
@.str.8 = [5 x i8] c"\F0\90\80\80\00"
@.str.9 = [6 x i8] c"\F8\87\BF\BF\BF\00"
@.str.10 = [6 x i8] c"\F8\88\80\80\80\00"
@.str.11 = [7 x i8] c"\FC\83\BF\BF\BF\BF\00"
@.str.12 = [7 x i8] c"\FC\84\80\80\80\80\00"
@.str.13 = [7 x i8] c"\FD\BF\BF\BF\BF\BF\00"
@.str.14 = [3 x i8] c"\C2\00\00"
@.str.15 = [3 x i8] c"\C2\C0\00"
@.str.16 = [4 x i8] c"\E0 \80\00"
@.str.17 = [4 x i8] c"\E0\E0\80\00"
@.str.18 = [4 x i8] c"\E0\A0\00\00"
@.str.19 = [4 x i8] c"\E0\A0\C0\00"
@.str.20 = [5 x i8] c"\F0\10\80\80\00"
@.str.21 = [5 x i8] c"\F0\D0\80\80\00"
@.str.22 = [5 x i8] c"\F0\90\00\80\00"
@.str.23 = [5 x i8] c"\F0\90\C0\80\00"
@.str.24 = [5 x i8] c"\F0\90\80\00\00"
@.str.25 = [5 x i8] c"\F0\90\80\C0\00"
@.str.26 = [7 x i8] c"\FD?\BF\BF\BF\BF\00"
@.str.27 = [7 x i8] c"\FD\FF\BF\BF\BF\BF\00"
@.str.28 = [7 x i8] c"\FD\BF?\BF\BF\BF\00"
@.str.29 = [7 x i8] c"\FD\BF\FF\BF\BF\BF\00"
@.str.30 = [7 x i8] c"\FD\BF\BF\BF?\BF\00"
@.str.31 = [7 x i8] c"\FD\BF\BF\BF\FF\BF\00"
@.str.32 = [7 x i8] c"\FD\BF\BF\BF\BF?\00"
@.str.33 = [7 x i8] c"\FD\BF\BF\BF\BF\FF\00"
@.str.34 = [7 x i8] c"\FE\BF\BF\BF\BF\BF\00"
@.str.35 = [7 x i8] c"\FF\BF\BF\BF\BF\BF\00"
@.str.36 = [8 x i8] c".......\00"
@.str.37 = [8 x i8] c"\7F......\00"
@.str.38 = [8 x i8] c"\C2\80.....\00"
@.str.39 = [8 x i8] c"\DF\BF.....\00"
@.str.40 = [8 x i8] c"\E0\A0\80....\00"
@.str.41 = [8 x i8] c"\EF\BF\BF....\00"
@.str.42 = [8 x i8] c"\F0\90\80\80...\00"
@.str.43 = [8 x i8] c"\F7\BF\BF\BF...\00"
@.str.44 = [8 x i8] c"\F8\88\80\80\80..\00"
@.str.45 = [8 x i8] c"\FB\BF\BF\BF\BF..\00"
@.str.46 = [8 x i8] c"\FC\84\80\80\80\80.\00"
@.str.47 = [8 x i8] c"\FD\BF\BF\BF\BF\BF.\00"
define void @test_utf8() {
%1 = alloca %struct.charset*
%2 = alloca i32
%3 = alloca [8 x i8]
%4 = call %struct.charset* @charset_find(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store %struct.charset* %4, %struct.charset** %1
%5 = load %struct.charset*, %struct.charset** %1
%6 = call i32 @test_any(%struct.charset* %5)
store i32 0, i32* %2
%7 = load %struct.charset*, %struct.charset** %1
%8 = call i32 @charset_mbtowc(%struct.charset* %7, i32* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 127
br label %13
13: ; preds = %10, %0
%14 = phi i1 [ false, %0 ], [ %12, %10 ]
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load %struct.charset*, %struct.charset** %1
%18 = call i32 @charset_mbtowc(%struct.charset* %17, i32* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 2)
%19 = icmp eq i32 %18, -1
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load %struct.charset*, %struct.charset** %1
%23 = call i32 @charset_mbtowc(%struct.charset* %22, i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 9)
%24 = icmp eq i32 %23, -1
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load %struct.charset*, %struct.charset** %1
%28 = call i32 @charset_mbtowc(%struct.charset* %27, i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 1)
%29 = icmp eq i32 %28, -1
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = load %struct.charset*, %struct.charset** %1
%33 = call i32 @charset_mbtowc(%struct.charset* %32, i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2)
%34 = icmp eq i32 %33, 2
br i1 %34, label %35, label %38
35: ; preds = %13
%36 = load i32, i32* %2
%37 = icmp eq i32 %36, 128
br label %38
38: ; preds = %35, %13
%39 = phi i1 [ false, %13 ], [ %37, %35 ]
%40 = zext i1 %39 to i32
%41 = call i32 @assert(i32 %40)
%42 = load %struct.charset*, %struct.charset** %1
%43 = call i32 @charset_mbtowc(%struct.charset* %42, i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 3)
%44 = icmp eq i32 %43, 2
br i1 %44, label %45, label %48
45: ; preds = %38
%46 = load i32, i32* %2
%47 = icmp eq i32 %46, 128
br label %48
48: ; preds = %45, %38
%49 = phi i1 [ false, %38 ], [ %47, %45 ]
%50 = zext i1 %49 to i32
%51 = call i32 @assert(i32 %50)
%52 = load %struct.charset*, %struct.charset** %1
%53 = call i32 @charset_mbtowc(%struct.charset* %52, i32* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 9)
%54 = icmp eq i32 %53, -1
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
%57 = load %struct.charset*, %struct.charset** %1
%58 = call i32 @charset_mbtowc(%struct.charset* %57, i32* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 9)
%59 = icmp eq i32 %58, 3
br i1 %59, label %60, label %63
60: ; preds = %48
%61 = load i32, i32* %2
%62 = icmp eq i32 %61, 2048
br label %63
63: ; preds = %60, %48
%64 = phi i1 [ false, %48 ], [ %62, %60 ]
%65 = zext i1 %64 to i32
%66 = call i32 @assert(i32 %65)
%67 = load %struct.charset*, %struct.charset** %1
%68 = call i32 @charset_mbtowc(%struct.charset* %67, i32* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 9)
%69 = icmp eq i32 %68, -1
%70 = zext i1 %69 to i32
%71 = call i32 @assert(i32 %70)
%72 = load %struct.charset*, %struct.charset** %1
%73 = call i32 @charset_mbtowc(%struct.charset* %72, i32* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 9)
%74 = icmp eq i32 %73, 4
br i1 %74, label %75, label %78
75: ; preds = %63
%76 = load i32, i32* %2
%77 = icmp eq i32 %76, 65536
br label %78
78: ; preds = %75, %63
%79 = phi i1 [ false, %63 ], [ %77, %75 ]
%80 = zext i1 %79 to i32
%81 = call i32 @assert(i32 %80)
%82 = load %struct.charset*, %struct.charset** %1
%83 = call i32 @charset_mbtowc(%struct.charset* %82, i32* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 9)
%84 = icmp eq i32 %83, -1
%85 = zext i1 %84 to i32
%86 = call i32 @assert(i32 %85)
%87 = load %struct.charset*, %struct.charset** %1
%88 = call i32 @charset_mbtowc(%struct.charset* %87, i32* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 9)
%89 = icmp eq i32 %88, 5
br i1 %89, label %90, label %93
90: ; preds = %78
%91 = load i32, i32* %2
%92 = icmp eq i32 %91, 2097152
br label %93
93: ; preds = %90, %78
%94 = phi i1 [ false, %78 ], [ %92, %90 ]
%95 = zext i1 %94 to i32
%96 = call i32 @assert(i32 %95)
%97 = load %struct.charset*, %struct.charset** %1
%98 = call i32 @charset_mbtowc(%struct.charset* %97, i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 9)
%99 = icmp eq i32 %98, -1
%100 = zext i1 %99 to i32
%101 = call i32 @assert(i32 %100)
%102 = load %struct.charset*, %struct.charset** %1
%103 = call i32 @charset_mbtowc(%struct.charset* %102, i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 9)
%104 = icmp eq i32 %103, 6
br i1 %104, label %105, label %108
105: ; preds = %93
%106 = load i32, i32* %2
%107 = icmp eq i32 %106, 67108864
br label %108
108: ; preds = %105, %93
%109 = phi i1 [ false, %93 ], [ %107, %105 ]
%110 = zext i1 %109 to i32
%111 = call i32 @assert(i32 %110)
%112 = load %struct.charset*, %struct.charset** %1
%113 = call i32 @charset_mbtowc(%struct.charset* %112, i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i32 9)
%114 = icmp eq i32 %113, 6
br i1 %114, label %115, label %118
115: ; preds = %108
%116 = load i32, i32* %2
%117 = icmp eq i32 %116, 2147483647
br label %118
118: ; preds = %115, %108
%119 = phi i1 [ false, %108 ], [ %117, %115 ]
%120 = zext i1 %119 to i32
%121 = call i32 @assert(i32 %120)
%122 = load %struct.charset*, %struct.charset** %1
%123 = call i32 @charset_mbtowc(%struct.charset* %122, i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0), i32 2)
%124 = icmp eq i32 %123, -1
%125 = zext i1 %124 to i32
%126 = call i32 @assert(i32 %125)
%127 = load %struct.charset*, %struct.charset** %1
%128 = call i32 @charset_mbtowc(%struct.charset* %127, i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0), i32 2)
%129 = icmp eq i32 %128, -1
%130 = zext i1 %129 to i32
%131 = call i32 @assert(i32 %130)
%132 = load %struct.charset*, %struct.charset** %1
%133 = call i32 @charset_mbtowc(%struct.charset* %132, i32* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i32 9)
%134 = icmp eq i32 %133, -1
%135 = zext i1 %134 to i32
%136 = call i32 @assert(i32 %135)
%137 = load %struct.charset*, %struct.charset** %1
%138 = call i32 @charset_mbtowc(%struct.charset* %137, i32* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i32 9)
%139 = icmp eq i32 %138, -1
%140 = zext i1 %139 to i32
%141 = call i32 @assert(i32 %140)
%142 = load %struct.charset*, %struct.charset** %1
%143 = call i32 @charset_mbtowc(%struct.charset* %142, i32* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i32 9)
%144 = icmp eq i32 %143, -1
%145 = zext i1 %144 to i32
%146 = call i32 @assert(i32 %145)
%147 = load %struct.charset*, %struct.charset** %1
%148 = call i32 @charset_mbtowc(%struct.charset* %147, i32* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0), i32 9)
%149 = icmp eq i32 %148, -1
%150 = zext i1 %149 to i32
%151 = call i32 @assert(i32 %150)
%152 = load %struct.charset*, %struct.charset** %1
%153 = call i32 @charset_mbtowc(%struct.charset* %152, i32* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i64 0, i64 0), i32 9)
%154 = icmp eq i32 %153, -1
%155 = zext i1 %154 to i32
%156 = call i32 @assert(i32 %155)
%157 = load %struct.charset*, %struct.charset** %1
%158 = call i32 @charset_mbtowc(%struct.charset* %157, i32* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i64 0, i64 0), i32 9)
%159 = icmp eq i32 %158, -1
%160 = zext i1 %159 to i32
%161 = call i32 @assert(i32 %160)
%162 = load %struct.charset*, %struct.charset** %1
%163 = call i32 @charset_mbtowc(%struct.charset* %162, i32* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.22, i64 0, i64 0), i32 9)
%164 = icmp eq i32 %163, -1
%165 = zext i1 %164 to i32
%166 = call i32 @assert(i32 %165)
%167 = load %struct.charset*, %struct.charset** %1
%168 = call i32 @charset_mbtowc(%struct.charset* %167, i32* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.23, i64 0, i64 0), i32 9)
%169 = icmp eq i32 %168, -1
%170 = zext i1 %169 to i32
%171 = call i32 @assert(i32 %170)
%172 = load %struct.charset*, %struct.charset** %1
%173 = call i32 @charset_mbtowc(%struct.charset* %172, i32* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0), i32 9)
%174 = icmp eq i32 %173, -1
%175 = zext i1 %174 to i32
%176 = call i32 @assert(i32 %175)
%177 = load %struct.charset*, %struct.charset** %1
%178 = call i32 @charset_mbtowc(%struct.charset* %177, i32* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.25, i64 0, i64 0), i32 9)
%179 = icmp eq i32 %178, -1
%180 = zext i1 %179 to i32
%181 = call i32 @assert(i32 %180)
%182 = load %struct.charset*, %struct.charset** %1
%183 = call i32 @charset_mbtowc(%struct.charset* %182, i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.26, i64 0, i64 0), i32 9)
%184 = icmp eq i32 %183, -1
%185 = zext i1 %184 to i32
%186 = call i32 @assert(i32 %185)
%187 = load %struct.charset*, %struct.charset** %1
%188 = call i32 @charset_mbtowc(%struct.charset* %187, i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.27, i64 0, i64 0), i32 9)
%189 = icmp eq i32 %188, -1
%190 = zext i1 %189 to i32
%191 = call i32 @assert(i32 %190)
%192 = load %struct.charset*, %struct.charset** %1
%193 = call i32 @charset_mbtowc(%struct.charset* %192, i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.28, i64 0, i64 0), i32 9)
%194 = icmp eq i32 %193, -1
%195 = zext i1 %194 to i32
%196 = call i32 @assert(i32 %195)
%197 = load %struct.charset*, %struct.charset** %1
%198 = call i32 @charset_mbtowc(%struct.charset* %197, i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.29, i64 0, i64 0), i32 9)
%199 = icmp eq i32 %198, -1
%200 = zext i1 %199 to i32
%201 = call i32 @assert(i32 %200)
%202 = load %struct.charset*, %struct.charset** %1
%203 = call i32 @charset_mbtowc(%struct.charset* %202, i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.30, i64 0, i64 0), i32 9)
%204 = icmp eq i32 %203, -1
%205 = zext i1 %204 to i32
%206 = call i32 @assert(i32 %205)
%207 = load %struct.charset*, %struct.charset** %1
%208 = call i32 @charset_mbtowc(%struct.charset* %207, i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.31, i64 0, i64 0), i32 9)
%209 = icmp eq i32 %208, -1
%210 = zext i1 %209 to i32
%211 = call i32 @assert(i32 %210)
%212 = load %struct.charset*, %struct.charset** %1
%213 = call i32 @charset_mbtowc(%struct.charset* %212, i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.32, i64 0, i64 0), i32 9)
%214 = icmp eq i32 %213, -1
%215 = zext i1 %214 to i32
%216 = call i32 @assert(i32 %215)
%217 = load %struct.charset*, %struct.charset** %1
%218 = call i32 @charset_mbtowc(%struct.charset* %217, i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.33, i64 0, i64 0), i32 9)
%219 = icmp eq i32 %218, -1
%220 = zext i1 %219 to i32
%221 = call i32 @assert(i32 %220)
%222 = load %struct.charset*, %struct.charset** %1
%223 = call i32 @charset_mbtowc(%struct.charset* %222, i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.34, i64 0, i64 0), i32 9)
%224 = icmp eq i32 %223, -1
%225 = zext i1 %224 to i32
%226 = call i32 @assert(i32 %225)
%227 = load %struct.charset*, %struct.charset** %1
%228 = call i32 @charset_mbtowc(%struct.charset* %227, i32* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.35, i64 0, i64 0), i32 9)
%229 = icmp eq i32 %228, -1
%230 = zext i1 %229 to i32
%231 = call i32 @assert(i32 %230)
%232 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%233 = call i32 @safe_strncpy(i8* %232, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.36, i64 0, i64 0), i32 8)
%234 = load %struct.charset*, %struct.charset** %1
%235 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%236 = call i32 @charset_wctomb(%struct.charset* %234, i8* %235, i32 -2147483648)
%237 = icmp eq i32 %236, -1
br i1 %237, label %238, label %243
238: ; preds = %118
%239 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%240 = call i32 @strcmp(i8* %239, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.36, i64 0, i64 0))
%241 = icmp ne i32 %240, 0
%242 = xor i1 %241, true
br label %243
243: ; preds = %238, %118
%244 = phi i1 [ false, %118 ], [ %242, %238 ]
%245 = zext i1 %244 to i32
%246 = call i32 @assert(i32 %245)
%247 = load %struct.charset*, %struct.charset** %1
%248 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%249 = call i32 @charset_wctomb(%struct.charset* %247, i8* %248, i32 127)
%250 = icmp eq i32 %249, 1
br i1 %250, label %251, label %256
251: ; preds = %243
%252 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%253 = call i32 @strcmp(i8* %252, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.37, i64 0, i64 0))
%254 = icmp ne i32 %253, 0
%255 = xor i1 %254, true
br label %256
256: ; preds = %251, %243
%257 = phi i1 [ false, %243 ], [ %255, %251 ]
%258 = zext i1 %257 to i32
%259 = call i32 @assert(i32 %258)
%260 = load %struct.charset*, %struct.charset** %1
%261 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%262 = call i32 @charset_wctomb(%struct.charset* %260, i8* %261, i32 128)
%263 = icmp eq i32 %262, 2
br i1 %263, label %264, label %269
264: ; preds = %256
%265 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%266 = call i32 @strcmp(i8* %265, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.38, i64 0, i64 0))
%267 = icmp ne i32 %266, 0
%268 = xor i1 %267, true
br label %269
269: ; preds = %264, %256
%270 = phi i1 [ false, %256 ], [ %268, %264 ]
%271 = zext i1 %270 to i32
%272 = call i32 @assert(i32 %271)
%273 = load %struct.charset*, %struct.charset** %1
%274 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%275 = call i32 @charset_wctomb(%struct.charset* %273, i8* %274, i32 2047)
%276 = icmp eq i32 %275, 2
br i1 %276, label %277, label %282
277: ; preds = %269
%278 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%279 = call i32 @strcmp(i8* %278, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.39, i64 0, i64 0))
%280 = icmp ne i32 %279, 0
%281 = xor i1 %280, true
br label %282
282: ; preds = %277, %269
%283 = phi i1 [ false, %269 ], [ %281, %277 ]
%284 = zext i1 %283 to i32
%285 = call i32 @assert(i32 %284)
%286 = load %struct.charset*, %struct.charset** %1
%287 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%288 = call i32 @charset_wctomb(%struct.charset* %286, i8* %287, i32 2048)
%289 = icmp eq i32 %288, 3
br i1 %289, label %290, label %295
290: ; preds = %282
%291 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%292 = call i32 @strcmp(i8* %291, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.40, i64 0, i64 0))
%293 = icmp ne i32 %292, 0
%294 = xor i1 %293, true
br label %295
295: ; preds = %290, %282
%296 = phi i1 [ false, %282 ], [ %294, %290 ]
%297 = zext i1 %296 to i32
%298 = call i32 @assert(i32 %297)
%299 = load %struct.charset*, %struct.charset** %1
%300 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%301 = call i32 @charset_wctomb(%struct.charset* %299, i8* %300, i32 65535)
%302 = icmp eq i32 %301, 3
br i1 %302, label %303, label %308
303: ; preds = %295
%304 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%305 = call i32 @strcmp(i8* %304, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.41, i64 0, i64 0))
%306 = icmp ne i32 %305, 0
%307 = xor i1 %306, true
br label %308
308: ; preds = %303, %295
%309 = phi i1 [ false, %295 ], [ %307, %303 ]
%310 = zext i1 %309 to i32
%311 = call i32 @assert(i32 %310)
%312 = load %struct.charset*, %struct.charset** %1
%313 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%314 = call i32 @charset_wctomb(%struct.charset* %312, i8* %313, i32 65536)
%315 = icmp eq i32 %314, 4
br i1 %315, label %316, label %321
316: ; preds = %308
%317 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%318 = call i32 @strcmp(i8* %317, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.42, i64 0, i64 0))
%319 = icmp ne i32 %318, 0
%320 = xor i1 %319, true
br label %321
321: ; preds = %316, %308
%322 = phi i1 [ false, %308 ], [ %320, %316 ]
%323 = zext i1 %322 to i32
%324 = call i32 @assert(i32 %323)
%325 = load %struct.charset*, %struct.charset** %1
%326 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%327 = call i32 @charset_wctomb(%struct.charset* %325, i8* %326, i32 2097151)
%328 = icmp eq i32 %327, 4
br i1 %328, label %329, label %334
329: ; preds = %321
%330 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%331 = call i32 @strcmp(i8* %330, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.43, i64 0, i64 0))
%332 = icmp ne i32 %331, 0
%333 = xor i1 %332, true
br label %334
334: ; preds = %329, %321
%335 = phi i1 [ false, %321 ], [ %333, %329 ]
%336 = zext i1 %335 to i32
%337 = call i32 @assert(i32 %336)
%338 = load %struct.charset*, %struct.charset** %1
%339 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%340 = call i32 @charset_wctomb(%struct.charset* %338, i8* %339, i32 2097152)
%341 = icmp eq i32 %340, 5
br i1 %341, label %342, label %347
342: ; preds = %334
%343 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%344 = call i32 @strcmp(i8* %343, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.44, i64 0, i64 0))
%345 = icmp ne i32 %344, 0
%346 = xor i1 %345, true
br label %347
347: ; preds = %342, %334
%348 = phi i1 [ false, %334 ], [ %346, %342 ]
%349 = zext i1 %348 to i32
%350 = call i32 @assert(i32 %349)
%351 = load %struct.charset*, %struct.charset** %1
%352 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%353 = call i32 @charset_wctomb(%struct.charset* %351, i8* %352, i32 67108863)
%354 = icmp eq i32 %353, 5
br i1 %354, label %355, label %360
355: ; preds = %347
%356 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%357 = call i32 @strcmp(i8* %356, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.45, i64 0, i64 0))
%358 = icmp ne i32 %357, 0
%359 = xor i1 %358, true
br label %360
360: ; preds = %355, %347
%361 = phi i1 [ false, %347 ], [ %359, %355 ]
%362 = zext i1 %361 to i32
%363 = call i32 @assert(i32 %362)
%364 = load %struct.charset*, %struct.charset** %1
%365 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%366 = call i32 @charset_wctomb(%struct.charset* %364, i8* %365, i32 67108864)
%367 = icmp eq i32 %366, 6
br i1 %367, label %368, label %373
368: ; preds = %360
%369 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%370 = call i32 @strcmp(i8* %369, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.46, i64 0, i64 0))
%371 = icmp ne i32 %370, 0
%372 = xor i1 %371, true
br label %373
373: ; preds = %368, %360
%374 = phi i1 [ false, %360 ], [ %372, %368 ]
%375 = zext i1 %374 to i32
%376 = call i32 @assert(i32 %375)
%377 = load %struct.charset*, %struct.charset** %1
%378 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%379 = call i32 @charset_wctomb(%struct.charset* %377, i8* %378, i32 2147483647)
%380 = icmp eq i32 %379, 6
br i1 %380, label %381, label %386
381: ; preds = %373
%382 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%383 = call i32 @strcmp(i8* %382, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.47, i64 0, i64 0))
%384 = icmp ne i32 %383, 0
%385 = xor i1 %384, true
br label %386
386: ; preds = %381, %373
%387 = phi i1 [ false, %373 ], [ %385, %381 ]
%388 = zext i1 %387 to i32
%389 = call i32 @assert(i32 %388)
ret void
}

LLVM IR (-O2):
%struct.charset = type { i32 }
@.str = [6 x i8] c"UTF-8\00"
@.str.1 = [2 x i8] c"\7F\00"
@.str.2 = [2 x i8] c"\80\00"
@.str.3 = [3 x i8] c"\C1\BF\00"
@.str.4 = [3 x i8] c"\C2\80\00"
@.str.5 = [4 x i8] c"\E0\9F\80\00"
@.str.6 = [4 x i8] c"\E0\A0\80\00"
@.str.7 = [5 x i8] c"\F0\8F\BF\BF\00"
@.str.8 = [5 x i8] c"\F0\90\80\80\00"
@.str.9 = [6 x i8] c"\F8\87\BF\BF\BF\00"
@.str.10 = [6 x i8] c"\F8\88\80\80\80\00"
@.str.11 = [7 x i8] c"\FC\83\BF\BF\BF\BF\00"
@.str.12 = [7 x i8] c"\FC\84\80\80\80\80\00"
@.str.13 = [7 x i8] c"\FD\BF\BF\BF\BF\BF\00"
@.str.14 = [3 x i8] c"\C2\00\00"
@.str.15 = [3 x i8] c"\C2\C0\00"
@.str.16 = [4 x i8] c"\E0 \80\00"
@.str.17 = [4 x i8] c"\E0\E0\80\00"
@.str.18 = [4 x i8] c"\E0\A0\00\00"
@.str.19 = [4 x i8] c"\E0\A0\C0\00"
@.str.20 = [5 x i8] c"\F0\10\80\80\00"
@.str.21 = [5 x i8] c"\F0\D0\80\80\00"
@.str.22 = [5 x i8] c"\F0\90\00\80\00"
@.str.23 = [5 x i8] c"\F0\90\C0\80\00"
@.str.24 = [5 x i8] c"\F0\90\80\00\00"
@.str.25 = [5 x i8] c"\F0\90\80\C0\00"
@.str.26 = [7 x i8] c"\FD?\BF\BF\BF\BF\00"
@.str.27 = [7 x i8] c"\FD\FF\BF\BF\BF\BF\00"
@.str.28 = [7 x i8] c"\FD\BF?\BF\BF\BF\00"
@.str.29 = [7 x i8] c"\FD\BF\FF\BF\BF\BF\00"
@.str.30 = [7 x i8] c"\FD\BF\BF\BF?\BF\00"
@.str.31 = [7 x i8] c"\FD\BF\BF\BF\FF\BF\00"
@.str.32 = [7 x i8] c"\FD\BF\BF\BF\BF?\00"
@.str.33 = [7 x i8] c"\FD\BF\BF\BF\BF\FF\00"
@.str.34 = [7 x i8] c"\FE\BF\BF\BF\BF\BF\00"
@.str.35 = [7 x i8] c"\FF\BF\BF\BF\BF\BF\00"
@.str.36 = [8 x i8] c".......\00"
@.str.37 = [8 x i8] c"\7F......\00"
@.str.38 = [8 x i8] c"\C2\80.....\00"
@.str.39 = [8 x i8] c"\DF\BF.....\00"
@.str.40 = [8 x i8] c"\E0\A0\80....\00"
@.str.41 = [8 x i8] c"\EF\BF\BF....\00"
@.str.42 = [8 x i8] c"\F0\90\80\80...\00"
@.str.43 = [8 x i8] c"\F7\BF\BF\BF...\00"
@.str.44 = [8 x i8] c"\F8\88\80\80\80..\00"
@.str.45 = [8 x i8] c"\FB\BF\BF\BF\BF..\00"
@.str.46 = [8 x i8] c"\FC\84\80\80\80\80.\00"
@.str.47 = [8 x i8] c"\FD\BF\BF\BF\BF\BF.\00"
define void @test_utf8() {
%1 = alloca i32
%2 = alloca [8 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%5 = tail call %struct.charset* @charset_find(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @test_any(%struct.charset* %5)
store i32 0, i32* %1
%7 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%8 = icmp eq i32 %7, 1
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 127
%11 = select i1 %8, i1 %10, i1 false
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 2)
%15 = icmp eq i32 %14, -1
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 9)
%19 = icmp eq i32 %18, -1
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 1)
%23 = icmp eq i32 %22, -1
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2)
%27 = icmp eq i32 %26, 2
%28 = load i32, i32* %1
%29 = icmp eq i32 %28, 128
%30 = select i1 %27, i1 %29, i1 false
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 3)
%34 = icmp eq i32 %33, 2
%35 = load i32, i32* %1
%36 = icmp eq i32 %35, 128
%37 = select i1 %34, i1 %36, i1 false
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 9)
%41 = icmp eq i32 %40, -1
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
%44 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 9)
%45 = icmp eq i32 %44, 3
%46 = load i32, i32* %1
%47 = icmp eq i32 %46, 2048
%48 = select i1 %45, i1 %47, i1 false
%49 = zext i1 %48 to i32
%50 = call i32 @assert(i32 %49)
%51 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 9)
%52 = icmp eq i32 %51, -1
%53 = zext i1 %52 to i32
%54 = call i32 @assert(i32 %53)
%55 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 9)
%56 = icmp eq i32 %55, 4
%57 = load i32, i32* %1
%58 = icmp eq i32 %57, 65536
%59 = select i1 %56, i1 %58, i1 false
%60 = zext i1 %59 to i32
%61 = call i32 @assert(i32 %60)
%62 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 9)
%63 = icmp eq i32 %62, -1
%64 = zext i1 %63 to i32
%65 = call i32 @assert(i32 %64)
%66 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i32 9)
%67 = icmp eq i32 %66, 5
%68 = load i32, i32* %1
%69 = icmp eq i32 %68, 2097152
%70 = select i1 %67, i1 %69, i1 false
%71 = zext i1 %70 to i32
%72 = call i32 @assert(i32 %71)
%73 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 9)
%74 = icmp eq i32 %73, -1
%75 = zext i1 %74 to i32
%76 = call i32 @assert(i32 %75)
%77 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i32 9)
%78 = icmp eq i32 %77, 6
%79 = load i32, i32* %1
%80 = icmp eq i32 %79, 67108864
%81 = select i1 %78, i1 %80, i1 false
%82 = zext i1 %81 to i32
%83 = call i32 @assert(i32 %82)
%84 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i32 9)
%85 = icmp eq i32 %84, 6
%86 = load i32, i32* %1
%87 = icmp eq i32 %86, 2147483647
%88 = select i1 %85, i1 %87, i1 false
%89 = zext i1 %88 to i32
%90 = call i32 @assert(i32 %89)
%91 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0), i32 2)
%92 = icmp eq i32 %91, -1
%93 = zext i1 %92 to i32
%94 = call i32 @assert(i32 %93)
%95 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0), i32 2)
%96 = icmp eq i32 %95, -1
%97 = zext i1 %96 to i32
%98 = call i32 @assert(i32 %97)
%99 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0), i32 9)
%100 = icmp eq i32 %99, -1
%101 = zext i1 %100 to i32
%102 = call i32 @assert(i32 %101)
%103 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i32 9)
%104 = icmp eq i32 %103, -1
%105 = zext i1 %104 to i32
%106 = call i32 @assert(i32 %105)
%107 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i32 9)
%108 = icmp eq i32 %107, -1
%109 = zext i1 %108 to i32
%110 = call i32 @assert(i32 %109)
%111 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0), i32 9)
%112 = icmp eq i32 %111, -1
%113 = zext i1 %112 to i32
%114 = call i32 @assert(i32 %113)
%115 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i64 0, i64 0), i32 9)
%116 = icmp eq i32 %115, -1
%117 = zext i1 %116 to i32
%118 = call i32 @assert(i32 %117)
%119 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i64 0, i64 0), i32 9)
%120 = icmp eq i32 %119, -1
%121 = zext i1 %120 to i32
%122 = call i32 @assert(i32 %121)
%123 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.22, i64 0, i64 0), i32 9)
%124 = icmp eq i32 %123, -1
%125 = zext i1 %124 to i32
%126 = call i32 @assert(i32 %125)
%127 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.23, i64 0, i64 0), i32 9)
%128 = icmp eq i32 %127, -1
%129 = zext i1 %128 to i32
%130 = call i32 @assert(i32 %129)
%131 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.24, i64 0, i64 0), i32 9)
%132 = icmp eq i32 %131, -1
%133 = zext i1 %132 to i32
%134 = call i32 @assert(i32 %133)
%135 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.25, i64 0, i64 0), i32 9)
%136 = icmp eq i32 %135, -1
%137 = zext i1 %136 to i32
%138 = call i32 @assert(i32 %137)
%139 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.26, i64 0, i64 0), i32 9)
%140 = icmp eq i32 %139, -1
%141 = zext i1 %140 to i32
%142 = call i32 @assert(i32 %141)
%143 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.27, i64 0, i64 0), i32 9)
%144 = icmp eq i32 %143, -1
%145 = zext i1 %144 to i32
%146 = call i32 @assert(i32 %145)
%147 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.28, i64 0, i64 0), i32 9)
%148 = icmp eq i32 %147, -1
%149 = zext i1 %148 to i32
%150 = call i32 @assert(i32 %149)
%151 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.29, i64 0, i64 0), i32 9)
%152 = icmp eq i32 %151, -1
%153 = zext i1 %152 to i32
%154 = call i32 @assert(i32 %153)
%155 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.30, i64 0, i64 0), i32 9)
%156 = icmp eq i32 %155, -1
%157 = zext i1 %156 to i32
%158 = call i32 @assert(i32 %157)
%159 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.31, i64 0, i64 0), i32 9)
%160 = icmp eq i32 %159, -1
%161 = zext i1 %160 to i32
%162 = call i32 @assert(i32 %161)
%163 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.32, i64 0, i64 0), i32 9)
%164 = icmp eq i32 %163, -1
%165 = zext i1 %164 to i32
%166 = call i32 @assert(i32 %165)
%167 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.33, i64 0, i64 0), i32 9)
%168 = icmp eq i32 %167, -1
%169 = zext i1 %168 to i32
%170 = call i32 @assert(i32 %169)
%171 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.34, i64 0, i64 0), i32 9)
%172 = icmp eq i32 %171, -1
%173 = zext i1 %172 to i32
%174 = call i32 @assert(i32 %173)
%175 = call i32 @charset_mbtowc(%struct.charset* %5, i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.35, i64 0, i64 0), i32 9)
%176 = icmp eq i32 %175, -1
%177 = zext i1 %176 to i32
%178 = call i32 @assert(i32 %177)
%179 = call i32 @safe_strncpy(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.36, i64 0, i64 0), i32 8)
%180 = call i32 @charset_wctomb(%struct.charset* %5, i8* %4, i32 -2147483648)
%181 = icmp eq i32 %180, -1
br i1 %181, label %182, label %186
182: ; preds = %0
%183 = call i32 @bcmp(i8* dereferenceable(8) %4, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.36, i64 0, i64 0), i64 8)
%184 = icmp eq i32 %183, 0
%185 = zext i1 %184 to i32
br label %186
186: ; preds = %182, %0
%187 = phi i32 [ 0, %0 ], [ %185, %182 ]
%188 = call i32 @assert(i32 %187)
%189 = call i32 @charset_wctomb(%struct.charset* %5, i8* %4, i32 127)
%190 = icmp eq i32 %189, 1
br i1 %190, label %191, label %195
191: ; preds = %186
%192 = call i32 @bcmp(i8* dereferenceable(8) %4, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.37, i64 0, i64 0), i64 8)
%193 = icmp eq i32 %192, 0
%194 = zext i1 %193 to i32
br label %195
195: ; preds = %191, %186
%196 = phi i32 [ 0, %186 ], [ %194, %191 ]
%197 = call i32 @assert(i32 %196)
%198 = call i32 @charset_wctomb(%struct.charset* %5, i8* %4, i32 128)
%199 = icmp eq i32 %198, 2
br i1 %199, label %200, label %204
200: ; preds = %195
%201 = call i32 @bcmp(i8* dereferenceable(8) %4, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.38, i64 0, i64 0), i64 8)
%202 = icmp eq i32 %201, 0
%203 = zext i1 %202 to i32
br label %204
204: ; preds = %200, %195
%205 = phi i32 [ 0, %195 ], [ %203, %200 ]
%206 = call i32 @assert(i32 %205)
%207 = call i32 @charset_wctomb(%struct.charset* %5, i8* %4, i32 2047)
%208 = icmp eq i32 %207, 2
br i1 %208, label %209, label %213
209: ; preds = %204
%210 = call i32 @bcmp(i8* dereferenceable(8) %4, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.39, i64 0, i64 0), i64 8)
%211 = icmp eq i32 %210, 0
%212 = zext i1 %211 to i32
br label %213
213: ; preds = %209, %204
%214 = phi i32 [ 0, %204 ], [ %212, %209 ]
%215 = call i32 @assert(i32 %214)
%216 = call i32 @charset_wctomb(%struct.charset* %5, i8* %4, i32 2048)
%217 = icmp eq i32 %216, 3
br i1 %217, label %218, label %222
218: ; preds = %213
%219 = call i32 @bcmp(i8* dereferenceable(8) %4, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.40, i64 0, i64 0), i64 8)
%220 = icmp eq i32 %219, 0
%221 = zext i1 %220 to i32
br label %222
222: ; preds = %218, %213
%223 = phi i32 [ 0, %213 ], [ %221, %218 ]
%224 = call i32 @assert(i32 %223)
%225 = call i32 @charset_wctomb(%struct.charset* %5, i8* %4, i32 65535)
%226 = icmp eq i32 %225, 3
br i1 %226, label %227, label %231
227: ; preds = %222
%228 = call i32 @bcmp(i8* dereferenceable(8) %4, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.41, i64 0, i64 0), i64 8)
%229 = icmp eq i32 %228, 0
%230 = zext i1 %229 to i32
br label %231
231: ; preds = %227, %222
%232 = phi i32 [ 0, %222 ], [ %230, %227 ]
%233 = call i32 @assert(i32 %232)
%234 = call i32 @charset_wctomb(%struct.charset* %5, i8* %4, i32 65536)
%235 = icmp eq i32 %234, 4
br i1 %235, label %236, label %240
236: ; preds = %231
%237 = call i32 @bcmp(i8* dereferenceable(8) %4, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.42, i64 0, i64 0), i64 8)
%238 = icmp eq i32 %237, 0
%239 = zext i1 %238 to i32
br label %240
240: ; preds = %236, %231
%241 = phi i32 [ 0, %231 ], [ %239, %236 ]
%242 = call i32 @assert(i32 %241)
%243 = call i32 @charset_wctomb(%struct.charset* %5, i8* %4, i32 2097151)
%244 = icmp eq i32 %243, 4
br i1 %244, label %245, label %249
245: ; preds = %240
%246 = call i32 @bcmp(i8* dereferenceable(8) %4, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.43, i64 0, i64 0), i64 8)
%247 = icmp eq i32 %246, 0
%248 = zext i1 %247 to i32
br label %249
249: ; preds = %245, %240
%250 = phi i32 [ 0, %240 ], [ %248, %245 ]
%251 = call i32 @assert(i32 %250)
%252 = call i32 @charset_wctomb(%struct.charset* %5, i8* %4, i32 2097152)
%253 = icmp eq i32 %252, 5
br i1 %253, label %254, label %258
254: ; preds = %249
%255 = call i32 @bcmp(i8* dereferenceable(8) %4, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.44, i64 0, i64 0), i64 8)
%256 = icmp eq i32 %255, 0
%257 = zext i1 %256 to i32
br label %258
258: ; preds = %254, %249
%259 = phi i32 [ 0, %249 ], [ %257, %254 ]
%260 = call i32 @assert(i32 %259)
%261 = call i32 @charset_wctomb(%struct.charset* %5, i8* %4, i32 67108863)
%262 = icmp eq i32 %261, 5
br i1 %262, label %263, label %267
263: ; preds = %258
%264 = call i32 @bcmp(i8* dereferenceable(8) %4, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.45, i64 0, i64 0), i64 8)
%265 = icmp eq i32 %264, 0
%266 = zext i1 %265 to i32
br label %267
267: ; preds = %263, %258
%268 = phi i32 [ 0, %258 ], [ %266, %263 ]
%269 = call i32 @assert(i32 %268)
%270 = call i32 @charset_wctomb(%struct.charset* %5, i8* %4, i32 67108864)
%271 = icmp eq i32 %270, 6
br i1 %271, label %272, label %276
272: ; preds = %267
%273 = call i32 @bcmp(i8* dereferenceable(8) %4, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.46, i64 0, i64 0), i64 8)
%274 = icmp eq i32 %273, 0
%275 = zext i1 %274 to i32
br label %276
276: ; preds = %272, %267
%277 = phi i32 [ 0, %267 ], [ %275, %272 ]
%278 = call i32 @assert(i32 %277)
%279 = call i32 @charset_wctomb(%struct.charset* %5, i8* %4, i32 2147483647)
%280 = icmp eq i32 %279, 6
br i1 %280, label %281, label %285
281: ; preds = %276
%282 = call i32 @bcmp(i8* dereferenceable(8) %4, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.47, i64 0, i64 0), i64 8)
%283 = icmp eq i32 %282, 0
%284 = zext i1 %283 to i32
br label %285
285: ; preds = %281, %276
%286 = phi i32 [ 0, %276 ], [ %284, %281 ]
%287 = call i32 @assert(i32 %286)
ret void
}