#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 */
double sqrt(double);
int calc_quadratic_equation(double a, double b, double c, double *x1,
                            double *x2) {
  double d;
  d = b * b - 4 * a * c;
  if (d < 0.0) {
    return (0);
  } else {
    *x1 = (-b + sqrt(d)) / (2 * a);
    *x2 = (-b - sqrt(d)) / (2 * a);
    return (1);
  }
}


x86 assembly (clang, -O0):
<calc_quadratic_equation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xebf(%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    1189 <calc_quadratic_equation+0x79>
movl   $0x0,-0x4(%rbp)
jmp    1230 <calc_quadratic_equation+0x120>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe40(%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
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  0xdf0(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_quadratic_equation>:
push   %r14
push   %rbx
sub    $0x48,%rsp
movapd %xmm0,%xmm4
movsd  0xedd(%rip),%xmm0
mulsd  %xmm4,%xmm0
mulsd  %xmm2,%xmm0
movapd %xmm1,%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm0,%xmm3
xor    %eax,%eax
xorpd  %xmm0,%xmm0
ucomisd %xmm3,%xmm0
ja     11f0 <calc_quadratic_equation+0xe0>
mov    %rsi,%r14
mov    %rdi,%rbx
movapd 0xebb(%rip),%xmm2
xorpd  %xmm1,%xmm2
movapd %xmm2,0x30(%rsp)
xorps  %xmm2,%xmm2
sqrtsd %xmm3,%xmm2
ucomisd %xmm0,%xmm3
movapd %xmm2,%xmm0
jae    11a7 <calc_quadratic_equation+0x97>
movapd %xmm3,%xmm0
movsd  %xmm4,(%rsp)
movapd %xmm3,0x20(%rsp)
movapd %xmm1,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
call   1030 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
movapd 0x10(%rsp),%xmm1
movapd 0x20(%rsp),%xmm3
movsd  (%rsp),%xmm4
subsd  %xmm1,%xmm0
addsd  %xmm4,%xmm4
divsd  %xmm4,%xmm0
movsd  %xmm0,(%rbx)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
jae    11d8 <calc_quadratic_equation+0xc8>
movapd %xmm3,%xmm0
movsd  %xmm4,(%rsp)
call   1030 <sqrt@plt>
movsd  (%rsp),%xmm4
movapd %xmm0,%xmm2
movapd 0x30(%rsp),%xmm0
subsd  %xmm2,%xmm0
divsd  %xmm4,%xmm0
movsd  %xmm0,(%r14)
mov    $0x1,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @calc_quadratic_equation(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* %8
%14 = load double, double* %8
%15 = load double, double* %7
%16 = fmul double 4.000000e+00, %15
%17 = load double, double* %9
%18 = fmul double %16, %17
%19 = fneg double %18
%20 = call double @llvm.fmuladd.f64(double %13, double %14, double %19)
store double %20, double* %12
%21 = load double, double* %12
%22 = fcmp olt double %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 double, double* %8
%26 = fneg double %25
%27 = load double, double* %12
%28 = call double @sqrt(double %27)
%29 = fadd double %26, %28
%30 = load double, double* %7
%31 = fmul double 2.000000e+00, %30
%32 = fdiv double %29, %31
%33 = load double*, double** %10
store double %32, double* %33
%34 = load double, double* %8
%35 = fneg double %34
%36 = load double, double* %12
%37 = call double @sqrt(double %36)
%38 = fsub double %35, %37
%39 = load double, double* %7
%40 = fmul double 2.000000e+00, %39
%41 = fdiv double %38, %40
%42 = load double*, double** %11
store double %41, double* %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 @calc_quadratic_equation(double %0, double %1, double %2, double* nocapture writeonly %3, double* nocapture writeonly %4) {
%6 = fmul double %0, -4.000000e+00
%7 = fmul double %6, %2
%8 = tail call double @llvm.fmuladd.f64(double %1, double %1, double %7)
%9 = fcmp olt double %8, 0.000000e+00
br i1 %9, label %19, label %10
10: ; preds = %5
%11 = fneg double %1
%12 = tail call double @sqrt(double %8)
%13 = fsub double %12, %1
%14 = fmul double %0, 2.000000e+00
%15 = fdiv double %13, %14
store double %15, double* %3
%16 = tail call double @sqrt(double %8)
%17 = fsub double %11, %16
%18 = fdiv double %17, %14
store double %18, double* %4
br label %19
19: ; preds = %5, %10
%20 = phi i32 [ 1, %10 ], [ 0, %5 ]
ret i32 %20
}