#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*/ UNALIGNED_LOAD64(char const *);
int /*<<< orphan*/ UNALIGNED_STORE64(char *, int /*<<< orphan*/);
void incremental_copy_fast_path(const char *src, char *op, int len) {
  while (op - src < 8) {
    UNALIGNED_STORE64(op, UNALIGNED_LOAD64(src));
    len -= op - src;
    op += op - src;
  }
  while (len > 0) {
    UNALIGNED_STORE64(op, UNALIGNED_LOAD64(src));
    src += 8;
    op += 8;
    len -= 8;
  }
}


x86 assembly (clang, -O0):
<incremental_copy_fast_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
cmp    $0x8,%rax
jge    1191 <incremental_copy_fast_path+0x71>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <UNALIGNED_LOAD64@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1030 <UNALIGNED_STORE64@plt>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
sub    %rax,%rcx
movslq -0x14(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1133 <incremental_copy_fast_path+0x13>
jmp    1196 <incremental_copy_fast_path+0x76>
cmpl   $0x0,-0x14(%rbp)
jle    11e2 <incremental_copy_fast_path+0xc2>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <UNALIGNED_LOAD64@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
call   1030 <UNALIGNED_STORE64@plt>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x8,%eax
mov    %eax,-0x14(%rbp)
jmp    1196 <incremental_copy_fast_path+0x76>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<incremental_copy_fast_path>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%rbp
mov    %rdi,%r14
mov    %rsi,%rbx
sub    %rdi,%rbx
cmp    $0x7,%rbx
jg     1164 <incremental_copy_fast_path+0x44>
nopl   0x0(%rax)
mov    %r14,%rdi
call   1040 <UNALIGNED_LOAD64@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   1030 <UNALIGNED_STORE64@plt>
sub    %ebx,%r15d
add    %rbx,%rbp
mov    %rbp,%rbx
sub    %r14,%rbx
cmp    $0x8,%rbx
jl     1140 <incremental_copy_fast_path+0x20>
test   %r15d,%r15d
jle    1194 <incremental_copy_fast_path+0x74>
add    $0x8,%r15d
nopl   (%rax)
mov    %r14,%rdi
call   1040 <UNALIGNED_LOAD64@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   1030 <UNALIGNED_STORE64@plt>
add    $0x8,%r14
add    $0x8,%rbp
add    $0xfffffff8,%r15d
cmp    $0x8,%r15d
ja     1170 <incremental_copy_fast_path+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @incremental_copy_fast_path(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
br label %7
7: ; preds = %14, %3
%8 = load i8*, i8** %5
%9 = load i8*, i8** %4
%10 = ptrtoint i8* %8 to i64
%11 = ptrtoint i8* %9 to i64
%12 = sub i64 %10, %11
%13 = icmp slt i64 %12, 8
br i1 %13, label %14, label %35
14: ; preds = %7
%15 = load i8*, i8** %5
%16 = load i8*, i8** %4
%17 = call i32 @UNALIGNED_LOAD64(i8* %16)
%18 = call i32 @UNALIGNED_STORE64(i8* %15, i32 %17)
%19 = load i8*, i8** %5
%20 = load i8*, i8** %4
%21 = ptrtoint i8* %19 to i64
%22 = ptrtoint i8* %20 to i64
%23 = sub i64 %21, %22
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = sub nsw i64 %25, %23
%27 = trunc i64 %26 to i32
store i32 %27, i32* %6
%28 = load i8*, i8** %5
%29 = load i8*, i8** %4
%30 = ptrtoint i8* %28 to i64
%31 = ptrtoint i8* %29 to i64
%32 = sub i64 %30, %31
%33 = load i8*, i8** %5
%34 = getelementptr inbounds i8, i8* %33, i64 %32
store i8* %34, i8** %5
br label %7
35: ; preds = %7
br label %36
36: ; preds = %39, %35
%37 = load i32, i32* %6
%38 = icmp sgt i32 %37, 0
br i1 %38, label %39, label %50
39: ; preds = %36
%40 = load i8*, i8** %5
%41 = load i8*, i8** %4
%42 = call i32 @UNALIGNED_LOAD64(i8* %41)
%43 = call i32 @UNALIGNED_STORE64(i8* %40, i32 %42)
%44 = load i8*, i8** %4
%45 = getelementptr inbounds i8, i8* %44, i64 8
store i8* %45, i8** %4
%46 = load i8*, i8** %5
%47 = getelementptr inbounds i8, i8* %46, i64 8
store i8* %47, i8** %5
%48 = load i32, i32* %6
%49 = sub nsw i32 %48, 8
store i32 %49, i32* %6
br label %36
50: ; preds = %36
ret void
}

LLVM IR (-O2):
define void @incremental_copy_fast_path(i8* %0, i8* %1, i32 %2) {
%4 = ptrtoint i8* %0 to i64
%5 = ptrtoint i8* %1 to i64
%6 = sub i64 %5, %4
%7 = icmp slt i64 %6, 8
br i1 %7, label %12, label %8
8: ; preds = %12, %3
%9 = phi i8* [ %1, %3 ], [ %20, %12 ]
%10 = phi i32 [ %2, %3 ], [ %19, %12 ]
%11 = icmp sgt i32 %10, 0
br i1 %11, label %24, label %34
12: ; preds = %3, %12
%13 = phi i64 [ %22, %12 ], [ %6, %3 ]
%14 = phi i32 [ %19, %12 ], [ %2, %3 ]
%15 = phi i8* [ %20, %12 ], [ %1, %3 ]
%16 = tail call i32 @UNALIGNED_LOAD64(i8* %0)
%17 = tail call i32 @UNALIGNED_STORE64(i8* %15, i32 %16)
%18 = trunc i64 %13 to i32
%19 = sub i32 %14, %18
%20 = getelementptr inbounds i8, i8* %15, i64 %13
%21 = ptrtoint i8* %20 to i64
%22 = sub i64 %21, %4
%23 = icmp slt i64 %22, 8
br i1 %23, label %12, label %8
24: ; preds = %8, %24
%25 = phi i32 [ %32, %24 ], [ %10, %8 ]
%26 = phi i8* [ %31, %24 ], [ %9, %8 ]
%27 = phi i8* [ %30, %24 ], [ %0, %8 ]
%28 = tail call i32 @UNALIGNED_LOAD64(i8* %27)
%29 = tail call i32 @UNALIGNED_STORE64(i8* %26, i32 %28)
%30 = getelementptr inbounds i8, i8* %27, i64 8
%31 = getelementptr inbounds i8, i8* %26, i64 8
%32 = add nsw i32 %25, -8
%33 = icmp ugt i32 %25, 8
br i1 %33, label %24, label %34
34: ; preds = %24, %8
ret void
}