#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*/ isNotZero(float);
scalar_t__ sqrt(float);
float solveQuadric(float *c, float *s) {
  float p, q, D;
  float sqrt_D;
  p = c[1];
  q = c[0];
  D = p * p - q;
  if (!isNotZero(D)) {
    s[0] = s[1] = -p;
    return 1.0F;
  }
  if (D < 0.0F)
    return 0.0F;
  sqrt_D = (float)sqrt(D);
  s[0] = sqrt_D - p;
  s[1] = -sqrt_D - p;
  return 2.0F;
}


x86 assembly (clang, -O0):
<solveQuadric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm2
movss  -0x20(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
call   1040 <isNotZero@plt>
cmp    $0x0,%eax
jne    11bc <solveQuadric+0x9c>
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  0xe4e(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1229 <solveQuadric+0x109>
xorps  %xmm0,%xmm0
ucomiss -0x24(%rbp),%xmm0
jbe    11d6 <solveQuadric+0xb6>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1229 <solveQuadric+0x109>
movss  -0x24(%rbp),%xmm0
call   1030 <sqrt@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
subss  -0x1c(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x28(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
subss  -0x1c(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  0xde0(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solveQuadric>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
movss  0x4(%rdi),%xmm0
movaps %xmm0,(%rsp)
mulss  %xmm0,%xmm0
subss  (%rdi),%xmm0
movaps %xmm0,0x10(%rsp)
call   1040 <isNotZero@plt>
test   %eax,%eax
je     118d <solveQuadric+0x6d>
xorps  %xmm0,%xmm0
movaps 0x10(%rsp),%xmm1
ucomiss %xmm1,%xmm0
ja     11a9 <solveQuadric+0x89>
movaps %xmm1,%xmm0
call   1030 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movaps %xmm0,%xmm1
movaps (%rsp),%xmm2
subss  %xmm2,%xmm1
xorps  0xe8a(%rip),%xmm0
movss  %xmm1,(%rbx)
subss  %xmm2,%xmm0
movss  %xmm0,0x4(%rbx)
movss  0xe85(%rip),%xmm0
jmp    11a9 <solveQuadric+0x89>
movaps (%rsp),%xmm0
xorps  0xe68(%rip),%xmm0
movss  %xmm0,0x4(%rbx)
movss  %xmm0,(%rbx)
movss  0xe6b(%rip),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float @solveQuadric(float* %0, float* %1) {
%3 = alloca float
%4 = alloca float*
%5 = alloca float*
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float* %0, float** %4
store float* %1, float** %5
%10 = load float*, float** %4
%11 = getelementptr inbounds float, float* %10, i64 1
%12 = load float, float* %11
store float %12, float* %6
%13 = load float*, float** %4
%14 = getelementptr inbounds float, float* %13, i64 0
%15 = load float, float* %14
store float %15, float* %7
%16 = load float, float* %6
%17 = load float, float* %6
%18 = load float, float* %7
%19 = fneg float %18
%20 = call float @llvm.fmuladd.f32(float %16, float %17, float %19)
store float %20, float* %8
%21 = load float, float* %8
%22 = call i32 @isNotZero(float %21)
%23 = icmp ne i32 %22, 0
br i1 %23, label %31, label %24
24: ; preds = %2
%25 = load float, float* %6
%26 = fneg float %25
%27 = load float*, float** %5
%28 = getelementptr inbounds float, float* %27, i64 1
store float %26, float* %28
%29 = load float*, float** %5
%30 = getelementptr inbounds float, float* %29, i64 0
store float %26, float* %30
store float 1.000000e+00, float* %3
br label %50
31: ; preds = %2
%32 = load float, float* %8
%33 = fcmp olt float %32, 0.000000e+00
br i1 %33, label %34, label %35
34: ; preds = %31
store float 0.000000e+00, float* %3
br label %50
35: ; preds = %31
%36 = load float, float* %8
%37 = call i64 @sqrt(float %36)
%38 = sitofp i64 %37 to float
store float %38, float* %9
%39 = load float, float* %9
%40 = load float, float* %6
%41 = fsub float %39, %40
%42 = load float*, float** %5
%43 = getelementptr inbounds float, float* %42, i64 0
store float %41, float* %43
%44 = load float, float* %9
%45 = fneg float %44
%46 = load float, float* %6
%47 = fsub float %45, %46
%48 = load float*, float** %5
%49 = getelementptr inbounds float, float* %48, i64 1
store float %47, float* %49
store float 2.000000e+00, float* %3
br label %50
50: ; preds = %35, %34, %24
%51 = load float, float* %3
ret float %51
}

LLVM IR (-O2):
define float @solveQuadric(float* nocapture %0, float* nocapture writeonly %1) {
%3 = getelementptr inbounds float, float* %0, i64 1
%4 = load float, float* %3
%5 = load float, float* %0
%6 = fneg float %5
%7 = tail call float @llvm.fmuladd.f32(float %4, float %4, float %6)
%8 = tail call i32 @isNotZero(float %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = fneg float %4
%12 = getelementptr inbounds float, float* %1, i64 1
store float %11, float* %12
store float %11, float* %1
br label %22
13: ; preds = %2
%14 = fcmp olt float %7, 0.000000e+00
br i1 %14, label %22, label %15
15: ; preds = %13
%16 = tail call i64 @sqrt(float %7)
%17 = sitofp i64 %16 to float
%18 = fsub float %17, %4
store float %18, float* %1
%19 = fneg float %17
%20 = fsub float %19, %4
%21 = getelementptr inbounds float, float* %1, i64 1
store float %20, float* %21
br label %22
22: ; preds = %13, %15, %10
%23 = phi float [ 2.000000e+00, %15 ], [ 1.000000e+00, %10 ], [ 0.000000e+00, %13 ]
ret float %23
}