#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 sg_vector_linear_operation_inner(const void *restrict ctx,
                                      const size_t _offset,
                                      double *const restrict _v0,
                                      double *const restrict _v1,
                                      double *const restrict _v2,
                                      const size_t _num_elems) {
  size_t _i;
  (void)ctx;
  for (_i = 0; _i < _num_elems; ++_i) {
    size_t index = _offset + _i;
    double *const x = _v0 + _i;
    double *const y = _v1 + _i;
    double *const z = _v2 + _i;
    (void)index;
    {
      {
        const double *const c = (const double *)ctx;
        *z = c[0] * *x + c[1] * *y;
      }
    }
  }
}


x86 assembly (clang, -O0):
<sg_vector_linear_operation_inner>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    11c1 <sg_vector_linear_operation_inner+0xc1>
mov    -0x10(%rbp),%rax
add    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x38(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x48(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x60(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x50(%rbp),%rax
mulsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x58(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1124 <sg_vector_linear_operation_inner+0x24>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sg_vector_linear_operation_inner>:
test   %r9,%r9
je     1255 <sg_vector_linear_operation_inner+0x155>
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
cmp    $0x4,%r9
jae    111f <sg_vector_linear_operation_inner+0x1f>
xor    %eax,%eax
jmp    1230 <sg_vector_linear_operation_inner+0x130>
mov    %r9,%rax
and    $0xfffffffffffffffc,%rax
movapd %xmm1,%xmm3
unpcklpd %xmm1,%xmm3
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
lea    -0x4(%rax),%rsi
mov    %rsi,%r10
shr    $0x2,%r10
add    $0x1,%r10
test   %rsi,%rsi
je     1256 <sg_vector_linear_operation_inner+0x156>
mov    %r10,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %esi,%esi
nopw   0x0(%rax,%rax,1)
movupd (%rdx,%rsi,8),%xmm4
movupd 0x10(%rdx,%rsi,8),%xmm5
movupd (%rcx,%rsi,8),%xmm6
movupd 0x10(%rcx,%rsi,8),%xmm7
mulpd  %xmm3,%xmm6
mulpd  %xmm3,%xmm7
mulpd  %xmm2,%xmm4
addpd  %xmm6,%xmm4
mulpd  %xmm2,%xmm5
addpd  %xmm7,%xmm5
movupd %xmm4,(%r8,%rsi,8)
movupd %xmm5,0x10(%r8,%rsi,8)
movupd 0x20(%rdx,%rsi,8),%xmm4
movupd 0x30(%rdx,%rsi,8),%xmm5
movupd 0x20(%rcx,%rsi,8),%xmm6
movupd 0x30(%rcx,%rsi,8),%xmm7
mulpd  %xmm3,%xmm6
mulpd  %xmm3,%xmm7
mulpd  %xmm2,%xmm4
addpd  %xmm6,%xmm4
mulpd  %xmm2,%xmm5
addpd  %xmm7,%xmm5
movupd %xmm4,0x20(%r8,%rsi,8)
movupd %xmm5,0x30(%r8,%rsi,8)
add    $0x8,%rsi
add    $0xfffffffffffffffe,%rdi
jne    1160 <sg_vector_linear_operation_inner+0x60>
test   $0x1,%r10b
je     1228 <sg_vector_linear_operation_inner+0x128>
movupd (%rdx,%rsi,8),%xmm4
movupd 0x10(%rdx,%rsi,8),%xmm5
movupd (%rcx,%rsi,8),%xmm6
movupd 0x10(%rcx,%rsi,8),%xmm7
mulpd  %xmm3,%xmm6
mulpd  %xmm3,%xmm7
mulpd  %xmm2,%xmm4
addpd  %xmm6,%xmm4
mulpd  %xmm2,%xmm5
addpd  %xmm7,%xmm5
movupd %xmm4,(%r8,%rsi,8)
movupd %xmm5,0x10(%r8,%rsi,8)
cmp    %r9,%rax
je     1255 <sg_vector_linear_operation_inner+0x155>
nopl   (%rax)
movsd  (%rcx,%rax,8),%xmm2
mulsd  %xmm1,%xmm2
movsd  (%rdx,%rax,8),%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
movsd  %xmm3,(%r8,%rax,8)
add    $0x1,%rax
cmp    %rax,%r9
jne    1230 <sg_vector_linear_operation_inner+0x130>
ret
xor    %esi,%esi
test   $0x1,%r10b
jne    11ed <sg_vector_linear_operation_inner+0xed>
jmp    1228 <sg_vector_linear_operation_inner+0x128>

LLVM IR (-O0):
define void @sg_vector_linear_operation_inner(i8* noalias %0, i64 %1, double* noalias %2, double* noalias %3, double* noalias %4, i64 %5) {
%7 = alloca i8*
%8 = alloca i64
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca double*
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
store i8* %0, i8** %7
store i64 %1, i64* %8
store double* %2, double** %9
store double* %3, double** %10
store double* %4, double** %11
store i64 %5, i64* %12
%19 = load i8*, i8** %7
store i64 0, i64* %13
br label %20
20: ; preds = %53, %6
%21 = load i64, i64* %13
%22 = load i64, i64* %12
%23 = icmp ult i64 %21, %22
br i1 %23, label %24, label %56
24: ; preds = %20
%25 = load i64, i64* %8
%26 = load i64, i64* %13
%27 = add i64 %25, %26
store i64 %27, i64* %14
%28 = load double*, double** %9
%29 = load i64, i64* %13
%30 = getelementptr inbounds double, double* %28, i64 %29
store double* %30, double** %15
%31 = load double*, double** %10
%32 = load i64, i64* %13
%33 = getelementptr inbounds double, double* %31, i64 %32
store double* %33, double** %16
%34 = load double*, double** %11
%35 = load i64, i64* %13
%36 = getelementptr inbounds double, double* %34, i64 %35
store double* %36, double** %17
%37 = load i64, i64* %14
%38 = load i8*, i8** %7
%39 = bitcast i8* %38 to double*
store double* %39, double** %18
%40 = load double*, double** %18
%41 = getelementptr inbounds double, double* %40, i64 0
%42 = load double, double* %41
%43 = load double*, double** %15
%44 = load double, double* %43
%45 = load double*, double** %18
%46 = getelementptr inbounds double, double* %45, i64 1
%47 = load double, double* %46
%48 = load double*, double** %16
%49 = load double, double* %48
%50 = fmul double %47, %49
%51 = call double @llvm.fmuladd.f64(double %42, double %44, double %50)
%52 = load double*, double** %17
store double %51, double* %52
br label %53
53: ; preds = %24
%54 = load i64, i64* %13
%55 = add i64 %54, 1
store i64 %55, i64* %13
br label %20
56: ; preds = %20
ret void
}

LLVM IR (-O2):
define void @sg_vector_linear_operation_inner(i8* noalias nocapture %0, i64 %1, double* noalias nocapture %2, double* noalias nocapture %3, double* noalias nocapture writeonly %4, i64 %5) {
%7 = icmp eq i64 %5, 0
br i1 %7, label %118, label %8
8: ; preds = %6
%9 = bitcast i8* %0 to double*
%10 = load double, double* %9
%11 = getelementptr inbounds i8, i8* %0, i64 8
%12 = bitcast i8* %11 to double*
%13 = load double, double* %12
%14 = icmp ult i64 %5, 4
br i1 %14, label %105, label %15
15: ; preds = %8
%16 = and i64 %5, -4
%17 = insertelement <2 x double> poison, double %13, i64 0
%18 = shufflevector <2 x double> %17, <2 x double> poison, <2 x i32> zeroinitializer
%19 = insertelement <2 x double> poison, double %13, i64 0
%20 = shufflevector <2 x double> %19, <2 x double> poison, <2 x i32> zeroinitializer
%21 = insertelement <2 x double> poison, double %10, i64 0
%22 = shufflevector <2 x double> %21, <2 x double> poison, <2 x i32> zeroinitializer
%23 = insertelement <2 x double> poison, double %10, i64 0
%24 = shufflevector <2 x double> %23, <2 x double> poison, <2 x i32> zeroinitializer
%25 = add i64 %16, -4
%26 = lshr exact i64 %25, 2
%27 = add nuw nsw i64 %26, 1
%28 = and i64 %27, 1
%29 = icmp eq i64 %25, 0
br i1 %29, label %79, label %30
30: ; preds = %15
%31 = and i64 %27, 9223372036854775806
br label %32
32: ; preds = %32, %30
%33 = phi i64 [ 0, %30 ], [ %76, %32 ]
%34 = phi i64 [ 0, %30 ], [ %77, %32 ]
%35 = getelementptr inbounds double, double* %2, i64 %33
%36 = getelementptr inbounds double, double* %3, i64 %33
%37 = getelementptr inbounds double, double* %4, i64 %33
%38 = bitcast double* %35 to <2 x double>*
%39 = load <2 x double>, <2 x double>* %38
%40 = getelementptr inbounds double, double* %35, i64 2
%41 = bitcast double* %40 to <2 x double>*
%42 = load <2 x double>, <2 x double>* %41
%43 = bitcast double* %36 to <2 x double>*
%44 = load <2 x double>, <2 x double>* %43
%45 = getelementptr inbounds double, double* %36, i64 2
%46 = bitcast double* %45 to <2 x double>*
%47 = load <2 x double>, <2 x double>* %46
%48 = fmul <2 x double> %18, %44
%49 = fmul <2 x double> %20, %47
%50 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %22, <2 x double> %39, <2 x double> %48)
%51 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %24, <2 x double> %42, <2 x double> %49)
%52 = bitcast double* %37 to <2 x double>*
store <2 x double> %50, <2 x double>* %52
%53 = getelementptr inbounds double, double* %37, i64 2
%54 = bitcast double* %53 to <2 x double>*
store <2 x double> %51, <2 x double>* %54
%55 = or i64 %33, 4
%56 = getelementptr inbounds double, double* %2, i64 %55
%57 = getelementptr inbounds double, double* %3, i64 %55
%58 = getelementptr inbounds double, double* %4, i64 %55
%59 = bitcast double* %56 to <2 x double>*
%60 = load <2 x double>, <2 x double>* %59
%61 = getelementptr inbounds double, double* %56, i64 2
%62 = bitcast double* %61 to <2 x double>*
%63 = load <2 x double>, <2 x double>* %62
%64 = bitcast double* %57 to <2 x double>*
%65 = load <2 x double>, <2 x double>* %64
%66 = getelementptr inbounds double, double* %57, i64 2
%67 = bitcast double* %66 to <2 x double>*
%68 = load <2 x double>, <2 x double>* %67
%69 = fmul <2 x double> %18, %65
%70 = fmul <2 x double> %20, %68
%71 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %22, <2 x double> %60, <2 x double> %69)
%72 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %24, <2 x double> %63, <2 x double> %70)
%73 = bitcast double* %58 to <2 x double>*
store <2 x double> %71, <2 x double>* %73
%74 = getelementptr inbounds double, double* %58, i64 2
%75 = bitcast double* %74 to <2 x double>*
store <2 x double> %72, <2 x double>* %75
%76 = add nuw i64 %33, 8
%77 = add i64 %34, 2
%78 = icmp eq i64 %77, %31
br i1 %78, label %79, label %32
79: ; preds = %32, %15
%80 = phi i64 [ 0, %15 ], [ %76, %32 ]
%81 = icmp eq i64 %28, 0
br i1 %81, label %103, label %82
82: ; preds = %79
%83 = getelementptr inbounds double, double* %2, i64 %80
%84 = getelementptr inbounds double, double* %3, i64 %80
%85 = getelementptr inbounds double, double* %4, i64 %80
%86 = bitcast double* %83 to <2 x double>*
%87 = load <2 x double>, <2 x double>* %86
%88 = getelementptr inbounds double, double* %83, i64 2
%89 = bitcast double* %88 to <2 x double>*
%90 = load <2 x double>, <2 x double>* %89
%91 = bitcast double* %84 to <2 x double>*
%92 = load <2 x double>, <2 x double>* %91
%93 = getelementptr inbounds double, double* %84, i64 2
%94 = bitcast double* %93 to <2 x double>*
%95 = load <2 x double>, <2 x double>* %94
%96 = fmul <2 x double> %18, %92
%97 = fmul <2 x double> %20, %95
%98 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %22, <2 x double> %87, <2 x double> %96)
%99 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %24, <2 x double> %90, <2 x double> %97)
%100 = bitcast double* %85 to <2 x double>*
store <2 x double> %98, <2 x double>* %100
%101 = getelementptr inbounds double, double* %85, i64 2
%102 = bitcast double* %101 to <2 x double>*
store <2 x double> %99, <2 x double>* %102
br label %103
103: ; preds = %79, %82
%104 = icmp eq i64 %16, %5
br i1 %104, label %118, label %105
105: ; preds = %8, %103
%106 = phi i64 [ 0, %8 ], [ %16, %103 ]
br label %107
107: ; preds = %105, %107
%108 = phi i64 [ %116, %107 ], [ %106, %105 ]
%109 = getelementptr inbounds double, double* %2, i64 %108
%110 = getelementptr inbounds double, double* %3, i64 %108
%111 = getelementptr inbounds double, double* %4, i64 %108
%112 = load double, double* %109
%113 = load double, double* %110
%114 = fmul double %13, %113
%115 = tail call double @llvm.fmuladd.f64(double %10, double %112, double %114)
store double %115, double* %111
%116 = add nuw i64 %108, 1
%117 = icmp eq i64 %116, %5
br i1 %117, label %118, label %107
118: ; preds = %107, %103, %6
ret void
}