#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;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
wchar_t *wcscpy(wchar_t *s1, const wchar_t *s2) {
  wchar_t *p;
  assert(s1 != NULL);
  assert(s2 != NULL);
  for (p = s1; (*p = *s2) != L'\0'; ++p, ++s2)
    ;
  return s1;
}


x86 assembly (clang, -O0):
<wcscpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %eax,(%rcx)
cmp    $0x0,%eax
je     1183 <wcscpy+0x73>
jmp    1166 <wcscpy+0x56>
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
jmp    114c <wcscpy+0x3c>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcscpy>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1030 <assert@plt>
mov    (%r14),%eax
mov    %eax,(%rbx)
test   %eax,%eax
je     115f <wcscpy+0x4f>
mov    $0x4,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r14,%rax,1),%ecx
mov    %ecx,(%rbx,%rax,1)
add    $0x4,%rax
test   %ecx,%ecx
jne    1150 <wcscpy+0x40>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32* @wcscpy(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = icmp ne i32* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i32*, i32** %4
%11 = icmp ne i32* %10, null
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i32*, i32** %3
store i32* %14, i32** %5
br label %15
15: ; preds = %21, %2
%16 = load i32*, i32** %4
%17 = load i32, i32* %16
%18 = load i32*, i32** %5
store i32 %17, i32* %18
%19 = icmp ne i32 %17, 0
br i1 %19, label %20, label %26
20: ; preds = %15
br label %21
21: ; preds = %20
%22 = load i32*, i32** %5
%23 = getelementptr inbounds i32, i32* %22, i32 1
store i32* %23, i32** %5
%24 = load i32*, i32** %4
%25 = getelementptr inbounds i32, i32* %24, i32 1
store i32* %25, i32** %4
br label %15
26: ; preds = %15
%27 = load i32*, i32** %3
ret i32* %27
}

LLVM IR (-O2):
define i32* @wcscpy(i32* returned writeonly %0, i32* %1) {
%3 = icmp ne i32* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp ne i32* %1, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = load i32, i32* %1
store i32 %9, i32* %0
%10 = icmp eq i32 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %2, %11
%12 = phi i32* [ %14, %11 ], [ %0, %2 ]
%13 = phi i32* [ %15, %11 ], [ %1, %2 ]
%14 = getelementptr inbounds i32, i32* %12, i64 1
%15 = getelementptr inbounds i32, i32* %13, i64 1
%16 = load i32, i32* %15
store i32 %16, i32* %14
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %11
18: ; preds = %11, %2
ret i32* %0
}