#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 DBL_EPSILON;
double fabs(double);
double initialStep(double fnew, double fmin, double gtp, double smax) {
  double d, alpha;
  d = fabs(fnew - fmin);
  alpha = 1.0;
  if (d * 2.0 <= -(gtp) && d >= DBL_EPSILON) {
    alpha = d * -2.0 / gtp;
  }
  if (alpha >= smax) {
    alpha = smax;
  }
  return alpha;
}


x86 assembly (clang, -O0):
<initialStep>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movaps 0xef7(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xece(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xeb9(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
jb     119f <initialStep+0x9f>
movsd  -0x28(%rbp),%xmm0
mov    0x2e6a(%rip),%rax
ucomisd (%rax),%xmm0
jb     119f <initialStep+0x9f>
movsd  0xe80(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     11b9 <initialStep+0xb9>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialStep>:
subsd  %xmm1,%xmm0
andpd  0xef4(%rip),%xmm0
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movapd 0xef4(%rip),%xmm4
xorpd  %xmm2,%xmm4
ucomisd %xmm1,%xmm4
movsd  0xef4(%rip),%xmm1
jb     114b <initialStep+0x4b>
mov    0x2eb3(%rip),%rax
ucomisd (%rax),%xmm0
jb     114b <initialStep+0x4b>
mulsd  0xee5(%rip),%xmm0
divsd  %xmm2,%xmm0
movapd %xmm0,%xmm1
movapd %xmm3,%xmm0
cmplesd %xmm1,%xmm0
andpd  %xmm0,%xmm3
andnpd %xmm1,%xmm0
orpd   %xmm3,%xmm0
ret

LLVM IR (-O0):
@DBL_EPSILON = global double 0.000000e+00
define double @initialStep(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
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%11 = load double, double* %5
%12 = load double, double* %6
%13 = fsub double %11, %12
%14 = call double @llvm.fabs.f64(double %13)
store double %14, double* %9
store double 1.000000e+00, double* %10
%15 = load double, double* %9
%16 = fmul double %15, 2.000000e+00
%17 = load double, double* %7
%18 = fneg double %17
%19 = fcmp ole double %16, %18
br i1 %19, label %20, label %29
20: ; preds = %4
%21 = load double, double* %9
%22 = load double, double* @DBL_EPSILON
%23 = fcmp oge double %21, %22
br i1 %23, label %24, label %29
24: ; preds = %20
%25 = load double, double* %9
%26 = fmul double %25, -2.000000e+00
%27 = load double, double* %7
%28 = fdiv double %26, %27
store double %28, double* %10
br label %29
29: ; preds = %24, %20, %4
%30 = load double, double* %10
%31 = load double, double* %8
%32 = fcmp oge double %30, %31
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = load double, double* %8
store double %34, double* %10
br label %35
35: ; preds = %33, %29
%36 = load double, double* %10
ret double %36
}

LLVM IR (-O2):
@DBL_EPSILON = global double 0.000000e+00
define double @initialStep(double %0, double %1, double %2, double %3) {
%5 = fsub double %0, %1
%6 = tail call double @llvm.fabs.f64(double %5)
%7 = fmul double %6, 2.000000e+00
%8 = fneg double %2
%9 = fcmp ugt double %7, %8
%10 = load double, double* @DBL_EPSILON
%11 = fcmp ult double %6, %10
%12 = select i1 %9, i1 true, i1 %11
br i1 %12, label %16, label %13
13: ; preds = %4
%14 = fmul double %6, -2.000000e+00
%15 = fdiv double %14, %2
br label %16
16: ; preds = %13, %4
%17 = phi double [ %15, %13 ], [ 1.000000e+00, %4 ]
%18 = fcmp oge double %17, %3
%19 = select i1 %18, double %3, double %17
ret double %19
}