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

/* Variables and functions */
wchar_t *wcscat(wchar_t *__restrict__ dest, const wchar_t *__restrict__ src) {
  wchar_t *orig = dest;
  for (; *dest; ++dest)
    ;
  for (; (*dest = *src); ++src, ++dest)
    ;
  return orig;
}


x86 assembly (clang, -O0):
<wcscat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1138 <wcscat+0x38>
jmp    1127 <wcscat+0x27>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <wcscat+0x14>
jmp    113d <wcscat+0x3d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x8(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
je     1177 <wcscat+0x77>
jmp    115a <wcscat+0x5a>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    113d <wcscat+0x3d>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcscat>:
mov    %rdi,%rax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
cmpq   $0x0,(%rcx)
lea    0x8(%rcx),%rcx
jne    1110 <wcscat+0x10>
mov    (%rsi),%rdx
mov    %rdx,-0x8(%rcx)
test   %rdx,%rdx
je     1142 <wcscat+0x42>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsi,%rdx,1),%rdi
mov    %rdi,(%rcx,%rdx,1)
add    $0x8,%rdx
test   %rdi,%rdi
jne    1130 <wcscat+0x30>
ret

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

LLVM IR (-O2):
define i64* @wcscat(i64* noalias returned %0, i64* noalias nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64* [ %0, %2 ], [ %7, %3 ]
%5 = load i64, i64* %4
%6 = icmp eq i64 %5, 0
%7 = getelementptr inbounds i64, i64* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = load i64, i64* %1
store i64 %9, i64* %4
%10 = icmp eq i64 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %8, %11
%12 = phi i64* [ %15, %11 ], [ %4, %8 ]
%13 = phi i64* [ %14, %11 ], [ %1, %8 ]
%14 = getelementptr inbounds i64, i64* %13, i64 1
%15 = getelementptr inbounds i64, i64* %12, i64 1
%16 = load i64, i64* %14
store i64 %16, i64* %15
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %11
18: ; preds = %11, %8
ret i64* %0
}