#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*/ fit_parabola_3p(int *, double *, double *, double *, double,
                                   double, double, double, double, double);
void expand_width(double *pwidth, double f0, double f1, double f2, double x0,
                  double x1, double x2) {
  int code;
  double a, cen, b, diff;
  (*pwidth) *= 1.618034;
  fit_parabola_3p(&code, &a, &cen, &b, x0, f0, x1, x1, x2, f2);
  if ((code != 0) || (a <= 0.0))
    (*pwidth) *= 1.0 / 1.618034;
  else {
    diff = cen - x1;
    diff = fabs(diff);
    diff *= 2.0;
    if (diff > *pwidth) {
      if (diff > (*pwidth) * 1.0 / 1.618034) {
        (*pwidth) *= 1.0 / 1.618034;
      }
    } else
      (*pwidth) = diff;
  }
}


x86 assembly (clang, -O0):
<expand_width>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xeba(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm4
movsd  -0x20(%rbp),%xmm5
lea    -0x3c(%rbp),%rdi
lea    -0x48(%rbp),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x58(%rbp),%rcx
call   1030 <fit_parabola_3p@plt>
cmpl   $0x0,-0x3c(%rbp)
jne    1199 <expand_width+0x89>
xorps  %xmm0,%xmm0
ucomisd -0x48(%rbp),%xmm0
jb     11b2 <expand_width+0xa2>
mov    -0x8(%rbp),%rax
movsd  0xe73(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
jmp    1251 <expand_width+0x141>
movsd  -0x50(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movaps 0xe53(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe2a(%rip),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
mov    -0x8(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    123f <expand_width+0x12f>
movsd  -0x60(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  0xe04(%rip),%xmm1
mulsd  (%rax),%xmm1
movsd  0xde8(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    123a <expand_width+0x12a>
mov    -0x8(%rbp),%rax
movsd  0xde6(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
jmp    124c <expand_width+0x13c>
movsd  -0x60(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1251 <expand_width+0x141>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expand_width>:
push   %rbx
sub    $0x30,%rsp
movaps %xmm2,%xmm6
movapd %xmm0,%xmm1
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
mulsd  0xed5(%rip),%xmm0
movsd  %xmm0,(%rdi)
lea    0xc(%rsp),%rdi
lea    0x20(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x28(%rsp),%rcx
movapd %xmm3,%xmm0
movapd %xmm4,%xmm2
movsd  %xmm4,0x10(%rsp)
movapd %xmm4,%xmm3
movaps %xmm5,%xmm4
movaps %xmm6,%xmm5
call   1030 <fit_parabola_3p@plt>
cmpl   $0x0,0xc(%rsp)
jne    11b5 <expand_width+0xa5>
xorpd  %xmm0,%xmm0
ucomisd 0x20(%rsp),%xmm0
jae    11b5 <expand_width+0xa5>
movsd  0x18(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
andpd  0xe89(%rip),%xmm0
addsd  %xmm0,%xmm0
movsd  (%rbx),%xmm1
ucomisd %xmm1,%xmm0
jbe    11c1 <expand_width+0xb1>
movapd %xmm1,%xmm2
divsd  0xe5f(%rip),%xmm2
ucomisd %xmm2,%xmm0
jbe    11c5 <expand_width+0xb5>
mulsd  0xe59(%rip),%xmm1
movapd %xmm1,%xmm0
jmp    11c1 <expand_width+0xb1>
movsd  (%rbx),%xmm0
mulsd  0xe47(%rip),%xmm0
movsd  %xmm0,(%rbx)
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @expand_width(double* %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = alloca double*
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
store double* %0, double** %8
store double %1, double* %9
store double %2, double* %10
store double %3, double* %11
store double %4, double* %12
store double %5, double* %13
store double %6, double* %14
%20 = load double*, double** %8
%21 = load double, double* %20
%22 = fmul double %21, 0x3FF9E3779E9D0E99
store double %22, double* %20
%23 = load double, double* %12
%24 = load double, double* %9
%25 = load double, double* %13
%26 = load double, double* %13
%27 = load double, double* %14
%28 = load double, double* %11
%29 = call i32 @fit_parabola_3p(i32* %15, double* %16, double* %17, double* %18, double %23, double %24, double %25, double %26, double %27, double %28)
%30 = load i32, i32* %15
%31 = icmp ne i32 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %7
%33 = load double, double* %16
%34 = fcmp ole double %33, 0.000000e+00
br i1 %34, label %35, label %39
35: ; preds = %32, %7
%36 = load double*, double** %8
%37 = load double, double* %36
%38 = fmul double %37, 0x3FE3C6EF34E15083
store double %38, double* %36
br label %67
39: ; preds = %32
%40 = load double, double* %17
%41 = load double, double* %13
%42 = fsub double %40, %41
store double %42, double* %19
%43 = load double, double* %19
%44 = call double @llvm.fabs.f64(double %43)
store double %44, double* %19
%45 = load double, double* %19
%46 = fmul double %45, 2.000000e+00
store double %46, double* %19
%47 = load double, double* %19
%48 = load double*, double** %8
%49 = load double, double* %48
%50 = fcmp ogt double %47, %49
br i1 %50, label %51, label %63
51: ; preds = %39
%52 = load double, double* %19
%53 = load double*, double** %8
%54 = load double, double* %53
%55 = fmul double %54, 1.000000e+00
%56 = fdiv double %55, 0x3FF9E3779E9D0E99
%57 = fcmp ogt double %52, %56
br i1 %57, label %58, label %62
58: ; preds = %51
%59 = load double*, double** %8
%60 = load double, double* %59
%61 = fmul double %60, 0x3FE3C6EF34E15083
store double %61, double* %59
br label %62
62: ; preds = %58, %51
br label %66
63: ; preds = %39
%64 = load double, double* %19
%65 = load double*, double** %8
store double %64, double* %65
br label %66
66: ; preds = %63, %62
br label %67
67: ; preds = %66, %35
ret void
}

LLVM IR (-O2):
define void @expand_width(double* nocapture %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = bitcast i32* %8 to i8*
%13 = bitcast double* %9 to i8*
%14 = bitcast double* %10 to i8*
%15 = bitcast double* %11 to i8*
%16 = load double, double* %0
%17 = fmul double %16, 0x3FF9E3779E9D0E99
store double %17, double* %0
%18 = call i32 @fit_parabola_3p(i32* %8, double* %9, double* %10, double* %11, double %4, double %1, double %5, double %5, double %6, double %3)
%19 = load i32, i32* %8
%20 = icmp ne i32 %19, 0
%21 = load double, double* %9
%22 = fcmp ole double %21, 0.000000e+00
%23 = select i1 %20, i1 true, i1 %22
br i1 %23, label %24, label %27
24: ; preds = %7
%25 = load double, double* %0
%26 = fmul double %25, 0x3FE3C6EF34E15083
br label %39
27: ; preds = %7
%28 = load double, double* %10
%29 = fsub double %28, %5
%30 = call double @llvm.fabs.f64(double %29)
%31 = fmul double %30, 2.000000e+00
%32 = load double, double* %0
%33 = fcmp ogt double %31, %32
br i1 %33, label %34, label %39
34: ; preds = %27
%35 = fdiv double %32, 0x3FF9E3779E9D0E99
%36 = fcmp ogt double %31, %35
br i1 %36, label %37, label %41
37: ; preds = %34
%38 = fmul double %32, 0x3FE3C6EF34E15083
br label %39
39: ; preds = %27, %24, %37
%40 = phi double [ %38, %37 ], [ %26, %24 ], [ %31, %27 ]
store double %40, double* %0
br label %41
41: ; preds = %39, %34
ret void
}