#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*/ mpfr_t;

/* Variables and functions */
int /*<<< orphan*/ MPFR_RNDN;
double P(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_set_default_prec(int);
int /*<<< orphan*/ mpfr_set_ui(int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, unsigned int, int, double);
int main() {
  unsigned int i;
  mpfr_t n;
  mpfr_t r;
  double answer;
  mpfr_set_default_prec(1024);
  mpfr_init(n);
  mpfr_init(r);
  for (i = 2; i < 32; i++) {
    mpfr_set_ui(n, i, MPFR_RNDN);
    mpfr_set_ui(r, 1024 * 1024 * 8, MPFR_RNDN);
    answer = P(n, r);
    printf("n=%d, r=%d, P=%f\n", i, 1024 * 1024 * 8, answer);
  }
  mpfr_clear(n);
  mpfr_clear(r);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x400,%edi
call   1070 <mpfr_set_default_prec@plt>
mov    -0xc(%rbp),%edi
call   1030 <mpfr_init@plt>
mov    -0x10(%rbp),%edi
call   1030 <mpfr_init@plt>
movl   $0x2,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jae    11fb <main+0x9b>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x2e41(%rip),%rax
mov    (%rax),%edx
call   1080 <mpfr_set_ui@plt>
mov    -0x10(%rbp),%edi
mov    0x2e30(%rip),%rax
mov    (%rax),%edx
mov    $0x800000,%esi
call   1080 <mpfr_set_ui@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <P@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
lea    0xe1d(%rip),%rdi
mov    $0x800000,%edx
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1190 <main+0x30>
mov    -0xc(%rbp),%edi
call   1060 <mpfr_clear@plt>
mov    -0x10(%rbp),%edi
call   1060 <mpfr_clear@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x400,%edi
call   1070 <mpfr_set_default_prec@plt>
call   1030 <mpfr_init@plt>
call   1030 <mpfr_init@plt>
mov    $0x2,%ebx
mov    0x2e63(%rip),%r15
lea    0xe74(%rip),%r14
nopl   0x0(%rax)
mov    (%r15),%edx
mov    %ebx,%esi
call   1080 <mpfr_set_ui@plt>
mov    (%r15),%edx
mov    $0x800000,%esi
call   1080 <mpfr_set_ui@plt>
call   1040 <P@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x800000,%edx
call   1050 <printf@plt>
add    $0x1,%ebx
cmp    $0x20,%ebx
jne    1190 <main+0x30>
call   1060 <mpfr_clear@plt>
call   1060 <mpfr_clear@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@MPFR_RNDN = global i32 0
@.str = [18 x i8] c"n=%d, r=%d, P=%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 @mpfr_set_default_prec(i32 1024)
%7 = load i32, i32* %3
%8 = call i32 @mpfr_init(i32 %7)
%9 = load i32, i32* %4
%10 = call i32 @mpfr_init(i32 %9)
store i32 2, i32* %2
br label %11
11: ; preds = %28, %0
%12 = load i32, i32* %2
%13 = icmp ult i32 %12, 32
br i1 %13, label %14, label %31
14: ; preds = %11
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = load i32, i32* @MPFR_RNDN
%18 = call i32 @mpfr_set_ui(i32 %15, i32 %16, i32 %17)
%19 = load i32, i32* %4
%20 = load i32, i32* @MPFR_RNDN
%21 = call i32 @mpfr_set_ui(i32 %19, i32 8388608, i32 %20)
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = call double @P(i32 %22, i32 %23)
store double %24, double* %5
%25 = load i32, i32* %2
%26 = load double, double* %5
%27 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %25, i32 8388608, double %26)
br label %28
28: ; preds = %14
%29 = load i32, i32* %2
%30 = add i32 %29, 1
store i32 %30, i32* %2
br label %11
31: ; preds = %11
%32 = load i32, i32* %3
%33 = call i32 @mpfr_clear(i32 %32)
%34 = load i32, i32* %4
%35 = call i32 @mpfr_clear(i32 %34)
ret i32 1
}

LLVM IR (-O2):
@MPFR_RNDN = global i32 0
@.str = [18 x i8] c"n=%d, r=%d, P=%f\0A\00"
define i32 @main() {
%1 = tail call i32 @mpfr_set_default_prec(i32 1024)
%2 = tail call i32 @mpfr_init(i32 undef)
%3 = tail call i32 @mpfr_init(i32 undef)
br label %4
4: ; preds = %0, %4
%5 = phi i32 [ 2, %0 ], [ %12, %4 ]
%6 = load i32, i32* @MPFR_RNDN
%7 = tail call i32 @mpfr_set_ui(i32 undef, i32 %5, i32 %6)
%8 = load i32, i32* @MPFR_RNDN
%9 = tail call i32 @mpfr_set_ui(i32 undef, i32 8388608, i32 %8)
%10 = tail call double @P(i32 undef, i32 undef)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %5, i32 8388608, double %10)
%12 = add nuw nsw i32 %5, 1
%13 = icmp eq i32 %12, 32
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = tail call i32 @mpfr_clear(i32 undef)
%16 = tail call i32 @mpfr_clear(i32 undef)
ret i32 1
}