#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ s;
typedef char mbstate_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ LC_CTYPE;
int MB_CUR_MAX;
int /*<<< orphan*/ MB_LEN_MAX;
int /*<<< orphan*/ assert(int);
int mbrlen(char *, int, char *);
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
scalar_t__ strcmp(int /*<<< orphan*/, char *);
int main(int argc, char *argv[]) {
  mbstate_t s;
  size_t len;
  char buf[MB_LEN_MAX + 1];
  printf("1..1\n");
  assert(MB_CUR_MAX == 1);
  memset(buf, 0xcc, sizeof(buf));
  buf[0] = 0;
  assert(mbrlen(buf, 1, NULL) == 0);
  memset(&s, 0, sizeof(s));
  assert(mbrlen(buf, 1, &s) == 0);
  assert(mbrlen(NULL, 0, NULL) == 0);
  buf[0] = 'A';
  assert(mbrlen(buf, 1, NULL) == 1);
  memset(&s, 0, sizeof(s));
  assert(mbrlen(buf, 1, &s) == 1);
  memset(&s, 0, sizeof(s));
  assert(mbrlen(buf, 0, &s) == (size_t)-2);
  assert(strcmp(setlocale(LC_CTYPE, "ja_JP.eucJP"), "ja_JP.eucJP") == 0);
  assert(MB_CUR_MAX > 1);
  assert(mbrlen(NULL, 0, NULL) == 0);
  memset(buf, 0xcc, sizeof(buf));
  buf[0] = 0;
  assert(mbrlen(buf, 1, NULL) == 0);
  memset(&s, 0, sizeof(s));
  assert(mbrlen(buf, 1, &s) == 0);
  assert(mbrlen(NULL, 0, NULL) == 0);
  buf[0] = 'A';
  assert(mbrlen(buf, 1, NULL) == 1);
  memset(&s, 0, sizeof(s));
  assert(mbrlen(buf, 1, &s) == 1);
  memset(&s, 0, sizeof(s));
  assert(mbrlen(buf, 0, &s) == (size_t)-2);
  memset(buf, 0xcc, sizeof(buf));
  buf[0] = 0xa3;
  buf[1] = 0x00;
  memset(&s, 0, sizeof(s));
  assert(mbrlen(buf, 1, &s) == (size_t)-2);
  buf[1] = 0xc1;
  memset(&s, 0, sizeof(s));
  assert(mbrlen(buf, 2, &s) == 2);
  printf("ok 1 - mbrlen()\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e53(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rax,-0x40(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e3c(%rip),%rax
cmpl   $0x1,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rax
mov    %eax,%edx
mov    $0xcc,%esi
call   1040 <memset@plt>
mov    -0x38(%rbp),%rdi
movb   $0x0,(%rdi)
mov    $0x1,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1070 <mbrlen@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x11(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    -0x38(%rbp),%rdi
mov    $0x1,%esi
lea    -0x11(%rbp),%rdx
call   1070 <mbrlen@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
xor    %eax,%eax
mov    %eax,%edx
xor    %esi,%esi
mov    %rdx,%rdi
call   1070 <mbrlen@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x38(%rbp),%rdi
movb   $0x41,(%rdi)
mov    $0x1,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1070 <mbrlen@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x11(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    -0x38(%rbp),%rdi
mov    $0x1,%esi
lea    -0x11(%rbp),%rdx
call   1070 <mbrlen@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x11(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    -0x38(%rbp),%rdi
xor    %esi,%esi
lea    -0x11(%rbp),%rdx
call   1070 <mbrlen@plt>
cltq
cmp    $0xfffffffffffffffe,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    0x2cfb(%rip),%rax
mov    (%rax),%edi
lea    0xd18(%rip),%rsi
call   1080 <setlocale@plt>
mov    %eax,%edi
lea    0xd0a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    0x2cdf(%rip),%rax
cmpl   $0x1,(%rax)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
xor    %eax,%eax
mov    %eax,%edx
xor    %esi,%esi
mov    %rdx,%rdi
call   1070 <mbrlen@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rax
mov    %eax,%edx
mov    $0xcc,%esi
call   1040 <memset@plt>
mov    -0x38(%rbp),%rdi
movb   $0x0,(%rdi)
mov    $0x1,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1070 <mbrlen@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x11(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    -0x38(%rbp),%rdi
mov    $0x1,%esi
lea    -0x11(%rbp),%rdx
call   1070 <mbrlen@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
xor    %eax,%eax
mov    %eax,%edx
xor    %esi,%esi
mov    %rdx,%rdi
call   1070 <mbrlen@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x38(%rbp),%rdi
movb   $0x41,(%rdi)
mov    $0x1,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1070 <mbrlen@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x11(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    -0x38(%rbp),%rdi
mov    $0x1,%esi
lea    -0x11(%rbp),%rdx
call   1070 <mbrlen@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x11(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    -0x38(%rbp),%rdi
xor    %esi,%esi
lea    -0x11(%rbp),%rdx
call   1070 <mbrlen@plt>
cltq
cmp    $0xfffffffffffffffe,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rax
mov    %eax,%edx
mov    $0xcc,%esi
call   1040 <memset@plt>
mov    -0x38(%rbp),%rax
movb   $0xa3,(%rax)
movb   $0x0,0x1(%rax)
lea    -0x11(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    -0x38(%rbp),%rdi
mov    $0x1,%esi
lea    -0x11(%rbp),%rdx
call   1070 <mbrlen@plt>
cltq
cmp    $0xfffffffffffffffe,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x38(%rbp),%rax
movb   $0xc1,0x1(%rax)
lea    -0x11(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    -0x38(%rbp),%rdi
mov    $0x2,%esi
lea    -0x11(%rbp),%rdx
call   1070 <mbrlen@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xb24(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsp,-0x40(%rbp)
mov    0x2e54(%rip),%rax
mov    (%rax),%r14d
add    $0x1,%r14d
mov    %rsp,%rbx
mov    %rbx,-0x38(%rbp)
lea    0xf(%r14),%r13
and    $0xfffffffffffffff0,%r13
sub    %r13,%rbx
mov    %rbx,%rsp
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e4d(%rip),%rax
xor    %edi,%edi
cmpl   $0x1,(%rax)
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
mov    $0xcc,%esi
mov    %r14d,%edx
call   1040 <memset@plt>
movb   $0x0,(%rbx)
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1070 <mbrlen@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
lea    -0x29(%rbp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r15,%rdx
call   1070 <mbrlen@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <mbrlen@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
movb   $0x41,(%rbx)
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1070 <mbrlen@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1060 <assert@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r15,%rdx
call   1070 <mbrlen@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1060 <assert@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1070 <mbrlen@plt>
xor    %edi,%edi
cmp    $0xfffffffe,%eax
sete   %dil
call   1060 <assert@plt>
mov    0x2d32(%rip),%rax
mov    (%rax),%edi
lea    0xd49(%rip),%r12
mov    %r12,%rsi
call   1080 <setlocale@plt>
mov    %eax,%edi
mov    %r12,%rsi
call   1050 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
mov    0x2d18(%rip),%rax
cmpl   $0x2,(%rax)
setge  %dil
call   1060 <assert@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <mbrlen@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
mov    $0xcc,%esi
mov    %r14d,%edx
call   1040 <memset@plt>
movb   $0x0,(%rbx)
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1070 <mbrlen@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r15,%rdx
call   1070 <mbrlen@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <mbrlen@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
movb   $0x41,(%rbx)
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
call   1070 <mbrlen@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1060 <assert@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r15,%rdx
call   1070 <mbrlen@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1060 <assert@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1070 <mbrlen@plt>
xor    %edi,%edi
cmp    $0xfffffffe,%eax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
mov    $0xcc,%esi
mov    %r14d,%edx
call   1040 <memset@plt>
movw   $0xa3,(%rbx)
neg    %r13
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r15,%rdx
call   1070 <mbrlen@plt>
xor    %edi,%edi
cmp    $0xfffffffe,%eax
sete   %dil
call   1060 <assert@plt>
mov    -0x38(%rbp),%rax
movb   $0xc1,0x1(%rax,%r13,1)
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r15,%rdx
call   1070 <mbrlen@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1060 <assert@plt>
lea    0xba0(%rip),%rdi
call   1030 <puts@plt>
mov    -0x40(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@MB_LEN_MAX = global i32 0
@.str = [6 x i8] c"1..1\0A\00"
@MB_CUR_MAX = global i32 0
@LC_CTYPE = global i32 0
@.str.1 = [12 x i8] c"ja_JP.eucJP\00"
@.str.2 = [17 x i8] c"ok 1 - mbrlen()\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* @MB_LEN_MAX
%11 = add nsw i32 %10, 1
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %8
%14 = alloca i8, i64 %12
store i64 %12, i64* %9
%15 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%16 = load i32, i32* @MB_CUR_MAX
%17 = icmp eq i32 %16, 1
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = trunc i64 %12 to i32
%21 = call i32 @memset(i8* %14, i32 204, i32 %20)
%22 = getelementptr inbounds i8, i8* %14, i64 0
store i8 0, i8* %22
%23 = call i32 @mbrlen(i8* %14, i32 1, i8* null)
%24 = icmp eq i32 %23, 0
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = call i32 @memset(i8* %6, i32 0, i32 1)
%28 = call i32 @mbrlen(i8* %14, i32 1, i8* %6)
%29 = icmp eq i32 %28, 0
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = call i32 @mbrlen(i8* null, i32 0, i8* null)
%33 = icmp eq i32 %32, 0
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = getelementptr inbounds i8, i8* %14, i64 0
store i8 65, i8* %36
%37 = call i32 @mbrlen(i8* %14, i32 1, i8* null)
%38 = icmp eq i32 %37, 1
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = call i32 @memset(i8* %6, i32 0, i32 1)
%42 = call i32 @mbrlen(i8* %14, i32 1, i8* %6)
%43 = icmp eq i32 %42, 1
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
%46 = call i32 @memset(i8* %6, i32 0, i32 1)
%47 = call i32 @mbrlen(i8* %14, i32 0, i8* %6)
%48 = sext i32 %47 to i64
%49 = icmp eq i64 %48, -2
%50 = zext i1 %49 to i32
%51 = call i32 @assert(i32 %50)
%52 = load i32, i32* @LC_CTYPE
%53 = call i32 @setlocale(i32 %52, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%54 = call i64 @strcmp(i32 %53, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
%56 = zext i1 %55 to i32
%57 = call i32 @assert(i32 %56)
%58 = load i32, i32* @MB_CUR_MAX
%59 = icmp sgt i32 %58, 1
%60 = zext i1 %59 to i32
%61 = call i32 @assert(i32 %60)
%62 = call i32 @mbrlen(i8* null, i32 0, i8* null)
%63 = icmp eq i32 %62, 0
%64 = zext i1 %63 to i32
%65 = call i32 @assert(i32 %64)
%66 = trunc i64 %12 to i32
%67 = call i32 @memset(i8* %14, i32 204, i32 %66)
%68 = getelementptr inbounds i8, i8* %14, i64 0
store i8 0, i8* %68
%69 = call i32 @mbrlen(i8* %14, i32 1, i8* null)
%70 = icmp eq i32 %69, 0
%71 = zext i1 %70 to i32
%72 = call i32 @assert(i32 %71)
%73 = call i32 @memset(i8* %6, i32 0, i32 1)
%74 = call i32 @mbrlen(i8* %14, i32 1, i8* %6)
%75 = icmp eq i32 %74, 0
%76 = zext i1 %75 to i32
%77 = call i32 @assert(i32 %76)
%78 = call i32 @mbrlen(i8* null, i32 0, i8* null)
%79 = icmp eq i32 %78, 0
%80 = zext i1 %79 to i32
%81 = call i32 @assert(i32 %80)
%82 = getelementptr inbounds i8, i8* %14, i64 0
store i8 65, i8* %82
%83 = call i32 @mbrlen(i8* %14, i32 1, i8* null)
%84 = icmp eq i32 %83, 1
%85 = zext i1 %84 to i32
%86 = call i32 @assert(i32 %85)
%87 = call i32 @memset(i8* %6, i32 0, i32 1)
%88 = call i32 @mbrlen(i8* %14, i32 1, i8* %6)
%89 = icmp eq i32 %88, 1
%90 = zext i1 %89 to i32
%91 = call i32 @assert(i32 %90)
%92 = call i32 @memset(i8* %6, i32 0, i32 1)
%93 = call i32 @mbrlen(i8* %14, i32 0, i8* %6)
%94 = sext i32 %93 to i64
%95 = icmp eq i64 %94, -2
%96 = zext i1 %95 to i32
%97 = call i32 @assert(i32 %96)
%98 = trunc i64 %12 to i32
%99 = call i32 @memset(i8* %14, i32 204, i32 %98)
%100 = getelementptr inbounds i8, i8* %14, i64 0
store i8 -93, i8* %100
%101 = getelementptr inbounds i8, i8* %14, i64 1
store i8 0, i8* %101
%102 = call i32 @memset(i8* %6, i32 0, i32 1)
%103 = call i32 @mbrlen(i8* %14, i32 1, i8* %6)
%104 = sext i32 %103 to i64
%105 = icmp eq i64 %104, -2
%106 = zext i1 %105 to i32
%107 = call i32 @assert(i32 %106)
%108 = getelementptr inbounds i8, i8* %14, i64 1
store i8 -63, i8* %108
%109 = call i32 @memset(i8* %6, i32 0, i32 1)
%110 = call i32 @mbrlen(i8* %14, i32 2, i8* %6)
%111 = icmp eq i32 %110, 2
%112 = zext i1 %111 to i32
%113 = call i32 @assert(i32 %112)
%114 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
%115 = load i8*, i8** %8
%116 = load i32, i32* %3
ret i32 %116
}

LLVM IR (-O2):
@MB_LEN_MAX = global i32 0
@MB_CUR_MAX = global i32 0
@LC_CTYPE = global i32 0
@.str.1 = [12 x i8] c"ja_JP.eucJP\00"
@str = [5 x i8] c"1..1\00"
@str.3 = [16 x i8] c"ok 1 - mbrlen()\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
%4 = load i32, i32* @MB_LEN_MAX
%5 = add nsw i32 %4, 1
%6 = zext i32 %5 to i64
%7 = tail call i8* @llvm.stacksave()
%8 = alloca i8, i64 %6
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%10 = load i32, i32* @MB_CUR_MAX
%11 = icmp eq i32 %10, 1
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = call i32 @memset(i8* %8, i32 204, i32 %5)
store i8 0, i8* %8
%15 = call i32 @mbrlen(i8* %8, i32 1, i8* null)
%16 = icmp eq i32 %15, 0
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = call i32 @memset(i8* %3, i32 0, i32 1)
%20 = call i32 @mbrlen(i8* %8, i32 1, i8* %3)
%21 = icmp eq i32 %20, 0
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = call i32 @mbrlen(i8* null, i32 0, i8* null)
%25 = icmp eq i32 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
store i8 65, i8* %8
%28 = call i32 @mbrlen(i8* %8, i32 1, i8* null)
%29 = icmp eq i32 %28, 1
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = call i32 @memset(i8* %3, i32 0, i32 1)
%33 = call i32 @mbrlen(i8* %8, i32 1, i8* %3)
%34 = icmp eq i32 %33, 1
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
%37 = call i32 @memset(i8* %3, i32 0, i32 1)
%38 = call i32 @mbrlen(i8* %8, i32 0, i8* %3)
%39 = icmp eq i32 %38, -2
%40 = zext i1 %39 to i32
%41 = call i32 @assert(i32 %40)
%42 = load i32, i32* @LC_CTYPE
%43 = call i32 @setlocale(i32 %42, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%44 = call i64 @strcmp(i32 %43, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
%46 = zext i1 %45 to i32
%47 = call i32 @assert(i32 %46)
%48 = load i32, i32* @MB_CUR_MAX
%49 = icmp sgt i32 %48, 1
%50 = zext i1 %49 to i32
%51 = call i32 @assert(i32 %50)
%52 = call i32 @mbrlen(i8* null, i32 0, i8* null)
%53 = icmp eq i32 %52, 0
%54 = zext i1 %53 to i32
%55 = call i32 @assert(i32 %54)
%56 = call i32 @memset(i8* %8, i32 204, i32 %5)
store i8 0, i8* %8
%57 = call i32 @mbrlen(i8* %8, i32 1, i8* null)
%58 = icmp eq i32 %57, 0
%59 = zext i1 %58 to i32
%60 = call i32 @assert(i32 %59)
%61 = call i32 @memset(i8* %3, i32 0, i32 1)
%62 = call i32 @mbrlen(i8* %8, i32 1, i8* %3)
%63 = icmp eq i32 %62, 0
%64 = zext i1 %63 to i32
%65 = call i32 @assert(i32 %64)
%66 = call i32 @mbrlen(i8* null, i32 0, i8* null)
%67 = icmp eq i32 %66, 0
%68 = zext i1 %67 to i32
%69 = call i32 @assert(i32 %68)
store i8 65, i8* %8
%70 = call i32 @mbrlen(i8* %8, i32 1, i8* null)
%71 = icmp eq i32 %70, 1
%72 = zext i1 %71 to i32
%73 = call i32 @assert(i32 %72)
%74 = call i32 @memset(i8* %3, i32 0, i32 1)
%75 = call i32 @mbrlen(i8* %8, i32 1, i8* %3)
%76 = icmp eq i32 %75, 1
%77 = zext i1 %76 to i32
%78 = call i32 @assert(i32 %77)
%79 = call i32 @memset(i8* %3, i32 0, i32 1)
%80 = call i32 @mbrlen(i8* %8, i32 0, i8* %3)
%81 = icmp eq i32 %80, -2
%82 = zext i1 %81 to i32
%83 = call i32 @assert(i32 %82)
%84 = call i32 @memset(i8* %8, i32 204, i32 %5)
store i8 -93, i8* %8
%85 = getelementptr inbounds i8, i8* %8, i64 1
store i8 0, i8* %85
%86 = call i32 @memset(i8* %3, i32 0, i32 1)
%87 = call i32 @mbrlen(i8* %8, i32 1, i8* %3)
%88 = icmp eq i32 %87, -2
%89 = zext i1 %88 to i32
%90 = call i32 @assert(i32 %89)
store i8 -63, i8* %85
%91 = call i32 @memset(i8* %3, i32 0, i32 1)
%92 = call i32 @mbrlen(i8* %8, i32 2, i8* %3)
%93 = icmp eq i32 %92, 2
%94 = zext i1 %93 to i32
%95 = call i32 @assert(i32 %94)
%96 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.3, i64 0, i64 0))
ret i32 0
}