#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 */
scalar_t__ computeCircleArea(double);
int /*<<< orphan*/ gets(char *);
int parseInput(char *, int *);
int /*<<< orphan*/ printf(char *, scalar_t__);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int T, input[2], numInput;
  char line[100 + 1];
  double R, r;
  scanf("%d", &T);
  gets(line);
  while (T) {
    gets(line);
    numInput = parseInput(line, input);
    if (numInput == 1) {
      R = input[0] / 4.0;
      r = R;
    } else {
      R = (double)input[0];
      r = (double)input[1];
    }
    printf("%.4lf\n", computeCircleArea(R + r) - computeCircleArea(R) -
                          computeCircleArea(r));
    T--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9f(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
lea    -0x80(%rbp),%rdi
call   1050 <gets@plt>
cmpl   $0x0,-0x8(%rbp)
je     125e <main+0x10e>
lea    -0x80(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x80(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <parseInput@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    11d6 <main+0x86>
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xe4b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
jmp    11f0 <main+0xa0>
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
addsd  -0x90(%rbp),%xmm0
ff
call   1060 <computeCircleArea@plt>
mov    %rax,-0xa0(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
call   1060 <computeCircleArea@plt>
mov    %rax,%rcx
mov    -0xa0(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x98(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
call   1060 <computeCircleArea@plt>
mov    -0x98(%rbp),%rsi
sub    %rax,%rsi
lea    0xdc0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    117b <main+0x2b>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x90,%rsp
lea    0xea1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
lea    0x20(%rsp),%rdi
call   1050 <gets@plt>
cmpl   $0x0,0x4(%rsp)
je     1230 <main+0xe0>
lea    0x20(%rsp),%r12
lea    0x8(%rsp),%r14
lea    0xe74(%rip),%r15
jmp    11ed <main+0x9d>
nopl   0x0(%rax)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x18(%rsp)
movapd %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1060 <computeCircleArea@plt>
mov    %rax,%rbx
movsd  0x10(%rsp),%xmm0
call   1060 <computeCircleArea@plt>
mov    %rax,%r13
movsd  0x18(%rsp),%xmm0
call   1060 <computeCircleArea@plt>
add    %r13,%rax
sub    %rax,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
addl   $0xffffffff,0x4(%rsp)
je     1230 <main+0xe0>
mov    %r12,%rdi
call   1050 <gets@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1040 <parseInput@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x8(%rsp),%xmm0
movapd %xmm0,%xmm2
mulsd  0xdeb(%rip),%xmm2
movapd %xmm2,%xmm1
cmp    $0x1,%eax
je     11a0 <main+0x50>
xorps  %xmm1,%xmm1
cvtsi2sdl 0xc(%rsp),%xmm1
movapd %xmm0,%xmm2
jmp    11a0 <main+0x50>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%.4lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [2 x i32]
%4 = alloca i32
%5 = alloca [101 x i8]
%6 = alloca double
%7 = alloca double
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 0
%10 = call i32 @gets(i8* %9)
br label %11
11: ; preds = %35, %0
%12 = load i32, i32* %2
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %49
14: ; preds = %11
%15 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 0
%16 = call i32 @gets(i8* %15)
%17 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 0
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%19 = call i32 @parseInput(i8* %17, i32* %18)
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %28
22: ; preds = %14
%23 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%24 = load i32, i32* %23
%25 = sitofp i32 %24 to double
%26 = fdiv double %25, 4.000000e+00
store double %26, double* %6
%27 = load double, double* %6
store double %27, double* %7
br label %35
28: ; preds = %14
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%30 = load i32, i32* %29
%31 = sitofp i32 %30 to double
store double %31, double* %6
%32 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%33 = load i32, i32* %32
%34 = sitofp i32 %33 to double
store double %34, double* %7
br label %35
35: ; preds = %28, %22
%36 = load double, double* %6
%37 = load double, double* %7
%38 = fadd double %36, %37
%39 = call i64 @computeCircleArea(double %38)
%40 = load double, double* %6
%41 = call i64 @computeCircleArea(double %40)
%42 = sub nsw i64 %39, %41
%43 = load double, double* %7
%44 = call i64 @computeCircleArea(double %43)
%45 = sub nsw i64 %42, %44
%46 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64 %45)
%47 = load i32, i32* %2
%48 = add nsw i32 %47, -1
store i32 %48, i32* %2
br label %11
49: ; preds = %11
ret i32 0
}

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