#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 wchar_t;
typedef int /*<<< orphan*/ srcbuf;
typedef int /*<<< orphan*/ dstbuf;

/* Variables and functions */
int /*<<< orphan*/ LC_CTYPE;
int MB_CUR_MAX;
int /*<<< orphan*/ assert(int);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ printf(char *);
char *setlocale(int /*<<< orphan*/, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ wcscpy(int *, char *);
int wcstombs(char *, int *, int);
int /*<<< orphan*/ wmemset(int *, int, int);
int main(int argc, char *argv[]) {
  wchar_t srcbuf[128];
  char dstbuf[128];
  printf("1..1\n");
  wmemset(srcbuf, 0xcc, sizeof(srcbuf) / sizeof(*srcbuf));
  wcscpy(srcbuf, L"hello");
  memset(dstbuf, 0xcc, sizeof(dstbuf));
  assert(wcstombs(dstbuf, srcbuf, sizeof(dstbuf)) == 5);
  assert(strcmp(dstbuf, "hello") == 0);
  assert((unsigned char)dstbuf[6] == 0xcc);
  wmemset(srcbuf, 0xcc, sizeof(srcbuf) / sizeof(*srcbuf));
  wcscpy(srcbuf, L"hello");
  memset(dstbuf, 0xcc, sizeof(dstbuf));
  assert(wcstombs(dstbuf, srcbuf, 4) == 4);
  assert(memcmp(dstbuf, "hell", 4) == 0);
  assert((unsigned char)dstbuf[5] == 0xcc);
  wmemset(srcbuf, 0xcc, sizeof(srcbuf) / sizeof(*srcbuf));
  wcscpy(srcbuf, L"hello");
  assert(wcstombs(NULL, srcbuf, sizeof(dstbuf)) == 5);
  wmemset(srcbuf, 0xcc, sizeof(srcbuf) / sizeof(*srcbuf));
  wcscpy(srcbuf, L"hello");
  memset(dstbuf, 0xcc, sizeof(dstbuf));
  assert(wcstombs(dstbuf, srcbuf, sizeof(dstbuf)) == 5);
  assert(strcmp(dstbuf, "hello") == 0);
  assert((unsigned char)dstbuf[6] == 0xcc);
  wmemset(srcbuf, 0xcc, sizeof(srcbuf) / sizeof(*srcbuf));
  wcscpy(srcbuf, L"hello");
  assert(wcstombs(NULL, srcbuf, 0) == 5);
  wmemset(srcbuf, 0xcc, sizeof(srcbuf) / sizeof(*srcbuf));
  srcbuf[0] = L'\0';
  memset(dstbuf, 0xcc, sizeof(dstbuf));
  assert(wcstombs(dstbuf, srcbuf, sizeof(dstbuf)) == 0);
  assert(dstbuf[0] == L'\0');
  wmemset(srcbuf, 0xcc, sizeof(srcbuf) / sizeof(*srcbuf));
  wcscpy(srcbuf, L"hello");
  memset(dstbuf, 0xcc, sizeof(dstbuf));
  assert(wcstombs(dstbuf, srcbuf, 0) == 0);
  assert((unsigned char)dstbuf[0] == 0xcc);
  assert(strcmp(setlocale(LC_CTYPE, "ja_JP.eucJP"), "ja_JP.eucJP") == 0);
  assert(MB_CUR_MAX > 1);
  wmemset(srcbuf, 0xcc, sizeof(srcbuf) / sizeof(*srcbuf));
  srcbuf[0] = 0xA3C1;
  srcbuf[1] = 0x0020;
  srcbuf[2] = 0x0042;
  srcbuf[3] = 0x0020;
  srcbuf[4] = 0xA3C3;
  srcbuf[5] = 0x0000;
  memset(dstbuf, 0xcc, sizeof(dstbuf));
  assert(wcstombs(dstbuf, srcbuf, sizeof(dstbuf)) == 7);
  assert(strcmp(dstbuf, "\xA3\xC1 B \xA3\xC3") == 0);
  assert((unsigned char)dstbuf[8] == 0xcc);
  printf("ok 1 - wcstombs()\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x290,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe50(%rip),%rdi
call   1030 <printf@plt>
lea    -0x210(%rbp),%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1050 <wmemset@plt>
lea    -0x210(%rbp),%rdi
lea    0xe5f(%rip),%rsi
call   1080 <wcscpy@plt>
lea    -0x290(%rbp),%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    -0x290(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    $0x80,%edx
call   10b0 <wcstombs@plt>
cmp    $0x5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
lea    -0x290(%rbp),%rdi
lea    0xddc(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
movzbl -0x28a(%rbp),%eax
cmp    $0xcc,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
lea    -0x210(%rbp),%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1050 <wmemset@plt>
lea    -0x210(%rbp),%rdi
lea    0xdbb(%rip),%rsi
call   1080 <wcscpy@plt>
lea    -0x290(%rbp),%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    -0x290(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    $0x4,%edx
call   10b0 <wcstombs@plt>
cmp    $0x4,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
lea    -0x290(%rbp),%rdi
lea    0xd3e(%rip),%rsi
mov    $0x4,%edx
call   1060 <memcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
movzbl -0x28b(%rbp),%eax
cmp    $0xcc,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
lea    -0x210(%rbp),%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1050 <wmemset@plt>
lea    -0x210(%rbp),%rdi
lea    0xd12(%rip),%rsi
call   1080 <wcscpy@plt>
lea    -0x210(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
mov    $0x80,%edx
call   10b0 <wcstombs@plt>
cmp    $0x5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
lea    -0x210(%rbp),%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1050 <wmemset@plt>
lea    -0x210(%rbp),%rdi
lea    0xcc4(%rip),%rsi
call   1080 <wcscpy@plt>
lea    -0x290(%rbp),%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    -0x290(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    $0x80,%edx
call   10b0 <wcstombs@plt>
cmp    $0x5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
lea    -0x290(%rbp),%rdi
lea    0xc41(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
movzbl -0x28a(%rbp),%eax
cmp    $0xcc,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
lea    -0x210(%rbp),%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1050 <wmemset@plt>
lea    -0x210(%rbp),%rdi
lea    0xc20(%rip),%rsi
call   1080 <wcscpy@plt>
lea    -0x210(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
xor    %edx,%edx
call   10b0 <wcstombs@plt>
cmp    $0x5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
lea    -0x210(%rbp),%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1050 <wmemset@plt>
movl   $0x0,-0x210(%rbp)
lea    -0x290(%rbp),%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    -0x290(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    $0x80,%edx
call   10b0 <wcstombs@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
movsbl -0x290(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
lea    -0x210(%rbp),%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1050 <wmemset@plt>
lea    -0x210(%rbp),%rdi
lea    0xb60(%rip),%rsi
call   1080 <wcscpy@plt>
lea    -0x290(%rbp),%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    -0x290(%rbp),%rdi
lea    -0x210(%rbp),%rsi
xor    %edx,%edx
call   10b0 <wcstombs@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
movzbl -0x290(%rbp),%eax
cmp    $0xcc,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    0x2aa8(%rip),%rax
mov    (%rax),%edi
lea    0xad0(%rip),%rsi
call   10a0 <setlocale@plt>
mov    %rax,%rdi
lea    0xac1(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    0x2a8b(%rip),%rax
cmpl   $0x1,(%rax)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
lea    -0x210(%rbp),%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1050 <wmemset@plt>
movl   $0xa3c1,-0x210(%rbp)
movl   $0x20,-0x20c(%rbp)
movl   $0x42,-0x208(%rbp)
movl   $0x20,-0x204(%rbp)
movl   $0xa3c3,-0x200(%rbp)
movl   $0x0,-0x1fc(%rbp)
lea    -0x290(%rbp),%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    -0x290(%rbp),%rdi
lea    -0x210(%rbp),%rsi
mov    $0x80,%edx
call   10b0 <wcstombs@plt>
cmp    $0x7,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
lea    -0x290(%rbp),%rdi
lea    0xa02(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
movzbl -0x288(%rbp),%eax
cmp    $0xcc,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
lea    0x9d4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x290,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x280,%rsp
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
lea    0x80(%rsp),%r13
mov    %r13,%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1050 <wmemset@plt>
lea    0xe43(%rip),%r15
mov    %r13,%rdi
mov    %r15,%rsi
call   1080 <wcscpy@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
mov    %r14,%rdi
mov    %r13,%rsi
mov    $0x80,%edx
call   10b0 <wcstombs@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1090 <assert@plt>
lea    0xe16(%rip),%r12
mov    %r14,%rdi
mov    %r12,%rsi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1090 <assert@plt>
xor    %edi,%edi
cmpb   $0xcc,0x6(%rsp)
sete   %dil
call   1090 <assert@plt>
mov    %r13,%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1050 <wmemset@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1080 <wcscpy@plt>
mov    %r14,%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
mov    %r14,%rdi
mov    %r13,%rsi
mov    $0x4,%edx
call   10b0 <wcstombs@plt>
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
call   1090 <assert@plt>
lea    0xd9f(%rip),%rsi
mov    %r14,%rdi
mov    $0x4,%edx
call   1060 <memcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1090 <assert@plt>
xor    %edi,%edi
cmpb   $0xcc,0x5(%rsp)
sete   %dil
call   1090 <assert@plt>
mov    %r13,%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1050 <wmemset@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1080 <wcscpy@plt>
xor    %edi,%edi
mov    %r13,%rsi
mov    $0x80,%edx
call   10b0 <wcstombs@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1090 <assert@plt>
mov    %r13,%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1050 <wmemset@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1080 <wcscpy@plt>
mov    %r14,%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
mov    %r14,%rdi
mov    %r13,%rsi
mov    $0x80,%edx
call   10b0 <wcstombs@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1090 <assert@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1090 <assert@plt>
xor    %edi,%edi
cmpb   $0xcc,0x6(%rsp)
sete   %dil
call   1090 <assert@plt>
mov    %r13,%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1050 <wmemset@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1080 <wcscpy@plt>
xor    %edi,%edi
mov    %r13,%rsi
xor    %edx,%edx
call   10b0 <wcstombs@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1090 <assert@plt>
mov    %r13,%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1050 <wmemset@plt>
movl   $0x0,0x80(%rsp)
mov    %r14,%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
mov    %r14,%rdi
mov    %r13,%rsi
mov    $0x80,%edx
call   10b0 <wcstombs@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1090 <assert@plt>
xor    %edi,%edi
cmpb   $0x0,(%rsp)
sete   %dil
call   1090 <assert@plt>
mov    %r13,%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1050 <wmemset@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1080 <wcscpy@plt>
mov    %r14,%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
mov    %r14,%rdi
mov    %r13,%rsi
xor    %edx,%edx
call   10b0 <wcstombs@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1090 <assert@plt>
xor    %edi,%edi
cmpb   $0xcc,(%rsp)
sete   %dil
call   1090 <assert@plt>
mov    0x2b85(%rip),%rax
mov    (%rax),%edi
lea    0xbcf(%rip),%rbx
mov    %rbx,%rsi
call   10a0 <setlocale@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1090 <assert@plt>
mov    0x2b6c(%rip),%rax
xor    %edi,%edi
cmpl   $0x2,(%rax)
setge  %dil
call   1090 <assert@plt>
mov    %r13,%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1050 <wmemset@plt>
movaps 0xb4d(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movq   $0xa3c3,0x90(%rsp)
mov    %r14,%rdi
mov    $0xcc,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
mov    %r14,%rdi
mov    %r13,%rsi
mov    $0x80,%edx
call   10b0 <wcstombs@plt>
xor    %edi,%edi
cmp    $0x7,%eax
sete   %dil
call   1090 <assert@plt>
lea    0xb41(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1090 <assert@plt>
xor    %edi,%edi
cmpb   $0xcc,0x8(%rsp)
sete   %dil
call   1090 <assert@plt>
lea    0xb21(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x280,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"1..1\0A\00"
@.str.1 = [6 x i32] [i32 104, i32 101, i32 108, i32 108, i32 111, i32 0]
@.str.2 = [6 x i8] c"hello\00"
@.str.3 = [5 x i8] c"hell\00"
@LC_CTYPE = global i32 0
@.str.4 = [12 x i8] c"ja_JP.eucJP\00"
@MB_CUR_MAX = global i32 0
@.str.5 = [8 x i8] c"\A3\C1 B \A3\C3\00"
@.str.6 = [19 x i8] c"ok 1 - wcstombs()\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [128 x i32]
%7 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%10 = call i32 @wmemset(i32* %9, i32 204, i32 128)
%11 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%12 = call i32 @wcscpy(i32* %11, i8* bitcast ([6 x i32]* @.str.1 to i8*))
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%14 = call i32 @memset(i8* %13, i32 204, i32 128)
%15 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%16 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%17 = call i32 @wcstombs(i8* %15, i32* %16, i32 128)
%18 = icmp eq i32 %17, 5
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 6
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = icmp eq i32 %28, 204
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%33 = call i32 @wmemset(i32* %32, i32 204, i32 128)
%34 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%35 = call i32 @wcscpy(i32* %34, i8* bitcast ([6 x i32]* @.str.1 to i8*))
%36 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%37 = call i32 @memset(i8* %36, i32 204, i32 128)
%38 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%39 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%40 = call i32 @wcstombs(i8* %38, i32* %39, i32 4)
%41 = icmp eq i32 %40, 4
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
%44 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%45 = call i64 @memcmp(i8* %44, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
%46 = icmp eq i64 %45, 0
%47 = zext i1 %46 to i32
%48 = call i32 @assert(i32 %47)
%49 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 5
%50 = load i8, i8* %49
%51 = zext i8 %50 to i32
%52 = icmp eq i32 %51, 204
%53 = zext i1 %52 to i32
%54 = call i32 @assert(i32 %53)
%55 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%56 = call i32 @wmemset(i32* %55, i32 204, i32 128)
%57 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%58 = call i32 @wcscpy(i32* %57, i8* bitcast ([6 x i32]* @.str.1 to i8*))
%59 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%60 = call i32 @wcstombs(i8* null, i32* %59, i32 128)
%61 = icmp eq i32 %60, 5
%62 = zext i1 %61 to i32
%63 = call i32 @assert(i32 %62)
%64 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%65 = call i32 @wmemset(i32* %64, i32 204, i32 128)
%66 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%67 = call i32 @wcscpy(i32* %66, i8* bitcast ([6 x i32]* @.str.1 to i8*))
%68 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%69 = call i32 @memset(i8* %68, i32 204, i32 128)
%70 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%71 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%72 = call i32 @wcstombs(i8* %70, i32* %71, i32 128)
%73 = icmp eq i32 %72, 5
%74 = zext i1 %73 to i32
%75 = call i32 @assert(i32 %74)
%76 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%77 = call i64 @strcmp(i8* %76, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%78 = icmp eq i64 %77, 0
%79 = zext i1 %78 to i32
%80 = call i32 @assert(i32 %79)
%81 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 6
%82 = load i8, i8* %81
%83 = zext i8 %82 to i32
%84 = icmp eq i32 %83, 204
%85 = zext i1 %84 to i32
%86 = call i32 @assert(i32 %85)
%87 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%88 = call i32 @wmemset(i32* %87, i32 204, i32 128)
%89 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%90 = call i32 @wcscpy(i32* %89, i8* bitcast ([6 x i32]* @.str.1 to i8*))
%91 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%92 = call i32 @wcstombs(i8* null, i32* %91, i32 0)
%93 = icmp eq i32 %92, 5
%94 = zext i1 %93 to i32
%95 = call i32 @assert(i32 %94)
%96 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%97 = call i32 @wmemset(i32* %96, i32 204, i32 128)
%98 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
store i32 0, i32* %98
%99 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%100 = call i32 @memset(i8* %99, i32 204, i32 128)
%101 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%102 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%103 = call i32 @wcstombs(i8* %101, i32* %102, i32 128)
%104 = icmp eq i32 %103, 0
%105 = zext i1 %104 to i32
%106 = call i32 @assert(i32 %105)
%107 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%108 = load i8, i8* %107
%109 = sext i8 %108 to i32
%110 = icmp eq i32 %109, 0
%111 = zext i1 %110 to i32
%112 = call i32 @assert(i32 %111)
%113 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%114 = call i32 @wmemset(i32* %113, i32 204, i32 128)
%115 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%116 = call i32 @wcscpy(i32* %115, i8* bitcast ([6 x i32]* @.str.1 to i8*))
%117 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%118 = call i32 @memset(i8* %117, i32 204, i32 128)
%119 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%120 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%121 = call i32 @wcstombs(i8* %119, i32* %120, i32 0)
%122 = icmp eq i32 %121, 0
%123 = zext i1 %122 to i32
%124 = call i32 @assert(i32 %123)
%125 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%126 = load i8, i8* %125
%127 = zext i8 %126 to i32
%128 = icmp eq i32 %127, 204
%129 = zext i1 %128 to i32
%130 = call i32 @assert(i32 %129)
%131 = load i32, i32* @LC_CTYPE
%132 = call i8* @setlocale(i32 %131, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%133 = call i64 @strcmp(i8* %132, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%134 = icmp eq i64 %133, 0
%135 = zext i1 %134 to i32
%136 = call i32 @assert(i32 %135)
%137 = load i32, i32* @MB_CUR_MAX
%138 = icmp sgt i32 %137, 1
%139 = zext i1 %138 to i32
%140 = call i32 @assert(i32 %139)
%141 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%142 = call i32 @wmemset(i32* %141, i32 204, i32 128)
%143 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
store i32 41921, i32* %143
%144 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 1
store i32 32, i32* %144
%145 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 2
store i32 66, i32* %145
%146 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 3
store i32 32, i32* %146
%147 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 4
store i32 41923, i32* %147
%148 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 5
store i32 0, i32* %148
%149 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%150 = call i32 @memset(i8* %149, i32 204, i32 128)
%151 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%152 = getelementptr inbounds [128 x i32], [128 x i32]* %6, i64 0, i64 0
%153 = call i32 @wcstombs(i8* %151, i32* %152, i32 128)
%154 = icmp eq i32 %153, 7
%155 = zext i1 %154 to i32
%156 = call i32 @assert(i32 %155)
%157 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%158 = call i64 @strcmp(i8* %157, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%159 = icmp eq i64 %158, 0
%160 = zext i1 %159 to i32
%161 = call i32 @assert(i32 %160)
%162 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 8
%163 = load i8, i8* %162
%164 = zext i8 %163 to i32
%165 = icmp eq i32 %164, 204
%166 = zext i1 %165 to i32
%167 = call i32 @assert(i32 %166)
%168 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

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