#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 */
float sqrt(float);
int solve_quadratic_2(float a, float b, float c, float t[2]) {
  if (a == 0) {
    t[0] = -c / b;
    return 1;
  }
  float value = b * b - 4 * a * c;
  if (value < 0)
    return 0;
  float det = sqrt(value);
  t[0] = (-b + det) / (2 * a);
  t[1] = (-b - det) / (2 * a);
  return 2;
}


x86 assembly (clang, -O0):
<solve_quadratic_2>:
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
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    116d <solve_quadratic_2+0x5d>
jp     116d <solve_quadratic_2+0x5d>
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
divss  -0xc(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1233 <solve_quadratic_2+0x123>
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  0xe81(%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    11bc <solve_quadratic_2+0xac>
movl   $0x0,-0x4(%rbp)
jmp    1233 <solve_quadratic_2+0x123>
movss  -0x1c(%rbp),%xmm0
call   1030 <sqrt@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
addss  -0x20(%rbp),%xmm0
movss  0xe1a(%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  0xdea(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_quadratic_2>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
xorps  %xmm4,%xmm4
ucomiss %xmm4,%xmm0
jne    1138 <solve_quadratic_2+0x28>
jp     1138 <solve_quadratic_2+0x28>
xorps  0xee7(%rip),%xmm2
divss  %xmm1,%xmm2
movss  %xmm2,(%rbx)
mov    $0x1,%eax
jmp    11b2 <solve_quadratic_2+0xa2>
movaps %xmm0,%xmm5
movss  0xebd(%rip),%xmm3
mulss  %xmm0,%xmm3
mulss  %xmm2,%xmm3
movaps %xmm1,%xmm0
mulss  %xmm1,%xmm0
addss  %xmm3,%xmm0
xor    %eax,%eax
ucomiss %xmm0,%xmm4
ja     11b2 <solve_quadratic_2+0xa2>
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm0
jb     116b <solve_quadratic_2+0x5b>
sqrtss %xmm0,%xmm0
jmp    1186 <solve_quadratic_2+0x76>
movaps %xmm1,0x10(%rsp)
movss  %xmm5,0xc(%rsp)
call   1030 <sqrt@plt>
movss  0xc(%rsp),%xmm5
movaps 0x10(%rsp),%xmm1
movaps %xmm0,%xmm2
subss  %xmm1,%xmm2
xorps  0xe7c(%rip),%xmm1
addss  %xmm5,%xmm5
divss  %xmm5,%xmm2
movss  %xmm2,(%rbx)
subss  %xmm0,%xmm1
divss  %xmm5,%xmm1
movss  %xmm1,0x4(%rbx)
mov    $0x2,%eax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @solve_quadratic_2(float %0, float %1, float %2, float* nocapture writeonly %3) {
%5 = fcmp oeq float %0, 0.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %4
%7 = fneg float %2
%8 = fdiv float %7, %1
store float %8, float* %3
br label %23
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 %23, label %14
14: ; preds = %9
%15 = tail call float @sqrt(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
br label %23
23: ; preds = %14, %9, %6
%24 = phi i32 [ 1, %6 ], [ 2, %14 ], [ 0, %9 ]
ret i32 %24
}