#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 other_fun(double *restrict out, double *restrict a, double *restrict b,
               double *restrict c, int n) {
  int i;
  for (i = 0; i < n; i++) {
    out[i] = fma(a[i], b[i], c[i]);
  }
}


x86 assembly (clang, -O0):
<other_fun>:
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    %r8d,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1186 <other_fun+0x76>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
call   1030 <fma@plt>
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1133 <other_fun+0x23>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<other_fun>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
test   %r8d,%r8d
jle    1317 <other_fun+0x207>
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%r15
mov    %r8d,%ebx
cmp    $0x1,%r8d
jne    1143 <other_fun+0x33>
xor    %ebp,%ebp
jmp    12f0 <other_fun+0x1e0>
mov    %r13,0x8(%rsp)
mov    %r14,%rdx
mov    %rbx,0x70(%rsp)
mov    %ebx,%ebp
and    $0xfffffffe,%ebp
lea    -0x2(%rbp),%rax
mov    %rax,%r14
shr    %r14
add    $0x1,%r14
test   %rax,%rax
mov    %r14,0x68(%rsp)
mov    %rdx,0x58(%rsp)
mov    %r12,0x50(%rsp)
je     1267 <other_fun+0x157>
and    $0xfffffffffffffffe,%r14
xor    %r13d,%r13d
mov    %r15,0x60(%rsp)
mov    0x50(%rsp),%rbx
mov    0x58(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%r15
movups (%r15,%r13,8),%xmm0
movaps %xmm0,0x10(%rsp)
movups (%rbx,%r13,8),%xmm1
movaps %xmm1,0x20(%rsp)
movups (%r12,%r13,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,%r13,8)
movups 0x10(%r15,%r13,8),%xmm0
movaps %xmm0,0x10(%rsp)
mov    0x60(%rsp),%r15
movups 0x10(%rbx,%r13,8),%xmm1
movaps %xmm1,0x20(%rsp)
movups 0x10(%r12,%r13,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(%r15,%r13,8)
add    $0x4,%r13
add    $0xfffffffffffffffe,%r14
jne    11a0 <other_fun+0x90>
jmp    126a <other_fun+0x15a>
xor    %r13d,%r13d
testb  $0x1,0x68(%rsp)
mov    0x58(%rsp),%r14
mov    0x50(%rsp),%r12
je     12d2 <other_fun+0x1c2>
mov    0x8(%rsp),%rax
movups (%rax,%r13,8),%xmm0
movaps %xmm0,0x10(%rsp)
movups (%r12,%r13,8),%xmm1
movaps %xmm1,0x20(%rsp)
movups (%r14,%r13,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,(%r15,%r13,8)
mov    0x70(%rsp),%rbx
cmp    %rbx,%rbp
mov    0x8(%rsp),%r13
je     1317 <other_fun+0x207>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  0x0(%r13,%rbp,8),%xmm0
movsd  (%r12,%rbp,8),%xmm1
movsd  (%r14,%rbp,8),%xmm2
call   1030 <fma@plt>
movsd  %xmm0,(%r15,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    12f0 <other_fun+0x1e0>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @other_fun(double* noalias nocapture writeonly %0, double* noalias nocapture %1, double* noalias nocapture %2, double* noalias nocapture %3, i32 %4) {
%6 = icmp sgt i32 %4, 0
br i1 %6, label %7, label %82
7: ; preds = %5
%8 = zext i32 %4 to i64
%9 = icmp eq i32 %4, 1
br i1 %9, label %68, label %10
10: ; preds = %7
%11 = and i64 %8, 4294967294
%12 = add nsw i64 %11, -2
%13 = lshr exact i64 %12, 1
%14 = add nuw i64 %13, 1
%15 = and i64 %14, 1
%16 = icmp eq i64 %12, 0
br i1 %16, label %50, label %17
17: ; preds = %10
%18 = and i64 %14, -2
br label %19
19: ; preds = %19, %17
%20 = phi i64 [ 0, %17 ], [ %47, %19 ]
%21 = phi i64 [ 0, %17 ], [ %48, %19 ]
%22 = getelementptr inbounds double, double* %1, i64 %20
%23 = bitcast double* %22 to <2 x double>*
%24 = load <2 x double>, <2 x double>* %23
%25 = getelementptr inbounds double, double* %2, i64 %20
%26 = bitcast double* %25 to <2 x double>*
%27 = load <2 x double>, <2 x double>* %26
%28 = getelementptr inbounds double, double* %3, i64 %20
%29 = bitcast double* %28 to <2 x double>*
%30 = load <2 x double>, <2 x double>* %29
%31 = call <2 x double> @llvm.fma.v2f64(<2 x double> %24, <2 x double> %27, <2 x double> %30)
%32 = getelementptr inbounds double, double* %0, i64 %20
%33 = bitcast double* %32 to <2 x double>*
store <2 x double> %31, <2 x double>* %33
%34 = or i64 %20, 2
%35 = getelementptr inbounds double, double* %1, i64 %34
%36 = bitcast double* %35 to <2 x double>*
%37 = load <2 x double>, <2 x double>* %36
%38 = getelementptr inbounds double, double* %2, i64 %34
%39 = bitcast double* %38 to <2 x double>*
%40 = load <2 x double>, <2 x double>* %39
%41 = getelementptr inbounds double, double* %3, i64 %34
%42 = bitcast double* %41 to <2 x double>*
%43 = load <2 x double>, <2 x double>* %42
%44 = call <2 x double> @llvm.fma.v2f64(<2 x double> %37, <2 x double> %40, <2 x double> %43)
%45 = getelementptr inbounds double, double* %0, i64 %34
%46 = bitcast double* %45 to <2 x double>*
store <2 x double> %44, <2 x double>* %46
%47 = add nuw i64 %20, 4
%48 = add nuw i64 %21, 2
%49 = icmp eq i64 %48, %18
br i1 %49, label %50, label %19
50: ; preds = %19, %10
%51 = phi i64 [ 0, %10 ], [ %47, %19 ]
%52 = icmp eq i64 %15, 0
br i1 %52, label %66, label %53
53: ; preds = %50
%54 = getelementptr inbounds double, double* %1, i64 %51
%55 = bitcast double* %54 to <2 x double>*
%56 = load <2 x double>, <2 x double>* %55
%57 = getelementptr inbounds double, double* %2, i64 %51
%58 = bitcast double* %57 to <2 x double>*
%59 = load <2 x double>, <2 x double>* %58
%60 = getelementptr inbounds double, double* %3, i64 %51
%61 = bitcast double* %60 to <2 x double>*
%62 = load <2 x double>, <2 x double>* %61
%63 = call <2 x double> @llvm.fma.v2f64(<2 x double> %56, <2 x double> %59, <2 x double> %62)
%64 = getelementptr inbounds double, double* %0, i64 %51
%65 = bitcast double* %64 to <2 x double>*
store <2 x double> %63, <2 x double>* %65
br label %66
66: ; preds = %50, %53
%67 = icmp eq i64 %11, %8
br i1 %67, label %82, label %68
68: ; preds = %7, %66
%69 = phi i64 [ 0, %7 ], [ %11, %66 ]
br label %70
70: ; preds = %68, %70
%71 = phi i64 [ %80, %70 ], [ %69, %68 ]
%72 = getelementptr inbounds double, double* %1, i64 %71
%73 = load double, double* %72
%74 = getelementptr inbounds double, double* %2, i64 %71
%75 = load double, double* %74
%76 = getelementptr inbounds double, double* %3, i64 %71
%77 = load double, double* %76
%78 = tail call double @llvm.fma.f64(double %73, double %75, double %77)
%79 = getelementptr inbounds double, double* %0, i64 %71
store double %78, double* %79
%80 = add nuw nsw i64 %71, 1
%81 = icmp eq i64 %80, %8
br i1 %81, label %82, label %70
82: ; preds = %70, %66, %5
ret void
}