void copy_sincos(int numt, double sinx0[], double cosx0[], double sinx[],
                 double cosx[]) {
  int i;
  for (i = 0; i < numt; i++) {
    sinx[i] = sinx0[i];
    cosx[i] = cosx0[i];
  }
}


x86 assembly (clang, -O0):
<copy_sincos>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    116c <copy_sincos+0x6c>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    111e <copy_sincos+0x1e>
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_sincos>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %edi,%edi
jle    12cf <copy_sincos+0x1cf>
mov    %edi,%r9d
cmp    $0x4,%edi
jae    118c <copy_sincos+0x8c>
xor    %edi,%edi
mov    %rdi,%rax
not    %rax
test   $0x1,%r9b
je     1141 <copy_sincos+0x41>
movsd  (%rsi,%rdi,8),%xmm0
movsd  %xmm0,(%rcx,%rdi,8)
movsd  (%rdx,%rdi,8),%xmm0
movsd  %xmm0,(%r8,%rdi,8)
or     $0x1,%rdi
add    %r9,%rax
je     12cf <copy_sincos+0x1cf>
nopw   0x0(%rax,%rax,1)
movsd  (%rsi,%rdi,8),%xmm0
movsd  %xmm0,(%rcx,%rdi,8)
movsd  (%rdx,%rdi,8),%xmm0
movsd  %xmm0,(%r8,%rdi,8)
movsd  0x8(%rsi,%rdi,8),%xmm0
movsd  %xmm0,0x8(%rcx,%rdi,8)
movsd  0x8(%rdx,%rdi,8),%xmm0
movsd  %xmm0,0x8(%r8,%rdi,8)
add    $0x2,%rdi
cmp    %rdi,%r9
jne    1150 <copy_sincos+0x50>
jmp    12cf <copy_sincos+0x1cf>
lea    (%r8,%r9,8),%rdi
cmp    %rcx,%rdi
seta   -0x1(%rsp)
lea    (%rcx,%r9,8),%rbx
cmp    %r8,%rbx
seta   %r12b
lea    (%rsi,%r9,8),%rbp
cmp    %rcx,%rbp
seta   %al
cmp    %rsi,%rbx
seta   %r15b
lea    (%rdx,%r9,8),%r14
cmp    %rcx,%r14
seta   %r10b
cmp    %rdx,%rbx
seta   %r13b
cmp    %r8,%rbp
seta   %r11b
cmp    %rsi,%rdi
seta   %bpl
cmp    %r8,%r14
seta   %bl
cmp    %rdx,%rdi
seta   %r14b
xor    %edi,%edi
test   %r12b,-0x1(%rsp)
jne    111c <copy_sincos+0x1c>
and    %r15b,%al
jne    111c <copy_sincos+0x1c>
and    %r13b,%r10b
jne    111c <copy_sincos+0x1c>
and    %bpl,%r11b
jne    111c <copy_sincos+0x1c>
and    %r14b,%bl
jne    111c <copy_sincos+0x1c>
mov    %r9d,%edi
and    $0xfffffffc,%edi
lea    -0x4(%rdi),%rax
mov    %rax,%r10
shr    $0x2,%r10
add    $0x1,%r10
test   %rax,%rax
je     12da <copy_sincos+0x1da>
mov    %r10,%r11
and    $0xfffffffffffffffe,%r11
xor    %eax,%eax
nopl   0x0(%rax)
movups (%rsi,%rax,8),%xmm0
movups 0x10(%rsi,%rax,8),%xmm1
movups %xmm0,(%rcx,%rax,8)
movups %xmm1,0x10(%rcx,%rax,8)
movups (%rdx,%rax,8),%xmm0
movups 0x10(%rdx,%rax,8),%xmm1
movups %xmm0,(%r8,%rax,8)
movups %xmm1,0x10(%r8,%rax,8)
movups 0x20(%rsi,%rax,8),%xmm0
movups 0x30(%rsi,%rax,8),%xmm1
movups %xmm0,0x20(%rcx,%rax,8)
movups %xmm1,0x30(%rcx,%rax,8)
movups 0x20(%rdx,%rax,8),%xmm0
movups 0x30(%rdx,%rax,8),%xmm1
movups %xmm0,0x20(%r8,%rax,8)
movups %xmm1,0x30(%r8,%rax,8)
add    $0x8,%rax
add    $0xfffffffffffffffe,%r11
jne    1240 <copy_sincos+0x140>
test   $0x1,%r10b
je     12c6 <copy_sincos+0x1c6>
movups (%rsi,%rax,8),%xmm0
movups 0x10(%rsi,%rax,8),%xmm1
movups %xmm0,(%rcx,%rax,8)
movups %xmm1,0x10(%rcx,%rax,8)
movups (%rdx,%rax,8),%xmm0
movups 0x10(%rdx,%rax,8),%xmm1
movups %xmm0,(%r8,%rax,8)
movups %xmm1,0x10(%r8,%rax,8)
cmp    %r9,%rdi
jne    111c <copy_sincos+0x1c>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
test   $0x1,%r10b
jne    12a0 <copy_sincos+0x1a0>
jmp    12c6 <copy_sincos+0x1c6>

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

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