#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__ DBL_EPSILON;
scalar_t__ fabs(double);
int solve_linear(double, double, double *);
double sqrt(scalar_t__);
int solve_square(double a, double b, double c, double *x1, double *x2) {
  if (fabs(a) < DBL_EPSILON)
    return solve_linear(b, c, x1);
  double d = b * b - 4 * a * c;
  if ((d < 0) && (fabs(d) > DBL_EPSILON)) {
    return 0;
  } else if (fabs(d) < DBL_EPSILON) {
    *x1 = -b / (2 * a);
    return 1;
  } else {
    d = sqrt(fabs(d));
    *x1 = (-b - d) / (2 * a);
    *x2 = (-b + d) / (2 * a);
    return 2;
  }
}


x86 assembly (clang, -O0):
<solve_square>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <fabs@plt>
mov    0x2e88(%rip),%rcx
cmp    (%rcx),%rax
jge    1184 <solve_square+0x54>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mov    -0x28(%rbp),%rdi
call   1050 <solve_linear@plt>
mov    %eax,-0x4(%rbp)
jmp    12e5 <solve_square+0x1b5>
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xe6a(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    11f8 <solve_square+0xc8>
movsd  -0x38(%rbp),%xmm0
call   1030 <fabs@plt>
mov    0x2e05(%rip),%rcx
cmp    (%rcx),%rax
jle    11f8 <solve_square+0xc8>
movl   $0x0,-0x4(%rbp)
jmp    12e5 <solve_square+0x1b5>
movsd  -0x38(%rbp),%xmm0
call   1030 <fabs@plt>
mov    0x2ddf(%rip),%rcx
cmp    (%rcx),%rax
jge    1253 <solve_square+0x123>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xdd2(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    12e5 <solve_square+0x1b5>
movsd  -0x38(%rbp),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rdi
call   1040 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  0xd75(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  0xd3b(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_square>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
movsd  %xmm2,0x10(%rsp)
movaps %xmm1,0x20(%rsp)
movsd  %xmm0,0x8(%rsp)
call   1030 <fabs@plt>
mov    0x2e8c(%rip),%rbx
cmp    (%rbx),%rax
jge    117d <solve_square+0x4d>
movaps 0x20(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    %r15,%rdi
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <solve_linear@plt>
movsd  0xe7b(%rip),%xmm1
mulsd  0x8(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
movapd 0x20(%rsp),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
movapd %xmm0,0x10(%rsp)
jbe    11c8 <solve_square+0x98>
call   1030 <fabs@plt>
movapd 0x10(%rsp),%xmm0
mov    %rax,%rcx
xor    %eax,%eax
cmp    (%rbx),%rcx
jg     1248 <solve_square+0x118>
call   1030 <fabs@plt>
cmp    (%rbx),%rax
jge    11fa <solve_square+0xca>
movapd 0x20(%rsp),%xmm0
xorpd  0xe30(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%r15)
mov    $0x1,%eax
jmp    1248 <solve_square+0x118>
movapd 0x10(%rsp),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rdi
call   1040 <sqrt@plt>
movapd 0xdfb(%rip),%xmm1
movapd 0x20(%rsp),%xmm2
xorpd  %xmm2,%xmm1
subsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm3
addsd  %xmm3,%xmm3
divsd  %xmm3,%xmm1
movsd  %xmm1,(%r15)
subsd  %xmm2,%xmm0
divsd  %xmm3,%xmm0
movsd  %xmm0,(%r14)
mov    $0x2,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@DBL_EPSILON = global i64 0
define i32 @solve_square(double %0, double %1, double %2, double* %3, double* %4) {
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double*
%11 = alloca double*
%12 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double* %3, double** %10
store double* %4, double** %11
%13 = load double, double* %7
%14 = call i64 @fabs(double %13)
%15 = load i64, i64* @DBL_EPSILON
%16 = icmp slt i64 %14, %15
br i1 %16, label %17, label %22
17: ; preds = %5
%18 = load double, double* %8
%19 = load double, double* %9
%20 = load double*, double** %10
%21 = call i32 @solve_linear(double %18, double %19, double* %20)
store i32 %21, i32* %6
br label %71
22: ; preds = %5
%23 = load double, double* %8
%24 = load double, double* %8
%25 = load double, double* %7
%26 = fmul double 4.000000e+00, %25
%27 = load double, double* %9
%28 = fmul double %26, %27
%29 = fneg double %28
%30 = call double @llvm.fmuladd.f64(double %23, double %24, double %29)
store double %30, double* %12
%31 = load double, double* %12
%32 = fcmp olt double %31, 0.000000e+00
br i1 %32, label %33, label %39
33: ; preds = %22
%34 = load double, double* %12
%35 = call i64 @fabs(double %34)
%36 = load i64, i64* @DBL_EPSILON
%37 = icmp sgt i64 %35, %36
br i1 %37, label %38, label %39
38: ; preds = %33
store i32 0, i32* %6
br label %71
39: ; preds = %33, %22
%40 = load double, double* %12
%41 = call i64 @fabs(double %40)
%42 = load i64, i64* @DBL_EPSILON
%43 = icmp slt i64 %41, %42
br i1 %43, label %44, label %51
44: ; preds = %39
%45 = load double, double* %8
%46 = fneg double %45
%47 = load double, double* %7
%48 = fmul double 2.000000e+00, %47
%49 = fdiv double %46, %48
%50 = load double*, double** %10
store double %49, double* %50
store i32 1, i32* %6
br label %71
51: ; preds = %39
%52 = load double, double* %12
%53 = call i64 @fabs(double %52)
%54 = call double @sqrt(i64 %53)
store double %54, double* %12
%55 = load double, double* %8
%56 = fneg double %55
%57 = load double, double* %12
%58 = fsub double %56, %57
%59 = load double, double* %7
%60 = fmul double 2.000000e+00, %59
%61 = fdiv double %58, %60
%62 = load double*, double** %10
store double %61, double* %62
%63 = load double, double* %8
%64 = fneg double %63
%65 = load double, double* %12
%66 = fadd double %64, %65
%67 = load double, double* %7
%68 = fmul double 2.000000e+00, %67
%69 = fdiv double %66, %68
%70 = load double*, double** %11
store double %69, double* %70
store i32 2, i32* %6
br label %71
71: ; preds = %51, %44, %38, %17
%72 = load i32, i32* %6
ret i32 %72
}

LLVM IR (-O2):
@DBL_EPSILON = global i64 0
define i32 @solve_square(double %0, double %1, double %2, double* %3, double* nocapture writeonly %4) {
%6 = tail call i64 @fabs(double %0)
%7 = load i64, i64* @DBL_EPSILON
%8 = icmp slt i64 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i32 @solve_linear(double %1, double %2, double* %3)
br label %37
11: ; preds = %5
%12 = fmul double %0, -4.000000e+00
%13 = fmul double %12, %2
%14 = tail call double @llvm.fmuladd.f64(double %1, double %1, double %13)
%15 = fcmp olt double %14, 0.000000e+00
br i1 %15, label %16, label %20
16: ; preds = %11
%17 = tail call i64 @fabs(double %14)
%18 = load i64, i64* @DBL_EPSILON
%19 = icmp sgt i64 %17, %18
br i1 %19, label %37, label %20
20: ; preds = %16, %11
%21 = tail call i64 @fabs(double %14)
%22 = load i64, i64* @DBL_EPSILON
%23 = icmp slt i64 %21, %22
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = fneg double %1
%26 = fmul double %0, 2.000000e+00
%27 = fdiv double %25, %26
store double %27, double* %3
br label %37
28: ; preds = %20
%29 = tail call i64 @fabs(double %14)
%30 = tail call double @sqrt(i64 %29)
%31 = fneg double %1
%32 = fsub double %31, %30
%33 = fmul double %0, 2.000000e+00
%34 = fdiv double %32, %33
store double %34, double* %3
%35 = fsub double %30, %1
%36 = fdiv double %35, %33
store double %36, double* %4
br label %37
37: ; preds = %24, %28, %16, %9
%38 = phi i32 [ %10, %9 ], [ 1, %24 ], [ 2, %28 ], [ 0, %16 ]
ret i32 %38
}