#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 */
scalar_t__ approxf(float, int /*<<< orphan*/);
int roots1rf(float, float, float *);
float sqrtf(float);
int roots2rf(float a, float b, float c, float z[2]) {
  float d, sd;
  if (approxf(a, 0))
    return roots1rf(b, c, z);
  d = b * b - 4 * a * c;
  if (d < 0)
    return 0;
  sd = sqrtf(d);
  z[0] = (-b + sd) / (2 * a);
  z[1] = (-b - sd) / (2 * a);
  if (approxf(d, 0))
    return 1;
  return 2;
}


x86 assembly (clang, -O0):
<roots2rf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
xor    %edi,%edi
call   1030 <approxf@plt>
cmp    $0x0,%rax
je     117c <roots2rf+0x4c>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
mov    -0x18(%rbp),%rdi
call   1050 <roots1rf@plt>
mov    %eax,-0x4(%rbp)
jmp    1264 <roots2rf+0x134>
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  0xe72(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x1c(%rbp),%xmm0
jbe    11cb <roots2rf+0x9b>
movl   $0x0,-0x4(%rbp)
jmp    1264 <roots2rf+0x134>
movss  -0x1c(%rbp),%xmm0
call   1040 <sqrtf@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
addss  -0x20(%rbp),%xmm0
movss  0xe0b(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
subss  -0x20(%rbp),%xmm0
movss  0xddb(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x1c(%rbp),%xmm0
xor    %edi,%edi
call   1030 <approxf@plt>
cmp    $0x0,%rax
je     125d <roots2rf+0x12d>
movl   $0x1,-0x4(%rbp)
jmp    1264 <roots2rf+0x134>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roots2rf>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
mov    %rdi,%rbx
movss  %xmm2,0x10(%rsp)
movaps %xmm1,0x20(%rsp)
xor    %ebp,%ebp
movss  %xmm0,0xc(%rsp)
xor    %edi,%edi
call   1030 <approxf@plt>
test   %rax,%rax
je     1171 <roots2rf+0x41>
movaps 0x20(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
mov    %rbx,%rdi
add    $0x38,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <roots1rf@plt>
movss  0xe87(%rip),%xmm0
movss  0xc(%rsp),%xmm3
mulss  %xmm3,%xmm0
mulss  0x10(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movaps %xmm1,%xmm4
mulss  %xmm1,%xmm4
addss  %xmm0,%xmm4
xorps  %xmm0,%xmm0
ucomiss %xmm4,%xmm0
ja     120c <roots2rf+0xdc>
ucomiss %xmm0,%xmm4
jb     11b2 <roots2rf+0x82>
movaps %xmm1,%xmm2
xorps  %xmm0,%xmm0
sqrtss %xmm4,%xmm0
jmp    11cf <roots2rf+0x9f>
movaps %xmm4,%xmm0
movaps %xmm4,0x10(%rsp)
call   1040 <sqrtf@plt>
movaps 0x10(%rsp),%xmm4
movss  0xc(%rsp),%xmm3
movaps 0x20(%rsp),%xmm2
movaps %xmm0,%xmm1
subss  %xmm2,%xmm1
xorps  0xe33(%rip),%xmm2
addss  %xmm3,%xmm3
divss  %xmm3,%xmm1
movss  %xmm1,(%rbx)
subss  %xmm0,%xmm2
divss  %xmm3,%xmm2
movss  %xmm2,0x4(%rbx)
movaps %xmm4,%xmm0
xor    %edi,%edi
call   1030 <approxf@plt>
cmp    $0x1,%rax
mov    $0x1,%ebp
adc    $0x0,%ebp
mov    %ebp,%eax
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @roots2rf(float %0, float %1, float %2, float* %3) {
%5 = tail call i64 @approxf(float %0, i32 0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @roots1rf(float %1, float %2, float* %3)
br label %26
9: ; preds = %4
%10 = fmul float %0, -4.000000e+00
%11 = fmul float %10, %2
%12 = tail call float @llvm.fmuladd.f32(float %1, float %1, float %11)
%13 = fcmp olt float %12, 0.000000e+00
br i1 %13, label %26, label %14
14: ; preds = %9
%15 = tail call float @sqrtf(float %12)
%16 = fneg float %1
%17 = fsub float %15, %1
%18 = fmul float %0, 2.000000e+00
%19 = fdiv float %17, %18
store float %19, float* %3
%20 = fsub float %16, %15
%21 = fdiv float %20, %18
%22 = getelementptr inbounds float, float* %3, i64 1
store float %21, float* %22
%23 = tail call i64 @approxf(float %12, i32 0)
%24 = icmp eq i64 %23, 0
%25 = select i1 %24, i32 2, i32 1
br label %26
26: ; preds = %14, %9, %7
%27 = phi i32 [ %8, %7 ], [ 0, %9 ], [ %25, %14 ]
ret i32 %27
}