#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);
int /*<<< orphan*/ scanf(char *, ...);
double sqrt(double);
int main() {
  int t, i;
  double a, b, c, d;
  scanf("%d", &t);
  for (i = 0; i < t; i++) {
    scanf("%lf%lf%lf%lf", &a, &b, &c, &d);
    double s = (a + b + c + d) / 2;
    double ans = sqrt((s - a) * (s - b) * (s - c) * (s - d));
    printf("%.2lf\n", ans);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1204 <main+0xd4>
lea    0xea0(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x30(%rbp),%r8
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  0xe62(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm1
subsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
lea    0xe27(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1158 <main+0x28>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xecb(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    1225 <main+0xf5>
lea    0x20(%rsp),%r15
lea    0x18(%rsp),%r12
lea    0x10(%rsp),%r13
lea    0x8(%rsp),%rbx
lea    0xea9(%rip),%rbp
xor    %r14d,%r14d
jmp    119c <main+0x6c>
nopl   0x0(%rax)
call   1050 <sqrt@plt>
mov    %rbp,%rdi
call   1030 <printf@plt>
add    $0x1,%r14d
cmp    0x4(%rsp),%r14d
jge    1225 <main+0xf5>
lea    0xe70(%rip),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1040 <scanf@plt>
movsd  0x20(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movapd %xmm1,%xmm0
addsd  %xmm2,%xmm0
movsd  0x10(%rsp),%xmm3
addsd  %xmm3,%xmm0
movsd  0x8(%rsp),%xmm4
addsd  %xmm4,%xmm0
mulsd  0xe1a(%rip),%xmm0
movapd %xmm0,%xmm5
subsd  %xmm1,%xmm5
movapd %xmm0,%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm5,%xmm1
movapd %xmm0,%xmm2
subsd  %xmm3,%xmm2
mulsd  %xmm1,%xmm2
subsd  %xmm4,%xmm0
mulsd  %xmm2,%xmm0
ucomisd 0xdf2(%rip),%xmm0
jb     1180 <main+0x50>
sqrtsd %xmm0,%xmm0
jmp    1185 <main+0x55>
xor    %eax,%eax
add    $0x28,%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 = [13 x i8] c"%lf%lf%lf%lf\00"
@.str.2 = [7 x i8] c"%.2lf\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
store i32 0, i32* %1
%10 = 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 %11
11: ; preds = %43, %0
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %46
15: ; preds = %11
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double* %4, double* %5, double* %6, double* %7)
%17 = load double, double* %4
%18 = load double, double* %5
%19 = fadd double %17, %18
%20 = load double, double* %6
%21 = fadd double %19, %20
%22 = load double, double* %7
%23 = fadd double %21, %22
%24 = fdiv double %23, 2.000000e+00
store double %24, double* %8
%25 = load double, double* %8
%26 = load double, double* %4
%27 = fsub double %25, %26
%28 = load double, double* %8
%29 = load double, double* %5
%30 = fsub double %28, %29
%31 = fmul double %27, %30
%32 = load double, double* %8
%33 = load double, double* %6
%34 = fsub double %32, %33
%35 = fmul double %31, %34
%36 = load double, double* %8
%37 = load double, double* %7
%38 = fsub double %36, %37
%39 = fmul double %35, %38
%40 = call double @sqrt(double %39)
store double %40, double* %9
%41 = load double, double* %9
%42 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %41)
br label %43
43: ; preds = %15
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 1
store i32 %45, i32* %3
br label %11
46: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [13 x i8] c"%lf%lf%lf%lf\00"
@.str.2 = [7 x i8] c"%.2lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = bitcast i32* %1 to i8*
%7 = bitcast double* %2 to i8*
%8 = bitcast double* %3 to i8*
%9 = bitcast double* %4 to i8*
%10 = bitcast double* %5 to i8*
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %37
14: ; preds = %0, %14
%15 = phi i32 [ %34, %14 ], [ 0, %0 ]
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3, double* %4, double* %5)
%17 = load double, double* %2
%18 = load double, double* %3
%19 = fadd double %17, %18
%20 = load double, double* %4
%21 = fadd double %19, %20
%22 = load double, double* %5
%23 = fadd double %21, %22
%24 = fmul double %23, 5.000000e-01
%25 = fsub double %24, %17
%26 = fsub double %24, %18
%27 = fmul double %25, %26
%28 = fsub double %24, %20
%29 = fmul double %28, %27
%30 = fsub double %24, %22
%31 = fmul double %30, %29
%32 = call double @sqrt(double %31)
%33 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %32)
%34 = add nuw nsw i32 %15, 1
%35 = load i32, i32* %1
%36 = icmp slt i32 %34, %35
br i1 %36, label %14, label %37
37: ; preds = %14, %0
ret i32 0
}