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


x86 assembly (clang, -O0):
<sg_vector_scale_assign_operation_inner>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1178 <sg_vector_scale_assign_operation_inner+0x78>
mov    -0x10(%rbp),%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x38(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    111c <sg_vector_scale_assign_operation_inner+0x1c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sg_vector_scale_assign_operation_inner>:
test   %rcx,%rcx
je     11e7 <sg_vector_scale_assign_operation_inner+0xe7>
movsd  (%rdi),%xmm0
cmp    $0x4,%rcx
jae    111a <sg_vector_scale_assign_operation_inner+0x1a>
xor    %eax,%eax
jmp    11d0 <sg_vector_scale_assign_operation_inner+0xd0>
mov    %rcx,%rax
and    $0xfffffffffffffffc,%rax
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
lea    -0x4(%rax),%rsi
mov    %rsi,%r8
shr    $0x2,%r8
add    $0x1,%r8
test   %rsi,%rsi
je     11e8 <sg_vector_scale_assign_operation_inner+0xe8>
mov    %r8,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %esi,%esi
nopw   0x0(%rax,%rax,1)
movupd (%rdx,%rsi,8),%xmm2
movupd 0x10(%rdx,%rsi,8),%xmm3
movupd 0x20(%rdx,%rsi,8),%xmm4
movupd 0x30(%rdx,%rsi,8),%xmm5
mulpd  %xmm1,%xmm2
mulpd  %xmm1,%xmm3
movupd %xmm2,(%rdx,%rsi,8)
movupd %xmm3,0x10(%rdx,%rsi,8)
mulpd  %xmm1,%xmm4
mulpd  %xmm1,%xmm5
movupd %xmm4,0x20(%rdx,%rsi,8)
movupd %xmm5,0x30(%rdx,%rsi,8)
add    $0x8,%rsi
add    $0xfffffffffffffffe,%rdi
jne    1150 <sg_vector_scale_assign_operation_inner+0x50>
test   $0x1,%r8b
je     11bc <sg_vector_scale_assign_operation_inner+0xbc>
movupd (%rdx,%rsi,8),%xmm2
movupd 0x10(%rdx,%rsi,8),%xmm3
mulpd  %xmm1,%xmm2
mulpd  %xmm1,%xmm3
movupd %xmm2,(%rdx,%rsi,8)
movupd %xmm3,0x10(%rdx,%rsi,8)
cmp    %rcx,%rax
je     11e7 <sg_vector_scale_assign_operation_inner+0xe7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rdx,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rdx,%rax,8)
add    $0x1,%rax
cmp    %rax,%rcx
jne    11d0 <sg_vector_scale_assign_operation_inner+0xd0>
ret
xor    %esi,%esi
test   $0x1,%r8b
jne    119e <sg_vector_scale_assign_operation_inner+0x9e>
jmp    11bc <sg_vector_scale_assign_operation_inner+0xbc>

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

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