#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*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ ENDSWAP_64X(int /*<<< orphan*/);
void endswap_int64_t_copy(int64_t *dest, const int64_t *src, int len) {
  int64_t value;
  while (--len >= 0) {
    value = src[len];
    dest[len] = ENDSWAP_64X(value);
  };
}


x86 assembly (clang, -O0):
<endswap_int64_t_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jl     115d <endswap_int64_t_copy+0x4d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <ENDSWAP_64X@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    1123 <endswap_int64_t_copy+0x13>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<endswap_int64_t_copy>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    114b <endswap_int64_t_copy+0x3b>
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%ebx
add    $0x1,%rbx
nopl   0x0(%rax,%rax,1)
lea    -0x2(%rbx),%r12d
mov    (%r14,%r12,4),%edi
call   1030 <ENDSWAP_64X@plt>
mov    %eax,(%r15,%r12,4)
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1130 <endswap_int64_t_copy+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @endswap_int64_t_copy(i32* nocapture writeonly %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %16
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ %6, %5 ], [ %9, %7 ]
%9 = add nsw i64 %8, -1
%10 = and i64 %9, 4294967295
%11 = getelementptr inbounds i32, i32* %1, i64 %10
%12 = load i32, i32* %11
%13 = tail call i32 @ENDSWAP_64X(i32 %12)
%14 = getelementptr inbounds i32, i32* %0, i64 %10
store i32 %13, i32* %14
%15 = icmp ugt i64 %8, 1
br i1 %15, label %7, label %16
16: ; preds = %7, %3
ret void
}