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


x86 assembly (clang, -O0):
<sg_vector_linear_assign_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)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    11aa <sg_vector_linear_assign_operation_inner+0xaa>
mov    -0x10(%rbp),%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x48(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x50(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x40(%rbp),%rax
mulsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1120 <sg_vector_linear_assign_operation_inner+0x20>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sg_vector_linear_assign_operation_inner>:
test   %r8,%r8
je     1256 <sg_vector_linear_assign_operation_inner+0x156>
movsd  (%rdi),%xmm8
movsd  0x8(%rdi),%xmm9
cmp    $0x4,%r8
jae    1121 <sg_vector_linear_assign_operation_inner+0x21>
xor    %eax,%eax
jmp    1230 <sg_vector_linear_assign_operation_inner+0x130>
mov    %r8,%rax
and    $0xfffffffffffffffc,%rax
movapd %xmm9,%xmm3
unpcklpd %xmm9,%xmm3
movapd %xmm8,%xmm2
unpcklpd %xmm8,%xmm2
lea    -0x4(%rax),%rsi
mov    %rsi,%r9
shr    $0x2,%r9
add    $0x1,%r9
test   %rsi,%rsi
je     1257 <sg_vector_linear_assign_operation_inner+0x157>
mov    %r9,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %esi,%esi
nopl   (%rax)
movupd (%rdx,%rsi,8),%xmm4
movupd 0x10(%rdx,%rsi,8),%xmm5
mulpd  %xmm3,%xmm4
mulpd  %xmm3,%xmm5
movupd (%rcx,%rsi,8),%xmm6
movupd 0x10(%rcx,%rsi,8),%xmm7
movupd 0x20(%rcx,%rsi,8),%xmm0
movupd 0x30(%rcx,%rsi,8),%xmm1
mulpd  %xmm2,%xmm6
addpd  %xmm4,%xmm6
mulpd  %xmm2,%xmm7
addpd  %xmm5,%xmm7
movupd %xmm6,(%rcx,%rsi,8)
movupd %xmm7,0x10(%rcx,%rsi,8)
movupd 0x20(%rdx,%rsi,8),%xmm4
movupd 0x30(%rdx,%rsi,8),%xmm5
mulpd  %xmm3,%xmm4
mulpd  %xmm3,%xmm5
mulpd  %xmm2,%xmm0
addpd  %xmm4,%xmm0
mulpd  %xmm2,%xmm1
addpd  %xmm5,%xmm1
movupd %xmm0,0x20(%rcx,%rsi,8)
movupd %xmm1,0x30(%rcx,%rsi,8)
add    $0x8,%rsi
add    $0xfffffffffffffffe,%rdi
jne    1160 <sg_vector_linear_assign_operation_inner+0x60>
test   $0x1,%r9b
je     121e <sg_vector_linear_assign_operation_inner+0x11e>
movupd (%rcx,%rsi,8),%xmm0
movupd 0x10(%rcx,%rsi,8),%xmm1
movupd (%rdx,%rsi,8),%xmm4
movupd 0x10(%rdx,%rsi,8),%xmm5
mulpd  %xmm3,%xmm4
mulpd  %xmm3,%xmm5
mulpd  %xmm2,%xmm0
addpd  %xmm4,%xmm0
mulpd  %xmm2,%xmm1
addpd  %xmm5,%xmm1
movupd %xmm0,(%rcx,%rsi,8)
movupd %xmm1,0x10(%rcx,%rsi,8)
cmp    %r8,%rax
je     1256 <sg_vector_linear_assign_operation_inner+0x156>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rdx,%rax,8),%xmm0
mulsd  %xmm9,%xmm0
movsd  (%rcx,%rax,8),%xmm1
mulsd  %xmm8,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rcx,%rax,8)
add    $0x1,%rax
cmp    %rax,%r8
jne    1230 <sg_vector_linear_assign_operation_inner+0x130>
ret
xor    %esi,%esi
test   $0x1,%r9b
jne    11e5 <sg_vector_linear_assign_operation_inner+0xe5>
jmp    121e <sg_vector_linear_assign_operation_inner+0x11e>

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

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