#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*/ assert(int);
double *CopyVector(const double *A, double *B, const unsigned int n) {
  assert(NULL != A);
  assert(NULL != B);
  assert(n > 0);
  for (unsigned int i = 0; i < n; i++) {
    B[i] = A[i];
  }
  return B;
}


x86 assembly (clang, -O0):
<CopyVector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0x14(%rbp)
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1193 <CopyVector+0x83>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1161 <CopyVector+0x51>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CopyVector>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %ebp,%ebp
setne  %dil
call   1030 <assert@plt>
test   %ebp,%ebp
je     12b4 <CopyVector+0x1a4>
mov    %ebp,%eax
cmp    $0x4,%ebp
jb     116a <CopyVector+0x5a>
lea    (%r14,%rax,8),%rcx
cmp    %rbx,%rcx
jbe    11e0 <CopyVector+0xd0>
lea    (%rbx,%rax,8),%rcx
cmp    %r14,%rcx
jbe    11e0 <CopyVector+0xd0>
xor    %ecx,%ecx
mov    %rcx,%rdx
not    %rdx
add    %rax,%rdx
mov    %rax,%rsi
and    $0x3,%rsi
je     1195 <CopyVector+0x85>
xchg   %ax,%ax
movsd  (%r14,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rsi
jne    1180 <CopyVector+0x70>
cmp    $0x3,%rdx
jb     12b4 <CopyVector+0x1a4>
nop
movsd  (%r14,%rcx,8),%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
movsd  0x8(%r14,%rcx,8),%xmm0
movsd  %xmm0,0x8(%rbx,%rcx,8)
movsd  0x10(%r14,%rcx,8),%xmm0
movsd  %xmm0,0x10(%rbx,%rcx,8)
movsd  0x18(%r14,%rcx,8),%xmm0
movsd  %xmm0,0x18(%rbx,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%rax
jne    11a0 <CopyVector+0x90>
jmp    12b4 <CopyVector+0x1a4>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rdi
mov    %rdi,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %esi,%edx
and    $0x3,%edx
cmp    $0xc,%rdi
jae    1203 <CopyVector+0xf3>
xor    %edi,%edi
jmp    1270 <CopyVector+0x160>
and    $0xfffffffffffffffc,%rsi
xor    %edi,%edi
nopl   0x0(%rax)
movups (%r14,%rdi,8),%xmm0
movups 0x10(%r14,%rdi,8),%xmm1
movups %xmm0,(%rbx,%rdi,8)
movups %xmm1,0x10(%rbx,%rdi,8)
movups 0x20(%r14,%rdi,8),%xmm0
movups 0x30(%r14,%rdi,8),%xmm1
movups %xmm0,0x20(%rbx,%rdi,8)
movups %xmm1,0x30(%rbx,%rdi,8)
movups 0x40(%r14,%rdi,8),%xmm0
movups 0x50(%r14,%rdi,8),%xmm1
movups %xmm0,0x40(%rbx,%rdi,8)
movups %xmm1,0x50(%rbx,%rdi,8)
movups 0x60(%r14,%rdi,8),%xmm0
movups 0x70(%r14,%rdi,8),%xmm1
movups %xmm0,0x60(%rbx,%rdi,8)
movups %xmm1,0x70(%rbx,%rdi,8)
add    $0x10,%rdi
add    $0xfffffffffffffffc,%rsi
jne    1210 <CopyVector+0x100>
test   %rdx,%rdx
je     12ab <CopyVector+0x19b>
lea    (%rbx,%rdi,8),%rsi
add    $0x10,%rsi
lea    (%r14,%rdi,8),%rdi
add    $0x10,%rdi
shl    $0x5,%rdx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movups -0x10(%rdi,%rbp,1),%xmm0
movups (%rdi,%rbp,1),%xmm1
movups %xmm0,-0x10(%rsi,%rbp,1)
movups %xmm1,(%rsi,%rbp,1)
add    $0x20,%rbp
cmp    %rbp,%rdx
jne    1290 <CopyVector+0x180>
cmp    %rax,%rcx
jne    116c <CopyVector+0x5c>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double* @CopyVector(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
%8 = load double*, double** %4
%9 = icmp ne double* null, %8
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load double*, double** %5
%13 = icmp ne double* null, %12
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load i32, i32* %6
%17 = icmp ugt i32 %16, 0
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
store i32 0, i32* %7
br label %20
20: ; preds = %34, %3
%21 = load i32, i32* %7
%22 = load i32, i32* %6
%23 = icmp ult i32 %21, %22
br i1 %23, label %24, label %37
24: ; preds = %20
%25 = load double*, double** %4
%26 = load i32, i32* %7
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds double, double* %25, i64 %27
%29 = load double, double* %28
%30 = load double*, double** %5
%31 = load i32, i32* %7
%32 = zext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
store double %29, double* %33
br label %34
34: ; preds = %24
%35 = load i32, i32* %7
%36 = add i32 %35, 1
store i32 %36, i32* %7
br label %20
37: ; preds = %20
%38 = load double*, double** %5
ret double* %38
}

LLVM IR (-O2):
define double* @CopyVector(double* %0, double* returned writeonly %1, i32 %2) {
%4 = icmp ne double* %0, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = icmp ne double* %1, null
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = icmp ne i32 %2, 0
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = icmp eq i32 %2, 0
br i1 %13, label %120, label %14
14: ; preds = %3
%15 = zext i32 %2 to i64
%16 = icmp ult i32 %2, 4
br i1 %16, label %102, label %17
17: ; preds = %14
%18 = getelementptr double, double* %1, i64 %15
%19 = getelementptr double, double* %0, i64 %15
%20 = icmp ugt double* %19, %1
%21 = icmp ugt double* %18, %0
%22 = and i1 %20, %21
br i1 %22, label %102, label %23
23: ; preds = %17
%24 = and i64 %15, 4294967292
%25 = add nsw i64 %24, -4
%26 = lshr exact i64 %25, 2
%27 = add nuw nsw i64 %26, 1
%28 = and i64 %27, 3
%29 = icmp ult i64 %25, 12
br i1 %29, label %81, label %30
30: ; preds = %23
%31 = and i64 %27, 9223372036854775804
br label %32
32: ; preds = %32, %30
%33 = phi i64 [ 0, %30 ], [ %78, %32 ]
%34 = phi i64 [ 0, %30 ], [ %79, %32 ]
%35 = getelementptr inbounds double, double* %0, i64 %33
%36 = bitcast double* %35 to <2 x double>*
%37 = load <2 x double>, <2 x double>* %36
%38 = getelementptr inbounds double, double* %35, i64 2
%39 = bitcast double* %38 to <2 x double>*
%40 = load <2 x double>, <2 x double>* %39
%41 = getelementptr inbounds double, double* %1, i64 %33
%42 = bitcast double* %41 to <2 x double>*
store <2 x double> %37, <2 x double>* %42
%43 = getelementptr inbounds double, double* %41, i64 2
%44 = bitcast double* %43 to <2 x double>*
store <2 x double> %40, <2 x double>* %44
%45 = or i64 %33, 4
%46 = getelementptr inbounds double, double* %0, i64 %45
%47 = bitcast double* %46 to <2 x double>*
%48 = load <2 x double>, <2 x double>* %47
%49 = getelementptr inbounds double, double* %46, i64 2
%50 = bitcast double* %49 to <2 x double>*
%51 = load <2 x double>, <2 x double>* %50
%52 = getelementptr inbounds double, double* %1, i64 %45
%53 = bitcast double* %52 to <2 x double>*
store <2 x double> %48, <2 x double>* %53
%54 = getelementptr inbounds double, double* %52, i64 2
%55 = bitcast double* %54 to <2 x double>*
store <2 x double> %51, <2 x double>* %55
%56 = or i64 %33, 8
%57 = getelementptr inbounds double, double* %0, i64 %56
%58 = bitcast double* %57 to <2 x double>*
%59 = load <2 x double>, <2 x double>* %58
%60 = getelementptr inbounds double, double* %57, i64 2
%61 = bitcast double* %60 to <2 x double>*
%62 = load <2 x double>, <2 x double>* %61
%63 = getelementptr inbounds double, double* %1, i64 %56
%64 = bitcast double* %63 to <2 x double>*
store <2 x double> %59, <2 x double>* %64
%65 = getelementptr inbounds double, double* %63, i64 2
%66 = bitcast double* %65 to <2 x double>*
store <2 x double> %62, <2 x double>* %66
%67 = or i64 %33, 12
%68 = getelementptr inbounds double, double* %0, i64 %67
%69 = bitcast double* %68 to <2 x double>*
%70 = load <2 x double>, <2 x double>* %69
%71 = getelementptr inbounds double, double* %68, i64 2
%72 = bitcast double* %71 to <2 x double>*
%73 = load <2 x double>, <2 x double>* %72
%74 = getelementptr inbounds double, double* %1, i64 %67
%75 = bitcast double* %74 to <2 x double>*
store <2 x double> %70, <2 x double>* %75
%76 = getelementptr inbounds double, double* %74, i64 2
%77 = bitcast double* %76 to <2 x double>*
store <2 x double> %73, <2 x double>* %77
%78 = add nuw i64 %33, 16
%79 = add nuw i64 %34, 4
%80 = icmp eq i64 %79, %31
br i1 %80, label %81, label %32
81: ; preds = %32, %23
%82 = phi i64 [ 0, %23 ], [ %78, %32 ]
%83 = icmp eq i64 %28, 0
br i1 %83, label %100, label %84
84: ; preds = %81, %84
%85 = phi i64 [ %97, %84 ], [ %82, %81 ]
%86 = phi i64 [ %98, %84 ], [ 0, %81 ]
%87 = getelementptr inbounds double, double* %0, i64 %85
%88 = bitcast double* %87 to <2 x double>*
%89 = load <2 x double>, <2 x double>* %88
%90 = getelementptr inbounds double, double* %87, i64 2
%91 = bitcast double* %90 to <2 x double>*
%92 = load <2 x double>, <2 x double>* %91
%93 = getelementptr inbounds double, double* %1, i64 %85
%94 = bitcast double* %93 to <2 x double>*
store <2 x double> %89, <2 x double>* %94
%95 = getelementptr inbounds double, double* %93, i64 2
%96 = bitcast double* %95 to <2 x double>*
store <2 x double> %92, <2 x double>* %96
%97 = add nuw i64 %85, 4
%98 = add i64 %86, 1
%99 = icmp eq i64 %98, %28
br i1 %99, label %100, label %84
100: ; preds = %84, %81
%101 = icmp eq i64 %24, %15
br i1 %101, label %120, label %102
102: ; preds = %17, %14, %100
%103 = phi i64 [ 0, %17 ], [ 0, %14 ], [ %24, %100 ]
%104 = xor i64 %103, -1
%105 = add nsw i64 %104, %15
%106 = and i64 %15, 3
%107 = icmp eq i64 %106, 0
br i1 %107, label %117, label %108
108: ; preds = %102, %108
%109 = phi i64 [ %114, %108 ], [ %103, %102 ]
%110 = phi i64 [ %115, %108 ], [ 0, %102 ]
%111 = getelementptr inbounds double, double* %0, i64 %109
%112 = load double, double* %111
%113 = getelementptr inbounds double, double* %1, i64 %109
store double %112, double* %113
%114 = add nuw nsw i64 %109, 1
%115 = add i64 %110, 1
%116 = icmp eq i64 %115, %106
br i1 %116, label %117, label %108
117: ; preds = %108, %102
%118 = phi i64 [ %103, %102 ], [ %114, %108 ]
%119 = icmp ult i64 %105, 3
br i1 %119, label %120, label %121
120: ; preds = %117, %121, %100, %3
ret double* %1
121: ; preds = %117, %121
%122 = phi i64 [ %138, %121 ], [ %118, %117 ]
%123 = getelementptr inbounds double, double* %0, i64 %122
%124 = load double, double* %123
%125 = getelementptr inbounds double, double* %1, i64 %122
store double %124, double* %125
%126 = add nuw nsw i64 %122, 1
%127 = getelementptr inbounds double, double* %0, i64 %126
%128 = load double, double* %127
%129 = getelementptr inbounds double, double* %1, i64 %126
store double %128, double* %129
%130 = add nuw nsw i64 %122, 2
%131 = getelementptr inbounds double, double* %0, i64 %130
%132 = load double, double* %131
%133 = getelementptr inbounds double, double* %1, i64 %130
store double %132, double* %133
%134 = add nuw nsw i64 %122, 3
%135 = getelementptr inbounds double, double* %0, i64 %134
%136 = load double, double* %135
%137 = getelementptr inbounds double, double* %1, i64 %134
store double %136, double* %137
%138 = add nuw nsw i64 %122, 4
%139 = icmp eq i64 %138, %15
br i1 %139, label %120, label %121
}