#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);
double log(double);
double pow(double, double);
double sqrt(double);
double STS_FindRoot(double x0, double dtr, double dta) {
  double a, b, c;
  double Ns, Ns1;
  int n;
  n = 0;
  Ns = x0 + 1.0;
  Ns1 = x0;
  while (fabs(Ns - Ns1) >= 1.0e-5) {
    Ns = Ns1;
    a = (1.0 - sqrt(0.01)) / (1.0 + sqrt(0.01));
    b = pow(a, 2.0 * Ns);
    c = (1.0 - b) / (1.0 + b);
    Ns1 = Ns + (dta - dtr * Ns / (2.0 * sqrt(0.01)) * c) /
                   (dtr / (2.0 * sqrt(0.01)) *
                    (c - 2.0 * Ns * b * log(a) * (1.0 + c) / (1.0 + b)));
    n += 1;
  }
  return (Ns);
}


x86 assembly (clang, -O0):
<STS_FindRoot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movl   $0x0,-0x44(%rbp)
movsd  0xea7(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movaps 0xea2(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xe7e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     136e <STS_FindRoot+0x23e>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe72(%rip),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xe4a(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xe4e(%rip),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm2
movsd  -0x90(%rbp),%xmm0
ff
movsd  0xe1e(%rip),%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe14(%rip),%xmm1
mulsd  -0x38(%rbp),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  0xded(%rip),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  0xde0(%rip),%xmm1
addsd  -0x28(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xdbc(%rip),%xmm0
call   1050 <sqrt@plt>
movsd  -0x88(%rbp),%xmm1
ff
movaps %xmm0,%xmm3
movsd  -0x80(%rbp),%xmm0
movsd  0xd97(%rip),%xmm2
mulsd  %xmm3,%xmm2
divsd  %xmm2,%xmm0
movsd  -0x30(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xd5c(%rip),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm2
movsd  -0x78(%rbp),%xmm0
movsd  0xd3f(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xd20(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <log@plt>
movsd  -0x70(%rbp),%xmm4
movsd  -0x68(%rbp),%xmm3
movsd  -0x60(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm5
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm5,%xmm4
movsd  0xccf(%rip),%xmm5
addsd  -0x30(%rbp),%xmm5
mulsd  %xmm5,%xmm4
movsd  0xcbe(%rip),%xmm5
addsd  -0x28(%rbp),%xmm5
divsd  %xmm5,%xmm4
subsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    116d <STS_FindRoot+0x3d>
movsd  -0x38(%rbp),%xmm0
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<STS_FindRoot>:
sub    $0x38,%rsp
movapd %xmm0,%xmm3
movsd  0xee0(%rip),%xmm0
addsd  %xmm3,%xmm0
movapd %xmm0,%xmm4
subsd  %xmm3,%xmm4
andpd  0xefc(%rip),%xmm4
movsd  %xmm1,0x8(%rsp)
ucomisd 0xec6(%rip),%xmm4
jb     122d <STS_FindRoot+0x11d>
movsd  0x8(%rsp),%xmm0
divsd  0xeba(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  %xmm2,0x18(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm3,0x30(%rsp)
movsd  %xmm3,0x28(%rsp)
addsd  %xmm3,%xmm3
movsd  %xmm3,0x20(%rsp)
movsd  0xe8a(%rip),%xmm0
movapd %xmm3,%xmm1
call   1030 <pow@plt>
movsd  0x18(%rsp),%xmm2
movsd  0x30(%rsp),%xmm3
movsd  0xe55(%rip),%xmm5
movapd %xmm5,%xmm1
subsd  %xmm0,%xmm1
movsd  0x20(%rsp),%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm5,%xmm0
divsd  %xmm0,%xmm1
mulsd  0x8(%rsp),%xmm3
divsd  0xe4d(%rip),%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
mulsd  0xe45(%rip),%xmm4
movapd %xmm4,%xmm6
movapd %xmm1,%xmm4
addsd  %xmm5,%xmm4
mulsd  %xmm6,%xmm4
divsd  %xmm0,%xmm4
addsd  %xmm1,%xmm4
mulsd  0x10(%rsp),%xmm4
divsd  %xmm4,%xmm3
movsd  0x28(%rsp),%xmm0
addsd  %xmm0,%xmm3
movapd %xmm0,%xmm1
subsd  %xmm3,%xmm1
andpd  0xe11(%rip),%xmm1
ucomisd 0xde1(%rip),%xmm1
jae    1170 <STS_FindRoot+0x60>
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @STS_FindRoot(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
store i32 0, i32* %12
%13 = load double, double* %4
%14 = fadd double %13, 1.000000e+00
store double %14, double* %10
%15 = load double, double* %4
store double %15, double* %11
br label %16
16: ; preds = %22, %3
%17 = load double, double* %10
%18 = load double, double* %11
%19 = fsub double %17, %18
%20 = call double @llvm.fabs.f64(double %19)
%21 = fcmp oge double %20, 1.000000e-05
br i1 %21, label %22, label %73
22: ; preds = %16
%23 = load double, double* %11
store double %23, double* %10
%24 = call double @sqrt(double 1.000000e-02)
%25 = fsub double 1.000000e+00, %24
%26 = call double @sqrt(double 1.000000e-02)
%27 = fadd double 1.000000e+00, %26
%28 = fdiv double %25, %27
store double %28, double* %7
%29 = load double, double* %7
%30 = load double, double* %10
%31 = fmul double 2.000000e+00, %30
%32 = call double @pow(double %29, double %31)
store double %32, double* %8
%33 = load double, double* %8
%34 = fsub double 1.000000e+00, %33
%35 = load double, double* %8
%36 = fadd double 1.000000e+00, %35
%37 = fdiv double %34, %36
store double %37, double* %9
%38 = load double, double* %10
%39 = load double, double* %6
%40 = load double, double* %5
%41 = load double, double* %10
%42 = fmul double %40, %41
%43 = call double @sqrt(double 1.000000e-02)
%44 = fmul double 2.000000e+00, %43
%45 = fdiv double %42, %44
%46 = load double, double* %9
%47 = fneg double %45
%48 = call double @llvm.fmuladd.f64(double %47, double %46, double %39)
%49 = load double, double* %5
%50 = call double @sqrt(double 1.000000e-02)
%51 = fmul double 2.000000e+00, %50
%52 = fdiv double %49, %51
%53 = load double, double* %9
%54 = load double, double* %10
%55 = fmul double 2.000000e+00, %54
%56 = load double, double* %8
%57 = fmul double %55, %56
%58 = load double, double* %7
%59 = call double @log(double %58)
%60 = fmul double %57, %59
%61 = load double, double* %9
%62 = fadd double 1.000000e+00, %61
%63 = fmul double %60, %62
%64 = load double, double* %8
%65 = fadd double 1.000000e+00, %64
%66 = fdiv double %63, %65
%67 = fsub double %53, %66
%68 = fmul double %52, %67
%69 = fdiv double %48, %68
%70 = fadd double %38, %69
store double %70, double* %11
%71 = load i32, i32* %12
%72 = add nsw i32 %71, 1
store i32 %72, i32* %12
br label %16
73: ; preds = %16
%74 = load double, double* %10
ret double %74
}

LLVM IR (-O2):
define double @STS_FindRoot(double %0, double %1, double %2) {
%4 = fadd double %0, 1.000000e+00
%5 = fsub double %4, %0
%6 = tail call double @llvm.fabs.f64(double %5)
%7 = fcmp ult double %6, 1.000000e-05
br i1 %7, label %32, label %8
8: ; preds = %3
%9 = fdiv double %1, 2.000000e-01
br label %10
10: ; preds = %8, %10
%11 = phi double [ %0, %8 ], [ %28, %10 ]
%12 = fmul double %11, 2.000000e+00
%13 = tail call double @pow(double 0x3FEA2E8BA2E8BA2E, double %12)
%14 = fsub double 1.000000e+00, %13
%15 = fadd double %13, 1.000000e+00
%16 = fdiv double %14, %15
%17 = fmul double %11, %1
%18 = fdiv double %17, -2.000000e-01
%19 = tail call double @llvm.fmuladd.f64(double %18, double %16, double %2)
%20 = fmul double %12, %13
%21 = fmul double %20, 0x3FC9AF93CD234415
%22 = fadd double %16, 1.000000e+00
%23 = fmul double %21, %22
%24 = fdiv double %23, %15
%25 = fadd double %16, %24
%26 = fmul double %9, %25
%27 = fdiv double %19, %26
%28 = fadd double %11, %27
%29 = fsub double %11, %28
%30 = tail call double @llvm.fabs.f64(double %29)
%31 = fcmp ult double %30, 1.000000e-05
br i1 %31, label %32, label %10
32: ; preds = %10, %3
%33 = phi double [ %4, %3 ], [ %11, %10 ]
ret double %33
}