void wkeep_1D_left(double *sigIn, int sigInLength, double *sigOut,
                   int sigOutLength) {
  int count = 0;
  for (count = 0; count < sigOutLength; count++)
    sigOut[count] = sigIn[count];
  return;
}


x86 assembly (clang, -O0):
<wkeep_1D_left>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1154 <wkeep_1D_left+0x54>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1120 <wkeep_1D_left+0x20>
pop    %rbp
ret

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

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

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