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

/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void const *, int);
void utils_doubleCopy(void *dst, const void *src) {
  const bool is_big_endian = (*(uint16_t *)"\0\xff" < 0x100);
  if (is_big_endian)
    memcpy(dst, src, 8);
  else {
    ((uint8_t *)dst)[0] = ((const uint8_t *)src)[7];
    ((uint8_t *)dst)[1] = ((const uint8_t *)src)[6];
    ((uint8_t *)dst)[2] = ((const uint8_t *)src)[5];
    ((uint8_t *)dst)[3] = ((const uint8_t *)src)[4];
    ((uint8_t *)dst)[4] = ((const uint8_t *)src)[3];
    ((uint8_t *)dst)[5] = ((const uint8_t *)src)[2];
    ((uint8_t *)dst)[6] = ((const uint8_t *)src)[1];
    ((uint8_t *)dst)[7] = ((const uint8_t *)src)[0];
  }
}


x86 assembly (clang, -O0):
<utils_doubleCopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x100,0xed6(%rip)
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1156 <utils_doubleCopy+0x46>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
jmp    11c4 <utils_doubleCopy+0xb4>
mov    -0x10(%rbp),%rax
mov    0x1c(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x18(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x1c(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utils_doubleCopy>:
mov    0x1c(%rsi),%eax
mov    %eax,(%rdi)
mov    0x18(%rsi),%eax
mov    %eax,0x4(%rdi)
mov    0x14(%rsi),%eax
mov    %eax,0x8(%rdi)
mov    0x10(%rsi),%eax
mov    %eax,0xc(%rdi)
mov    0xc(%rsi),%eax
mov    %eax,0x10(%rdi)
mov    0x8(%rsi),%eax
mov    %eax,0x14(%rdi)
mov    0x4(%rsi),%eax
mov    %eax,0x18(%rdi)
mov    (%rsi),%eax
mov    %eax,0x1c(%rdi)
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\00\FF\00"
define void @utils_doubleCopy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i32, i32* bitcast ([3 x i8]* @.str to i32*)
%7 = icmp slt i32 %6, 256
%8 = zext i1 %7 to i32
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = load i8*, i8** %4
%14 = call i32 @memcpy(i8* %12, i8* %13, i32 8)
br label %72
15: ; preds = %2
%16 = load i8*, i8** %4
%17 = bitcast i8* %16 to i32*
%18 = getelementptr inbounds i32, i32* %17, i64 7
%19 = load i32, i32* %18
%20 = load i8*, i8** %3
%21 = bitcast i8* %20 to i32*
%22 = getelementptr inbounds i32, i32* %21, i64 0
store i32 %19, i32* %22
%23 = load i8*, i8** %4
%24 = bitcast i8* %23 to i32*
%25 = getelementptr inbounds i32, i32* %24, i64 6
%26 = load i32, i32* %25
%27 = load i8*, i8** %3
%28 = bitcast i8* %27 to i32*
%29 = getelementptr inbounds i32, i32* %28, i64 1
store i32 %26, i32* %29
%30 = load i8*, i8** %4
%31 = bitcast i8* %30 to i32*
%32 = getelementptr inbounds i32, i32* %31, i64 5
%33 = load i32, i32* %32
%34 = load i8*, i8** %3
%35 = bitcast i8* %34 to i32*
%36 = getelementptr inbounds i32, i32* %35, i64 2
store i32 %33, i32* %36
%37 = load i8*, i8** %4
%38 = bitcast i8* %37 to i32*
%39 = getelementptr inbounds i32, i32* %38, i64 4
%40 = load i32, i32* %39
%41 = load i8*, i8** %3
%42 = bitcast i8* %41 to i32*
%43 = getelementptr inbounds i32, i32* %42, i64 3
store i32 %40, i32* %43
%44 = load i8*, i8** %4
%45 = bitcast i8* %44 to i32*
%46 = getelementptr inbounds i32, i32* %45, i64 3
%47 = load i32, i32* %46
%48 = load i8*, i8** %3
%49 = bitcast i8* %48 to i32*
%50 = getelementptr inbounds i32, i32* %49, i64 4
store i32 %47, i32* %50
%51 = load i8*, i8** %4
%52 = bitcast i8* %51 to i32*
%53 = getelementptr inbounds i32, i32* %52, i64 2
%54 = load i32, i32* %53
%55 = load i8*, i8** %3
%56 = bitcast i8* %55 to i32*
%57 = getelementptr inbounds i32, i32* %56, i64 5
store i32 %54, i32* %57
%58 = load i8*, i8** %4
%59 = bitcast i8* %58 to i32*
%60 = getelementptr inbounds i32, i32* %59, i64 1
%61 = load i32, i32* %60
%62 = load i8*, i8** %3
%63 = bitcast i8* %62 to i32*
%64 = getelementptr inbounds i32, i32* %63, i64 6
store i32 %61, i32* %64
%65 = load i8*, i8** %4
%66 = bitcast i8* %65 to i32*
%67 = getelementptr inbounds i32, i32* %66, i64 0
%68 = load i32, i32* %67
%69 = load i8*, i8** %3
%70 = bitcast i8* %69 to i32*
%71 = getelementptr inbounds i32, i32* %70, i64 7
store i32 %68, i32* %71
br label %72
72: ; preds = %15, %11
ret void
}

LLVM IR (-O2):
define void @utils_doubleCopy(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = getelementptr inbounds i8, i8* %1, i64 28
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
%7 = bitcast i8* %0 to i32*
store i32 %6, i32* %7
%8 = getelementptr inbounds i8, i8* %1, i64 24
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = getelementptr inbounds i8, i8* %0, i64 4
%12 = bitcast i8* %11 to i32*
store i32 %10, i32* %12
%13 = getelementptr inbounds i8, i8* %1, i64 20
%14 = bitcast i8* %13 to i32*
%15 = load i32, i32* %14
%16 = getelementptr inbounds i8, i8* %0, i64 8
%17 = bitcast i8* %16 to i32*
store i32 %15, i32* %17
%18 = getelementptr inbounds i8, i8* %1, i64 16
%19 = bitcast i8* %18 to i32*
%20 = load i32, i32* %19
%21 = getelementptr inbounds i8, i8* %0, i64 12
%22 = bitcast i8* %21 to i32*
store i32 %20, i32* %22
%23 = getelementptr inbounds i8, i8* %1, i64 12
%24 = bitcast i8* %23 to i32*
%25 = load i32, i32* %24
%26 = getelementptr inbounds i8, i8* %0, i64 16
%27 = bitcast i8* %26 to i32*
store i32 %25, i32* %27
%28 = getelementptr inbounds i8, i8* %1, i64 8
%29 = bitcast i8* %28 to i32*
%30 = load i32, i32* %29
%31 = getelementptr inbounds i8, i8* %0, i64 20
%32 = bitcast i8* %31 to i32*
store i32 %30, i32* %32
%33 = getelementptr inbounds i8, i8* %1, i64 4
%34 = bitcast i8* %33 to i32*
%35 = load i32, i32* %34
%36 = getelementptr inbounds i8, i8* %0, i64 24
%37 = bitcast i8* %36 to i32*
store i32 %35, i32* %37
%38 = load i32, i32* %3
%39 = getelementptr inbounds i8, i8* %0, i64 28
%40 = bitcast i8* %39 to i32*
store i32 %38, i32* %40
ret void
}