#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(double);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, ...);
double sqrt(double);
int main() {
  int i, n;
  double r1, r2, r3, a, b, c, A, B, C, s, area, res, s1, s2, s3;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%lf %lf %lf", &r1, &r2, &r3);
    a = r2 + r3, b = r1 + r3, c = r1 + r2;
    A = acos((b * b + c * c - a * a) / (2 * b * c)),
    B = acos((c * c + a * a - b * b) / (2 * c * a)),
    C = acos((a * a + b * b - c * c) / (2 * a * b));
    s = (a + b + c) / 2.0;
    area = sqrt(s * (s - a) * (s - b) * (s - c));
    s1 = A * r1 * r1 * 0.5;
    s2 = B * r2 * r2 * 0.5;
    s3 = C * r3 * r3 * 0.5;
    res = area - s1 - s2 - s3;
    printf("%.6lf\n", res);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     13e4 <main+0x2a4>
lea    0xe95(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
mov    $0x0,%al
call   1050 <scanf@plt>
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdfd(%rip),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1040 <acos@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd98(%rip),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1040 <acos@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd33(%rip),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1040 <acos@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  0xd04(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
subsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x60(%rbp),%xmm1
subsd  -0x38(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x60(%rbp),%xmm1
subsd  -0x40(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xca3(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xc83(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x58(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xc63(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
subsd  -0x78(%rbp),%xmm0
subsd  -0x80(%rbp),%xmm0
subsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
lea    0xc4e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116b <main+0x2b>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xec8(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    136d <main+0x22d>
lea    0xead(%rip),%r14
lea    0x68(%rsp),%r15
lea    0x60(%rsp),%r12
lea    0x58(%rsp),%r13
lea    0xea3(%rip),%rbx
xor    %ebp,%ebp
jmp    120c <main+0xcc>
movapd %xmm6,0x10(%rsp)
call   1060 <sqrt@plt>
movapd 0x10(%rsp),%xmm6
movsd  0xe57(%rip),%xmm2
movapd 0x70(%rsp),%xmm3
movsd  0x28(%rsp),%xmm4
movsd  0x68(%rsp),%xmm1
mulsd  %xmm1,%xmm4
mulsd  %xmm1,%xmm4
mulsd  %xmm2,%xmm4
subsd  %xmm4,%xmm0
unpcklpd %xmm6,%xmm3
movsd  0x60(%rsp),%xmm1
movhpd 0x58(%rsp),%xmm1
mulpd  %xmm1,%xmm3
mulpd  %xmm1,%xmm3
mulpd  0xe25(%rip),%xmm3
subsd  %xmm3,%xmm0
unpckhpd %xmm3,%xmm3
subsd  %xmm3,%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    136d <main+0x22d>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1050 <scanf@plt>
movsd  0x60(%rsp),%xmm1
movsd  0x58(%rsp),%xmm2
movapd %xmm1,%xmm0
addsd  %xmm2,%xmm0
movapd %xmm0,%xmm3
movsd  %xmm0,0x10(%rsp)
movsd  0x68(%rsp),%xmm0
addsd  %xmm0,%xmm2
movsd  %xmm2,0x50(%rsp)
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm5
movapd %xmm1,%xmm4
movsd  %xmm1,0x48(%rsp)
mulsd  %xmm1,%xmm5
movsd  %xmm5,0x40(%rsp)
movapd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x38(%rsp)
addsd  %xmm5,%xmm0
mulsd  %xmm3,%xmm3
movsd  %xmm3,0x30(%rsp)
subsd  %xmm3,%xmm0
movapd %xmm2,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm4,%xmm1
divsd  %xmm1,%xmm0
call   1040 <acos@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x40(%rsp),%xmm0
addsd  0x30(%rsp),%xmm0
subsd  0x38(%rsp),%xmm0
movsd  0x48(%rsp),%xmm1
addsd  %xmm1,%xmm1
mulsd  0x10(%rsp),%xmm1
divsd  %xmm1,%xmm0
call   1040 <acos@plt>
movapd %xmm0,0x70(%rsp)
movsd  0x30(%rsp),%xmm1
addsd  0x38(%rsp),%xmm1
subsd  0x40(%rsp),%xmm1
movsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm0
mulsd  0x50(%rsp),%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1040 <acos@plt>
movapd %xmm0,%xmm6
movsd  0x10(%rsp),%xmm2
movapd %xmm2,%xmm0
movsd  0x50(%rsp),%xmm5
addsd  %xmm5,%xmm0
movsd  0x48(%rsp),%xmm4
addsd  %xmm4,%xmm0
movsd  0xcd2(%rip),%xmm3
mulsd  %xmm3,%xmm0
movapd %xmm0,%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm0,%xmm2
subsd  %xmm5,%xmm2
mulsd  %xmm1,%xmm2
subsd  %xmm4,%xmm0
mulsd  %xmm2,%xmm0
ucomisd 0xcae(%rip),%xmm0
jb     1190 <main+0x50>
movapd %xmm3,%xmm2
sqrtsd %xmm0,%xmm0
jmp    11a9 <main+0x69>
xor    %eax,%eax
add    $0x88,%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
%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
store i32 0, i32* %1
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 1, i32* %2
br label %20
20: ; preds = %130, %0
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = icmp sle i32 %21, %22
br i1 %23, label %24, label %133
24: ; preds = %20
%25 = 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)
%26 = load double, double* %5
%27 = load double, double* %6
%28 = fadd double %26, %27
store double %28, double* %7
%29 = load double, double* %4
%30 = load double, double* %6
%31 = fadd double %29, %30
store double %31, double* %8
%32 = load double, double* %4
%33 = load double, double* %5
%34 = fadd double %32, %33
store double %34, double* %9
%35 = load double, double* %8
%36 = load double, double* %8
%37 = load double, double* %9
%38 = load double, double* %9
%39 = fmul double %37, %38
%40 = call double @llvm.fmuladd.f64(double %35, double %36, double %39)
%41 = load double, double* %7
%42 = load double, double* %7
%43 = fneg double %41
%44 = call double @llvm.fmuladd.f64(double %43, double %42, double %40)
%45 = load double, double* %8
%46 = fmul double 2.000000e+00, %45
%47 = load double, double* %9
%48 = fmul double %46, %47
%49 = fdiv double %44, %48
%50 = call double @acos(double %49)
store double %50, double* %10
%51 = load double, double* %9
%52 = load double, double* %9
%53 = load double, double* %7
%54 = load double, double* %7
%55 = fmul double %53, %54
%56 = call double @llvm.fmuladd.f64(double %51, double %52, double %55)
%57 = load double, double* %8
%58 = load double, double* %8
%59 = fneg double %57
%60 = call double @llvm.fmuladd.f64(double %59, double %58, double %56)
%61 = load double, double* %9
%62 = fmul double 2.000000e+00, %61
%63 = load double, double* %7
%64 = fmul double %62, %63
%65 = fdiv double %60, %64
%66 = call double @acos(double %65)
store double %66, double* %11
%67 = load double, double* %7
%68 = load double, double* %7
%69 = load double, double* %8
%70 = load double, double* %8
%71 = fmul double %69, %70
%72 = call double @llvm.fmuladd.f64(double %67, double %68, double %71)
%73 = load double, double* %9
%74 = load double, double* %9
%75 = fneg double %73
%76 = call double @llvm.fmuladd.f64(double %75, double %74, double %72)
%77 = load double, double* %7
%78 = fmul double 2.000000e+00, %77
%79 = load double, double* %8
%80 = fmul double %78, %79
%81 = fdiv double %76, %80
%82 = call double @acos(double %81)
store double %82, double* %12
%83 = load double, double* %7
%84 = load double, double* %8
%85 = fadd double %83, %84
%86 = load double, double* %9
%87 = fadd double %85, %86
%88 = fdiv double %87, 2.000000e+00
store double %88, double* %13
%89 = load double, double* %13
%90 = load double, double* %13
%91 = load double, double* %7
%92 = fsub double %90, %91
%93 = fmul double %89, %92
%94 = load double, double* %13
%95 = load double, double* %8
%96 = fsub double %94, %95
%97 = fmul double %93, %96
%98 = load double, double* %13
%99 = load double, double* %9
%100 = fsub double %98, %99
%101 = fmul double %97, %100
%102 = call double @sqrt(double %101)
store double %102, double* %14
%103 = load double, double* %10
%104 = load double, double* %4
%105 = fmul double %103, %104
%106 = load double, double* %4
%107 = fmul double %105, %106
%108 = fmul double %107, 5.000000e-01
store double %108, double* %16
%109 = load double, double* %11
%110 = load double, double* %5
%111 = fmul double %109, %110
%112 = load double, double* %5
%113 = fmul double %111, %112
%114 = fmul double %113, 5.000000e-01
store double %114, double* %17
%115 = load double, double* %12
%116 = load double, double* %6
%117 = fmul double %115, %116
%118 = load double, double* %6
%119 = fmul double %117, %118
%120 = fmul double %119, 5.000000e-01
store double %120, double* %18
%121 = load double, double* %14
%122 = load double, double* %16
%123 = fsub double %121, %122
%124 = load double, double* %17
%125 = fsub double %123, %124
%126 = load double, double* %18
%127 = fsub double %125, %126
store double %127, double* %15
%128 = load double, double* %15
%129 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %128)
br label %130
130: ; preds = %24
%131 = load i32, i32* %2
%132 = add nsw i32 %131, 1
store i32 %132, i32* %2
br label %20
133: ; preds = %20
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 slt i32 %10, 1
br i1 %11, label %77, label %12
12: ; preds = %0, %12
%13 = phi i32 [ %74, %12 ], [ 1, %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* %3
%16 = load double, double* %4
%17 = fadd double %15, %16
%18 = load double, double* %2
%19 = fadd double %16, %18
%20 = fadd double %15, %18
%21 = fmul double %20, %20
%22 = call double @llvm.fmuladd.f64(double %19, double %19, double %21)
%23 = fneg double %17
%24 = call double @llvm.fmuladd.f64(double %23, double %17, double %22)
%25 = fmul double %19, 2.000000e+00
%26 = fmul double %20, %25
%27 = fdiv double %24, %26
%28 = call double @acos(double %27)
%29 = fmul double %17, %17
%30 = call double @llvm.fmuladd.f64(double %20, double %20, double %29)
%31 = fneg double %19
%32 = call double @llvm.fmuladd.f64(double %31, double %19, double %30)
%33 = fmul double %20, 2.000000e+00
%34 = fmul double %17, %33
%35 = fdiv double %32, %34
%36 = call double @acos(double %35)
%37 = fmul double %19, %19
%38 = call double @llvm.fmuladd.f64(double %17, double %17, double %37)
%39 = fneg double %20
%40 = call double @llvm.fmuladd.f64(double %39, double %20, double %38)
%41 = fmul double %17, 2.000000e+00
%42 = fmul double %41, %19
%43 = fdiv double %40, %42
%44 = call double @acos(double %43)
%45 = fadd double %17, %19
%46 = fadd double %20, %45
%47 = fmul double %46, 5.000000e-01
%48 = fsub double %47, %17
%49 = fmul double %47, %48
%50 = fsub double %47, %19
%51 = fmul double %50, %49
%52 = fsub double %47, %20
%53 = fmul double %52, %51
%54 = call double @sqrt(double %53)
%55 = load double, double* %2
%56 = fmul double %28, %55
%57 = fmul double %55, %56
%58 = fmul double %57, 5.000000e-01
%59 = load double, double* %3
%60 = load double, double* %4
%61 = insertelement <2 x double> poison, double %36, i64 0
%62 = insertelement <2 x double> %61, double %44, i64 1
%63 = insertelement <2 x double> poison, double %59, i64 0
%64 = insertelement <2 x double> %63, double %60, i64 1
%65 = fmul <2 x double> %62, %64
%66 = fmul <2 x double> %64, %65
%67 = fmul <2 x double> %66, <double 5.000000e-01, double 5.000000e-01>
%68 = fsub double %54, %58
%69 = extractelement <2 x double> %67, i64 0
%70 = fsub double %68, %69
%71 = extractelement <2 x double> %67, i64 1
%72 = fsub double %70, %71
%73 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %72)
%74 = add nuw nsw i32 %13, 1
%75 = load i32, i32* %1
%76 = icmp slt i32 %13, %75
br i1 %76, label %12, label %77
77: ; preds = %12, %0
ret i32 0
}