#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ RoundDouble(double);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
double pow(double, int);
int /*<<< orphan*/ printf(char *, int, int /*<<< orphan*/);
double sqrt(double);
int main() {
  int numCases = 0, i = 0;
  double r = 0, s = 0;
  FILE *fp = fopen("circle.in", "r");
  fscanf(fp, "%d", &numCases);
  for (i = 0; i < numCases; i++) {
    fscanf(fp, "%lf %lf", &r, &s);
    double answer = pow(1.0 / (1.0 / sqrt(r) + 1.0 / sqrt(s)), 2);
    printf("Circle Problem #%d: Radius of the small circle = %.02lf\n", i + 1,
           RoundDouble(answer));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xe74(%rip),%rdi
lea    0xe77(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe65(%rip),%rsi
lea    -0x8(%rbp),%rdx
mov    $0x0,%al
call   1040 <fscanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1274 <main+0x114>
mov    -0x28(%rbp),%rdi
lea    0xe3f(%rip),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
mov    $0x0,%al
call   1040 <fscanf@plt>
movsd  -0x18(%rbp),%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xe04(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1070 <sqrt@plt>
movsd  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  0xde1(%rip),%xmm0
divsd  %xmm2,%xmm0
addsd  %xmm0,%xmm1
movsd  0xdd1(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1080 <RoundDouble@plt>
mov    -0x34(%rbp),%esi
mov    %eax,%edx
lea    0xdbe(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c1 <main+0x61>
mov    -0x4(%rbp),%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    $0x38,%rsp
movl   $0x0,0xc(%rsp)
movq   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xe91(%rip),%rdi
lea    0xe94(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xe87(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rax,%rdi
xor    %eax,%eax
call   1040 <fscanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1296 <main+0x136>
lea    0xe69(%rip),%r14
lea    0x18(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xe60(%rip),%r13
xor    %ebp,%ebp
jmp    123d <main+0xdd>
nopl   0x0(%rax,%rax,1)
movapd %xmm1,0x20(%rsp)
call   1070 <sqrt@plt>
movapd 0x20(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd 0xe03(%rip),%xmm0
divpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  0xdfb(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
add    $0x1,%ebp
call   1080 <RoundDouble@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1030 <printf@plt>
cmp    0xc(%rsp),%ebp
jge    1296 <main+0x136>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1040 <fscanf@plt>
movsd  0x18(%rsp),%xmm0
ucomisd 0xdba(%rip),%xmm0
jb     1270 <main+0x110>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    1279 <main+0x119>
nopl   0x0(%rax)
call   1070 <sqrt@plt>
movapd %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
ucomisd 0xd91(%rip),%xmm0
jb     11e0 <main+0x80>
sqrtsd %xmm0,%xmm0
jmp    11f1 <main+0x91>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"circle.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [8 x i8] c"%lf %lf\00"
@.str.4 = [57 x i8] c"Circle Problem #%d: Radius of the small circle = %.02lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca i32*
%7 = alloca double
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store double 0.000000e+00, double* %4
store double 0.000000e+00, double* %5
%8 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %6
%9 = load i32*, i32** %6
%10 = call i32 (i32*, i8*, ...) @fscanf(i32* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %11
11: ; preds = %32, %0
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %35
15: ; preds = %11
%16 = load i32*, i32** %6
%17 = call i32 (i32*, i8*, ...) @fscanf(i32* %16, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double* %4, double* %5)
%18 = load double, double* %4
%19 = call double @sqrt(double %18)
%20 = fdiv double 1.000000e+00, %19
%21 = load double, double* %5
%22 = call double @sqrt(double %21)
%23 = fdiv double 1.000000e+00, %22
%24 = fadd double %20, %23
%25 = fdiv double 1.000000e+00, %24
%26 = call double @pow(double %25, i32 2)
store double %26, double* %7
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
%29 = load double, double* %7
%30 = call i32 @RoundDouble(double %29)
%31 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.4, i64 0, i64 0), i32 %28, i32 %30)
br label %32
32: ; preds = %15
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %11
35: ; preds = %11
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@.str = [10 x i8] c"circle.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [8 x i8] c"%lf %lf\00"
@.str.4 = [57 x i8] c"Circle Problem #%d: Radius of the small circle = %.02lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast double* %2 to i8*
store double 0.000000e+00, double* %2
%6 = bitcast double* %3 to i8*
store double 0.000000e+00, double* %3
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i32*, i8*, ...) @fscanf(i32* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %31
11: ; preds = %0, %11
%12 = phi i32 [ %26, %11 ], [ 0, %0 ]
%13 = call i32 (i32*, i8*, ...) @fscanf(i32* %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double* %2, double* %3)
%14 = load double, double* %2
%15 = call double @sqrt(double %14)
%16 = load double, double* %3
%17 = call double @sqrt(double %16)
%18 = insertelement <2 x double> poison, double %15, i64 0
%19 = insertelement <2 x double> %18, double %17, i64 1
%20 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %19
%21 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%22 = fadd <2 x double> %20, %21
%23 = extractelement <2 x double> %22, i64 0
%24 = fdiv double 1.000000e+00, %23
%25 = call double @pow(double %24, i32 2)
%26 = add nuw nsw i32 %12, 1
%27 = call i32 @RoundDouble(double %25)
%28 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.4, i64 0, i64 0), i32 %26, i32 %27)
%29 = load i32, i32* %1
%30 = icmp slt i32 %26, %29
br i1 %30, label %11, label %31
31: ; preds = %11, %0
ret i32 0
}