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

/* Variables and functions */
wchar_t *wcscat(wchar_t *dst, const wchar_t *src) {
  register wchar_t *dscan;
  register const wchar_t *sscan;
  if ((sscan = src) != NULL) {
    for (dscan = dst; *dscan != '\0'; dscan++)
      continue;
    while ((*dscan++ = *sscan++) != '\0')
      continue;
  }
  return (dst);
}


x86 assembly (clang, -O0):
<wcscat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1189 <wcscat+0x89>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     114c <wcscat+0x4c>
jmp    113b <wcscat+0x3b>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1126 <wcscat+0x26>
jmp    1151 <wcscat+0x51>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%al
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     1184 <wcscat+0x84>
jmp    1151 <wcscat+0x51>
jmp    1189 <wcscat+0x89>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcscat>:
mov    %rdi,%rax
test   %rsi,%rsi
je     1132 <wcscat+0x32>
mov    %rax,%rcx
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,(%rcx)
lea    0x1(%rcx),%rcx
jne    1110 <wcscat+0x10>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movzbl (%rsi,%rdx,1),%edi
mov    %dil,-0x1(%rcx,%rdx,1)
add    $0x1,%rdx
test   %dil,%dil
jne    1120 <wcscat+0x20>
ret

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

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