#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*/ quartic_equation_solve_exact(double *, double *, double *,
                                                double *, int *, int *, double,
                                                double, double, double, double);
float DirectSolve(float lambda, float C_0, float C_1, float C_2) {
  double result;
  double r1, r2, r3, r4;
  int nr1, nr2;
  quartic_equation_solve_exact(&r1, &r2, &r3, &r4, &nr1, &nr2, (double)C_0,
                               (double)C_1, (double)C_2, 0.0, 1.0);
  result = (((r1) > (r2)) ? (r1) : (r2));
  result = (((result) > (r3)) ? (result) : (r3));
  result = (((result) > (r4)) ? (result) : (r4));
  return (result);
}


x86 assembly (clang, -O0):
<DirectSolve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
lea    -0x38(%rbp),%rcx
lea    -0x3c(%rbp),%r8
lea    -0x40(%rbp),%r9
xorps  %xmm3,%xmm3
movsd  0xe96(%rip),%xmm4
call   1030 <quartic_equation_solve_exact@plt>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    118e <DirectSolve+0x7e>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1198 <DirectSolve+0x88>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    11c1 <DirectSolve+0xb1>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    11cb <DirectSolve+0xbb>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    11f4 <DirectSolve+0xe4>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    11fe <DirectSolve+0xee>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DirectSolve>:
sub    $0x28,%rsp
cvtss2sd %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm3,%xmm2
lea    0x18(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
lea    0x24(%rsp),%r8
lea    0x20(%rsp),%r9
movsd  0xeb6(%rip),%xmm4
xorps  %xmm3,%xmm3
call   1030 <quartic_equation_solve_exact@plt>
movsd  0x18(%rsp),%xmm0
maxsd  0x10(%rsp),%xmm0
maxsd  0x8(%rsp),%xmm0
maxsd  (%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @DirectSolve(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32
%15 = alloca i32
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%16 = load float, float* %6
%17 = fpext float %16 to double
%18 = load float, float* %7
%19 = fpext float %18 to double
%20 = load float, float* %8
%21 = fpext float %20 to double
%22 = call i32 @quartic_equation_solve_exact(double* %10, double* %11, double* %12, double* %13, i32* %14, i32* %15, double %17, double %19, double %21, double 0.000000e+00, double 1.000000e+00)
%23 = load double, double* %10
%24 = load double, double* %11
%25 = fcmp ogt double %23, %24
br i1 %25, label %26, label %28
26: ; preds = %4
%27 = load double, double* %10
br label %30
28: ; preds = %4
%29 = load double, double* %11
br label %30
30: ; preds = %28, %26
%31 = phi double [ %27, %26 ], [ %29, %28 ]
store double %31, double* %9
%32 = load double, double* %9
%33 = load double, double* %12
%34 = fcmp ogt double %32, %33
br i1 %34, label %35, label %37
35: ; preds = %30
%36 = load double, double* %9
br label %39
37: ; preds = %30
%38 = load double, double* %12
br label %39
39: ; preds = %37, %35
%40 = phi double [ %36, %35 ], [ %38, %37 ]
store double %40, double* %9
%41 = load double, double* %9
%42 = load double, double* %13
%43 = fcmp ogt double %41, %42
br i1 %43, label %44, label %46
44: ; preds = %39
%45 = load double, double* %9
br label %48
46: ; preds = %39
%47 = load double, double* %13
br label %48
48: ; preds = %46, %44
%49 = phi double [ %45, %44 ], [ %47, %46 ]
store double %49, double* %9
%50 = load double, double* %9
%51 = fptrunc double %50 to float
ret float %51
}

LLVM IR (-O2):
define float @DirectSolve(float %0, float %1, float %2, float %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = bitcast double* %5 to i8*
%12 = bitcast double* %6 to i8*
%13 = bitcast double* %7 to i8*
%14 = bitcast double* %8 to i8*
%15 = bitcast i32* %9 to i8*
%16 = bitcast i32* %10 to i8*
%17 = fpext float %1 to double
%18 = fpext float %2 to double
%19 = fpext float %3 to double
%20 = call i32 @quartic_equation_solve_exact(double* %5, double* %6, double* %7, double* %8, i32* %9, i32* %10, double %17, double %18, double %19, double 0.000000e+00, double 1.000000e+00)
%21 = load double, double* %5
%22 = load double, double* %6
%23 = fcmp ogt double %21, %22
%24 = select i1 %23, double %21, double %22
%25 = load double, double* %7
%26 = fcmp ogt double %24, %25
%27 = select i1 %26, double %24, double %25
%28 = load double, double* %8
%29 = fcmp ogt double %27, %28
%30 = select i1 %29, double %27, double %28
%31 = fptrunc double %30 to float
ret float %31
}