#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);
void solve_quadratic(float a, float b, float c, float t[2]) {
  float det = sqrt(b * b - 4 * a * c);
  float q = -0.5 * ((b < 0) ? (b - det) : (b + det));
  t[0] = q / a;
  t[1] = c / q;
}


x86 assembly (clang, -O0):
<solve_quadratic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
mov    %rdi,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
movss  0xec3(%rip),%xmm1
mulss  -0x4(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrt@plt>
movss  %xmm0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1187 <solve_quadratic+0x77>
movss  -0x8(%rbp),%xmm0
subss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    1196 <solve_quadratic+0x86>
movss  -0x8(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe61(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
divss  -0x4(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0xc(%rbp),%xmm0
divss  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_quadratic>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movaps %xmm2,%xmm3
movaps %xmm0,%xmm4
movss  0xeda(%rip),%xmm2
mulss  %xmm0,%xmm2
mulss  %xmm3,%xmm2
movaps %xmm1,%xmm0
mulss  %xmm1,%xmm0
addss  %xmm2,%xmm0
xorps  %xmm6,%xmm6
ucomiss %xmm6,%xmm0
jb     1147 <solve_quadratic+0x37>
sqrtss %xmm0,%xmm0
jmp    1173 <solve_quadratic+0x63>
movss  %xmm3,0xc(%rsp)
movss  %xmm4,0x8(%rsp)
movss  %xmm1,0x4(%rsp)
call   1030 <sqrt@plt>
xorps  %xmm6,%xmm6
movss  0x4(%rsp),%xmm1
movss  0x8(%rsp),%xmm4
movss  0xc(%rsp),%xmm3
movaps 0xe96(%rip),%xmm5
xorps  %xmm0,%xmm5
movaps %xmm1,%xmm2
cmpltss %xmm6,%xmm2
andps  %xmm2,%xmm5
andnps %xmm0,%xmm2
orps   %xmm5,%xmm2
addss  %xmm1,%xmm2
mulss  0xe6a(%rip),%xmm2
divss  %xmm2,%xmm3
divss  %xmm4,%xmm2
movss  %xmm2,(%rbx)
movss  %xmm3,0x4(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @solve_quadratic(float %0, float %1, float %2, float* %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float*
%9 = alloca float
%10 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float* %3, float** %8
%11 = load float, float* %6
%12 = load float, float* %6
%13 = load float, float* %5
%14 = fmul float 4.000000e+00, %13
%15 = load float, float* %7
%16 = fmul float %14, %15
%17 = fneg float %16
%18 = call float @llvm.fmuladd.f32(float %11, float %12, float %17)
%19 = call float @sqrt(float %18)
store float %19, float* %9
%20 = load float, float* %6
%21 = fcmp olt float %20, 0.000000e+00
br i1 %21, label %22, label %26
22: ; preds = %4
%23 = load float, float* %6
%24 = load float, float* %9
%25 = fsub float %23, %24
br label %30
26: ; preds = %4
%27 = load float, float* %6
%28 = load float, float* %9
%29 = fadd float %27, %28
br label %30
30: ; preds = %26, %22
%31 = phi float [ %25, %22 ], [ %29, %26 ]
%32 = fpext float %31 to double
%33 = fmul double -5.000000e-01, %32
%34 = fptrunc double %33 to float
store float %34, float* %10
%35 = load float, float* %10
%36 = load float, float* %5
%37 = fdiv float %35, %36
%38 = load float*, float** %8
%39 = getelementptr inbounds float, float* %38, i64 0
store float %37, float* %39
%40 = load float, float* %7
%41 = load float, float* %10
%42 = fdiv float %40, %41
%43 = load float*, float** %8
%44 = getelementptr inbounds float, float* %43, i64 1
store float %42, float* %44
ret void
}

LLVM IR (-O2):
define void @solve_quadratic(float %0, float %1, float %2, float* nocapture writeonly %3) {
%5 = fmul float %0, -4.000000e+00
%6 = fmul float %5, %2
%7 = tail call float @llvm.fmuladd.f32(float %1, float %1, float %6)
%8 = tail call float @sqrt(float %7)
%9 = fcmp olt float %1, 0.000000e+00
%10 = fneg float %8
%11 = select i1 %9, float %10, float %8
%12 = fadd float %11, %1
%13 = fmul float %12, -5.000000e-01
%14 = fdiv float %13, %0
store float %14, float* %3
%15 = fdiv float %2, %13
%16 = getelementptr inbounds float, float* %3, i64 1
store float %15, float* %16
ret void
}