#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 DMIN(double, double);
double sigma2_3(int, int, int);
double sigma2PQ(int i, int j, int k, int l) {
  double z1, z2;
  z1 = DMIN(sigma2_3(i, k, j), sigma2_3(i, k, l)) +
       DMIN(sigma2_3(j, l, i), sigma2_3(j, l, k));
  z2 = DMIN(sigma2_3(i, l, j), sigma2_3(i, l, k)) +
       DMIN(sigma2_3(j, k, i), sigma2_3(j, k, l));
  if ((z1 + z2) == 0.0)
    return ((sigma2_3(k, l, i) + sigma2_3(k, l, j)) / 8.0);
  else
    return (((z1 * z2) / (z1 + z2) +
             (sigma2_3(k, l, i) + sigma2_3(k, l, j)) / 2.0) /
            4.0);
}


x86 assembly (clang, -O0):
<sigma2PQ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <sigma2_3@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <sigma2_3@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
call   1030 <DMIN@plt>
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <sigma2_3@plt>
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <sigma2_3@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
call   1030 <DMIN@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <sigma2_3@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <sigma2_3@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
call   1030 <DMIN@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <sigma2_3@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <sigma2_3@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
call   1030 <DMIN@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1278 <sigma2PQ+0x158>
jp     1278 <sigma2PQ+0x158>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <sigma2_3@plt>
movsd  %xmm0,-0x60(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <sigma2_3@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xda6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12e8 <sigma2PQ+0x1c8>
movsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
addsd  -0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <sigma2_3@plt>
movsd  %xmm0,-0x70(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <sigma2_3@plt>
movsd  -0x70(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x68(%rbp),%xmm0
addsd  %xmm2,%xmm1
movsd  0xd39(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  0xd21(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigma2PQ>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%ebp
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%r15d
mov    %edx,%esi
mov    %r14d,%edx
call   1040 <sigma2_3@plt>
movsd  %xmm0,(%rsp)
mov    %r15d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
call   1040 <sigma2_3@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
call   1030 <DMIN@plt>
movsd  %xmm0,(%rsp)
mov    %r14d,%edi
mov    %ebp,%esi
mov    %r15d,%edx
call   1040 <sigma2_3@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r14d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
call   1040 <sigma2_3@plt>
movaps %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
call   1030 <DMIN@plt>
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %r15d,%edi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <sigma2_3@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r15d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
call   1040 <sigma2_3@plt>
movapd %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
call   1030 <DMIN@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r14d,%edi
mov    %ebx,%esi
mov    %r15d,%edx
call   1040 <sigma2_3@plt>
movsd  %xmm0,0x10(%rsp)
mov    %r14d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
call   1040 <sigma2_3@plt>
movaps %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
call   1030 <DMIN@plt>
addsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
movapd %xmm1,%xmm3
addsd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jne    1244 <sigma2PQ+0x124>
jp     1244 <sigma2PQ+0x124>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r15d,%edx
call   1040 <sigma2_3@plt>
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <sigma2_3@plt>
addsd  (%rsp),%xmm0
mulsd  0xdce(%rip),%xmm0
jmp    128a <sigma2PQ+0x16a>
mulsd  %xmm0,%xmm3
divsd  %xmm1,%xmm3
movsd  %xmm3,(%rsp)
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r15d,%edx
call   1040 <sigma2_3@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <sigma2_3@plt>
addsd  0x8(%rsp),%xmm0
mulsd  0xd83(%rip),%xmm0
addsd  (%rsp),%xmm0
mulsd  0xd7e(%rip),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define double @sigma2PQ(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call double @sigma2_3(i32 %0, i32 %2, i32 %1)
%6 = tail call double @sigma2_3(i32 %0, i32 %2, i32 %3)
%7 = tail call double @DMIN(double %5, double %6)
%8 = tail call double @sigma2_3(i32 %1, i32 %3, i32 %0)
%9 = tail call double @sigma2_3(i32 %1, i32 %3, i32 %2)
%10 = tail call double @DMIN(double %8, double %9)
%11 = fadd double %7, %10
%12 = tail call double @sigma2_3(i32 %0, i32 %3, i32 %1)
%13 = tail call double @sigma2_3(i32 %0, i32 %3, i32 %2)
%14 = tail call double @DMIN(double %12, double %13)
%15 = tail call double @sigma2_3(i32 %1, i32 %2, i32 %0)
%16 = tail call double @sigma2_3(i32 %1, i32 %2, i32 %3)
%17 = tail call double @DMIN(double %15, double %16)
%18 = fadd double %14, %17
%19 = fadd double %11, %18
%20 = fcmp oeq double %19, 0.000000e+00
br i1 %20, label %21, label %26
21: ; preds = %4
%22 = tail call double @sigma2_3(i32 %2, i32 %3, i32 %0)
%23 = tail call double @sigma2_3(i32 %2, i32 %3, i32 %1)
%24 = fadd double %22, %23
%25 = fmul double %24, 1.250000e-01
br label %35
26: ; preds = %4
%27 = fmul double %11, %18
%28 = fdiv double %27, %19
%29 = tail call double @sigma2_3(i32 %2, i32 %3, i32 %0)
%30 = tail call double @sigma2_3(i32 %2, i32 %3, i32 %1)
%31 = fadd double %29, %30
%32 = fmul double %31, 5.000000e-01
%33 = fadd double %28, %32
%34 = fmul double %33, 2.500000e-01
br label %35
35: ; preds = %26, %21
%36 = phi double [ %25, %21 ], [ %34, %26 ]
ret double %36
}