void recover_cached_full_array_(double *array, int *alen,
                                double **pointer_val) {
  double *ptr;
  int i;
  ptr = *pointer_val;
  for (i = 0; i < *alen; i++) {
    array[i] = ptr[i];
  }
  return;
}


x86 assembly (clang, -O0):
<recover_cached_full_array_>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    1159 <recover_cached_full_array_+0x59>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1122 <recover_cached_full_array_+0x22>
pop    %rbp
ret

x86 assembly (clang, -O2):
<recover_cached_full_array_>:
mov    (%rsi),%r9d
test   %r9d,%r9d
jle    1276 <recover_cached_full_array_+0x176>
mov    (%rdx),%rcx
cmp    $0x4,%r9d
jb     1127 <recover_cached_full_array_+0x27>
lea    (%rcx,%r9,8),%rax
cmp    %rdi,%rax
jbe    119c <recover_cached_full_array_+0x9c>
lea    (%rdi,%r9,8),%rax
cmp    %rax,%rcx
jae    119c <recover_cached_full_array_+0x9c>
xor    %edx,%edx
mov    %rdx,%rax
not    %rax
add    %r9,%rax
mov    %r9,%rsi
and    $0x3,%rsi
je     1154 <recover_cached_full_array_+0x54>
nopl   0x0(%rax,%rax,1)
movsd  (%rcx,%rdx,8),%xmm0
movsd  %xmm0,(%rdi,%rdx,8)
add    $0x1,%rdx
add    $0xffffffffffffffff,%rsi
jne    1140 <recover_cached_full_array_+0x40>
cmp    $0x3,%rax
jb     1276 <recover_cached_full_array_+0x176>
xchg   %ax,%ax
movsd  (%rcx,%rdx,8),%xmm0
movsd  %xmm0,(%rdi,%rdx,8)
movsd  0x8(%rcx,%rdx,8),%xmm0
movsd  %xmm0,0x8(%rdi,%rdx,8)
movsd  0x10(%rcx,%rdx,8),%xmm0
movsd  %xmm0,0x10(%rdi,%rdx,8)
movsd  0x18(%rcx,%rdx,8),%xmm0
movsd  %xmm0,0x18(%rdi,%rdx,8)
add    $0x4,%rdx
cmp    %rdx,%r9
jne    1160 <recover_cached_full_array_+0x60>
jmp    1276 <recover_cached_full_array_+0x176>
mov    %r9d,%edx
and    $0xfffffffc,%edx
lea    -0x4(%rdx),%rax
mov    %rax,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %esi,%r8d
and    $0x3,%r8d
cmp    $0xc,%rax
jae    11c2 <recover_cached_full_array_+0xc2>
xor    %eax,%eax
jmp    1228 <recover_cached_full_array_+0x128>
and    $0xfffffffffffffffc,%rsi
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movups (%rcx,%rax,8),%xmm0
movups 0x10(%rcx,%rax,8),%xmm1
movups %xmm0,(%rdi,%rax,8)
movups %xmm1,0x10(%rdi,%rax,8)
movups 0x20(%rcx,%rax,8),%xmm0
movups 0x30(%rcx,%rax,8),%xmm1
movups %xmm0,0x20(%rdi,%rax,8)
movups %xmm1,0x30(%rdi,%rax,8)
movups 0x40(%rcx,%rax,8),%xmm0
movups 0x50(%rcx,%rax,8),%xmm1
movups %xmm0,0x40(%rdi,%rax,8)
movups %xmm1,0x50(%rdi,%rax,8)
movups 0x60(%rcx,%rax,8),%xmm0
movups 0x70(%rcx,%rax,8),%xmm1
movups %xmm0,0x60(%rdi,%rax,8)
movups %xmm1,0x70(%rdi,%rax,8)
add    $0x10,%rax
add    $0xfffffffffffffffc,%rsi
jne    11d0 <recover_cached_full_array_+0xd0>
test   %r8,%r8
je     126d <recover_cached_full_array_+0x16d>
lea    (%rdi,%rax,8),%r10
add    $0x10,%r10
lea    (%rcx,%rax,8),%rax
add    $0x10,%rax
shl    $0x5,%r8
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups -0x10(%rax,%rsi,1),%xmm0
movups (%rax,%rsi,1),%xmm1
movups %xmm0,-0x10(%r10,%rsi,1)
movups %xmm1,(%r10,%rsi,1)
add    $0x20,%rsi
cmp    %rsi,%r8
jne    1250 <recover_cached_full_array_+0x150>
cmp    %r9,%rdx
jne    1129 <recover_cached_full_array_+0x29>
ret

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

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