#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(int);
void math_vector_multiply(const double *vector, double operand, size_t size,
                          double *result) {
  assert(vector && result);
  for (size_t i = 0; i != size; ++i) {
    result[i] = vector[i] * operand;
  }
}


x86 assembly (clang, -O0):
<math_vector_multiply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x29(%rbp)
je     1144 <math_vector_multiply+0x34>
cmpq   $0x0,-0x20(%rbp)
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     1197 <math_vector_multiply+0x87>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x10(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1159 <math_vector_multiply+0x49>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_vector_multiply>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r15
mov    %rsi,%r14
movapd %xmm0,(%rsp)
mov    %rdi,%rbx
test   %rdi,%rdi
setne  %al
test   %rdx,%rdx
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
movapd (%rsp),%xmm3
test   %r14,%r14
je     12aa <math_vector_multiply+0x19a>
cmp    $0x4,%r14
jb     116b <math_vector_multiply+0x5b>
lea    (%rbx,%r14,8),%rax
cmp    %r15,%rax
jbe    1200 <math_vector_multiply+0xf0>
lea    (%r15,%r14,8),%rax
cmp    %rbx,%rax
jbe    1200 <math_vector_multiply+0xf0>
xor    %eax,%eax
mov    %rax,%rcx
not    %rcx
add    %r14,%rcx
mov    %r14,%rdx
and    $0x3,%rdx
je     1199 <math_vector_multiply+0x89>
nop
movsd  (%rbx,%rax,8),%xmm0
mulsd  %xmm3,%xmm0
movsd  %xmm0,(%r15,%rax,8)
add    $0x1,%rax
add    $0xffffffffffffffff,%rdx
jne    1180 <math_vector_multiply+0x70>
cmp    $0x3,%rcx
jb     12aa <math_vector_multiply+0x19a>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rbx,%rax,8),%xmm0
mulsd  %xmm3,%xmm0
movsd  %xmm0,(%r15,%rax,8)
movsd  0x8(%rbx,%rax,8),%xmm0
mulsd  %xmm3,%xmm0
movsd  %xmm0,0x8(%r15,%rax,8)
movsd  0x10(%rbx,%rax,8),%xmm0
mulsd  %xmm3,%xmm0
movsd  %xmm0,0x10(%r15,%rax,8)
movsd  0x18(%rbx,%rax,8),%xmm0
mulsd  %xmm3,%xmm0
movsd  %xmm0,0x18(%r15,%rax,8)
add    $0x4,%rax
cmp    %rax,%r14
jne    11b0 <math_vector_multiply+0xa0>
jmp    12aa <math_vector_multiply+0x19a>
mov    %r14,%rax
and    $0xfffffffffffffffc,%rax
movapd %xmm3,%xmm0
unpcklpd %xmm3,%xmm0
lea    -0x4(%rax),%rcx
mov    %rcx,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
test   %rcx,%rcx
je     12b4 <math_vector_multiply+0x1a4>
mov    %rdx,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %ecx,%ecx
movupd (%rbx,%rcx,8),%xmm1
movupd 0x10(%rbx,%rcx,8),%xmm2
mulpd  %xmm0,%xmm1
mulpd  %xmm0,%xmm2
movupd %xmm1,(%r15,%rcx,8)
movupd %xmm2,0x10(%r15,%rcx,8)
movupd 0x20(%rbx,%rcx,8),%xmm1
movupd 0x30(%rbx,%rcx,8),%xmm2
mulpd  %xmm0,%xmm1
mulpd  %xmm0,%xmm2
movupd %xmm1,0x20(%r15,%rcx,8)
movupd %xmm2,0x30(%r15,%rcx,8)
add    $0x8,%rcx
add    $0xfffffffffffffffe,%rsi
jne    1230 <math_vector_multiply+0x120>
test   $0x1,%dl
je     12a1 <math_vector_multiply+0x191>
movupd (%rbx,%rcx,8),%xmm1
movupd 0x10(%rbx,%rcx,8),%xmm2
mulpd  %xmm0,%xmm1
mulpd  %xmm0,%xmm2
movupd %xmm1,(%r15,%rcx,8)
movupd %xmm2,0x10(%r15,%rcx,8)
cmp    %r14,%rax
jne    116d <math_vector_multiply+0x5d>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %ecx,%ecx
test   $0x1,%dl
jne    1281 <math_vector_multiply+0x171>
jmp    12a1 <math_vector_multiply+0x191>

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

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