#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 */
void entrywise_sum(double dest[], double op1[], double op2[], size_t len) {
  for (int i = 0; i < len; i++) {
    dest[i] = op1[i] + op2[i];
  }
}


x86 assembly (clang, -O0):
<entrywise_sum>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    115e <entrywise_sum+0x5e>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    111b <entrywise_sum+0x1b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<entrywise_sum>:
test   %rcx,%rcx
je     12c9 <entrywise_sum+0x1c9>
cmp    $0x4,%rcx
jae    11b3 <entrywise_sum+0xb3>
xor    %eax,%eax
mov    %rax,%r8
not    %r8
add    %rcx,%r8
mov    %rcx,%r9
and    $0x3,%r9
je     1149 <entrywise_sum+0x49>
nopw   0x0(%rax,%rax,1)
movsd  (%rsi,%rax,8),%xmm0
addsd  (%rdx,%rax,8),%xmm0
movsd  %xmm0,(%rdi,%rax,8)
add    $0x1,%rax
add    $0xffffffffffffffff,%r9
jne    1130 <entrywise_sum+0x30>
cmp    $0x3,%r8
jb     12c9 <entrywise_sum+0x1c9>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rsi,%rax,8),%xmm0
addsd  (%rdx,%rax,8),%xmm0
movsd  %xmm0,(%rdi,%rax,8)
movsd  0x8(%rsi,%rax,8),%xmm0
addsd  0x8(%rdx,%rax,8),%xmm0
movsd  %xmm0,0x8(%rdi,%rax,8)
movsd  0x10(%rsi,%rax,8),%xmm0
addsd  0x10(%rdx,%rax,8),%xmm0
movsd  %xmm0,0x10(%rdi,%rax,8)
movsd  0x18(%rsi,%rax,8),%xmm0
addsd  0x18(%rdx,%rax,8),%xmm0
movsd  %xmm0,0x18(%rdi,%rax,8)
add    $0x4,%rax
cmp    %rax,%rcx
jne    1160 <entrywise_sum+0x60>
jmp    12c9 <entrywise_sum+0x1c9>
lea    (%rdi,%rcx,8),%r9
lea    (%rsi,%rcx,8),%rax
cmp    %rdi,%rax
seta   %r10b
lea    (%rdx,%rcx,8),%rax
cmp    %rsi,%r9
seta   %r11b
cmp    %rdi,%rax
seta   %r8b
cmp    %rdx,%r9
seta   %r9b
xor    %eax,%eax
test   %r11b,%r10b
jne    1115 <entrywise_sum+0x15>
and    %r9b,%r8b
jne    1115 <entrywise_sum+0x15>
mov    %rcx,%rax
and    $0xfffffffffffffffc,%rax
lea    -0x4(%rax),%r8
mov    %r8,%r9
shr    $0x2,%r9
add    $0x1,%r9
test   %r8,%r8
je     12ca <entrywise_sum+0x1ca>
mov    %r9,%r10
and    $0xfffffffffffffffe,%r10
xor    %r8d,%r8d
nopl   0x0(%rax,%rax,1)
movupd (%rsi,%r8,8),%xmm0
movupd 0x10(%rsi,%r8,8),%xmm1
movupd (%rdx,%r8,8),%xmm2
addpd  %xmm0,%xmm2
movupd 0x10(%rdx,%r8,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,(%rdi,%r8,8)
movupd %xmm0,0x10(%rdi,%r8,8)
movupd 0x20(%rsi,%r8,8),%xmm0
movupd 0x30(%rsi,%r8,8),%xmm1
movupd 0x20(%rdx,%r8,8),%xmm2
addpd  %xmm0,%xmm2
movupd 0x30(%rdx,%r8,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,0x20(%rdi,%r8,8)
movupd %xmm0,0x30(%rdi,%r8,8)
add    $0x8,%r8
add    $0xfffffffffffffffe,%r10
jne    1220 <entrywise_sum+0x120>
test   $0x1,%r9b
je     12c0 <entrywise_sum+0x1c0>
movupd (%rsi,%r8,8),%xmm0
movupd 0x10(%rsi,%r8,8),%xmm1
movupd (%rdx,%r8,8),%xmm2
addpd  %xmm0,%xmm2
movupd 0x10(%rdx,%r8,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,(%rdi,%r8,8)
movupd %xmm0,0x10(%rdi,%r8,8)
cmp    %rcx,%rax
jne    1115 <entrywise_sum+0x15>
ret
xor    %r8d,%r8d
test   $0x1,%r9b
jne    1291 <entrywise_sum+0x191>
jmp    12c0 <entrywise_sum+0x1c0>

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

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