#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 fabs(double);
scalar_t__ isinf(double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int run, nruns;
  double x, y;
  int testinf = 0;
  scanf("%d\n", &nruns);
  for (run = 1; run <= nruns; run++) {
    scanf("%lf\n", &x);
    if (fabs(x - 1) < 0.0001) {
      printf("+2.0\n");
      continue;
    }
    if (fabs(x) < 0.0001) {
      testinf = 1;
      printf("%lE\n", 0.0 / -0);
      continue;
    }
    if (isinf(x)) {
      printf("%.7lf\n", 1 / 0.0);
      continue;
    }
    y = 1 / x;
    printf("%.7lf\n", y);
  }
  if (testinf)
    printf("0.0\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xee3(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1264 <main+0x134>
lea    0xec2(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x18(%rbp),%xmm1
movsd  0xe7e(%rip),%xmm0
subsd  %xmm0,%xmm1
movaps 0xe8b(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe5f(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11be <main+0x8e>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1256 <main+0x126>
movsd  -0x18(%rbp),%xmm1
movaps 0xe56(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe2a(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1202 <main+0xd2>
movl   $0x1,-0x24(%rbp)
lea    0xe51(%rip),%rdi
movsd  0xe22(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1256 <main+0x126>
movsd  -0x18(%rbp),%xmm0
call   1050 <isinf@plt>
cmp    $0x0,%rax
je     1231 <main+0x101>
lea    0xe27(%rip),%rdi
movsd  0xdeb(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1256 <main+0x126>
movsd  0xdcf(%rip),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xdf5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115f <main+0x2f>
cmpl   $0x0,-0x24(%rbp)
je     127c <main+0x14c>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeeb(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1255 <main+0x115>
lea    0xed1(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xeda(%rip),%r15
lea    0xec8(%rip),%r13
xor    %ebp,%ebp
xor    %r12d,%r12d
jmp    11a5 <main+0x65>
nopl   (%rax)
mov    %r15,%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    1244 <main+0x104>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsd  0x10(%rsp),%xmm0
movapd %xmm0,%xmm1
addsd  0xe3c(%rip),%xmm1
movapd 0xe64(%rip),%xmm2
andpd  %xmm2,%xmm1
movsd  0xe30(%rip),%xmm3
ucomisd %xmm1,%xmm3
ja     1190 <main+0x50>
movapd %xmm0,%xmm1
andpd  %xmm2,%xmm1
ucomisd %xmm1,%xmm3
jbe    1210 <main+0xd0>
lea    0xe56(%rip),%rdi
movsd  0xe25(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x1,%r12d
jmp    1198 <main+0x58>
nopw   0x0(%rax,%rax,1)
call   1060 <isinf@plt>
test   %rax,%rax
je     1227 <main+0xe7>
mov    %r13,%rdi
movsd  0xdeb(%rip),%xmm0
jmp    1238 <main+0xf8>
movsd  0xde9(%rip),%xmm0
divsd  0x10(%rsp),%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1198 <main+0x58>
test   %r12d,%r12d
je     1255 <main+0x115>
lea    0xe05(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [5 x i8] c"%lf\0A\00"
@.str.2 = [6 x i8] c"+2.0\0A\00"
@.str.3 = [5 x i8] c"%lE\0A\00"
@.str.4 = [7 x i8] c"%.7lf\0A\00"
@.str.5 = [5 x i8] c"0.0\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 1, i32* %2
br label %8
8: ; preds = %37, %0
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %40
12: ; preds = %8
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %4)
%14 = load double, double* %4
%15 = fsub double %14, 1.000000e+00
%16 = call double @llvm.fabs.f64(double %15)
%17 = fcmp olt double %16, 1.000000e-04
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %37
20: ; preds = %12
%21 = load double, double* %4
%22 = call double @llvm.fabs.f64(double %21)
%23 = fcmp olt double %22, 1.000000e-04
br i1 %23, label %24, label %26
24: ; preds = %20
store i32 1, i32* %6
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double 0x7FF8000000000000)
br label %37
26: ; preds = %20
%27 = load double, double* %4
%28 = call i64 @isinf(double %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double 0x7FF0000000000000)
br label %37
32: ; preds = %26
%33 = load double, double* %4
%34 = fdiv double 1.000000e+00, %33
store double %34, double* %5
%35 = load double, double* %5
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %35)
br label %37
37: ; preds = %32, %30, %24, %18
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %2
br label %8
40: ; preds = %8
%41 = load i32, i32* %6
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %45
45: ; preds = %43, %40
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [5 x i8] c"%lf\0A\00"
@.str.3 = [5 x i8] c"%lE\0A\00"
@.str.4 = [7 x i8] c"%.7lf\0A\00"
@str = [4 x i8] c"0.0\00"
@str.6 = [5 x i8] c"+2.0\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = bitcast i32* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 1
br i1 %7, label %41, label %8
8: ; preds = %0, %32
%9 = phi i32 [ %33, %32 ], [ 0, %0 ]
%10 = phi i32 [ %34, %32 ], [ 1, %0 ]
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %2)
%12 = load double, double* %2
%13 = fadd double %12, -1.000000e+00
%14 = call double @llvm.fabs.f64(double %13)
%15 = fcmp olt double %14, 1.000000e-04
br i1 %15, label %16, label %18
16: ; preds = %8
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.6, i64 0, i64 0))
br label %32
18: ; preds = %8
%19 = call double @llvm.fabs.f64(double %12)
%20 = fcmp olt double %19, 1.000000e-04
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double 0x7FF8000000000000)
br label %32
23: ; preds = %18
%24 = call i64 @isinf(double %12)
%25 = icmp eq i64 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double 0x7FF0000000000000)
br label %32
28: ; preds = %23
%29 = load double, double* %2
%30 = fdiv double 1.000000e+00, %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %30)
br label %32
32: ; preds = %28, %26, %21, %16
%33 = phi i32 [ %9, %16 ], [ 1, %21 ], [ %9, %26 ], [ %9, %28 ]
%34 = add nuw nsw i32 %10, 1
%35 = load i32, i32* %1
%36 = icmp slt i32 %10, %35
br i1 %36, label %8, label %37
37: ; preds = %32
%38 = icmp eq i32 %33, 0
br i1 %38, label %41, label %39
39: ; preds = %37
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
br label %41
41: ; preds = %0, %39, %37
ret i32 0
}