#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 delta_x1(double, double, double, double, double);
double delta_x2(double, double, double, double, double);
double delta_x3(double, double, double, double, double);
double delta_x4(double, double, double, double, double);
double get_het_f(double x1, double x2, double x3, double x4, double r,
                 double eps) {
  double pa;
  double qa;
  double pb;
  double qb;
  double het_f;
  double dx1;
  double dx2;
  double dx3;
  double dx4;
  while (x1 + x2 < 1.0 - eps) {
    pa = x1 + x2;
    qa = 1.0 - pa;
    dx1 = delta_x1(x1, x2, x3, x4, r);
    dx2 = delta_x2(x1, x2, x3, x4, r);
    dx3 = delta_x3(x1, x2, x3, x4, r);
    dx4 = delta_x4(x1, x2, x3, x4, r);
    x1 = x1 + dx1;
    x2 = x2 + dx2;
    x3 = x3 + dx3;
    x4 = x4 + dx4;
  }
  pb = x1 + x3;
  qb = 1.0 - pb;
  het_f = 2.0 * pb * qb;
  return het_f;
}


x86 assembly (clang, -O0):
<get_het_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
movsd  0xe85(%rip),%xmm0
subsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1278 <get_het_f+0x138>
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe5f(%rip),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
call   1030 <delta_x1@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
call   1040 <delta_x2@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
call   1060 <delta_x3@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
call   1050 <delta_x4@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1169 <get_het_f+0x29>
movsd  -0x8(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xd71(%rip),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xd67(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_het_f>:
sub    $0x48,%rsp
movapd %xmm0,%xmm6
movsd  0xeb0(%rip),%xmm7
subsd  %xmm5,%xmm7
movapd %xmm1,%xmm0
addsd  %xmm6,%xmm0
ucomisd %xmm0,%xmm7
jbe    126e <get_het_f+0x12e>
movsd  %xmm4,0x10(%rsp)
movsd  %xmm7,0x28(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm1,0x18(%rsp)
movsd  %xmm3,(%rsp)
movsd  %xmm6,0x20(%rsp)
movsd  %xmm2,0x8(%rsp)
movapd %xmm6,%xmm0
movsd  0x8(%rsp),%xmm2
movsd  (%rsp),%xmm3
movsd  0x10(%rsp),%xmm4
call   1030 <delta_x1@plt>
movsd  %xmm0,0x40(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
movsd  (%rsp),%xmm3
movsd  0x10(%rsp),%xmm4
call   1040 <delta_x2@plt>
movsd  %xmm0,0x38(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
movsd  (%rsp),%xmm3
movsd  0x10(%rsp),%xmm4
call   1060 <delta_x3@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
movsd  (%rsp),%xmm3
movsd  0x10(%rsp),%xmm4
call   1050 <delta_x4@plt>
movsd  0x28(%rsp),%xmm7
movsd  0x18(%rsp),%xmm1
movsd  (%rsp),%xmm3
movsd  0x20(%rsp),%xmm6
movsd  0x8(%rsp),%xmm2
addsd  0x40(%rsp),%xmm6
addsd  0x38(%rsp),%xmm1
addsd  0x30(%rsp),%xmm2
addsd  %xmm0,%xmm3
movapd %xmm1,%xmm0
addsd  %xmm6,%xmm0
ucomisd %xmm0,%xmm7
ja     1180 <get_het_f+0x40>
addsd  %xmm6,%xmm2
movsd  0xd86(%rip),%xmm0
subsd  %xmm2,%xmm0
addsd  %xmm2,%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
add    $0x48,%rsp
ret

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

LLVM IR (-O2):
define double @get_het_f(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = fsub double 1.000000e+00, %5
%8 = fadd double %1, %0
%9 = fcmp olt double %8, %7
br i1 %9, label %10, label %25
10: ; preds = %6, %10
%11 = phi double [ %19, %10 ], [ %0, %6 ]
%12 = phi double [ %20, %10 ], [ %1, %6 ]
%13 = phi double [ %21, %10 ], [ %2, %6 ]
%14 = phi double [ %22, %10 ], [ %3, %6 ]
%15 = tail call double @delta_x1(double %11, double %12, double %13, double %14, double %4)
%16 = tail call double @delta_x2(double %11, double %12, double %13, double %14, double %4)
%17 = tail call double @delta_x3(double %11, double %12, double %13, double %14, double %4)
%18 = tail call double @delta_x4(double %11, double %12, double %13, double %14, double %4)
%19 = fadd double %11, %15
%20 = fadd double %12, %16
%21 = fadd double %13, %17
%22 = fadd double %14, %18
%23 = fadd double %20, %19
%24 = fcmp olt double %23, %7
br i1 %24, label %10, label %25
25: ; preds = %10, %6
%26 = phi double [ %2, %6 ], [ %21, %10 ]
%27 = phi double [ %0, %6 ], [ %19, %10 ]
%28 = fadd double %26, %27
%29 = fsub double 1.000000e+00, %28
%30 = fmul double %28, 2.000000e+00
%31 = fmul double %30, %29
ret double %31
}