#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 countNumCoprimePairs(int *, int);
double estimatePi(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int n, i, numCoprimePairs;
  int arr[50];
  double pi;
  while (1) {
    scanf("%d", &n);
    if (!n) {
      break;
    }
    for (i = 0; i < n; ++i) {
      scanf("%d", &arr[i]);
    }
    numCoprimePairs = countNumCoprimePairs(arr, n);
    if (!numCoprimePairs) {
      printf("No estimate for this data set.\n");
    } else {
      pi = estimatePi(numCoprimePairs, n);
      printf("%.6lf\n", pi);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1171 <main+0x31>
jmp    120d <main+0xcd>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b0 <main+0x70>
movslq -0xc(%rbp),%rax
lea    -0xe0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe63(%rip),%rdi
call   1060 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1178 <main+0x38>
lea    -0xe0(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <countNumCoprimePairs@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11df <main+0x9f>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1208 <main+0xc8>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <estimatePi@plt>
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0xe8(%rbp),%xmm0
ff
lea    0xe22(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1152 <main+0x12>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
lea    0xe98(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
je     1217 <main+0xc7>
lea    0x10(%rsp),%r14
lea    0xe76(%rip),%rbx
lea    0xc(%rsp),%r12
lea    0xe6d(%rip),%r13
jmp    11c8 <main+0x78>
nopl   0x0(%rax,%rax,1)
mov    0xc(%rsp),%esi
mov    %eax,%edi
call   1060 <estimatePi@plt>
mov    %r13,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
je     1217 <main+0xc7>
test   %esi,%esi
jle    11fd <main+0xad>
mov    %r14,%rbp
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1070 <scanf@plt>
add    $0x1,%r15
movslq 0xc(%rsp),%rsi
add    $0x4,%rbp
cmp    %rsi,%r15
jl     11e0 <main+0x90>
mov    %r14,%rdi
call   1040 <countNumCoprimePairs@plt>
test   %eax,%eax
jne    11a0 <main+0x50>
lea    0xdfa(%rip),%rdi
call   1030 <puts@plt>
jmp    11b5 <main+0x65>
xor    %eax,%eax
add    $0xd8,%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 = [32 x i8] c"No estimate for this data set.\0A\00"
@.str.2 = [7 x i8] c"%.6lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [50 x i32]
%6 = alloca double
store i32 0, i32* %1
br label %7
7: ; preds = %0, %39
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %7
br label %40
12: ; preds = %7
store i32 0, i32* %3
br label %13
13: ; preds = %22, %12
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %25
17: ; preds = %13
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [50 x i32], [50 x i32]* %5, i64 0, i64 %19
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %20)
br label %22
22: ; preds = %17
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %13
25: ; preds = %13
%26 = getelementptr inbounds [50 x i32], [50 x i32]* %5, i64 0, i64 0
%27 = load i32, i32* %2
%28 = call i32 @countNumCoprimePairs(i32* %26, i32 %27)
store i32 %28, i32* %4
%29 = load i32, i32* %4
%30 = icmp ne i32 %29, 0
br i1 %30, label %33, label %31
31: ; preds = %25
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %39
33: ; preds = %25
%34 = load i32, i32* %4
%35 = load i32, i32* %2
%36 = call double @estimatePi(i32 %34, i32 %35)
store double %36, double* %6
%37 = load double, double* %6
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %37)
br label %39
39: ; preds = %33, %31
br label %7
40: ; preds = %11
ret i32 0
}

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