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


x86 assembly (clang, -O0):
<read_double_null>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jbe    118b <read_double_null+0x8b>
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)
movsd  -0x20(%rbp),%xmm0
movsd  0xea5(%rip),%xmm2
movaps %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    111d <read_double_null+0x1d>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_double_null>:
mov    %rdx,%rax
test   %rdx,%rdx
je     11db <read_double_null+0xdb>
lea    -0x1(%rax),%r8
mov    %rax,%rdx
and    $0x3,%rdx
je     115f <read_double_null+0x5f>
movsd  0xedf(%rip),%xmm1
mov    %rax,%rcx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movapd %xmm0,%xmm2
movsd  (%rdi),%xmm3
add    $0x8,%rdi
movsd  %xmm3,(%rsi)
addsd  %xmm1,%xmm0
movsd  %xmm2,0x8(%rsi)
add    $0x10,%rsi
add    $0xffffffffffffffff,%rcx
add    $0xffffffffffffffff,%rdx
jne    1130 <read_double_null+0x30>
cmp    $0x3,%r8
jae    1168 <read_double_null+0x68>
jmp    11db <read_double_null+0xdb>
mov    %rax,%rcx
cmp    $0x3,%r8
jb     11db <read_double_null+0xdb>
xor    %edx,%edx
movsd  0xe8e(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rdi,%rdx,8),%xmm2
movsd  %xmm2,(%rsi)
movsd  %xmm0,0x8(%rsi)
addsd  %xmm1,%xmm0
movsd  0x8(%rdi,%rdx,8),%xmm2
movsd  %xmm2,0x10(%rsi)
movsd  %xmm0,0x18(%rsi)
addsd  %xmm1,%xmm0
movsd  0x10(%rdi,%rdx,8),%xmm2
movsd  %xmm2,0x20(%rsi)
movsd  %xmm0,0x28(%rsi)
addsd  %xmm1,%xmm0
movsd  0x18(%rdi,%rdx,8),%xmm2
movsd  %xmm2,0x30(%rsi)
movsd  %xmm0,0x38(%rsi)
addsd  %xmm1,%xmm0
add    $0x4,%rdx
add    $0x40,%rsi
cmp    %rdx,%rcx
jne    1180 <read_double_null+0x80>
ret

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

LLVM IR (-O2):
define i64 @read_double_null(double* nocapture %0, double* nocapture writeonly %1, i64 returned %2, double %3) {
%5 = icmp eq i64 %2, 0
br i1 %5, label %57, label %6
6: ; preds = %4
%7 = add i64 %2, -1
%8 = and i64 %2, 3
%9 = icmp eq i64 %8, 0
br i1 %9, label %24, label %10
10: ; preds = %6, %10
%11 = phi i64 [ %21, %10 ], [ %2, %6 ]
%12 = phi double [ %19, %10 ], [ %3, %6 ]
%13 = phi double* [ %16, %10 ], [ %0, %6 ]
%14 = phi double* [ %20, %10 ], [ %1, %6 ]
%15 = phi i64 [ %22, %10 ], [ 0, %6 ]
%16 = getelementptr inbounds double, double* %13, i64 1
%17 = load double, double* %13
%18 = getelementptr inbounds double, double* %14, i64 1
store double %17, double* %14
%19 = fadd double %12, 1.000000e+00
%20 = getelementptr inbounds double, double* %14, i64 2
store double %12, double* %18
%21 = add i64 %11, -1
%22 = add i64 %15, 1
%23 = icmp eq i64 %22, %8
br i1 %23, label %24, label %10
24: ; preds = %10, %6
%25 = phi i64 [ %2, %6 ], [ %21, %10 ]
%26 = phi double [ %3, %6 ], [ %19, %10 ]
%27 = phi double* [ %0, %6 ], [ %16, %10 ]
%28 = phi double* [ %1, %6 ], [ %20, %10 ]
%29 = icmp ult i64 %7, 3
br i1 %29, label %57, label %30
30: ; preds = %24, %30
%31 = phi i64 [ %55, %30 ], [ %25, %24 ]
%32 = phi double [ %53, %30 ], [ %26, %24 ]
%33 = phi double* [ %50, %30 ], [ %27, %24 ]
%34 = phi double* [ %54, %30 ], [ %28, %24 ]
%35 = getelementptr inbounds double, double* %33, i64 1
%36 = load double, double* %33
%37 = getelementptr inbounds double, double* %34, i64 1
store double %36, double* %34
%38 = fadd double %32, 1.000000e+00
%39 = getelementptr inbounds double, double* %34, i64 2
store double %32, double* %37
%40 = getelementptr inbounds double, double* %33, i64 2
%41 = load double, double* %35
%42 = getelementptr inbounds double, double* %34, i64 3
store double %41, double* %39
%43 = fadd double %38, 1.000000e+00
%44 = getelementptr inbounds double, double* %34, i64 4
store double %38, double* %42
%45 = getelementptr inbounds double, double* %33, i64 3
%46 = load double, double* %40
%47 = getelementptr inbounds double, double* %34, i64 5
store double %46, double* %44
%48 = fadd double %43, 1.000000e+00
%49 = getelementptr inbounds double, double* %34, i64 6
store double %43, double* %47
%50 = getelementptr inbounds double, double* %33, i64 4
%51 = load double, double* %45
%52 = getelementptr inbounds double, double* %34, i64 7
store double %51, double* %49
%53 = fadd double %48, 1.000000e+00
%54 = getelementptr inbounds double, double* %34, i64 8
store double %48, double* %52
%55 = add i64 %31, -4
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %30
57: ; preds = %24, %30, %4
ret i64 %2
}