#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 /*<<< orphan*/ printf(char *, double, double);
int /*<<< orphan*/ scanf(char *, int *, ...);
double sqrt(int);
int main() {
  int t, b, ls;
  float rs;
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d", &b, &ls);
    printf("%f %f\n", sqrt(ls * ls - b * b), sqrt(ls * ls + b * b));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11c3 <main+0x93>
lea    0xe94(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%edi
imul   -0x10(%rbp),%edi
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
sub    %eax,%edi
call   1050 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%edi
imul   -0x10(%rbp),%edi
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
add    %eax,%edi
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
jmp    1151 <main+0x21>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xec0(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0xc(%rsp)
jb     11c8 <main+0x98>
lea    0xea4(%rip),%r14
lea    0x8(%rsp),%r15
lea    0x4(%rsp),%r12
lea    0xe98(%rip),%rbx
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
imul   %edi,%edi
mov    0x8(%rsp),%eax
imul   %eax,%eax
sub    %eax,%edi
call   1050 <sqrt@plt>
movsd  %xmm0,0x10(%rsp)
mov    0x4(%rsp),%eax
imul   %eax,%eax
mov    0x8(%rsp),%edi
imul   %edi,%edi
add    %eax,%edi
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
call   1030 <printf@plt>
subl   $0x1,0xc(%rsp)
jae    1170 <main+0x40>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [7 x i8] c"%f %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store i32 0, i32* %1
%6 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %11, %0
%8 = load i32, i32* %2
%9 = add nsw i32 %8, -1
store i32 %9, i32* %2
%10 = icmp ne i32 %8, 0
br i1 %10, label %11, label %30
11: ; preds = %7
%12 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%13 = load i32, i32* %4
%14 = load i32, i32* %4
%15 = mul nsw i32 %13, %14
%16 = load i32, i32* %3
%17 = load i32, i32* %3
%18 = mul nsw i32 %16, %17
%19 = sub nsw i32 %15, %18
%20 = call double @sqrt(i32 %19)
%21 = load i32, i32* %4
%22 = load i32, i32* %4
%23 = mul nsw i32 %21, %22
%24 = load i32, i32* %3
%25 = load i32, i32* %3
%26 = mul nsw i32 %24, %25
%27 = add nsw i32 %23, %26
%28 = call double @sqrt(i32 %27)
%29 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %20, double %28)
br label %7
30: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [7 x i8] c"%f %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = add nsw i32 %8, -1
store i32 %9, i32* %1
%10 = icmp eq i32 %8, 0
br i1 %10, label %29, label %11
11: ; preds = %0, %11
%12 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%13 = load i32, i32* %3
%14 = mul nsw i32 %13, %13
%15 = load i32, i32* %2
%16 = mul nsw i32 %15, %15
%17 = sub nsw i32 %14, %16
%18 = call double @sqrt(i32 %17)
%19 = load i32, i32* %3
%20 = mul nsw i32 %19, %19
%21 = load i32, i32* %2
%22 = mul nsw i32 %21, %21
%23 = add nuw nsw i32 %22, %20
%24 = call double @sqrt(i32 %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %18, double %24)
%26 = load i32, i32* %1
%27 = add nsw i32 %26, -1
store i32 %27, i32* %1
%28 = icmp eq i32 %26, 0
br i1 %28, label %29, label %11
29: ; preds = %11, %0
ret i32 0
}