#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 /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ ****uint32_t;

/* Variables and functions */
void copy_fwd_rest_blocks_aligned(uint32_t *d, const uint8_t *src,
                                  size_t blocks) {
  uint32_t *s = (uint32_t)src;
  while (blocks > 0) {
    *d++ = *s++;
    *d++ = *s++;
    blocks--;
  }
}


x86 assembly (clang, -O0):
<copy_fwd_rest_blocks_aligned>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
jbe    117c <copy_fwd_rest_blocks_aligned+0x7c>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x8(%rbp)
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x8(%rbp)
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    1118 <copy_fwd_rest_blocks_aligned+0x18>
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_fwd_rest_blocks_aligned>:
test   %rdx,%rdx
je     11a8 <copy_fwd_rest_blocks_aligned+0xa8>
lea    -0x1(%rdx),%r8
mov    %rdx,%r9
and    $0x3,%r9
je     1142 <copy_fwd_rest_blocks_aligned+0x42>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
mov    (%rsi),%rcx
mov    %rcx,(%rdi)
mov    0x8(%rsi),%rcx
add    $0x10,%rsi
mov    %rcx,0x8(%rdi)
add    $0x10,%rdi
add    $0x1,%rax
cmp    %rax,%r9
jne    1120 <copy_fwd_rest_blocks_aligned+0x20>
sub    %rax,%rdx
cmp    $0x3,%r8
jb     11a8 <copy_fwd_rest_blocks_aligned+0xa8>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
mov    (%rsi,%rax,1),%rcx
mov    %rcx,(%rdi,%rax,1)
mov    0x8(%rsi,%rax,1),%rcx
mov    %rcx,0x8(%rdi,%rax,1)
mov    0x10(%rsi,%rax,1),%rcx
mov    %rcx,0x10(%rdi,%rax,1)
mov    0x18(%rsi,%rax,1),%rcx
mov    %rcx,0x18(%rdi,%rax,1)
mov    0x20(%rsi,%rax,1),%rcx
mov    %rcx,0x20(%rdi,%rax,1)
mov    0x28(%rsi,%rax,1),%rcx
mov    %rcx,0x28(%rdi,%rax,1)
mov    0x30(%rsi,%rax,1),%rcx
mov    %rcx,0x30(%rdi,%rax,1)
mov    0x38(%rsi,%rax,1),%rcx
mov    %rcx,0x38(%rdi,%rax,1)
add    $0x40,%rax
add    $0xfffffffffffffffc,%rdx
jne    1150 <copy_fwd_rest_blocks_aligned+0x50>
ret

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

LLVM IR (-O2):
define void @copy_fwd_rest_blocks_aligned(i32***** nocapture writeonly %0, i32* nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %59, label %5
5: ; preds = %3
%6 = bitcast i32* %1 to i32*****
%7 = add i64 %2, -1
%8 = and i64 %2, 3
%9 = icmp eq i64 %8, 0
br i1 %9, label %24, label %10
10: ; preds = %5, %10
%11 = phi i32***** [ %18, %10 ], [ %6, %5 ]
%12 = phi i64 [ %21, %10 ], [ %2, %5 ]
%13 = phi i32***** [ %20, %10 ], [ %0, %5 ]
%14 = phi i64 [ %22, %10 ], [ 0, %5 ]
%15 = getelementptr inbounds i32****, i32***** %11, i64 1
%16 = load i32****, i32***** %11
%17 = getelementptr inbounds i32****, i32***** %13, i64 1
store i32**** %16, i32***** %13
%18 = getelementptr inbounds i32****, i32***** %11, i64 2
%19 = load i32****, i32***** %15
%20 = getelementptr inbounds i32****, i32***** %13, i64 2
store i32**** %19, i32***** %17
%21 = add i64 %12, -1
%22 = add i64 %14, 1
%23 = icmp eq i64 %22, %8
br i1 %23, label %24, label %10
24: ; preds = %10, %5
%25 = phi i32***** [ %6, %5 ], [ %18, %10 ]
%26 = phi i64 [ %2, %5 ], [ %21, %10 ]
%27 = phi i32***** [ %0, %5 ], [ %20, %10 ]
%28 = icmp ult i64 %7, 3
br i1 %28, label %59, label %29
29: ; preds = %24, %29
%30 = phi i32***** [ %54, %29 ], [ %25, %24 ]
%31 = phi i64 [ %57, %29 ], [ %26, %24 ]
%32 = phi i32***** [ %56, %29 ], [ %27, %24 ]
%33 = getelementptr inbounds i32****, i32***** %30, i64 1
%34 = load i32****, i32***** %30
%35 = getelementptr inbounds i32****, i32***** %32, i64 1
store i32**** %34, i32***** %32
%36 = getelementptr inbounds i32****, i32***** %30, i64 2
%37 = load i32****, i32***** %33
%38 = getelementptr inbounds i32****, i32***** %32, i64 2
store i32**** %37, i32***** %35
%39 = getelementptr inbounds i32****, i32***** %30, i64 3
%40 = load i32****, i32***** %36
%41 = getelementptr inbounds i32****, i32***** %32, i64 3
store i32**** %40, i32***** %38
%42 = getelementptr inbounds i32****, i32***** %30, i64 4
%43 = load i32****, i32***** %39
%44 = getelementptr inbounds i32****, i32***** %32, i64 4
store i32**** %43, i32***** %41
%45 = getelementptr inbounds i32****, i32***** %30, i64 5
%46 = load i32****, i32***** %42
%47 = getelementptr inbounds i32****, i32***** %32, i64 5
store i32**** %46, i32***** %44
%48 = getelementptr inbounds i32****, i32***** %30, i64 6
%49 = load i32****, i32***** %45
%50 = getelementptr inbounds i32****, i32***** %32, i64 6
store i32**** %49, i32***** %47
%51 = getelementptr inbounds i32****, i32***** %30, i64 7
%52 = load i32****, i32***** %48
%53 = getelementptr inbounds i32****, i32***** %32, i64 7
store i32**** %52, i32***** %50
%54 = getelementptr inbounds i32****, i32***** %30, i64 8
%55 = load i32****, i32***** %51
%56 = getelementptr inbounds i32****, i32***** %32, i64 8
store i32**** %55, i32***** %53
%57 = add i64 %31, -4
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %29
59: ; preds = %24, %29, %3
ret void
}