#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 disc(double, double, double);
double sgn(double);
double sqrt(double);
void qdrtc(double A, double B, double C, double *pX1, double *pY1, double *pX2,
           double *pY2) {
  double b, q, r, X1, Y1, X2, Y2;
  b = -B / 2;
  q = disc(A, b, C);
  if (q < 0) {
    X1 = b / A;
    X2 = X1;
    Y1 = sqrt(-q) / A;
    Y2 = -Y1;
  } else {
    Y1 = 0;
    Y2 = 0;
    r = b + sgn(b) * sqrt(q);
    if (r == 0) {
      X1 = C / A;
      X2 = -X1;
    } else {
      X1 = C / r;
      X2 = r / A;
    }
  }
  *pX1 = X1;
  *pY1 = Y1;
  *pX2 = X2;
  *pY2 = Y2;
}


x86 assembly (clang, -O0):
<qdrtc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe82(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   1030 <disc@plt>
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    1218 <qdrtc+0xe8>
movsd  -0x40(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x48(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1050 <sqrt@plt>
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    12d5 <qdrtc+0x1a5>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1040 <sgn@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  -0x80(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12b2 <qdrtc+0x182>
jp     12b2 <qdrtc+0x182>
movsd  -0x18(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    12d0 <qdrtc+0x1a0>
movsd  -0x18(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    12d5 <qdrtc+0x1a5>
movsd  -0x58(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x60(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x68(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x70(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qdrtc>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
mulsd  0xeb1(%rip),%xmm1
movapd %xmm0,0x10(%rsp)
movapd %xmm1,(%rsp)
movaps %xmm2,0x30(%rsp)
call   1030 <disc@plt>
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
jbe    1192 <qdrtc+0x62>
movapd 0xea6(%rip),%xmm0
xorpd  %xmm2,%xmm0
movsd  0xe82(%rip),%xmm1
ucomisd %xmm2,%xmm1
jb     11bf <qdrtc+0x8f>
sqrtsd %xmm0,%xmm0
jmp    11c4 <qdrtc+0x94>
movapd (%rsp),%xmm0
movapd %xmm2,0x20(%rsp)
call   1040 <sgn@plt>
movapd 0x20(%rsp),%xmm1
movapd %xmm0,%xmm4
ucomisd 0xe5c(%rip),%xmm1
jb     11f1 <qdrtc+0xc1>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    1206 <qdrtc+0xd6>
call   1050 <sqrt@plt>
movapd 0x10(%rsp),%xmm1
movapd (%rsp),%xmm2
unpcklpd %xmm2,%xmm0
unpcklpd %xmm1,%xmm1
divpd  %xmm1,%xmm0
movapd 0xe3d(%rip),%xmm1
xorpd  %xmm0,%xmm1
movapd %xmm0,%xmm2
unpckhpd %xmm0,%xmm2
jmp    1252 <qdrtc+0x122>
movapd %xmm1,%xmm0
movapd %xmm4,0x20(%rsp)
call   1050 <sqrt@plt>
movapd 0x20(%rsp),%xmm4
movapd 0x30(%rsp),%xmm2
movapd 0x10(%rsp),%xmm3
movapd (%rsp),%xmm1
mulsd  %xmm0,%xmm4
addsd  %xmm1,%xmm4
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm4
jne    1242 <qdrtc+0x112>
jp     1242 <qdrtc+0x112>
divsd  %xmm3,%xmm2
movapd 0xde9(%rip),%xmm0
xorpd  %xmm2,%xmm0
pslldq $0x8,%xmm0
jmp    1252 <qdrtc+0x122>
divsd  %xmm4,%xmm2
divsd  %xmm3,%xmm4
xorpd  %xmm0,%xmm0
unpcklpd %xmm4,%xmm0
movsd  %xmm2,(%rbx)
movlpd %xmm0,(%r12)
movhpd %xmm0,(%r15)
movsd  %xmm1,(%r14)
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @qdrtc(double %0, double %1, double %2, double* nocapture writeonly %3, double* nocapture writeonly %4, double* nocapture writeonly %5, double* nocapture writeonly %6) {
%8 = fmul double %1, -5.000000e-01
%9 = tail call double @disc(double %0, double %8, double %2)
%10 = fcmp olt double %9, 0.000000e+00
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = fneg double %9
%13 = tail call double @sqrt(double %12)
%14 = insertelement <2 x double> poison, double %13, i64 0
%15 = insertelement <2 x double> %14, double %8, i64 1
%16 = insertelement <2 x double> poison, double %0, i64 0
%17 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> zeroinitializer
%18 = fdiv <2 x double> %15, %17
%19 = extractelement <2 x double> %18, i64 0
%20 = fneg double %19
%21 = extractelement <2 x double> %18, i64 1
br label %35
22: ; preds = %7
%23 = tail call double @sgn(double %8)
%24 = tail call double @sqrt(double %9)
%25 = tail call double @llvm.fmuladd.f64(double %23, double %24, double %8)
%26 = fcmp oeq double %25, 0.000000e+00
br i1 %26, label %27, label %31
27: ; preds = %22
%28 = fdiv double %2, %0
%29 = fneg double %28
%30 = insertelement <2 x double> <double 0.000000e+00, double poison>, double %29, i64 1
br label %35
31: ; preds = %22
%32 = fdiv double %2, %25
%33 = fdiv double %25, %0
%34 = insertelement <2 x double> <double 0.000000e+00, double poison>, double %33, i64 1
br label %35
35: ; preds = %27, %31, %11
%36 = phi double [ %21, %11 ], [ %28, %27 ], [ %32, %31 ]
%37 = phi double [ %20, %11 ], [ 0.000000e+00, %27 ], [ 0.000000e+00, %31 ]
%38 = phi <2 x double> [ %18, %11 ], [ %30, %27 ], [ %34, %31 ]
store double %36, double* %3
%39 = extractelement <2 x double> %38, i64 0
store double %39, double* %4
%40 = extractelement <2 x double> %38, i64 1
store double %40, double* %5
store double %37, double* %6
ret void
}