#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 /*<<< orphan*/);
void math_vector_subtract(const double *vec_i, const double *vec_j, size_t size,
                          double *result) {
  assert(vec_i && vec_j && result);
  for (size_t i = 0; i != size; ++i) {
    result[i] = vec_i[i] - vec_j[i];
  }
}


x86 assembly (clang, -O0):
<math_vector_subtract>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x29(%rbp)
je     1153 <math_vector_subtract+0x43>
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x29(%rbp)
je     1153 <math_vector_subtract+0x43>
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     11ae <math_vector_subtract+0x9e>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
subsd  (%rax,%rcx,8),%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    1168 <math_vector_subtract+0x58>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_vector_subtract>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%rbx
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
and    %al,%cl
test   %r15,%r15
setne  %al
and    %cl,%al
movzbl %al,%edi
call   1030 <assert@plt>
test   %r14,%r14
je     1302 <math_vector_subtract+0x1f2>
cmp    $0x4,%r14
jae    11fb <math_vector_subtract+0xeb>
xor    %eax,%eax
mov    %rax,%rcx
not    %rcx
add    %r14,%rcx
mov    %r14,%rdx
and    $0x3,%rdx
je     118b <math_vector_subtract+0x7b>
nopl   0x0(%rax)
movsd  (%rbx,%rax,8),%xmm0
subsd  (%r12,%rax,8),%xmm0
movsd  %xmm0,(%r15,%rax,8)
add    $0x1,%rax
add    $0xffffffffffffffff,%rdx
jne    1170 <math_vector_subtract+0x60>
cmp    $0x3,%rcx
jb     1302 <math_vector_subtract+0x1f2>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rbx,%rax,8),%xmm0
subsd  (%r12,%rax,8),%xmm0
movsd  %xmm0,(%r15,%rax,8)
movsd  0x8(%rbx,%rax,8),%xmm0
subsd  0x8(%r12,%rax,8),%xmm0
movsd  %xmm0,0x8(%r15,%rax,8)
movsd  0x10(%rbx,%rax,8),%xmm0
subsd  0x10(%r12,%rax,8),%xmm0
movsd  %xmm0,0x10(%r15,%rax,8)
movsd  0x18(%rbx,%rax,8),%xmm0
subsd  0x18(%r12,%rax,8),%xmm0
movsd  %xmm0,0x18(%r15,%rax,8)
add    $0x4,%rax
cmp    %rax,%r14
jne    11a0 <math_vector_subtract+0x90>
jmp    1302 <math_vector_subtract+0x1f2>
lea    (%r15,%r14,8),%rax
lea    (%rbx,%r14,8),%rcx
cmp    %r15,%rcx
seta   %dil
lea    (%r12,%r14,8),%rcx
cmp    %rbx,%rax
seta   %dl
cmp    %r15,%rcx
seta   %cl
cmp    %r12,%rax
seta   %sil
xor    %eax,%eax
test   %dl,%dil
jne    1157 <math_vector_subtract+0x47>
and    %sil,%cl
jne    1157 <math_vector_subtract+0x47>
mov    %r14,%rax
and    $0xfffffffffffffffc,%rax
lea    -0x4(%rax),%rcx
mov    %rcx,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
test   %rcx,%rcx
je     130e <math_vector_subtract+0x1fe>
mov    %rdx,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %ecx,%ecx
nopl   (%rax)
movupd (%rbx,%rcx,8),%xmm0
movupd 0x10(%rbx,%rcx,8),%xmm1
movupd (%r12,%rcx,8),%xmm2
subpd  %xmm2,%xmm0
movupd 0x10(%r12,%rcx,8),%xmm2
subpd  %xmm2,%xmm1
movupd %xmm0,(%r15,%rcx,8)
movupd %xmm1,0x10(%r15,%rcx,8)
movupd 0x20(%rbx,%rcx,8),%xmm0
movupd 0x30(%rbx,%rcx,8),%xmm1
movupd 0x20(%r12,%rcx,8),%xmm2
subpd  %xmm2,%xmm0
movupd 0x30(%r12,%rcx,8),%xmm2
subpd  %xmm2,%xmm1
movupd %xmm0,0x20(%r15,%rcx,8)
movupd %xmm1,0x30(%r15,%rcx,8)
add    $0x8,%rcx
add    $0xfffffffffffffffe,%rsi
jne    1260 <math_vector_subtract+0x150>
test   $0x1,%dl
je     12f9 <math_vector_subtract+0x1e9>
movupd (%rbx,%rcx,8),%xmm0
movupd 0x10(%rbx,%rcx,8),%xmm1
movupd (%r12,%rcx,8),%xmm2
subpd  %xmm2,%xmm0
movupd 0x10(%r12,%rcx,8),%xmm2
subpd  %xmm2,%xmm1
movupd %xmm0,(%r15,%rcx,8)
movupd %xmm1,0x10(%r15,%rcx,8)
cmp    %r14,%rax
jne    1157 <math_vector_subtract+0x47>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
xor    %ecx,%ecx
test   $0x1,%dl
jne    12cc <math_vector_subtract+0x1bc>
jmp    12f9 <math_vector_subtract+0x1e9>

LLVM IR (-O0):
define void @math_vector_subtract(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 %18
12: ; preds = %4
%13 = load double*, double** %6
%14 = icmp ne double* %13, null
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load double*, double** %8
%17 = icmp ne double* %16, null
br label %18
18: ; preds = %15, %12, %4
%19 = phi i1 [ false, %12 ], [ false, %4 ], [ %17, %15 ]
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
store i64 0, i64* %9
br label %22
22: ; preds = %39, %18
%23 = load i64, i64* %9
%24 = load i64, i64* %7
%25 = icmp ne i64 %23, %24
br i1 %25, label %26, label %42
26: ; preds = %22
%27 = load double*, double** %5
%28 = load i64, i64* %9
%29 = getelementptr inbounds double, double* %27, i64 %28
%30 = load double, double* %29
%31 = load double*, double** %6
%32 = load i64, i64* %9
%33 = getelementptr inbounds double, double* %31, i64 %32
%34 = load double, double* %33
%35 = fsub double %30, %34
%36 = load double*, double** %8
%37 = load i64, i64* %9
%38 = getelementptr inbounds double, double* %36, i64 %37
store double %35, double* %38
br label %39
39: ; preds = %26
%40 = load i64, i64* %9
%41 = add i64 %40, 1
store i64 %41, i64* %9
br label %22
42: ; preds = %22
ret void
}

LLVM IR (-O2):
define void @math_vector_subtract(double* %0, double* %1, i64 %2, double* writeonly %3) {
%5 = icmp ne double* %0, null
%6 = icmp ne double* %1, null
%7 = and i1 %5, %6
%8 = icmp ne double* %3, null
%9 = and i1 %7, %8
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = icmp eq i64 %2, 0
br i1 %12, label %123, label %13
13: ; preds = %4
%14 = icmp ult i64 %2, 4
br i1 %14, label %102, label %15
15: ; preds = %13
%16 = getelementptr double, double* %3, i64 %2
%17 = getelementptr double, double* %0, i64 %2
%18 = getelementptr double, double* %1, i64 %2
%19 = icmp ugt double* %17, %3
%20 = icmp ugt double* %16, %0
%21 = and i1 %19, %20
%22 = icmp ugt double* %18, %3
%23 = icmp ugt double* %16, %1
%24 = and i1 %22, %23
%25 = or i1 %21, %24
br i1 %25, label %102, label %26
26: ; preds = %15
%27 = and i64 %2, -4
%28 = add i64 %27, -4
%29 = lshr exact i64 %28, 2
%30 = add nuw nsw i64 %29, 1
%31 = and i64 %30, 1
%32 = icmp eq i64 %28, 0
br i1 %32, label %78, label %33
33: ; preds = %26
%34 = and i64 %30, 9223372036854775806
br label %35
35: ; preds = %35, %33
%36 = phi i64 [ 0, %33 ], [ %75, %35 ]
%37 = phi i64 [ 0, %33 ], [ %76, %35 ]
%38 = getelementptr inbounds double, double* %0, i64 %36
%39 = bitcast double* %38 to <2 x double>*
%40 = load <2 x double>, <2 x double>* %39
%41 = getelementptr inbounds double, double* %38, i64 2
%42 = bitcast double* %41 to <2 x double>*
%43 = load <2 x double>, <2 x double>* %42
%44 = getelementptr inbounds double, double* %1, i64 %36
%45 = bitcast double* %44 to <2 x double>*
%46 = load <2 x double>, <2 x double>* %45
%47 = getelementptr inbounds double, double* %44, i64 2
%48 = bitcast double* %47 to <2 x double>*
%49 = load <2 x double>, <2 x double>* %48
%50 = fsub <2 x double> %40, %46
%51 = fsub <2 x double> %43, %49
%52 = getelementptr inbounds double, double* %3, i64 %36
%53 = bitcast double* %52 to <2 x double>*
store <2 x double> %50, <2 x double>* %53
%54 = getelementptr inbounds double, double* %52, i64 2
%55 = bitcast double* %54 to <2 x double>*
store <2 x double> %51, <2 x double>* %55
%56 = or i64 %36, 4
%57 = getelementptr inbounds double, double* %0, i64 %56
%58 = bitcast double* %57 to <2 x double>*
%59 = load <2 x double>, <2 x double>* %58
%60 = getelementptr inbounds double, double* %57, i64 2
%61 = bitcast double* %60 to <2 x double>*
%62 = load <2 x double>, <2 x double>* %61
%63 = getelementptr inbounds double, double* %1, i64 %56
%64 = bitcast double* %63 to <2 x double>*
%65 = load <2 x double>, <2 x double>* %64
%66 = getelementptr inbounds double, double* %63, i64 2
%67 = bitcast double* %66 to <2 x double>*
%68 = load <2 x double>, <2 x double>* %67
%69 = fsub <2 x double> %59, %65
%70 = fsub <2 x double> %62, %68
%71 = getelementptr inbounds double, double* %3, i64 %56
%72 = bitcast double* %71 to <2 x double>*
store <2 x double> %69, <2 x double>* %72
%73 = getelementptr inbounds double, double* %71, i64 2
%74 = bitcast double* %73 to <2 x double>*
store <2 x double> %70, <2 x double>* %74
%75 = add nuw i64 %36, 8
%76 = add i64 %37, 2
%77 = icmp eq i64 %76, %34
br i1 %77, label %78, label %35
78: ; preds = %35, %26
%79 = phi i64 [ 0, %26 ], [ %75, %35 ]
%80 = icmp eq i64 %31, 0
br i1 %80, label %100, label %81
81: ; preds = %78
%82 = getelementptr inbounds double, double* %0, i64 %79
%83 = bitcast double* %82 to <2 x double>*
%84 = load <2 x double>, <2 x double>* %83
%85 = getelementptr inbounds double, double* %82, i64 2
%86 = bitcast double* %85 to <2 x double>*
%87 = load <2 x double>, <2 x double>* %86
%88 = getelementptr inbounds double, double* %1, i64 %79
%89 = bitcast double* %88 to <2 x double>*
%90 = load <2 x double>, <2 x double>* %89
%91 = getelementptr inbounds double, double* %88, i64 2
%92 = bitcast double* %91 to <2 x double>*
%93 = load <2 x double>, <2 x double>* %92
%94 = fsub <2 x double> %84, %90
%95 = fsub <2 x double> %87, %93
%96 = getelementptr inbounds double, double* %3, i64 %79
%97 = bitcast double* %96 to <2 x double>*
store <2 x double> %94, <2 x double>* %97
%98 = getelementptr inbounds double, double* %96, i64 2
%99 = bitcast double* %98 to <2 x double>*
store <2 x double> %95, <2 x double>* %99
br label %100
100: ; preds = %78, %81
%101 = icmp eq i64 %27, %2
br i1 %101, label %123, label %102
102: ; preds = %15, %13, %100
%103 = phi i64 [ 0, %15 ], [ 0, %13 ], [ %27, %100 ]
%104 = xor i64 %103, -1
%105 = add i64 %104, %2
%106 = and i64 %2, 3
%107 = icmp eq i64 %106, 0
br i1 %107, label %120, label %108
108: ; preds = %102, %108
%109 = phi i64 [ %117, %108 ], [ %103, %102 ]
%110 = phi i64 [ %118, %108 ], [ 0, %102 ]
%111 = getelementptr inbounds double, double* %0, i64 %109
%112 = load double, double* %111
%113 = getelementptr inbounds double, double* %1, i64 %109
%114 = load double, double* %113
%115 = fsub double %112, %114
%116 = getelementptr inbounds double, double* %3, i64 %109
store double %115, double* %116
%117 = add nuw i64 %109, 1
%118 = add i64 %110, 1
%119 = icmp eq i64 %118, %106
br i1 %119, label %120, label %108
120: ; preds = %108, %102
%121 = phi i64 [ %103, %102 ], [ %117, %108 ]
%122 = icmp ult i64 %105, 3
br i1 %122, label %123, label %124
123: ; preds = %120, %124, %100, %4
ret void
124: ; preds = %120, %124
%125 = phi i64 [ %153, %124 ], [ %121, %120 ]
%126 = getelementptr inbounds double, double* %0, i64 %125
%127 = load double, double* %126
%128 = getelementptr inbounds double, double* %1, i64 %125
%129 = load double, double* %128
%130 = fsub double %127, %129
%131 = getelementptr inbounds double, double* %3, i64 %125
store double %130, double* %131
%132 = add nuw i64 %125, 1
%133 = getelementptr inbounds double, double* %0, i64 %132
%134 = load double, double* %133
%135 = getelementptr inbounds double, double* %1, i64 %132
%136 = load double, double* %135
%137 = fsub double %134, %136
%138 = getelementptr inbounds double, double* %3, i64 %132
store double %137, double* %138
%139 = add nuw i64 %125, 2
%140 = getelementptr inbounds double, double* %0, i64 %139
%141 = load double, double* %140
%142 = getelementptr inbounds double, double* %1, i64 %139
%143 = load double, double* %142
%144 = fsub double %141, %143
%145 = getelementptr inbounds double, double* %3, i64 %139
store double %144, double* %145
%146 = add nuw i64 %125, 3
%147 = getelementptr inbounds double, double* %0, i64 %146
%148 = load double, double* %147
%149 = getelementptr inbounds double, double* %1, i64 %146
%150 = load double, double* %149
%151 = fsub double %148, %150
%152 = getelementptr inbounds double, double* %3, i64 %146
store double %151, double* %152
%153 = add nuw i64 %125, 4
%154 = icmp eq i64 %153, %2
br i1 %154, label %123, label %124
}