#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_divide(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_divide>:
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_divide+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_divide+0x87>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -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_divide+0x49>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_vector_divide>:
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),%xmm2
test   %r14,%r14
je     1237 <math_vector_divide+0x127>
cmp    $0x1,%r14
je     1163 <math_vector_divide+0x53>
lea    (%rbx,%r14,8),%rax
cmp    %r15,%rax
jbe    11bb <math_vector_divide+0xab>
lea    (%r15,%r14,8),%rax
cmp    %rbx,%rax
jbe    11bb <math_vector_divide+0xab>
xor    %eax,%eax
mov    %rax,%rcx
not    %rcx
test   $0x1,%r14b
je     1184 <math_vector_divide+0x74>
movsd  (%rbx,%rax,8),%xmm0
divsd  %xmm2,%xmm0
movsd  %xmm0,(%r15,%rax,8)
or     $0x1,%rax
add    %r14,%rcx
je     1237 <math_vector_divide+0x127>
nopl   (%rax)
movsd  (%rbx,%rax,8),%xmm0
divsd  %xmm2,%xmm0
movsd  %xmm0,(%r15,%rax,8)
movsd  0x8(%rbx,%rax,8),%xmm0
divsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%r15,%rax,8)
add    $0x2,%rax
cmp    %rax,%r14
jne    1190 <math_vector_divide+0x80>
jmp    1237 <math_vector_divide+0x127>
mov    %r14,%rax
and    $0xfffffffffffffffe,%rax
movapd %xmm2,%xmm0
unpcklpd %xmm2,%xmm0
lea    -0x2(%rax),%rdx
mov    %rdx,%rcx
shr    %rcx
add    $0x1,%rcx
test   %rdx,%rdx
je     1241 <math_vector_divide+0x131>
mov    %rcx,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
movupd (%rbx,%rdx,8),%xmm1
divpd  %xmm0,%xmm1
movupd %xmm1,(%r15,%rdx,8)
movupd 0x10(%rbx,%rdx,8),%xmm1
divpd  %xmm0,%xmm1
movupd %xmm1,0x10(%r15,%rdx,8)
add    $0x4,%rdx
add    $0xfffffffffffffffe,%rsi
jne    11f0 <math_vector_divide+0xe0>
test   $0x1,%cl
je     122e <math_vector_divide+0x11e>
movupd (%rbx,%rdx,8),%xmm1
divpd  %xmm0,%xmm1
movupd %xmm1,(%r15,%rdx,8)
cmp    %r14,%rax
jne    1165 <math_vector_divide+0x55>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %edx,%edx
test   $0x1,%cl
jne    121f <math_vector_divide+0x10f>
jmp    122e <math_vector_divide+0x11e>

LLVM IR (-O0):
define void @math_vector_divide(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 = fdiv 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_divide(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)
switch i64 %2, label %10 [
i64 0, label %73
i64 1, label %58
]
10: ; preds = %4
%11 = getelementptr double, double* %3, i64 %2
%12 = getelementptr double, double* %0, i64 %2
%13 = icmp ugt double* %12, %3
%14 = icmp ugt double* %11, %0
%15 = and i1 %13, %14
br i1 %15, label %58, label %16
16: ; preds = %10
%17 = and i64 %2, -2
%18 = insertelement <2 x double> poison, double %1, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
%20 = add i64 %17, -2
%21 = lshr exact i64 %20, 1
%22 = add nuw i64 %21, 1
%23 = and i64 %22, 1
%24 = icmp eq i64 %20, 0
br i1 %24, label %46, label %25
25: ; preds = %16
%26 = and i64 %22, -2
br label %27
27: ; preds = %27, %25
%28 = phi i64 [ 0, %25 ], [ %43, %27 ]
%29 = phi i64 [ 0, %25 ], [ %44, %27 ]
%30 = getelementptr inbounds double, double* %0, i64 %28
%31 = bitcast double* %30 to <2 x double>*
%32 = load <2 x double>, <2 x double>* %31
%33 = fdiv <2 x double> %32, %19
%34 = getelementptr inbounds double, double* %3, i64 %28
%35 = bitcast double* %34 to <2 x double>*
store <2 x double> %33, <2 x double>* %35
%36 = or i64 %28, 2
%37 = getelementptr inbounds double, double* %0, i64 %36
%38 = bitcast double* %37 to <2 x double>*
%39 = load <2 x double>, <2 x double>* %38
%40 = fdiv <2 x double> %39, %19
%41 = getelementptr inbounds double, double* %3, i64 %36
%42 = bitcast double* %41 to <2 x double>*
store <2 x double> %40, <2 x double>* %42
%43 = add nuw i64 %28, 4
%44 = add nuw i64 %29, 2
%45 = icmp eq i64 %44, %26
br i1 %45, label %46, label %27
46: ; preds = %27, %16
%47 = phi i64 [ 0, %16 ], [ %43, %27 ]
%48 = icmp eq i64 %23, 0
br i1 %48, label %56, label %49
49: ; preds = %46
%50 = getelementptr inbounds double, double* %0, i64 %47
%51 = bitcast double* %50 to <2 x double>*
%52 = load <2 x double>, <2 x double>* %51
%53 = fdiv <2 x double> %52, %19
%54 = getelementptr inbounds double, double* %3, i64 %47
%55 = bitcast double* %54 to <2 x double>*
store <2 x double> %53, <2 x double>* %55
br label %56
56: ; preds = %46, %49
%57 = icmp eq i64 %17, %2
br i1 %57, label %73, label %58
58: ; preds = %4, %10, %56
%59 = phi i64 [ 0, %4 ], [ 0, %10 ], [ %17, %56 ]
%60 = xor i64 %59, -1
%61 = and i64 %2, 1
%62 = icmp eq i64 %61, 0
br i1 %62, label %69, label %63
63: ; preds = %58
%64 = getelementptr inbounds double, double* %0, i64 %59
%65 = load double, double* %64
%66 = fdiv double %65, %1
%67 = getelementptr inbounds double, double* %3, i64 %59
store double %66, double* %67
%68 = or i64 %59, 1
br label %69
69: ; preds = %63, %58
%70 = phi i64 [ %59, %58 ], [ %68, %63 ]
%71 = sub i64 0, %2
%72 = icmp eq i64 %60, %71
br i1 %72, label %73, label %74
73: ; preds = %69, %74, %56, %4
ret void
74: ; preds = %69, %74
%75 = phi i64 [ %85, %74 ], [ %70, %69 ]
%76 = getelementptr inbounds double, double* %0, i64 %75
%77 = load double, double* %76
%78 = fdiv double %77, %1
%79 = getelementptr inbounds double, double* %3, i64 %75
store double %78, double* %79
%80 = add nuw i64 %75, 1
%81 = getelementptr inbounds double, double* %0, i64 %80
%82 = load double, double* %81
%83 = fdiv double %82, %1
%84 = getelementptr inbounds double, double* %3, i64 %80
store double %83, double* %84
%85 = add nuw i64 %75, 2
%86 = icmp eq i64 %85, %2
br i1 %86, label %73, label %74
}