#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 */
int /*<<< orphan*/ assert(int);
double const fabs(double const);
int const log(double);
double sqrt(double);
double gtoRadius(const double c, const double zeta, const int l,
                 const double cutoff) {
  int i;
  double delta, dg, guess, zr, r = 0.0;
  const int N = 40;
  int converged = 0;
  const double t = log(fabs(c) / fabs(cutoff));
  dg = t / zeta;
  r = (dg > cutoff) ? dg : cutoff;
  if (0 != l) {
    if (0 < l) {
      dg = sqrt(0.5 * l / fabs(c));
      guess = (dg > cutoff) ? dg : cutoff;
      if (guess > r) {
        r = 0.5 * (r + guess);
      }
    }
    for (i = 0; i < N; i++) {
      zr = zeta * r;
      guess = t + l * log(r) - zr * r;
      delta = guess / (l / r - 2 * zr);
      dg = r - delta;
      r = (dg > cutoff) ? dg : cutoff;
      if (fabs(delta) < cutoff) {
        r *= r;
        converged = 1;
        break;
      }
    }
    assert(0 != converged);
  }
  return r;
}


x86 assembly (clang, -O0):
<gtoRadius>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
movsd  %xmm2,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x28,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
divsd  %xmm1,%xmm0
call   1050 <log@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11d4 <gtoRadius+0x94>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    11de <gtoRadius+0x9e>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
xor    %eax,%eax
cmp    -0x14(%rbp),%eax
je     13ec <gtoRadius+0x2ac>
xor    %eax,%eax
cmp    -0x14(%rbp),%eax
jge    1297 <gtoRadius+0x157>
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xdf5(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
divsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1253 <gtoRadius+0x113>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    125d <gtoRadius+0x11d>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    1292 <gtoRadius+0x152>
movsd  -0x50(%rbp),%xmm1
addsd  -0x40(%rbp),%xmm1
movsd  0xd77(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1297 <gtoRadius+0x157>
movl   $0x0,-0x24(%rbp)
cmpl   $0x28,-0x24(%rbp)
jge    13da <gtoRadius+0x29a>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x14(%rbp),%eax
mov    %eax,-0x84(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1050 <log@plt>
movsd  -0x90(%rbp),%xmm1
ff
mov    %eax,%ecx
mov    -0x84(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
addsd  %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
divsd  -0x50(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
addsd  %xmm2,%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x50(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1376 <gtoRadius+0x236>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
jmp    1383 <gtoRadius+0x243>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1030 <fabs@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    13c7 <gtoRadius+0x287>
movsd  -0x50(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x1,-0x58(%rbp)
jmp    13da <gtoRadius+0x29a>
jmp    13cc <gtoRadius+0x28c>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    129e <gtoRadius+0x15e>
xor    %eax,%eax
cmp    -0x58(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movsd  -0x50(%rbp),%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gtoRadius>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
movsd  %xmm2,0x18(%rsp)
mov    %edi,%r14d
movsd  %xmm1,0x20(%rsp)
movapd %xmm0,(%rsp)
divsd  %xmm2,%xmm0
andpd  0xea8(%rip),%xmm0
call   1040 <log@plt>
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
movsd  %xmm2,0x30(%rsp)
divsd  0x20(%rsp),%xmm2
maxsd  0x18(%rsp),%xmm2
test   %r14d,%r14d
je     129b <gtoRadius+0x16b>
cvtsi2sd %r14d,%xmm3
movsd  %xmm3,0x28(%rsp)
jle    11e0 <gtoRadius+0xb0>
movsd  0xe7c(%rip),%xmm0
mulsd  %xmm3,%xmm0
movapd (%rsp),%xmm1
andpd  0xe5b(%rip),%xmm1
divsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11b9 <gtoRadius+0x89>
sqrtsd %xmm0,%xmm0
jmp    11c8 <gtoRadius+0x98>
movsd  %xmm2,(%rsp)
call   1050 <sqrt@plt>
movsd  (%rsp),%xmm2
maxsd  0x18(%rsp),%xmm0
ucomisd %xmm2,%xmm0
jbe    11e0 <gtoRadius+0xb0>
addsd  %xmm0,%xmm2
mulsd  0xe30(%rip),%xmm2
xor    %ebp,%ebp
mov    $0x1,%bl
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  %xmm2,(%rsp)
movapd %xmm2,%xmm0
mulsd  0x20(%rsp),%xmm0
movsd  %xmm0,0x38(%rsp)
movapd %xmm2,%xmm0
call   1040 <log@plt>
movsd  0x28(%rsp),%xmm3
movsd  (%rsp),%xmm2
imul   %r14d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0x30(%rsp),%xmm0
movsd  0x38(%rsp),%xmm4
movapd %xmm4,%xmm1
mulsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movapd %xmm3,%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm4,%xmm4
subsd  %xmm4,%xmm1
divsd  %xmm1,%xmm0
subsd  %xmm0,%xmm2
movsd  0x18(%rsp),%xmm1
maxsd  %xmm1,%xmm2
andpd  0xd9a(%rip),%xmm0
ucomisd %xmm0,%xmm1
ja     1282 <gtoRadius+0x152>
cmp    $0x27,%ebp
lea    0x1(%rbp),%eax
setb   %bl
mov    %eax,%ebp
cmp    $0x28,%eax
jne    11f0 <gtoRadius+0xc0>
jmp    1286 <gtoRadius+0x156>
mulsd  %xmm2,%xmm2
movsd  %xmm2,(%rsp)
movzbl %bl,%edi
and    $0x1,%edi
call   1030 <assert@plt>
movsd  (%rsp),%xmm2
movapd %xmm2,%xmm0
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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