#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 */
int fabs(double);
int /*<<< orphan*/ printf(char *, double, ...);
int /*<<< orphan*/ scanf(char *, ...);
int sqrt(double);
int main() {
  int n;
  scanf("%d", &n);
  while (n--) {
    double a, b, c;
    double x1, x2;
    scanf("%lf %lf %lf", &a, &b, &c);
    double delta = b * b - 4 * a * c;
    if (delta > 0) {
      x1 = (-b + sqrt(delta)) / (2 * a);
      x2 = (-b - sqrt(delta)) / (2 * a);
      printf("x1=%.5lf;x2=%.5lf\n", x1, x2);
    } else if (fabs(delta) < 1e-8) {
      x1 = -b / (2 * a);
      printf("x1=x2=%.5lf\n", x1);
    } else {
      delta = 0 - delta;
      double p = -b / (2 * a);
      double q = sqrt(delta) / (2 * a);
      if (fabs(p) < 1e-8)
        p = 0.0;
      printf("x1=%.5lf+%.5lfi;x2=%.5lf-%.5lfi\n", p, q, p, q);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     13bb <main+0x27b>
lea    0xe9f(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
mov    $0x0,%al
call   1050 <scanf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xe5f(%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)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    129a <main+0x15a>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  -0x58(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm0
movsd  0xdef(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  -0x50(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  0xda1(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
lea    0xd99(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    13b6 <main+0x276>
movsd  -0x38(%rbp),%xmm0
call   1040 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xd58(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1304 <main+0x1c4>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xd32(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xd42(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    13b1 <main+0x271>
xorps  %xmm0,%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xcdb(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1060 <sqrt@plt>
cvtsi2sd %eax,%xmm0
movsd  0xcb7(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1040 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xc8b(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    138f <main+0x24f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm3
lea    0xc9d(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
jmp    13b6 <main+0x276>
jmp    1161 <main+0x21>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0xecb(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
subl   $0x1,0x14(%rsp)
jae    1179 <main+0x39>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea3(%rip),%r14
mov    %rsp,%r15
lea    0x18(%rsp),%r12
lea    0x38(%rsp),%rbx
lea    0xe9b(%rip),%r13
jmp    1221 <main+0xe1>
nopl   0x0(%rax)
movsd  %xmm2,0x8(%rsp)
call   1060 <sqrt@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
subsd  0x8(%rsp),%xmm1
movsd  (%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
xorps  0xe38(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movsd  0x20(%rsp),%xmm0
call   1060 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd 0x40(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
mov    %r13,%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x2,%al
call   1030 <printf@plt>
subl   $0x1,0x14(%rsp)
jb     1168 <main+0x28>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1050 <scanf@plt>
movsd  0x18(%rsp),%xmm2
movsd  (%rsp),%xmm1
mulsd  0xdb9(%rip),%xmm1
mulsd  0x38(%rsp),%xmm1
movapd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0xda7(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
ja     11a0 <main+0x60>
call   1040 <fabs@plt>
test   %eax,%eax
jle    1300 <main+0x1c0>
xorpd  %xmm0,%xmm0
subsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm2
xorpd  0xd7e(%rip),%xmm2
movsd  (%rsp),%xmm1
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm2
movapd %xmm2,0x20(%rsp)
call   1060 <sqrt@plt>
mov    %eax,%ebp
movsd  (%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
call   1040 <fabs@plt>
xorpd  %xmm0,%xmm0
test   %eax,%eax
jle    12d0 <main+0x190>
movapd 0x20(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
movsd  0x8(%rsp),%xmm2
addsd  %xmm2,%xmm2
divsd  %xmm2,%xmm1
lea    0xd63(%rip),%rdi
movapd %xmm0,%xmm2
movapd %xmm1,%xmm3
mov    $0x4,%al
call   1030 <printf@plt>
jmp    1216 <main+0xd6>
movsd  0x18(%rsp),%xmm0
xorpd  0xd02(%rip),%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
lea    0xd20(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1216 <main+0xd6>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [12 x i8] c"%lf %lf %lf\00"
@.str.2 = [19 x i8] c"x1=%.5lf;x2=%.5lf\0A\00"
@.str.3 = [13 x i8] c"x1=x2=%.5lf\0A\00"
@.str.4 = [33 x i8] c"x1=%.5lf+%.5lfi;x2=%.5lf-%.5lfi\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 0, i32* %1
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %12
12: ; preds = %89, %0
%13 = load i32, i32* %2
%14 = add nsw i32 %13, -1
store i32 %14, i32* %2
%15 = icmp ne i32 %13, 0
br i1 %15, label %16, label %90
16: ; preds = %12
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %3, double* %4, double* %5)
%18 = load double, double* %4
%19 = load double, double* %4
%20 = load double, double* %3
%21 = fmul double 4.000000e+00, %20
%22 = load double, double* %5
%23 = fmul double %21, %22
%24 = fneg double %23
%25 = call double @llvm.fmuladd.f64(double %18, double %19, double %24)
store double %25, double* %8
%26 = load double, double* %8
%27 = fcmp ogt double %26, 0.000000e+00
br i1 %27, label %28, label %50
28: ; preds = %16
%29 = load double, double* %4
%30 = fneg double %29
%31 = load double, double* %8
%32 = call i32 @sqrt(double %31)
%33 = sitofp i32 %32 to double
%34 = fadd double %30, %33
%35 = load double, double* %3
%36 = fmul double 2.000000e+00, %35
%37 = fdiv double %34, %36
store double %37, double* %6
%38 = load double, double* %4
%39 = fneg double %38
%40 = load double, double* %8
%41 = call i32 @sqrt(double %40)
%42 = sitofp i32 %41 to double
%43 = fsub double %39, %42
%44 = load double, double* %3
%45 = fmul double 2.000000e+00, %44
%46 = fdiv double %43, %45
store double %46, double* %7
%47 = load double, double* %6
%48 = load double, double* %7
%49 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %47, double %48)
br label %89
50: ; preds = %16
%51 = load double, double* %8
%52 = call i32 @fabs(double %51)
%53 = sitofp i32 %52 to double
%54 = fcmp olt double %53, 1.000000e-08
br i1 %54, label %55, label %63
55: ; preds = %50
%56 = load double, double* %4
%57 = fneg double %56
%58 = load double, double* %3
%59 = fmul double 2.000000e+00, %58
%60 = fdiv double %57, %59
store double %60, double* %6
%61 = load double, double* %6
%62 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), double %61)
br label %88
63: ; preds = %50
%64 = load double, double* %8
%65 = fsub double 0.000000e+00, %64
store double %65, double* %8
%66 = load double, double* %4
%67 = fneg double %66
%68 = load double, double* %3
%69 = fmul double 2.000000e+00, %68
%70 = fdiv double %67, %69
store double %70, double* %9
%71 = load double, double* %8
%72 = call i32 @sqrt(double %71)
%73 = sitofp i32 %72 to double
%74 = load double, double* %3
%75 = fmul double 2.000000e+00, %74
%76 = fdiv double %73, %75
store double %76, double* %10
%77 = load double, double* %9
%78 = call i32 @fabs(double %77)
%79 = sitofp i32 %78 to double
%80 = fcmp olt double %79, 1.000000e-08
br i1 %80, label %81, label %82
81: ; preds = %63
store double 0.000000e+00, double* %9
br label %82
82: ; preds = %81, %63
%83 = load double, double* %9
%84 = load double, double* %10
%85 = load double, double* %9
%86 = load double, double* %10
%87 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), double %83, double %84, double %85, double %86)
br label %88
88: ; preds = %82, %55
br label %89
89: ; preds = %88, %28
br label %12
90: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [12 x i8] c"%lf %lf %lf\00"
@.str.2 = [19 x i8] c"x1=%.5lf;x2=%.5lf\0A\00"
@.str.3 = [13 x i8] c"x1=x2=%.5lf\0A\00"
@.str.4 = [33 x i8] c"x1=%.5lf+%.5lfi;x2=%.5lf-%.5lfi\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = bitcast i32* %1 to i8*
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = add nsw i32 %7, -1
store i32 %8, i32* %1
%9 = icmp eq i32 %7, 0
br i1 %9, label %69, label %10
10: ; preds = %0
%11 = bitcast double* %2 to i8*
%12 = bitcast double* %3 to i8*
%13 = bitcast double* %4 to i8*
br label %14
14: ; preds = %10, %65
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3, double* %4)
%16 = load double, double* %3
%17 = load double, double* %2
%18 = load double, double* %4
%19 = fmul double %17, -4.000000e+00
%20 = fmul double %19, %18
%21 = call double @llvm.fmuladd.f64(double %16, double %16, double %20)
%22 = fcmp ogt double %21, 0.000000e+00
br i1 %22, label %23, label %39
23: ; preds = %14
%24 = call i32 @sqrt(double %21)
%25 = sitofp i32 %24 to double
%26 = fsub double %25, %16
%27 = load double, double* %2
%28 = fmul double %27, 2.000000e+00
%29 = fdiv double %26, %28
%30 = load double, double* %3
%31 = fneg double %30
%32 = call i32 @sqrt(double %21)
%33 = sitofp i32 %32 to double
%34 = fsub double %31, %33
%35 = load double, double* %2
%36 = fmul double %35, 2.000000e+00
%37 = fdiv double %34, %36
%38 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %29, double %37)
br label %65
39: ; preds = %14
%40 = call i32 @fabs(double %21)
%41 = icmp slt i32 %40, 1
br i1 %41, label %42, label %49
42: ; preds = %39
%43 = load double, double* %3
%44 = fneg double %43
%45 = load double, double* %2
%46 = fmul double %45, 2.000000e+00
%47 = fdiv double %44, %46
%48 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), double %47)
br label %65
49: ; preds = %39
%50 = fsub double 0.000000e+00, %21
%51 = load double, double* %3
%52 = fneg double %51
%53 = load double, double* %2
%54 = fmul double %53, 2.000000e+00
%55 = fdiv double %52, %54
%56 = call i32 @sqrt(double %50)
%57 = sitofp i32 %56 to double
%58 = load double, double* %2
%59 = fmul double %58, 2.000000e+00
%60 = fdiv double %57, %59
%61 = call i32 @fabs(double %55)
%62 = icmp slt i32 %61, 1
%63 = select i1 %62, double 0.000000e+00, double %55
%64 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), double %63, double %60, double %63, double %60)
br label %65
65: ; preds = %42, %49, %23
%66 = load i32, i32* %1
%67 = add nsw i32 %66, -1
store i32 %67, i32* %1
%68 = icmp eq i32 %66, 0
br i1 %68, label %69, label %14
69: ; preds = %65, %0
ret i32 0
}