#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 */
size_t read_double(double const *y, double *v, size_t c) {
  size_t n;
  for (n = c; n > 0; --n)
    *v++ = *y++;
  return c;
}


x86 assembly (clang, -O0):
<read_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jbe    115a <read_double+0x5a>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    1118 <read_double+0x18>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_double>:
mov    %rdx,%rax
test   %rdx,%rdx
je     12b2 <read_double+0x1b2>
cmp    $0x4,%rax
jb     112c <read_double+0x2c>
lea    (%rdi,%rax,8),%rcx
cmp    %rsi,%rcx
jbe    11dc <read_double+0xdc>
lea    (%rsi,%rax,8),%rcx
cmp    %rdi,%rcx
jbe    11dc <read_double+0xdc>
mov    %rax,%rdx
lea    -0x1(%rdx),%r8
mov    %rdx,%rcx
and    $0x7,%rcx
je     115a <read_double+0x5a>
nopl   0x0(%rax)
movsd  (%rdi),%xmm0
add    $0x8,%rdi
movsd  %xmm0,(%rsi)
add    $0x8,%rsi
add    $0xffffffffffffffff,%rdx
add    $0xffffffffffffffff,%rcx
jne    1140 <read_double+0x40>
cmp    $0x7,%r8
jb     12b2 <read_double+0x1b2>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
movsd  (%rdi,%rcx,8),%xmm0
movsd  %xmm0,(%rsi,%rcx,8)
movsd  0x8(%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x8(%rsi,%rcx,8)
movsd  0x10(%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x10(%rsi,%rcx,8)
movsd  0x18(%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x18(%rsi,%rcx,8)
movsd  0x20(%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x20(%rsi,%rcx,8)
movsd  0x28(%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x28(%rsi,%rcx,8)
movsd  0x30(%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x30(%rsi,%rcx,8)
movsd  0x38(%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x38(%rsi,%rcx,8)
add    $0x8,%rcx
cmp    %rcx,%rdx
jne    1170 <read_double+0x70>
jmp    12b2 <read_double+0x1b2>
mov    %rax,%r8
and    $0xfffffffffffffffc,%r8
lea    -0x4(%r8),%rdx
mov    %rdx,%rcx
shr    $0x2,%rcx
add    $0x1,%rcx
mov    %ecx,%r9d
and    $0x3,%r9d
cmp    $0xc,%rdx
jae    1203 <read_double+0x103>
xor    %edx,%edx
jmp    1268 <read_double+0x168>
and    $0xfffffffffffffffc,%rcx
xor    %edx,%edx
nopl   0x0(%rax)
movups (%rdi,%rdx,8),%xmm0
movups 0x10(%rdi,%rdx,8),%xmm1
movups %xmm0,(%rsi,%rdx,8)
movups %xmm1,0x10(%rsi,%rdx,8)
movups 0x20(%rdi,%rdx,8),%xmm0
movups 0x30(%rdi,%rdx,8),%xmm1
movups %xmm0,0x20(%rsi,%rdx,8)
movups %xmm1,0x30(%rsi,%rdx,8)
movups 0x40(%rdi,%rdx,8),%xmm0
movups 0x50(%rdi,%rdx,8),%xmm1
movups %xmm0,0x40(%rsi,%rdx,8)
movups %xmm1,0x50(%rsi,%rdx,8)
movups 0x60(%rdi,%rdx,8),%xmm0
movups 0x70(%rdi,%rdx,8),%xmm1
movups %xmm0,0x60(%rsi,%rdx,8)
movups %xmm1,0x70(%rsi,%rdx,8)
add    $0x10,%rdx
add    $0xfffffffffffffffc,%rcx
jne    1210 <read_double+0x110>
test   %r9,%r9
je     12ad <read_double+0x1ad>
lea    (%rsi,%rdx,8),%r10
add    $0x10,%r10
lea    (%rdi,%rdx,8),%rdx
add    $0x10,%rdx
shl    $0x5,%r9
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups -0x10(%rdx,%rcx,1),%xmm0
movups (%rdx,%rcx,1),%xmm1
movups %xmm0,-0x10(%r10,%rcx,1)
movups %xmm1,(%r10,%rcx,1)
add    $0x20,%rcx
cmp    %rcx,%r9
jne    1290 <read_double+0x190>
cmp    %rax,%r8
jne    12b3 <read_double+0x1b3>
ret
mov    %eax,%edx
and    $0x3,%edx
lea    (%rdi,%r8,8),%rdi
lea    (%rsi,%r8,8),%rsi
jmp    112f <read_double+0x2f>

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

LLVM IR (-O2):
define i64 @read_double(double* nocapture %0, double* nocapture writeonly %1, i64 returned %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %148, label %5
5: ; preds = %3
%6 = icmp ult i64 %2, 4
br i1 %6, label %95, label %7
7: ; preds = %5
%8 = getelementptr double, double* %1, i64 %2
%9 = getelementptr double, double* %0, i64 %2
%10 = icmp ugt double* %9, %1
%11 = icmp ugt double* %8, %0
%12 = and i1 %10, %11
br i1 %12, label %95, label %13
13: ; preds = %7
%14 = and i64 %2, -4
%15 = and i64 %2, 3
%16 = getelementptr double, double* %0, i64 %14
%17 = getelementptr double, double* %1, i64 %14
%18 = add i64 %14, -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 = %13
%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 double, double* %0, i64 %26
%29 = getelementptr double, double* %1, i64 %26
%30 = bitcast double* %28 to <2 x double>*
%31 = load <2 x double>, <2 x double>* %30
%32 = getelementptr double, double* %28, i64 2
%33 = bitcast double* %32 to <2 x double>*
%34 = load <2 x double>, <2 x double>* %33
%35 = bitcast double* %29 to <2 x double>*
store <2 x double> %31, <2 x double>* %35
%36 = getelementptr double, double* %29, i64 2
%37 = bitcast double* %36 to <2 x double>*
store <2 x double> %34, <2 x double>* %37
%38 = or i64 %26, 4
%39 = getelementptr double, double* %0, i64 %38
%40 = getelementptr double, double* %1, i64 %38
%41 = bitcast double* %39 to <2 x double>*
%42 = load <2 x double>, <2 x double>* %41
%43 = getelementptr double, double* %39, i64 2
%44 = bitcast double* %43 to <2 x double>*
%45 = load <2 x double>, <2 x double>* %44
%46 = bitcast double* %40 to <2 x double>*
store <2 x double> %42, <2 x double>* %46
%47 = getelementptr double, double* %40, i64 2
%48 = bitcast double* %47 to <2 x double>*
store <2 x double> %45, <2 x double>* %48
%49 = or i64 %26, 8
%50 = getelementptr double, double* %0, i64 %49
%51 = getelementptr double, double* %1, i64 %49
%52 = bitcast double* %50 to <2 x double>*
%53 = load <2 x double>, <2 x double>* %52
%54 = getelementptr double, double* %50, i64 2
%55 = bitcast double* %54 to <2 x double>*
%56 = load <2 x double>, <2 x double>* %55
%57 = bitcast double* %51 to <2 x double>*
store <2 x double> %53, <2 x double>* %57
%58 = getelementptr double, double* %51, i64 2
%59 = bitcast double* %58 to <2 x double>*
store <2 x double> %56, <2 x double>* %59
%60 = or i64 %26, 12
%61 = getelementptr double, double* %0, i64 %60
%62 = getelementptr double, double* %1, i64 %60
%63 = bitcast double* %61 to <2 x double>*
%64 = load <2 x double>, <2 x double>* %63
%65 = getelementptr double, double* %61, i64 2
%66 = bitcast double* %65 to <2 x double>*
%67 = load <2 x double>, <2 x double>* %66
%68 = bitcast double* %62 to <2 x double>*
store <2 x double> %64, <2 x double>* %68
%69 = getelementptr double, double* %62, i64 2
%70 = bitcast double* %69 to <2 x double>*
store <2 x double> %67, <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, %13
%75 = phi i64 [ 0, %13 ], [ %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 double, double* %0, i64 %78
%81 = getelementptr double, double* %1, i64 %78
%82 = bitcast double* %80 to <2 x double>*
%83 = load <2 x double>, <2 x double>* %82
%84 = getelementptr double, double* %80, i64 2
%85 = bitcast double* %84 to <2 x double>*
%86 = load <2 x double>, <2 x double>* %85
%87 = bitcast double* %81 to <2 x double>*
store <2 x double> %83, <2 x double>* %87
%88 = getelementptr double, double* %81, i64 2
%89 = bitcast double* %88 to <2 x double>*
store <2 x double> %86, <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 %14, %2
br i1 %94, label %148, label %95
95: ; preds = %7, %5, %93
%96 = phi i64 [ %2, %7 ], [ %2, %5 ], [ %15, %93 ]
%97 = phi double* [ %0, %7 ], [ %0, %5 ], [ %16, %93 ]
%98 = phi double* [ %1, %7 ], [ %1, %5 ], [ %17, %93 ]
%99 = add i64 %96, -1
%100 = and i64 %96, 7
%101 = icmp eq i64 %100, 0
br i1 %101, label %113, label %102
102: ; preds = %95, %102
%103 = phi i64 [ %110, %102 ], [ %96, %95 ]
%104 = phi double* [ %107, %102 ], [ %97, %95 ]
%105 = phi double* [ %109, %102 ], [ %98, %95 ]
%106 = phi i64 [ %111, %102 ], [ 0, %95 ]
%107 = getelementptr inbounds double, double* %104, i64 1
%108 = load double, double* %104
%109 = getelementptr inbounds double, double* %105, i64 1
store double %108, double* %105
%110 = add i64 %103, -1
%111 = add i64 %106, 1
%112 = icmp eq i64 %111, %100
br i1 %112, label %113, label %102
113: ; preds = %102, %95
%114 = phi i64 [ %96, %95 ], [ %110, %102 ]
%115 = phi double* [ %97, %95 ], [ %107, %102 ]
%116 = phi double* [ %98, %95 ], [ %109, %102 ]
%117 = icmp ult i64 %99, 7
br i1 %117, label %148, label %118
118: ; preds = %113, %118
%119 = phi i64 [ %146, %118 ], [ %114, %113 ]
%120 = phi double* [ %143, %118 ], [ %115, %113 ]
%121 = phi double* [ %145, %118 ], [ %116, %113 ]
%122 = getelementptr inbounds double, double* %120, i64 1
%123 = load double, double* %120
%124 = getelementptr inbounds double, double* %121, i64 1
store double %123, double* %121
%125 = getelementptr inbounds double, double* %120, i64 2
%126 = load double, double* %122
%127 = getelementptr inbounds double, double* %121, i64 2
store double %126, double* %124
%128 = getelementptr inbounds double, double* %120, i64 3
%129 = load double, double* %125
%130 = getelementptr inbounds double, double* %121, i64 3
store double %129, double* %127
%131 = getelementptr inbounds double, double* %120, i64 4
%132 = load double, double* %128
%133 = getelementptr inbounds double, double* %121, i64 4
store double %132, double* %130
%134 = getelementptr inbounds double, double* %120, i64 5
%135 = load double, double* %131
%136 = getelementptr inbounds double, double* %121, i64 5
store double %135, double* %133
%137 = getelementptr inbounds double, double* %120, i64 6
%138 = load double, double* %134
%139 = getelementptr inbounds double, double* %121, i64 6
store double %138, double* %136
%140 = getelementptr inbounds double, double* %120, i64 7
%141 = load double, double* %137
%142 = getelementptr inbounds double, double* %121, i64 7
store double %141, double* %139
%143 = getelementptr inbounds double, double* %120, i64 8
%144 = load double, double* %140
%145 = getelementptr inbounds double, double* %121, i64 8
store double %144, double* %142
%146 = add i64 %119, -8
%147 = icmp eq i64 %146, 0
br i1 %147, label %148, label %118
148: ; preds = %113, %118, %93, %3
ret i64 %2
}