#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 */
int /*<<< orphan*/ assert(double *);
void vectord_add_inplace(double *self, size_t size, double value) {
  assert(self);
  for (size_t i = 0; i < size; i++)
    self[i] += value;
}


x86 assembly (clang, -O0):
<vectord_add_inplace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    116c <vectord_add_inplace+0x5c>
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1136 <vectord_add_inplace+0x26>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vectord_add_inplace>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movapd %xmm0,(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <assert@plt>
movapd (%rsp),%xmm5
test   %r14,%r14
je     1207 <vectord_add_inplace+0xf7>
cmp    $0x4,%r14
jae    1142 <vectord_add_inplace+0x32>
xor    %eax,%eax
jmp    11f0 <vectord_add_inplace+0xe0>
mov    %r14,%rax
and    $0xfffffffffffffffc,%rax
movapd %xmm5,%xmm0
unpcklpd %xmm5,%xmm0
lea    -0x4(%rax),%rcx
mov    %rcx,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
test   %rcx,%rcx
je     120f <vectord_add_inplace+0xff>
mov    %rdx,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movupd (%rbx,%rcx,8),%xmm1
movupd 0x10(%rbx,%rcx,8),%xmm2
movupd 0x20(%rbx,%rcx,8),%xmm3
movupd 0x30(%rbx,%rcx,8),%xmm4
addpd  %xmm0,%xmm1
addpd  %xmm0,%xmm2
movupd %xmm1,(%rbx,%rcx,8)
movupd %xmm2,0x10(%rbx,%rcx,8)
addpd  %xmm0,%xmm3
addpd  %xmm0,%xmm4
movupd %xmm3,0x20(%rbx,%rcx,8)
movupd %xmm4,0x30(%rbx,%rcx,8)
add    $0x8,%rcx
add    $0xfffffffffffffffe,%rsi
jne    1180 <vectord_add_inplace+0x70>
test   $0x1,%dl
je     11eb <vectord_add_inplace+0xdb>
movupd (%rbx,%rcx,8),%xmm1
movupd 0x10(%rbx,%rcx,8),%xmm2
addpd  %xmm0,%xmm1
addpd  %xmm0,%xmm2
movupd %xmm1,(%rbx,%rcx,8)
movupd %xmm2,0x10(%rbx,%rcx,8)
cmp    %r14,%rax
je     1207 <vectord_add_inplace+0xf7>
movsd  (%rbx,%rax,8),%xmm0
addsd  %xmm5,%xmm0
movsd  %xmm0,(%rbx,%rax,8)
add    $0x1,%rax
cmp    %rax,%r14
jne    11f0 <vectord_add_inplace+0xe0>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret
xor    %ecx,%ecx
test   $0x1,%dl
jne    11cd <vectord_add_inplace+0xbd>
jmp    11eb <vectord_add_inplace+0xdb>

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

LLVM IR (-O2):
define void @vectord_add_inplace(double* %0, i64 %1, double %2) {
%4 = tail call i32 @assert(double* %0)
%5 = icmp eq i64 %1, 0
br i1 %5, label %66, label %6
6: ; preds = %3
%7 = icmp ult i64 %1, 4
br i1 %7, label %64, label %8
8: ; preds = %6
%9 = and i64 %1, -4
%10 = insertelement <2 x double> poison, double %2, i64 0
%11 = shufflevector <2 x double> %10, <2 x double> poison, <2 x i32> zeroinitializer
%12 = insertelement <2 x double> poison, double %2, i64 0
%13 = shufflevector <2 x double> %12, <2 x double> poison, <2 x i32> zeroinitializer
%14 = add i64 %9, -4
%15 = lshr exact i64 %14, 2
%16 = add nuw nsw i64 %15, 1
%17 = and i64 %16, 1
%18 = icmp eq i64 %14, 0
br i1 %18, label %48, label %19
19: ; preds = %8
%20 = and i64 %16, 9223372036854775806
br label %21
21: ; preds = %21, %19
%22 = phi i64 [ 0, %19 ], [ %45, %21 ]
%23 = phi i64 [ 0, %19 ], [ %46, %21 ]
%24 = getelementptr inbounds double, double* %0, i64 %22
%25 = bitcast double* %24 to <2 x double>*
%26 = load <2 x double>, <2 x double>* %25
%27 = getelementptr inbounds double, double* %24, i64 2
%28 = bitcast double* %27 to <2 x double>*
%29 = load <2 x double>, <2 x double>* %28
%30 = fadd <2 x double> %26, %11
%31 = fadd <2 x double> %29, %13
%32 = bitcast double* %24 to <2 x double>*
store <2 x double> %30, <2 x double>* %32
%33 = bitcast double* %27 to <2 x double>*
store <2 x double> %31, <2 x double>* %33
%34 = or i64 %22, 4
%35 = getelementptr inbounds double, double* %0, i64 %34
%36 = bitcast double* %35 to <2 x double>*
%37 = load <2 x double>, <2 x double>* %36
%38 = getelementptr inbounds double, double* %35, i64 2
%39 = bitcast double* %38 to <2 x double>*
%40 = load <2 x double>, <2 x double>* %39
%41 = fadd <2 x double> %37, %11
%42 = fadd <2 x double> %40, %13
%43 = bitcast double* %35 to <2 x double>*
store <2 x double> %41, <2 x double>* %43
%44 = bitcast double* %38 to <2 x double>*
store <2 x double> %42, <2 x double>* %44
%45 = add nuw i64 %22, 8
%46 = add i64 %23, 2
%47 = icmp eq i64 %46, %20
br i1 %47, label %48, label %21
48: ; preds = %21, %8
%49 = phi i64 [ 0, %8 ], [ %45, %21 ]
%50 = icmp eq i64 %17, 0
br i1 %50, label %62, label %51
51: ; preds = %48
%52 = getelementptr inbounds double, double* %0, i64 %49
%53 = bitcast double* %52 to <2 x double>*
%54 = load <2 x double>, <2 x double>* %53
%55 = getelementptr inbounds double, double* %52, i64 2
%56 = bitcast double* %55 to <2 x double>*
%57 = load <2 x double>, <2 x double>* %56
%58 = fadd <2 x double> %54, %11
%59 = fadd <2 x double> %57, %13
%60 = bitcast double* %52 to <2 x double>*
store <2 x double> %58, <2 x double>* %60
%61 = bitcast double* %55 to <2 x double>*
store <2 x double> %59, <2 x double>* %61
br label %62
62: ; preds = %48, %51
%63 = icmp eq i64 %9, %1
br i1 %63, label %66, label %64
64: ; preds = %6, %62
%65 = phi i64 [ 0, %6 ], [ %9, %62 ]
br label %67
66: ; preds = %67, %62, %3
ret void
67: ; preds = %64, %67
%68 = phi i64 [ %72, %67 ], [ %65, %64 ]
%69 = getelementptr inbounds double, double* %0, i64 %68
%70 = load double, double* %69
%71 = fadd double %70, %2
store double %71, double* %69
%72 = add nuw i64 %68, 1
%73 = icmp eq i64 %72, %1
br i1 %73, label %66, label %67
}