#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 */
double fma(double, double, double);
void util_list_map(double *in, double *out, double *m, double *b, size_t d) {
  for (size_t i = 0; i < d; ++i)
    out[i] = fma(in[i], m[i], b[i]);
}


x86 assembly (clang, -O0):
<util_list_map>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
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    118c <util_list_map+0x7c>
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
call   1030 <fma@plt>
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1134 <util_list_map+0x24>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_list_map>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
test   %r8,%r8
je     13c0 <util_list_map+0x2b0>
mov    %r8,%r15
mov    %rcx,%r13
mov    %rsi,%r12
cmp    $0x1,%r8
mov    %rdx,0x8(%rsp)
mov    %rdi,(%rsp)
jne    11db <util_list_map+0xcb>
xor    %ebp,%ebp
mov    %rbp,%r14
not    %r14
test   $0x1,%r15b
je     117a <util_list_map+0x6a>
mov    (%rsp),%rax
movsd  (%rax,%rbp,8),%xmm0
mov    0x8(%rsp),%rax
movsd  (%rax,%rbp,8),%xmm1
movsd  0x0(%r13,%rbp,8),%xmm2
call   1030 <fma@plt>
movsd  %xmm0,(%r12,%rbp,8)
or     $0x1,%rbp
add    %r15,%r14
mov    0x8(%rsp),%r14
mov    (%rsp),%rbx
je     13c0 <util_list_map+0x2b0>
nopl   0x0(%rax)
movsd  (%rbx,%rbp,8),%xmm0
movsd  (%r14,%rbp,8),%xmm1
movsd  0x0(%r13,%rbp,8),%xmm2
call   1030 <fma@plt>
movsd  %xmm0,(%r12,%rbp,8)
movsd  0x8(%rbx,%rbp,8),%xmm0
movsd  0x8(%r14,%rbp,8),%xmm1
movsd  0x8(%r13,%rbp,8),%xmm2
call   1030 <fma@plt>
movsd  %xmm0,0x8(%r12,%rbp,8)
add    $0x2,%rbp
cmp    %rbp,%r15
jne    1190 <util_list_map+0x80>
jmp    13c0 <util_list_map+0x2b0>
lea    (%rdi,%r15,8),%rax
cmp    %r12,%rax
seta   %r8b
lea    (%r12,%r15,8),%rsi
cmp    %rdi,%rsi
seta   %bl
lea    (%rdx,%r15,8),%rax
cmp    %r12,%rax
seta   %al
lea    0x0(,%r15,8),%rcx
add    %r13,%rcx
cmp    %rdx,%rsi
seta   %dil
cmp    %r12,%rcx
seta   %cl
cmp    %r13,%rsi
seta   %sil
xor    %ebp,%ebp
test   %bl,%r8b
jne    1145 <util_list_map+0x35>
and    %dil,%al
jne    1145 <util_list_map+0x35>
and    %sil,%cl
jne    1145 <util_list_map+0x35>
mov    %r15,0x70(%rsp)
mov    %r15,%rbp
and    $0xfffffffffffffffe,%rbp
lea    -0x2(%rbp),%rax
mov    %rax,%r15
shr    %r15
add    $0x1,%r15
test   %rax,%rax
mov    %r15,0x68(%rsp)
mov    %r13,0x58(%rsp)
je     1347 <util_list_map+0x237>
and    $0xfffffffffffffffe,%r15
xor    %r14d,%r14d
mov    %r12,0x60(%rsp)
mov    0x8(%rsp),%rbx
mov    0x58(%rsp),%r13
nopl   0x0(%rax)
mov    (%rsp),%r12
movups (%r12,%r14,8),%xmm0
movaps %xmm0,0x10(%rsp)
movups (%rbx,%r14,8),%xmm1
movaps %xmm1,0x20(%rsp)
movups 0x0(%r13,%r14,8),%xmm2
movaps %xmm2,0x30(%rsp)
call   1030 <fma@plt>
movaps %xmm0,0x40(%rsp)
movaps 0x10(%rsp),%xmm0
movhlps %xmm0,%xmm0
movaps 0x20(%rsp),%xmm1
movhlps %xmm1,%xmm1
movaps 0x30(%rsp),%xmm2
movhlps %xmm2,%xmm2
call   1030 <fma@plt>
movaps 0x40(%rsp),%xmm1
movlhps %xmm0,%xmm1
mov    0x60(%rsp),%rax
movups %xmm1,(%rax,%r14,8)
movups 0x10(%r12,%r14,8),%xmm0
movaps %xmm0,0x10(%rsp)
mov    0x60(%rsp),%r12
movups 0x10(%rbx,%r14,8),%xmm1
movaps %xmm1,0x20(%rsp)
movups 0x10(%r13,%r14,8),%xmm2
movaps %xmm2,0x30(%rsp)
call   1030 <fma@plt>
movaps %xmm0,0x40(%rsp)
movaps 0x10(%rsp),%xmm0
movhlps %xmm0,%xmm0
movaps 0x20(%rsp),%xmm1
movhlps %xmm1,%xmm1
movaps 0x30(%rsp),%xmm2
movhlps %xmm2,%xmm2
call   1030 <fma@plt>
movaps 0x40(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,0x10(%r12,%r14,8)
add    $0x4,%r14
add    $0xfffffffffffffffe,%r15
jne    1280 <util_list_map+0x170>
jmp    134a <util_list_map+0x23a>
xor    %r14d,%r14d
testb  $0x1,0x68(%rsp)
mov    0x58(%rsp),%r13
je     13b2 <util_list_map+0x2a2>
mov    (%rsp),%rax
movups (%rax,%r14,8),%xmm0
movaps %xmm0,0x10(%rsp)
mov    0x8(%rsp),%rax
movups (%rax,%r14,8),%xmm1
movaps %xmm1,0x20(%rsp)
movups 0x0(%r13,%r14,8),%xmm2
movaps %xmm2,0x30(%rsp)
call   1030 <fma@plt>
movaps %xmm0,0x40(%rsp)
movaps 0x10(%rsp),%xmm0
movhlps %xmm0,%xmm0
movaps 0x20(%rsp),%xmm1
movhlps %xmm1,%xmm1
movaps 0x30(%rsp),%xmm2
movhlps %xmm2,%xmm2
call   1030 <fma@plt>
movaps 0x40(%rsp),%xmm1
movlhps %xmm0,%xmm1
movups %xmm1,(%r12,%r14,8)
mov    0x70(%rsp),%r15
cmp    %r15,%rbp
jne    1145 <util_list_map+0x35>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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