#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 Distance(int, int, double **);
int /*<<< orphan*/ Emptied(int, double **);
double WeightMVR(int, int, int, double **, double);
double mu(int, int, double **, int);
void Branch_lengthMVR(int a, int b, double *la, double *lb, double **delta,
                      int n) {
  int i;
  double Dxu, Dyu, Wi, u;
  u = mu(a, b, delta, n);
  Dxu = Dyu = 0;
  for (i = 1; i <= n; i++) {
    if (!Emptied(i, delta) && (i != a) && (i != b)) {
      Wi = WeightMVR(a, b, i, delta, u);
      Dxu = Dxu + (Wi * (Distance(a, b, delta) + Distance(a, i, delta) -
                         Distance(b, i, delta)));
      Dyu = Dyu + (Wi * (Distance(a, b, delta) + Distance(b, i, delta) -
                         Distance(a, i, delta)));
    }
  }
  *la = Dxu;
  *lb = Dyu;
  return;
}


x86 assembly (clang, -O0):
<Branch_lengthMVR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1060 <mu@plt>
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     12f1 <Branch_lengthMVR+0x1b1>
mov    -0x28(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1050 <Emptied@plt>
cmp    $0x0,%eax
jne    12de <Branch_lengthMVR+0x19e>
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
je     12de <Branch_lengthMVR+0x19e>
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     12de <Branch_lengthMVR+0x19e>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x20(%rbp),%rcx
movsd  -0x48(%rbp),%xmm0
call   1030 <WeightMVR@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1040 <Distance@plt>
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1040 <Distance@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1040 <Distance@plt>
movsd  -0x80(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x70(%rbp),%xmm0
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1040 <Distance@plt>
movsd  %xmm0,-0x68(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1040 <Distance@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1040 <Distance@plt>
movsd  -0x60(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x50(%rbp),%xmm0
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    12e3 <Branch_lengthMVR+0x1a3>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    118f <Branch_lengthMVR+0x4f>
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Branch_lengthMVR>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9d,%r12d
mov    %r8,%rbx
mov    %rcx,0x20(%rsp)
mov    %rdx,%r15
mov    %esi,%r13d
mov    %edi,%ebp
mov    %r8,%rdx
mov    %r9d,%ecx
call   1060 <mu@plt>
movsd  %xmm0,0x28(%rsp)
test   %r12d,%r12d
jle    1297 <Branch_lengthMVR+0x157>
neg    %r12d
xorpd  %xmm0,%xmm0
movapd %xmm0,(%rsp)
mov    $0x1,%r14d
jmp    11a9 <Branch_lengthMVR+0x69>
nop
lea    (%r12,%r14,1),%eax
add    $0x1,%eax
mov    %r14d,%ecx
add    $0x1,%ecx
mov    %ecx,%r14d
cmp    $0x1,%eax
je     12a0 <Branch_lengthMVR+0x160>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1050 <Emptied@plt>
test   %eax,%eax
jne    1190 <Branch_lengthMVR+0x50>
cmp    %r14d,%ebp
je     1190 <Branch_lengthMVR+0x50>
cmp    %r14d,%r13d
je     1190 <Branch_lengthMVR+0x50>
mov    %ebp,%edi
mov    %r13d,%esi
mov    %r14d,%edx
mov    %rbx,%rcx
movsd  0x28(%rsp),%xmm0
call   1030 <WeightMVR@plt>
movapd %xmm0,0x60(%rsp)
mov    %ebp,%edi
mov    %r13d,%esi
mov    %rbx,%rdx
call   1040 <Distance@plt>
movapd %xmm0,0x10(%rsp)
mov    %ebp,%edi
mov    %r14d,%esi
mov    %rbx,%rdx
call   1040 <Distance@plt>
movapd %xmm0,0x40(%rsp)
mov    %r13d,%edi
mov    %r14d,%esi
mov    %rbx,%rdx
call   1040 <Distance@plt>
movapd %xmm0,0x50(%rsp)
mov    %ebp,%edi
mov    %r13d,%esi
mov    %rbx,%rdx
call   1040 <Distance@plt>
movapd %xmm0,0x30(%rsp)
mov    %r13d,%edi
mov    %r14d,%esi
mov    %rbx,%rdx
call   1040 <Distance@plt>
movapd 0x30(%rsp),%xmm1
unpcklpd 0x10(%rsp),%xmm1
unpcklpd 0x40(%rsp),%xmm0
addpd  %xmm1,%xmm0
movapd %xmm0,0x10(%rsp)
mov    %ebp,%edi
mov    %r14d,%esi
mov    %rbx,%rdx
call   1040 <Distance@plt>
unpcklpd 0x50(%rsp),%xmm0
movapd 0x10(%rsp),%xmm1
subpd  %xmm0,%xmm1
movapd 0x60(%rsp),%xmm0
unpcklpd %xmm0,%xmm0
mulpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
movapd (%rsp),%xmm0
addpd  %xmm1,%xmm0
movapd %xmm0,(%rsp)
jmp    1190 <Branch_lengthMVR+0x50>
xorpd  %xmm0,%xmm0
movapd %xmm0,(%rsp)
movaps (%rsp),%xmm0
movhps %xmm0,(%r15)
mov    0x20(%rsp),%rax
movlps %xmm0,(%rax)
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @Branch_lengthMVR(i32 %0, i32 %1, double* %2, double* %3, double** %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca double**
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store i32 %0, i32* %7
store i32 %1, i32* %8
store double* %2, double** %9
store double* %3, double** %10
store double** %4, double*** %11
store i32 %5, i32* %12
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = load double**, double*** %11
%21 = load i32, i32* %12
%22 = call double @mu(i32 %18, i32 %19, double** %20, i32 %21)
store double %22, double* %17
store double 0.000000e+00, double* %15
store double 0.000000e+00, double* %14
store i32 1, i32* %13
br label %23
23: ; preds = %82, %6
%24 = load i32, i32* %13
%25 = load i32, i32* %12
%26 = icmp sle i32 %24, %25
br i1 %26, label %27, label %85
27: ; preds = %23
%28 = load i32, i32* %13
%29 = load double**, double*** %11
%30 = call i32 @Emptied(i32 %28, double** %29)
%31 = icmp ne i32 %30, 0
br i1 %31, label %81, label %32
32: ; preds = %27
%33 = load i32, i32* %13
%34 = load i32, i32* %7
%35 = icmp ne i32 %33, %34
br i1 %35, label %36, label %81
36: ; preds = %32
%37 = load i32, i32* %13
%38 = load i32, i32* %8
%39 = icmp ne i32 %37, %38
br i1 %39, label %40, label %81
40: ; preds = %36
%41 = load i32, i32* %7
%42 = load i32, i32* %8
%43 = load i32, i32* %13
%44 = load double**, double*** %11
%45 = load double, double* %17
%46 = call double @WeightMVR(i32 %41, i32 %42, i32 %43, double** %44, double %45)
store double %46, double* %16
%47 = load double, double* %14
%48 = load double, double* %16
%49 = load i32, i32* %7
%50 = load i32, i32* %8
%51 = load double**, double*** %11
%52 = call double @Distance(i32 %49, i32 %50, double** %51)
%53 = load i32, i32* %7
%54 = load i32, i32* %13
%55 = load double**, double*** %11
%56 = call double @Distance(i32 %53, i32 %54, double** %55)
%57 = fadd double %52, %56
%58 = load i32, i32* %8
%59 = load i32, i32* %13
%60 = load double**, double*** %11
%61 = call double @Distance(i32 %58, i32 %59, double** %60)
%62 = fsub double %57, %61
%63 = call double @llvm.fmuladd.f64(double %48, double %62, double %47)
store double %63, double* %14
%64 = load double, double* %15
%65 = load double, double* %16
%66 = load i32, i32* %7
%67 = load i32, i32* %8
%68 = load double**, double*** %11
%69 = call double @Distance(i32 %66, i32 %67, double** %68)
%70 = load i32, i32* %8
%71 = load i32, i32* %13
%72 = load double**, double*** %11
%73 = call double @Distance(i32 %70, i32 %71, double** %72)
%74 = fadd double %69, %73
%75 = load i32, i32* %7
%76 = load i32, i32* %13
%77 = load double**, double*** %11
%78 = call double @Distance(i32 %75, i32 %76, double** %77)
%79 = fsub double %74, %78
%80 = call double @llvm.fmuladd.f64(double %65, double %79, double %64)
store double %80, double* %15
br label %81
81: ; preds = %40, %36, %32, %27
br label %82
82: ; preds = %81
%83 = load i32, i32* %13
%84 = add nsw i32 %83, 1
store i32 %84, i32* %13
br label %23
85: ; preds = %23
%86 = load double, double* %14
%87 = load double*, double** %9
store double %86, double* %87
%88 = load double, double* %15
%89 = load double*, double** %10
store double %88, double* %89
ret void
}

LLVM IR (-O2):
define void @Branch_lengthMVR(i32 %0, i32 %1, double* nocapture writeonly %2, double* nocapture writeonly %3, double** %4, i32 %5) {
%7 = tail call double @mu(i32 %0, i32 %1, double** %4, i32 %5)
%8 = icmp slt i32 %5, 1
br i1 %8, label %41, label %9
9: ; preds = %6, %37
%10 = phi i32 [ %39, %37 ], [ 1, %6 ]
%11 = phi <2 x double> [ %38, %37 ], [ zeroinitializer, %6 ]
%12 = tail call i32 @Emptied(i32 %10, double** %4)
%13 = icmp ne i32 %12, 0
%14 = icmp eq i32 %10, %0
%15 = or i1 %13, %14
%16 = icmp eq i32 %10, %1
%17 = or i1 %15, %16
br i1 %17, label %37, label %18
18: ; preds = %9
%19 = tail call double @WeightMVR(i32 %0, i32 %1, i32 %10, double** %4, double %7)
%20 = tail call double @Distance(i32 %0, i32 %1, double** %4)
%21 = tail call double @Distance(i32 %0, i32 %10, double** %4)
%22 = tail call double @Distance(i32 %1, i32 %10, double** %4)
%23 = tail call double @Distance(i32 %0, i32 %1, double** %4)
%24 = tail call double @Distance(i32 %1, i32 %10, double** %4)
%25 = insertelement <2 x double> poison, double %23, i64 0
%26 = insertelement <2 x double> %25, double %20, i64 1
%27 = insertelement <2 x double> poison, double %24, i64 0
%28 = insertelement <2 x double> %27, double %21, i64 1
%29 = fadd <2 x double> %26, %28
%30 = tail call double @Distance(i32 %0, i32 %10, double** %4)
%31 = insertelement <2 x double> poison, double %30, i64 0
%32 = insertelement <2 x double> %31, double %22, i64 1
%33 = fsub <2 x double> %29, %32
%34 = insertelement <2 x double> poison, double %19, i64 0
%35 = shufflevector <2 x double> %34, <2 x double> poison, <2 x i32> zeroinitializer
%36 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %35, <2 x double> %33, <2 x double> %11)
br label %37
37: ; preds = %9, %18
%38 = phi <2 x double> [ %11, %9 ], [ %36, %18 ]
%39 = add nuw i32 %10, 1
%40 = icmp eq i32 %10, %5
br i1 %40, label %41, label %9
41: ; preds = %37, %6
%42 = phi <2 x double> [ zeroinitializer, %6 ], [ %38, %37 ]
%43 = extractelement <2 x double> %42, i64 1
store double %43, double* %2
%44 = extractelement <2 x double> %42, i64 0
store double %44, double* %3
ret void
}