#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 sqrtf(float);
int limat_quadratic_solve_roots(float a, float b, float c, float *X1,
                                float *X2) {
  float det = b * b - 4.0f * a * c;
  if (det < 0.0f)
    return 0;
  det = sqrtf(det);
  *X1 = (-b - det) / (2.0f * a);
  *X2 = (-b + det) / (2.0f * a);
  return 1;
}


x86 assembly (clang, -O0):
<limat_quadratic_solve_roots>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  0xebf(%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,-0x24(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x24(%rbp),%xmm0
jbe    117e <limat_quadratic_solve_roots+0x6e>
movl   $0x0,-0x4(%rbp)
jmp    11f4 <limat_quadratic_solve_roots+0xe4>
movss  -0x24(%rbp),%xmm0
call   1030 <sqrtf@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
subss  -0x24(%rbp),%xmm0
movss  0xe58(%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
addss  -0x24(%rbp),%xmm0
movss  0xe28(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<limat_quadratic_solve_roots>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movaps %xmm0,%xmm3
movss  0xede(%rip),%xmm4
mulss  %xmm0,%xmm4
mulss  %xmm2,%xmm4
movaps %xmm1,%xmm0
mulss  %xmm1,%xmm0
addss  %xmm4,%xmm0
xor    %eax,%eax
xorps  %xmm2,%xmm2
ucomiss %xmm0,%xmm2
ja     1197 <limat_quadratic_solve_roots+0x87>
mov    %rsi,%r14
mov    %rdi,%rbx
ucomiss %xmm2,%xmm0
jb     1150 <limat_quadratic_solve_roots+0x40>
sqrtss %xmm0,%xmm0
jmp    116b <limat_quadratic_solve_roots+0x5b>
movss  %xmm3,0xc(%rsp)
movaps %xmm1,0x10(%rsp)
call   1030 <sqrtf@plt>
movaps 0x10(%rsp),%xmm1
movss  0xc(%rsp),%xmm3
movaps 0xe9e(%rip),%xmm2
xorps  %xmm1,%xmm2
subss  %xmm0,%xmm2
addss  %xmm3,%xmm3
divss  %xmm3,%xmm2
movss  %xmm2,(%rbx)
subss  %xmm1,%xmm0
divss  %xmm3,%xmm0
movss  %xmm0,(%r14)
mov    $0x1,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @limat_quadratic_solve_roots(float %0, float %1, float %2, float* nocapture writeonly %3, float* nocapture writeonly %4) {
%6 = fmul float %0, -4.000000e+00
%7 = fmul float %6, %2
%8 = tail call float @llvm.fmuladd.f32(float %1, float %1, float %7)
%9 = fcmp olt float %8, 0.000000e+00
br i1 %9, label %18, label %10
10: ; preds = %5
%11 = tail call float @sqrtf(float %8)
%12 = fneg float %1
%13 = fsub float %12, %11
%14 = fmul float %0, 2.000000e+00
%15 = fdiv float %13, %14
store float %15, float* %3
%16 = fsub float %11, %1
%17 = fdiv float %16, %14
store float %17, float* %4
br label %18
18: ; preds = %5, %10
%19 = phi i32 [ 1, %10 ], [ 0, %5 ]
ret i32 %19
}