#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 acos(int);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, ...);
double sqrt(double);
int main() {
  int t, i;
  double r1, r2, r3, temp;
  scanf("%d", &t);
  for (i = 0; i < t; i++) {
    scanf("%lf %lf %lf", &r1, &r2, &r3);
    temp = ((r1 * r1 * acos(1 - ((2 * r2 * r3) / ((r1 + r2) * (r1 + r3))))) +
            (r2 * r2 * acos(1 - ((2 * r1 * r3) / ((r1 + r2) * (r2 + r3))))) +
            (r3 * r3 * acos(1 - ((2 * r2 * r1) / ((r1 + r3) * (r2 + r3)))))) *
           .5;
    temp = ((sqrt((r1 * r2 * r3) * (r1 + r2 + r3))) - temp);
    printf("%.6lf\n", temp);
  }
  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>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1322 <main+0x1e2>
lea    0xea0(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
mov    $0x0,%al
call   1050 <scanf@plt>
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe6b(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
addsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  0xe35(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <acos@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe14(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
addsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  0xdde(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <acos@plt>
movsd  -0x58(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xd9f(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
addsd  -0x28(%rbp),%xmm2
mulsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  0xd69(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <acos@plt>
movsd  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd37(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
addsd  -0x20(%rbp),%xmm1
addsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
lea    0xd18(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1168 <main+0x28>
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    $0x38,%rsp
lea    0xec3(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1335 <main+0x1f5>
lea    0xea8(%rip),%r14
lea    0x20(%rsp),%r15
lea    0x18(%rsp),%r12
lea    0x10(%rsp),%r13
lea    0xe9e(%rip),%rbx
xor    %ebp,%ebp
jmp    11b8 <main+0x78>
nopl   (%rax)
movsd  %xmm4,(%rsp)
call   1060 <sqrt@plt>
movsd  (%rsp),%xmm4
subsd  %xmm4,%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    1335 <main+0x1f5>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1050 <scanf@plt>
movsd  0x20(%rsp),%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x28(%rsp)
movsd  0x18(%rsp),%xmm1
movapd %xmm1,%xmm2
addsd  %xmm1,%xmm2
movsd  0x10(%rsp),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm0,%xmm1
addsd  %xmm3,%xmm0
mulsd  %xmm1,%xmm0
divsd  %xmm0,%xmm2
movsd  0xdf1(%rip),%xmm0
subsd  %xmm2,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <acos@plt>
movsd  %xmm0,(%rsp)
movsd  0x18(%rsp),%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x30(%rsp)
movsd  0x20(%rsp),%xmm1
movapd %xmm1,%xmm2
addsd  %xmm1,%xmm2
movsd  0x10(%rsp),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm0,%xmm1
addsd  %xmm3,%xmm0
mulsd  %xmm1,%xmm0
divsd  %xmm0,%xmm2
movsd  0xd9b(%rip),%xmm0
subsd  %xmm2,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <acos@plt>
mulsd  0x30(%rsp),%xmm0
movsd  (%rsp),%xmm1
mulsd  0x28(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x10(%rsp),%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x28(%rsp)
movsd  0x18(%rsp),%xmm1
movapd %xmm1,%xmm2
addsd  %xmm1,%xmm2
movsd  0x20(%rsp),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm0,%xmm3
addsd  %xmm1,%xmm0
mulsd  %xmm3,%xmm0
divsd  %xmm0,%xmm2
movsd  0xd30(%rip),%xmm0
subsd  %xmm2,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <acos@plt>
movapd %xmm0,%xmm4
mulsd  0x28(%rsp),%xmm4
addsd  (%rsp),%xmm4
mulsd  0xd14(%rip),%xmm4
movsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movapd %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movsd  0x10(%rsp),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm0
addsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm0
ucomisd 0xcea(%rip),%xmm0
jb     1190 <main+0x50>
sqrtsd %xmm0,%xmm0
jmp    119f <main+0x5f>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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