#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 numrxnrate(double, double, double);
double sqrt(double);
double unbindingradius(double pgem, double dt, double difc, double a) {
  double b, lo, dif, step, ki, kmax;
  int n;
  if (pgem <= 0 || pgem >= 1 || difc <= 0 || a <= 0 || dt < 0)
    return -2;
  if (dt == 0)
    return a / pgem;
  step = sqrt(2.0 * difc * dt);
  ki = numrxnrate(step, a, -1);
  kmax = numrxnrate(step, a, 0);
  if (1.0 - ki / kmax < pgem)
    return ki / kmax - 1.0;
  lo = 0;
  b = a;
  while (1.0 - ki / numrxnrate(step, a, b) > pgem) {
    lo = b;
    b *= 2.0;
  }
  dif = b - lo;
  for (n = 0; n < 15; n++) {
    dif *= 0.5;
    b = lo + dif;
    if (1.0 - ki / numrxnrate(step, a, b) > pgem)
      lo = b;
  }
  b = lo + 0.5 * dif;
  return b;
}


x86 assembly (clang, -O0):
<unbindingradius>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jae    118b <unbindingradius+0x6b>
movsd  -0x10(%rbp),%xmm0
movsd  0xea9(%rip),%xmm1
ucomisd %xmm1,%xmm0
jae    118b <unbindingradius+0x6b>
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jae    118b <unbindingradius+0x6b>
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jae    118b <unbindingradius+0x6b>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    119d <unbindingradius+0x7d>
movsd  0xe8d(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1393 <unbindingradius+0x273>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11c9 <unbindingradius+0xa9>
jp     11c9 <unbindingradius+0xa9>
movsd  -0x28(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1393 <unbindingradius+0x273>
movsd  0xe3f(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xe11(%rip),%xmm2
call   1030 <numrxnrate@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
xorps  %xmm2,%xmm2
call   1030 <numrxnrate@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  0xdd6(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    125d <unbindingradius+0x13d>
movsd  -0x50(%rbp),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  0xdb1(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1393 <unbindingradius+0x273>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
call   1030 <numrxnrate@plt>
movsd  -0x68(%rbp),%xmm1
divsd  %xmm0,%xmm1
movsd  0xd62(%rip),%xmm0
subsd  %xmm1,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    12ce <unbindingradius+0x1ae>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xd51(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    126f <unbindingradius+0x14f>
movsd  -0x30(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x5c(%rbp)
cmpl   $0xf,-0x5c(%rbp)
jge    136a <unbindingradius+0x24a>
movsd  0xd22(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
call   1030 <numrxnrate@plt>
movsd  -0x70(%rbp),%xmm1
divsd  %xmm0,%xmm1
movsd  0xcc2(%rip),%xmm0
subsd  %xmm1,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1357 <unbindingradius+0x237>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    135c <unbindingradius+0x23c>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    12e4 <unbindingradius+0x1c4>
movsd  -0x38(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
movsd  0xc9c(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unbindingradius>:
push   %rbx
sub    $0x50,%rsp
movapd %xmm0,%xmm5
xorpd  %xmm4,%xmm4
ucomisd %xmm1,%xmm4
movsd  0xec7(%rip),%xmm0
ja     1357 <unbindingradius+0x237>
ucomisd %xmm5,%xmm4
jae    1357 <unbindingradius+0x237>
ucomisd 0xeb7(%rip),%xmm5
jae    1357 <unbindingradius+0x237>
xorpd  %xmm4,%xmm4
ucomisd %xmm2,%xmm4
jae    1357 <unbindingradius+0x237>
ucomisd %xmm3,%xmm4
jae    1357 <unbindingradius+0x237>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1188 <unbindingradius+0x68>
jp     1188 <unbindingradius+0x68>
divsd  %xmm5,%xmm3
movapd %xmm3,%xmm0
jmp    1357 <unbindingradius+0x237>
movsd  %xmm5,0x20(%rsp)
addsd  %xmm2,%xmm2
mulsd  %xmm1,%xmm2
ucomisd %xmm0,%xmm2
movsd  %xmm3,0x8(%rsp)
jb     11ab <unbindingradius+0x8b>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    11ba <unbindingradius+0x9a>
movapd %xmm2,%xmm0
call   1040 <sqrt@plt>
movsd  0x8(%rsp),%xmm3
movsd  0xe4e(%rip),%xmm2
movsd  %xmm0,0x18(%rsp)
movapd %xmm3,%xmm1
call   1030 <numrxnrate@plt>
movsd  %xmm0,0x10(%rsp)
xorps  %xmm2,%xmm2
movsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <numrxnrate@plt>
movsd  0x10(%rsp),%xmm2
movapd %xmm0,%xmm1
movapd %xmm2,%xmm0
divsd  %xmm1,%xmm0
movsd  0xe03(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0x20(%rsp),%xmm2
ucomisd %xmm1,%xmm2
jbe    1222 <unbindingradius+0x102>
addsd  0xdf3(%rip),%xmm0
jmp    1357 <unbindingradius+0x237>
movsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movaps %xmm1,%xmm2
call   1030 <numrxnrate@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0xdc0(%rip),%xmm0
subsd  %xmm1,%xmm0
ucomisd 0x20(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movapd %xmm1,%xmm2
xorpd  %xmm0,%xmm0
movapd %xmm0,0x30(%rsp)
jbe    12b5 <unbindingradius+0x195>
movapd %xmm1,%xmm2
nopl   0x0(%rax)
movapd %xmm2,0x30(%rsp)
addsd  %xmm2,%xmm2
movsd  %xmm2,0x28(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <numrxnrate@plt>
movsd  0x28(%rsp),%xmm2
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm3
divsd  %xmm0,%xmm3
movsd  0xd5f(%rip),%xmm0
subsd  %xmm3,%xmm0
ucomisd 0x20(%rsp),%xmm0
ja     1270 <unbindingradius+0x150>
movapd 0x30(%rsp),%xmm3
subsd  %xmm3,%xmm2
mov    $0xf,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movapd %xmm3,0x30(%rsp)
mulsd  0xd3a(%rip),%xmm2
movsd  %xmm2,0x28(%rsp)
addsd  %xmm2,%xmm3
movapd %xmm3,0x40(%rsp)
movsd  0x18(%rsp),%xmm0
movapd %xmm3,%xmm2
call   1030 <numrxnrate@plt>
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm3
divsd  %xmm0,%xmm3
movsd  0xcf3(%rip),%xmm4
subsd  %xmm3,%xmm4
movsd  0x28(%rsp),%xmm2
movsd  0x20(%rsp),%xmm0
cmpltsd %xmm4,%xmm0
movapd 0x40(%rsp),%xmm3
andpd  %xmm0,%xmm3
andnpd 0x30(%rsp),%xmm0
orpd   %xmm3,%xmm0
movapd %xmm0,%xmm3
add    $0xffffffff,%ebx
jne    12d0 <unbindingradius+0x1b0>
mulsd  0xcc9(%rip),%xmm2
addsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @unbindingradius(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%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 i32
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
%17 = load double, double* %6
%18 = fcmp ole double %17, 0.000000e+00
br i1 %18, label %31, label %19
19: ; preds = %4
%20 = load double, double* %6
%21 = fcmp oge double %20, 1.000000e+00
br i1 %21, label %31, label %22
22: ; preds = %19
%23 = load double, double* %8
%24 = fcmp ole double %23, 0.000000e+00
br i1 %24, label %31, label %25
25: ; preds = %22
%26 = load double, double* %9
%27 = fcmp ole double %26, 0.000000e+00
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = load double, double* %7
%30 = fcmp olt double %29, 0.000000e+00
br i1 %30, label %31, label %32
31: ; preds = %28, %25, %22, %19, %4
store double -2.000000e+00, double* %5
br label %111
32: ; preds = %28
%33 = load double, double* %7
%34 = fcmp oeq double %33, 0.000000e+00
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = load double, double* %9
%37 = load double, double* %6
%38 = fdiv double %36, %37
store double %38, double* %5
br label %111
39: ; preds = %32
%40 = load double, double* %8
%41 = fmul double 2.000000e+00, %40
%42 = load double, double* %7
%43 = fmul double %41, %42
%44 = call double @sqrt(double %43)
store double %44, double* %13
%45 = load double, double* %13
%46 = load double, double* %9
%47 = call double @numrxnrate(double %45, double %46, double -1.000000e+00)
store double %47, double* %14
%48 = load double, double* %13
%49 = load double, double* %9
%50 = call double @numrxnrate(double %48, double %49, double 0.000000e+00)
store double %50, double* %15
%51 = load double, double* %14
%52 = load double, double* %15
%53 = fdiv double %51, %52
%54 = fsub double 1.000000e+00, %53
%55 = load double, double* %6
%56 = fcmp olt double %54, %55
br i1 %56, label %57, label %62
57: ; preds = %39
%58 = load double, double* %14
%59 = load double, double* %15
%60 = fdiv double %58, %59
%61 = fsub double %60, 1.000000e+00
store double %61, double* %5
br label %111
62: ; preds = %39
store double 0.000000e+00, double* %11
%63 = load double, double* %9
store double %63, double* %10
br label %64
64: ; preds = %74, %62
%65 = load double, double* %14
%66 = load double, double* %13
%67 = load double, double* %9
%68 = load double, double* %10
%69 = call double @numrxnrate(double %66, double %67, double %68)
%70 = fdiv double %65, %69
%71 = fsub double 1.000000e+00, %70
%72 = load double, double* %6
%73 = fcmp ogt double %71, %72
br i1 %73, label %74, label %78
74: ; preds = %64
%75 = load double, double* %10
store double %75, double* %11
%76 = load double, double* %10
%77 = fmul double %76, 2.000000e+00
store double %77, double* %10
br label %64
78: ; preds = %64
%79 = load double, double* %10
%80 = load double, double* %11
%81 = fsub double %79, %80
store double %81, double* %12
store i32 0, i32* %16
br label %82
82: ; preds = %103, %78
%83 = load i32, i32* %16
%84 = icmp slt i32 %83, 15
br i1 %84, label %85, label %106
85: ; preds = %82
%86 = load double, double* %12
%87 = fmul double %86, 5.000000e-01
store double %87, double* %12
%88 = load double, double* %11
%89 = load double, double* %12
%90 = fadd double %88, %89
store double %90, double* %10
%91 = load double, double* %14
%92 = load double, double* %13
%93 = load double, double* %9
%94 = load double, double* %10
%95 = call double @numrxnrate(double %92, double %93, double %94)
%96 = fdiv double %91, %95
%97 = fsub double 1.000000e+00, %96
%98 = load double, double* %6
%99 = fcmp ogt double %97, %98
br i1 %99, label %100, label %102
100: ; preds = %85
%101 = load double, double* %10
store double %101, double* %11
br label %102
102: ; preds = %100, %85
br label %103
103: ; preds = %102
%104 = load i32, i32* %16
%105 = add nsw i32 %104, 1
store i32 %105, i32* %16
br label %82
106: ; preds = %82
%107 = load double, double* %11
%108 = load double, double* %12
%109 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %108, double %107)
store double %109, double* %10
%110 = load double, double* %10
store double %110, double* %5
br label %111
111: ; preds = %106, %57, %35, %31
%112 = load double, double* %5
ret double %112
}

LLVM IR (-O2):
define double @unbindingradius(double %0, double %1, double %2, double %3) {
%5 = fcmp ole double %0, 0.000000e+00
%6 = fcmp oge double %0, 1.000000e+00
%7 = or i1 %5, %6
%8 = fcmp ole double %2, 0.000000e+00
%9 = or i1 %7, %8
%10 = fcmp ole double %3, 0.000000e+00
%11 = or i1 %9, %10
%12 = fcmp olt double %1, 0.000000e+00
%13 = or i1 %12, %11
br i1 %13, label %60, label %14
14: ; preds = %4
%15 = fcmp oeq double %1, 0.000000e+00
br i1 %15, label %16, label %18
16: ; preds = %14
%17 = fdiv double %3, %0
br label %60
18: ; preds = %14
%19 = fmul double %2, 2.000000e+00
%20 = fmul double %19, %1
%21 = tail call double @sqrt(double %20)
%22 = tail call double @numrxnrate(double %21, double %3, double -1.000000e+00)
%23 = tail call double @numrxnrate(double %21, double %3, double 0.000000e+00)
%24 = fdiv double %22, %23
%25 = fsub double 1.000000e+00, %24
%26 = fcmp olt double %25, %0
br i1 %26, label %32, label %27
27: ; preds = %18
%28 = tail call double @numrxnrate(double %21, double %3, double %3)
%29 = fdiv double %22, %28
%30 = fsub double 1.000000e+00, %29
%31 = fcmp ogt double %30, %0
br i1 %31, label %34, label %41
32: ; preds = %18
%33 = fadd double %24, -1.000000e+00
br label %60
34: ; preds = %27, %34
%35 = phi double [ %36, %34 ], [ %3, %27 ]
%36 = fmul double %35, 2.000000e+00
%37 = tail call double @numrxnrate(double %21, double %3, double %36)
%38 = fdiv double %22, %37
%39 = fsub double 1.000000e+00, %38
%40 = fcmp ogt double %39, %0
br i1 %40, label %34, label %41
41: ; preds = %34, %27
%42 = phi double [ 0.000000e+00, %27 ], [ %35, %34 ]
%43 = phi double [ %3, %27 ], [ %36, %34 ]
%44 = fsub double %43, %42
br label %45
45: ; preds = %41, %45
%46 = phi i32 [ 0, %41 ], [ %56, %45 ]
%47 = phi double [ %42, %41 ], [ %55, %45 ]
%48 = phi double [ %44, %41 ], [ %49, %45 ]
%49 = fmul double %48, 5.000000e-01
%50 = fadd double %47, %49
%51 = tail call double @numrxnrate(double %21, double %3, double %50)
%52 = fdiv double %22, %51
%53 = fsub double 1.000000e+00, %52
%54 = fcmp ogt double %53, %0
%55 = select i1 %54, double %50, double %47
%56 = add nuw nsw i32 %46, 1
%57 = icmp eq i32 %56, 15
br i1 %57, label %58, label %45
58: ; preds = %45
%59 = tail call double @llvm.fmuladd.f64(double %49, double 5.000000e-01, double %55)
br label %60
60: ; preds = %4, %58, %32, %16
%61 = phi double [ %17, %16 ], [ %33, %32 ], [ %59, %58 ], [ -2.000000e+00, %4 ]
ret double %61
}