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

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ assert(int);
size_t strlen(char *);
unsigned char *strToUnicode(char *p) {
  static unsigned char buf[1024];
  size_t l = strlen(p);
  int i = 0;
  assert(l * 2 < sizeof buf);
  while (l--) {
    buf[i++] = *p++;
    buf[i++] = 0;
  }
  return buf;
}


x86 assembly (clang, -O0):
<strToUnicode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x1,%rax
cmp    $0x400,%rax
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
je     11bb <strToUnicode+0x9b>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%dl
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %eax,%rcx
lea    0x2ea6(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %eax,%rcx
lea    0x2e8e(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
jmp    115b <strToUnicode+0x3b>
lea    0x2e7e(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strToUnicode>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,%r14
movabs $0x7ffffffffffffe00,%rax
ff ff 7f
xor    %edi,%edi
test   %rax,%r14
sete   %dil
call   1040 <assert@plt>
test   %r14,%r14
je     12c4 <strToUnicode+0x1a4>
cmp    $0x10,%r14
jb     116f <strToUnicode+0x4f>
lea    0x2ee3(%rip),%rcx
lea    (%rbx,%r14,1),%rax
cmp    %rcx,%rax
jbe    118d <strToUnicode+0x6d>
lea    (%rcx,%r14,2),%rax
cmp    %rbx,%rax
jbe    118d <strToUnicode+0x6d>
xor    %esi,%esi
test   $0x1,%r14b
jne    1253 <strToUnicode+0x133>
mov    %r14,%r8
cmp    $0x1,%r14
jne    127c <strToUnicode+0x15c>
jmp    12c4 <strToUnicode+0x1a4>
mov    %r14,%rsi
and    $0xfffffffffffffff0,%rsi
lea    -0x10(%rsi),%rdx
mov    %rdx,%rax
shr    $0x4,%rax
add    $0x1,%rax
test   %rdx,%rdx
je     12d3 <strToUnicode+0x1b3>
mov    %rax,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
pxor   %xmm0,%xmm0
nopl   0x0(%rax)
movq   (%rbx,%rdx,1),%xmm1
movq   0x8(%rbx,%rdx,1),%xmm2
punpcklbw %xmm0,%xmm1
movdqa %xmm1,(%rcx,%rdx,2)
punpcklbw %xmm0,%xmm2
movdqa %xmm2,0x10(%rcx,%rdx,2)
movq   0x10(%rbx,%rdx,1),%xmm1
movq   0x18(%rbx,%rdx,1),%xmm2
punpcklbw %xmm0,%xmm1
movdqa %xmm1,0x20(%rcx,%rdx,2)
punpcklbw %xmm0,%xmm2
movdqa %xmm2,0x30(%rcx,%rdx,2)
add    $0x20,%rdx
add    $0xfffffffffffffffe,%rdi
jne    11c0 <strToUnicode+0xa0>
test   $0x1,%al
je     1236 <strToUnicode+0x116>
lea    (%rdx,%rdx,1),%rax
movq   (%rbx,%rdx,1),%xmm0
movq   0x8(%rbx,%rdx,1),%xmm1
or     $0x11,%rax
pxor   %xmm2,%xmm2
punpcklbw %xmm2,%xmm0
movdqa %xmm0,(%rcx,%rdx,2)
punpcklbw %xmm2,%xmm1
movdqa %xmm1,-0x1(%rax,%rcx,1)
cmp    %rsi,%r14
je     12c4 <strToUnicode+0x1a4>
and    $0xf,%r14d
add    %rsi,%rbx
add    %rsi,%rsi
test   $0x1,%r14b
je     117b <strToUnicode+0x5b>
lea    -0x1(%r14),%r8
mov    (%rbx),%dl
add    $0x1,%rbx
mov    %rsi,%rax
or     $0x1,%rax
lea    0x2dd5(%rip),%rcx
mov    %dl,(%rsi,%rcx,1)
add    $0x2,%rsi
movb   $0x0,(%rax,%rcx,1)
cmp    $0x1,%r14
je     12c4 <strToUnicode+0x1a4>
xor    %edx,%edx
lea    0x2dbb(%rip),%rdi
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rbx,%rdx,1),%ecx
mov    %rsi,%rax
or     $0x1,%rax
mov    %cl,(%rsi,%rdi,1)
movb   $0x0,(%rax,%rdi,1)
movzbl 0x1(%rbx,%rdx,1),%eax
lea    0x2(%rsi),%rcx
or     $0x1,%rcx
mov    %al,0x2(%rsi,%rdi,1)
movb   $0x0,(%rcx,%rdi,1)
add    $0x2,%rdx
add    $0x4,%rsi
cmp    %rdx,%r8
jne    1290 <strToUnicode+0x170>
lea    0x2d75(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %edx,%edx
test   $0x1,%al
jne    120c <strToUnicode+0xec>
jmp    1236 <strToUnicode+0x116>

LLVM IR (-O0):
@strToUnicode.buf = internal global [1024 x i8] zeroinitializer
define i8* @strToUnicode(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
store i64 %6, i64* %3
store i32 0, i32* %4
%7 = load i64, i64* %3
%8 = mul i64 %7, 2
%9 = icmp ult i64 %8, 1024
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
br label %12
12: ; preds = %16, %1
%13 = load i64, i64* %3
%14 = add i64 %13, -1
store i64 %14, i64* %3
%15 = icmp ne i64 %13, 0
br i1 %15, label %16, label %28
16: ; preds = %12
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %2
%19 = load i8, i8* %17
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
%22 = sext i32 %20 to i64
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 %22
store i8 %19, i8* %23
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
%26 = sext i32 %24 to i64
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 %26
store i8 0, i8* %27
br label %12
28: ; preds = %12
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@strToUnicode.buf = internal global [1024 x i8] zeroinitializer
define i8* @strToUnicode(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = and i64 %2, 9223372036854775296
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = icmp eq i64 %2, 0
br i1 %7, label %130, label %8
8: ; preds = %1
%9 = icmp ult i64 %2, 16
br i1 %9, label %93, label %10
10: ; preds = %8
%11 = shl i64 %2, 1
%12 = getelementptr [1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 %11
%13 = getelementptr i8, i8* %0, i64 %2
%14 = icmp ugt i8* %13, getelementptr inbounds ([1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 0)
%15 = icmp ugt i8* %12, %0
%16 = and i1 %14, %15
br i1 %16, label %93, label %17
17: ; preds = %10
%18 = and i64 %2, -16
%19 = shl i64 %18, 1
%20 = and i64 %2, 15
%21 = getelementptr i8, i8* %0, i64 %18
%22 = add i64 %18, -16
%23 = lshr exact i64 %22, 4
%24 = add nuw nsw i64 %23, 1
%25 = and i64 %24, 1
%26 = icmp eq i64 %22, 0
br i1 %26, label %70, label %27
27: ; preds = %17
%28 = and i64 %24, 2305843009213693950
br label %29
29: ; preds = %29, %27
%30 = phi i64 [ 0, %27 ], [ %67, %29 ]
%31 = phi i64 [ 0, %27 ], [ %68, %29 ]
%32 = shl i64 %30, 1
%33 = getelementptr i8, i8* %0, i64 %30
%34 = bitcast i8* %33 to <8 x i8>*
%35 = load <8 x i8>, <8 x i8>* %34
%36 = getelementptr i8, i8* %33, i64 8
%37 = bitcast i8* %36 to <8 x i8>*
%38 = load <8 x i8>, <8 x i8>* %37
%39 = or i64 %32, 1
%40 = or i64 %32, 17
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 %39
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 %40
%43 = getelementptr inbounds i8, i8* %41, i64 -1
%44 = bitcast i8* %43 to <16 x i8>*
%45 = getelementptr inbounds i8, i8* %42, i64 -1
%46 = bitcast i8* %45 to <16 x i8>*
%47 = shufflevector <8 x i8> %35, <8 x i8> zeroinitializer, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
store <16 x i8> %47, <16 x i8>* %44
%48 = shufflevector <8 x i8> %38, <8 x i8> zeroinitializer, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
store <16 x i8> %48, <16 x i8>* %46
%49 = or i64 %30, 16
%50 = shl i64 %49, 1
%51 = getelementptr i8, i8* %0, i64 %49
%52 = bitcast i8* %51 to <8 x i8>*
%53 = load <8 x i8>, <8 x i8>* %52
%54 = getelementptr i8, i8* %51, i64 8
%55 = bitcast i8* %54 to <8 x i8>*
%56 = load <8 x i8>, <8 x i8>* %55
%57 = or i64 %50, 1
%58 = or i64 %50, 17
%59 = getelementptr inbounds [1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 %57
%60 = getelementptr inbounds [1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 %58
%61 = getelementptr inbounds i8, i8* %59, i64 -1
%62 = bitcast i8* %61 to <16 x i8>*
%63 = getelementptr inbounds i8, i8* %60, i64 -1
%64 = bitcast i8* %63 to <16 x i8>*
%65 = shufflevector <8 x i8> %53, <8 x i8> zeroinitializer, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
store <16 x i8> %65, <16 x i8>* %62
%66 = shufflevector <8 x i8> %56, <8 x i8> zeroinitializer, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
store <16 x i8> %66, <16 x i8>* %64
%67 = add nuw i64 %30, 32
%68 = add i64 %31, 2
%69 = icmp eq i64 %68, %28
br i1 %69, label %70, label %29
70: ; preds = %29, %17
%71 = phi i64 [ 0, %17 ], [ %67, %29 ]
%72 = icmp eq i64 %25, 0
br i1 %72, label %91, label %73
73: ; preds = %70
%74 = shl i64 %71, 1
%75 = getelementptr i8, i8* %0, i64 %71
%76 = bitcast i8* %75 to <8 x i8>*
%77 = load <8 x i8>, <8 x i8>* %76
%78 = getelementptr i8, i8* %75, i64 8
%79 = bitcast i8* %78 to <8 x i8>*
%80 = load <8 x i8>, <8 x i8>* %79
%81 = or i64 %74, 1
%82 = or i64 %74, 17
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 %81
%84 = getelementptr inbounds [1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 %82
%85 = getelementptr inbounds i8, i8* %83, i64 -1
%86 = bitcast i8* %85 to <16 x i8>*
%87 = getelementptr inbounds i8, i8* %84, i64 -1
%88 = bitcast i8* %87 to <16 x i8>*
%89 = shufflevector <8 x i8> %77, <8 x i8> zeroinitializer, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
store <16 x i8> %89, <16 x i8>* %86
%90 = shufflevector <8 x i8> %80, <8 x i8> zeroinitializer, <16 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11, i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
store <16 x i8> %90, <16 x i8>* %88
br label %91
91: ; preds = %70, %73
%92 = icmp eq i64 %2, %18
br i1 %92, label %130, label %93
93: ; preds = %10, %8, %91
%94 = phi i64 [ 0, %10 ], [ 0, %8 ], [ %19, %91 ]
%95 = phi i64 [ %2, %10 ], [ %2, %8 ], [ %20, %91 ]
%96 = phi i8* [ %0, %10 ], [ %0, %8 ], [ %21, %91 ]
%97 = and i64 %95, 1
%98 = icmp eq i64 %97, 0
br i1 %98, label %107, label %99
99: ; preds = %93
%100 = add i64 %95, -1
%101 = getelementptr inbounds i8, i8* %96, i64 1
%102 = load i8, i8* %96
%103 = or i64 %94, 1
%104 = getelementptr inbounds [1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 %94
store i8 %102, i8* %104
%105 = add nuw i64 %94, 2
%106 = getelementptr inbounds [1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 %103
store i8 0, i8* %106
br label %107
107: ; preds = %99, %93
%108 = phi i64 [ %94, %93 ], [ %105, %99 ]
%109 = phi i64 [ %95, %93 ], [ %100, %99 ]
%110 = phi i8* [ %96, %93 ], [ %101, %99 ]
%111 = icmp eq i64 %95, 1
br i1 %111, label %130, label %112
112: ; preds = %107, %112
%113 = phi i64 [ %127, %112 ], [ %108, %107 ]
%114 = phi i64 [ %122, %112 ], [ %109, %107 ]
%115 = phi i8* [ %123, %112 ], [ %110, %107 ]
%116 = getelementptr inbounds i8, i8* %115, i64 1
%117 = load i8, i8* %115
%118 = or i64 %113, 1
%119 = getelementptr inbounds [1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 %113
store i8 %117, i8* %119
%120 = add nuw i64 %113, 2
%121 = getelementptr inbounds [1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 %118
store i8 0, i8* %121
%122 = add i64 %114, -2
%123 = getelementptr inbounds i8, i8* %115, i64 2
%124 = load i8, i8* %116
%125 = or i64 %120, 1
%126 = getelementptr inbounds [1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 %120
store i8 %124, i8* %126
%127 = add nuw i64 %113, 4
%128 = getelementptr inbounds [1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 %125
store i8 0, i8* %128
%129 = icmp eq i64 %122, 0
br i1 %129, label %130, label %112
130: ; preds = %107, %112, %91, %1
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @strToUnicode.buf, i64 0, i64 0)
}