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

/* Variables and functions */
int /*<<< orphan*/ strcpy2(char *, char *);
char *strcpy6(char *dest, const char *src) {
  uint64_t *src64 = (uint64_t *)src;
  uint64_t *dest64 = (uint64_t *)dest;
  while (1) {
    register uint64_t tmp = *src64;
    uint64_t scan;
    for (scan = 0xffULL; (tmp & scan) != 0; scan <<= 8)
      ;
    if (scan != 0) {
      strcpy2((char *)dest64, (char *)src64);
      break;
    }
    *dest64++ = tmp;
    src64++;
  }
  return dest;
}


x86 assembly (clang, -O0):
<strcpy6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
movl   $0xff,-0x28(%rbp)
mov    -0x24(%rbp),%eax
and    -0x28(%rbp),%eax
cmp    $0x0,%eax
je     1162 <strcpy6+0x52>
jmp    1154 <strcpy6+0x44>
mov    -0x28(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x28(%rbp)
jmp    1140 <strcpy6+0x30>
cmpl   $0x0,-0x28(%rbp)
je     117e <strcpy6+0x6e>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy2@plt>
jmp    11a3 <strcpy6+0x93>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x20(%rbp)
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
jmp    1130 <strcpy6+0x20>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy6>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rsi),%eax
mov    $0xff,%ecx
nopw   0x0(%rax,%rax,1)
mov    %ecx,%edx
shl    $0x8,%ecx
test   %eax,%edx
jne    1130 <strcpy6+0x20>
test   %edx,%edx
jne    1149 <strcpy6+0x39>
mov    %eax,(%rdi)
add    $0x4,%rdi
add    $0x4,%rsi
jmp    1120 <strcpy6+0x10>
call   1030 <strcpy2@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @strcpy6(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %5
%11 = load i8*, i8** %3
%12 = bitcast i8* %11 to i32*
store i32* %12, i32** %6
br label %13
13: ; preds = %2, %34
%14 = load i32*, i32** %5
%15 = load i32, i32* %14
store i32 %15, i32* %7
store i32 255, i32* %8
br label %16
16: ; preds = %22, %13
%17 = load i32, i32* %7
%18 = load i32, i32* %8
%19 = and i32 %17, %18
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %16
br label %22
22: ; preds = %21
%23 = load i32, i32* %8
%24 = shl i32 %23, 8
store i32 %24, i32* %8
br label %16
25: ; preds = %16
%26 = load i32, i32* %8
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = load i32*, i32** %6
%30 = bitcast i32* %29 to i8*
%31 = load i32*, i32** %5
%32 = bitcast i32* %31 to i8*
%33 = call i32 @strcpy2(i8* %30, i8* %32)
br label %40
34: ; preds = %25
%35 = load i32, i32* %7
%36 = load i32*, i32** %6
%37 = getelementptr inbounds i32, i32* %36, i32 1
store i32* %37, i32** %6
store i32 %35, i32* %36
%38 = load i32*, i32** %5
%39 = getelementptr inbounds i32, i32* %38, i32 1
store i32* %39, i32** %5
br label %13
40: ; preds = %28
%41 = load i8*, i8** %3
ret i8* %41
}

LLVM IR (-O2):
define i8* @strcpy6(i8* returned %0, i8* %1) {
%3 = bitcast i8* %1 to i32*
%4 = bitcast i8* %0 to i32*
br label %5
5: ; preds = %16, %2
%6 = phi i32* [ %4, %2 ], [ %17, %16 ]
%7 = phi i32* [ %3, %2 ], [ %18, %16 ]
%8 = load i32, i32* %7
br label %9
9: ; preds = %9, %5
%10 = phi i32 [ 255, %5 ], [ %13, %9 ]
%11 = and i32 %10, %8
%12 = icmp eq i32 %11, 0
%13 = shl i32 %10, 8
br i1 %12, label %14, label %9
14: ; preds = %9
%15 = icmp eq i32 %10, 0
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = getelementptr inbounds i32, i32* %6, i64 1
store i32 %8, i32* %6
%18 = getelementptr inbounds i32, i32* %7, i64 1
br label %5
19: ; preds = %14
%20 = bitcast i32* %6 to i8*
%21 = bitcast i32* %7 to i8*
%22 = tail call i32 @strcpy2(i8* %20, i8* %21)
ret i8* %0
}