#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 fabs(double);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
double log(double);
double sinh(double);
double sqrt(double);
int /*<<< orphan*/ stderr;
double corbel_fget(double e, double capn) {
  int IMAX = 10;
  double tmp, x, shx, chx;
  double esh, ech, f, fp, fpp, fppp, dx;
  double corbel_fget_out = 0.0;
  if (capn < 0.0) {
    tmp = -2.0 * capn / e + 1.80;
    x = -log(tmp);
  } else {
    tmp = +2.0 * capn / e + 1.80;
    x = log(tmp);
  }
  corbel_fget_out = x;
  for (int i = 0; i < IMAX; i++) {
    shx = sinh(x);
    chx = sqrt(1.0 + shx * shx);
    esh = e * shx;
    ech = e * chx;
    f = esh - x - capn;
    fp = ech - 1.0;
    fpp = esh;
    fppp = ech;
    dx = -f / fp;
    dx = -f / (fp + dx * fpp / 2.0);
    dx = -f / (fp + dx * fpp / 2.0 + dx * dx * fppp / 6.0);
    corbel_fget_out = x + dx;
    if (fabs(dx) < 4.0e-15) {
      return corbel_fget_out;
    }
    x = corbel_fget_out;
  }
  fputs("FGET : RETURNING WITHOUT COMPLETE CONVERGENCE", stderr);
  return corbel_fget_out;
}


x86 assembly (clang, -O0):
<corbel_fget>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movl   $0xa,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11c0 <corbel_fget+0x80>
movsd  0xe96(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  0xe74(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <log@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    11f2 <corbel_fget+0xb2>
movsd  0xe40(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  0xe26(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1050 <log@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    13cf <corbel_fget+0x28f>
movsd  -0x30(%rbp),%xmm0
call   1030 <sinh@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdee(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xda1(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm2
mulsd  -0x68(%rbp),%xmm2
movsd  0xd0b(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm2
mulsd  -0x68(%rbp),%xmm2
movsd  0xcc7(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
movsd  -0x78(%rbp),%xmm2
mulsd  -0x78(%rbp),%xmm2
mulsd  -0x70(%rbp),%xmm2
movsd  0xcc0(%rip),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm1
movaps 0xca4(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xc80(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    13b1 <corbel_fget+0x271>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13ee <corbel_fget+0x2ae>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1206 <corbel_fget+0xc6>
mov    0x2c0a(%rip),%rax
mov    (%rax),%esi
lea    0xc61(%rip),%rdi
call   1040 <fputs@plt>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<corbel_fget>:
push   %rbx
sub    $0x30,%rsp
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
movsd  %xmm1,0x28(%rsp)
movapd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm2,0x20(%rsp)
divsd  %xmm2,%xmm0
jbe    1193 <corbel_fget+0x53>
movsd  0xe8d(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1050 <log@plt>
movapd %xmm0,%xmm6
xorpd  0xea4(%rip),%xmm6
mov    $0xa,%ebx
jmp    11b0 <corbel_fget+0x70>
addsd  0xe65(%rip),%xmm0
call   1050 <log@plt>
movapd %xmm0,%xmm6
mov    $0xa,%ebx
nopl   0x0(%rax)
movapd %xmm6,(%rsp)
movapd %xmm6,%xmm0
call   1030 <sinh@plt>
movapd %xmm0,%xmm7
mulsd  %xmm0,%xmm0
addsd  0xe3a(%rip),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11e0 <corbel_fget+0xa0>
sqrtsd %xmm0,%xmm0
jmp    11f1 <corbel_fget+0xb1>
xchg   %ax,%ax
movsd  %xmm7,0x18(%rsp)
call   1060 <sqrt@plt>
movsd  0x18(%rsp),%xmm7
movsd  0x20(%rsp),%xmm1
mulsd  %xmm1,%xmm7
mulsd  %xmm1,%xmm0
movapd %xmm7,%xmm2
movapd (%rsp),%xmm6
subsd  %xmm6,%xmm2
subsd  0x28(%rsp),%xmm2
movsd  0xdf6(%rip),%xmm3
addsd  %xmm0,%xmm3
movapd 0xe0a(%rip),%xmm1
xorpd  %xmm2,%xmm1
divsd  %xmm3,%xmm2
mulsd  %xmm7,%xmm2
movsd  0xdde(%rip),%xmm4
mulsd  %xmm4,%xmm2
movapd %xmm3,%xmm5
subsd  %xmm2,%xmm5
movapd %xmm1,%xmm2
divsd  %xmm5,%xmm2
mulsd  %xmm2,%xmm7
mulsd  %xmm4,%xmm7
addsd  %xmm3,%xmm7
mulsd  %xmm2,%xmm2
mulsd  %xmm0,%xmm2
divsd  0xdb6(%rip),%xmm2
addsd  %xmm7,%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm6
andpd  0xdc2(%rip),%xmm1
movsd  0xda2(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     12b4 <corbel_fget+0x174>
add    $0xffffffff,%ebx
jne    11b0 <corbel_fget+0x70>
mov    0x2d44(%rip),%rax
mov    (%rax),%esi
lea    0xdab(%rip),%rdi
movapd %xmm6,(%rsp)
call   1040 <fputs@plt>
movapd (%rsp),%xmm6
movapd %xmm6,%xmm0
add    $0x30,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [46 x i8] c"FGET : RETURNING WITHOUT COMPLETE CONVERGENCE\00"
@stderr = global i32 0
define double @corbel_fget(double %0, double %1) {
%3 = fcmp olt double %1, 0.000000e+00
%4 = fmul double %1, 2.000000e+00
%5 = fdiv double %4, %0
br i1 %3, label %6, label %10
6: ; preds = %2
%7 = fsub double 1.800000e+00, %5
%8 = tail call double @log(double %7)
%9 = fneg double %8
br label %13
10: ; preds = %2
%11 = fadd double %5, 1.800000e+00
%12 = tail call double @log(double %11)
br label %13
13: ; preds = %10, %6
%14 = phi double [ %9, %6 ], [ %12, %10 ]
br label %18
15: ; preds = %18
%16 = add nuw nsw i32 %19, 1
%17 = icmp eq i32 %16, 10
br i1 %17, label %46, label %18
18: ; preds = %13, %15
%19 = phi i32 [ %16, %15 ], [ 0, %13 ]
%20 = phi double [ %43, %15 ], [ %14, %13 ]
%21 = tail call double @sinh(double %20)
%22 = tail call double @llvm.fmuladd.f64(double %21, double %21, double 1.000000e+00)
%23 = tail call double @sqrt(double %22)
%24 = fmul double %21, %0
%25 = fmul double %23, %0
%26 = fsub double %24, %20
%27 = fsub double %26, %1
%28 = fadd double %25, -1.000000e+00
%29 = fneg double %27
%30 = fdiv double %29, %28
%31 = fmul double %24, %30
%32 = fmul double %31, 5.000000e-01
%33 = fadd double %28, %32
%34 = fdiv double %29, %33
%35 = fmul double %24, %34
%36 = fmul double %35, 5.000000e-01
%37 = fadd double %28, %36
%38 = fmul double %34, %34
%39 = fmul double %25, %38
%40 = fdiv double %39, 6.000000e+00
%41 = fadd double %37, %40
%42 = fdiv double %29, %41
%43 = fadd double %20, %42
%44 = tail call double @llvm.fabs.f64(double %42)
%45 = fcmp olt double %44, 4.000000e-15
br i1 %45, label %49, label %15
46: ; preds = %15
%47 = load i32, i32* @stderr
%48 = tail call i32 @fputs(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %18, %46
ret double %43
}