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

/* Variables and functions */
int M_PI;
int /*<<< orphan*/ mpf_add(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpf_div_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ mpf_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpf_mul(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpf_mul_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ mpf_out_str(int /*<<< orphan*/, int, int /*<<< orphan*/,
                               int /*<<< orphan*/);
int /*<<< orphan*/ mpf_set_d(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpf_set_prec(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpf_set_ui(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpf_sqrt_ui(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpf_sub(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpf_ui_div(int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void ramanujanNW(int times) {
  mpf_t pi, term, mult, tmp, rpi;
  mpf_init(pi);
  mpf_init(term);
  mpf_init(mult);
  mpf_init(tmp);
  mpf_set_prec(pi, 16384);
  mpf_set_prec(term, 16384);
  mpf_set_prec(mult, 16384);
  mpf_set_prec(tmp, 16384);
  mpf_set_ui(mult, 1);
  double n;
  mpf_set_ui(pi, 1103);
  for (n = 1; n < times; n++) {
    mpf_set_d(tmp, ((4 * n) * (4 * n - 1) * (4 * n - 2) * (4 * n - 3)));
    mpf_div_ui(tmp, tmp, (n * n * 396 * 396));
    mpf_div_ui(tmp, tmp, (n * n * 396 * 396));
    mpf_mul(mult, mult, tmp);
    mpf_mul_ui(term, mult, (1103 + 26390 * n));
    mpf_add(pi, pi, term);
  }
  mpf_sqrt_ui(tmp, 2);
  mpf_mul_ui(tmp, tmp, 2);
  mpf_div_ui(tmp, tmp, 9801);
  mpf_mul(pi, pi, tmp);
  mpf_ui_div(pi, 1, pi);
  mpf_out_str(stdout, 10, 0, pi);
  printf("\n");
  mpf_set_d(tmp, M_PI);
  mpf_sub(tmp, pi, tmp);
  printf("delta=\n");
  mpf_out_str(stdout, 10, 0, tmp);
  printf("\n");
}


x86 assembly (clang, -O0):
<ramanujanNW>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x8(%rbp),%edi
call   1070 <mpf_init@plt>
mov    -0xc(%rbp),%edi
call   1070 <mpf_init@plt>
mov    -0x10(%rbp),%edi
call   1070 <mpf_init@plt>
mov    -0x14(%rbp),%edi
call   1070 <mpf_init@plt>
mov    -0x8(%rbp),%edi
mov    $0x4000,%esi
call   1060 <mpf_set_prec@plt>
mov    -0xc(%rbp),%edi
mov    $0x4000,%esi
call   1060 <mpf_set_prec@plt>
mov    -0x10(%rbp),%edi
mov    $0x4000,%esi
call   1060 <mpf_set_prec@plt>
mov    -0x14(%rbp),%edi
mov    $0x4000,%esi
call   1060 <mpf_set_prec@plt>
mov    -0x10(%rbp),%edi
mov    $0x1,%esi
call   10a0 <mpf_set_ui@plt>
mov    -0x8(%rbp),%edi
mov    $0x44f,%esi
call   10a0 <mpf_set_ui@plt>
movsd  0xdaf(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
cvtsi2sdl -0x4(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    13a7 <ramanujanNW+0x1d7>
mov    -0x14(%rbp),%edi
movsd  0xdab(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xd99(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xda5(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xd78(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd7c(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xd57(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd53(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
call   1090 <mpf_set_d@plt>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xd1a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd0e(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
call   1080 <mpf_div_ui@plt>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xce9(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xcdd(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
call   1080 <mpf_div_ui@plt>
mov    -0x10(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   10e0 <mpf_mul@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
movsd  0xc9f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc9b(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
call   10b0 <mpf_mul_ui@plt>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1050 <mpf_add@plt>
movsd  0xc68(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1256 <ramanujanNW+0x86>
mov    -0x14(%rbp),%edi
mov    $0x2,%esi
call   10f0 <mpf_sqrt_ui@plt>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    $0x2,%edx
call   10b0 <mpf_mul_ui@plt>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    $0x2649,%edx
call   1080 <mpf_div_ui@plt>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
call   10e0 <mpf_mul@plt>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    $0x1,%esi
call   1030 <mpf_ui_div@plt>
mov    0x2bdf(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%ecx
mov    $0xa,%esi
xor    %edx,%edx
call   10d0 <mpf_out_str@plt>
lea    0xc35(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
mov    0x2bc8(%rip),%rax
mov    (%rax),%esi
call   1090 <mpf_set_d@plt>
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
call   10c0 <mpf_sub@plt>
lea    0xc04(%rip),%rdi
call   1040 <printf@plt>
mov    0x2b90(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%ecx
mov    $0xa,%esi
xor    %edx,%edx
call   10d0 <mpf_out_str@plt>
lea    0xbe6(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ramanujanNW>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
call   1080 <mpf_init@plt>
call   1080 <mpf_init@plt>
call   1080 <mpf_init@plt>
call   1080 <mpf_init@plt>
mov    $0x4000,%esi
call   1070 <mpf_set_prec@plt>
mov    $0x4000,%esi
call   1070 <mpf_set_prec@plt>
mov    $0x4000,%esi
call   1070 <mpf_set_prec@plt>
mov    $0x4000,%esi
call   1070 <mpf_set_prec@plt>
mov    $0x1,%esi
call   10b0 <mpf_set_ui@plt>
mov    $0x44f,%esi
call   10b0 <mpf_set_ui@plt>
cmp    $0x2,%ebx
jl     1322 <ramanujanNW+0x142>
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xdae(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
mulsd  0xd96(%rip),%xmm0
movapd %xmm0,%xmm1
addsd  0xd92(%rip),%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm0,%xmm2
addsd  0xd8a(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  0xd86(%rip),%xmm0
mulsd  %xmm2,%xmm0
cvttsd2si %xmm0,%esi
call   10a0 <mpf_set_d@plt>
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm0
movsd  0xd70(%rip),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ebx
mov    %ebx,%edx
call   1090 <mpf_div_ui@plt>
mov    %ebx,%edx
call   1090 <mpf_div_ui@plt>
call   10f0 <mpf_mul@plt>
movsd  (%rsp),%xmm0
mulsd  0xd4c(%rip),%xmm0
addsd  0xd4c(%rip),%xmm0
cvttsd2si %xmm0,%edx
call   10c0 <mpf_mul_ui@plt>
call   1060 <mpf_add@plt>
movsd  (%rsp),%xmm0
addsd  0xcf9(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
ucomisd (%rsp),%xmm0
movsd  (%rsp),%xmm0
ja     1260 <ramanujanNW+0x80>
mov    $0x2,%esi
call   1100 <mpf_sqrt_ui@plt>
mov    $0x2,%edx
call   10c0 <mpf_mul_ui@plt>
mov    $0x2649,%edx
call   1090 <mpf_div_ui@plt>
call   10f0 <mpf_mul@plt>
mov    $0x1,%esi
call   1050 <mpf_ui_div@plt>
mov    0x2c82(%rip),%rbx
mov    (%rbx),%edi
mov    $0xa,%esi
xor    %edx,%edx
call   10e0 <mpf_out_str@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2c73(%rip),%rax
mov    (%rax),%esi
call   10a0 <mpf_set_d@plt>
call   10d0 <mpf_sub@plt>
lea    0xcb8(%rip),%rdi
call   1040 <puts@plt>
mov    (%rbx),%edi
mov    $0xa,%esi
xor    %edx,%edx
call   10e0 <mpf_out_str@plt>
mov    $0xa,%edi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [2 x i8] c"\0A\00"
@M_PI = global i32 0
@.str.1 = [8 x i8] c"delta=\0A\00"
define void @ramanujanNW(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
store i32 %0, i32* %2
%9 = load i32, i32* %3
%10 = call i32 @mpf_init(i32 %9)
%11 = load i32, i32* %4
%12 = call i32 @mpf_init(i32 %11)
%13 = load i32, i32* %5
%14 = call i32 @mpf_init(i32 %13)
%15 = load i32, i32* %6
%16 = call i32 @mpf_init(i32 %15)
%17 = load i32, i32* %3
%18 = call i32 @mpf_set_prec(i32 %17, i32 16384)
%19 = load i32, i32* %4
%20 = call i32 @mpf_set_prec(i32 %19, i32 16384)
%21 = load i32, i32* %5
%22 = call i32 @mpf_set_prec(i32 %21, i32 16384)
%23 = load i32, i32* %6
%24 = call i32 @mpf_set_prec(i32 %23, i32 16384)
%25 = load i32, i32* %5
%26 = call i32 @mpf_set_ui(i32 %25, i32 1)
%27 = load i32, i32* %3
%28 = call i32 @mpf_set_ui(i32 %27, i32 1103)
store double 1.000000e+00, double* %8
br label %29
29: ; preds = %81, %1
%30 = load double, double* %8
%31 = load i32, i32* %2
%32 = sitofp i32 %31 to double
%33 = fcmp olt double %30, %32
br i1 %33, label %34, label %84
34: ; preds = %29
%35 = load i32, i32* %6
%36 = load double, double* %8
%37 = fmul double 4.000000e+00, %36
%38 = load double, double* %8
%39 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %38, double -1.000000e+00)
%40 = fmul double %37, %39
%41 = load double, double* %8
%42 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %41, double -2.000000e+00)
%43 = fmul double %40, %42
%44 = load double, double* %8
%45 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %44, double -3.000000e+00)
%46 = fmul double %43, %45
%47 = fptosi double %46 to i32
%48 = call i32 @mpf_set_d(i32 %35, i32 %47)
%49 = load i32, i32* %6
%50 = load i32, i32* %6
%51 = load double, double* %8
%52 = load double, double* %8
%53 = fmul double %51, %52
%54 = fmul double %53, 3.960000e+02
%55 = fmul double %54, 3.960000e+02
%56 = fptosi double %55 to i32
%57 = call i32 @mpf_div_ui(i32 %49, i32 %50, i32 %56)
%58 = load i32, i32* %6
%59 = load i32, i32* %6
%60 = load double, double* %8
%61 = load double, double* %8
%62 = fmul double %60, %61
%63 = fmul double %62, 3.960000e+02
%64 = fmul double %63, 3.960000e+02
%65 = fptosi double %64 to i32
%66 = call i32 @mpf_div_ui(i32 %58, i32 %59, i32 %65)
%67 = load i32, i32* %5
%68 = load i32, i32* %5
%69 = load i32, i32* %6
%70 = call i32 @mpf_mul(i32 %67, i32 %68, i32 %69)
%71 = load i32, i32* %4
%72 = load i32, i32* %5
%73 = load double, double* %8
%74 = call double @llvm.fmuladd.f64(double 2.639000e+04, double %73, double 1.103000e+03)
%75 = fptosi double %74 to i32
%76 = call i32 @mpf_mul_ui(i32 %71, i32 %72, i32 %75)
%77 = load i32, i32* %3
%78 = load i32, i32* %3
%79 = load i32, i32* %4
%80 = call i32 @mpf_add(i32 %77, i32 %78, i32 %79)
br label %81
81: ; preds = %34
%82 = load double, double* %8
%83 = fadd double %82, 1.000000e+00
store double %83, double* %8
br label %29
84: ; preds = %29
%85 = load i32, i32* %6
%86 = call i32 @mpf_sqrt_ui(i32 %85, i32 2)
%87 = load i32, i32* %6
%88 = load i32, i32* %6
%89 = call i32 @mpf_mul_ui(i32 %87, i32 %88, i32 2)
%90 = load i32, i32* %6
%91 = load i32, i32* %6
%92 = call i32 @mpf_div_ui(i32 %90, i32 %91, i32 9801)
%93 = load i32, i32* %3
%94 = load i32, i32* %3
%95 = load i32, i32* %6
%96 = call i32 @mpf_mul(i32 %93, i32 %94, i32 %95)
%97 = load i32, i32* %3
%98 = load i32, i32* %3
%99 = call i32 @mpf_ui_div(i32 %97, i32 1, i32 %98)
%100 = load i32, i32* @stdout
%101 = load i32, i32* %3
%102 = call i32 @mpf_out_str(i32 %100, i32 10, i32 0, i32 %101)
%103 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%104 = load i32, i32* %6
%105 = load i32, i32* @M_PI
%106 = call i32 @mpf_set_d(i32 %104, i32 %105)
%107 = load i32, i32* %6
%108 = load i32, i32* %3
%109 = load i32, i32* %6
%110 = call i32 @mpf_sub(i32 %107, i32 %108, i32 %109)
%111 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%112 = load i32, i32* @stdout
%113 = load i32, i32* %6
%114 = call i32 @mpf_out_str(i32 %112, i32 10, i32 0, i32 %113)
%115 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@M_PI = global i32 0
@str = [7 x i8] c"delta=\00"
define void @ramanujanNW(i32 %0) {
%2 = tail call i32 @mpf_init(i32 undef)
%3 = tail call i32 @mpf_init(i32 undef)
%4 = tail call i32 @mpf_init(i32 undef)
%5 = tail call i32 @mpf_init(i32 undef)
%6 = tail call i32 @mpf_set_prec(i32 undef, i32 16384)
%7 = tail call i32 @mpf_set_prec(i32 undef, i32 16384)
%8 = tail call i32 @mpf_set_prec(i32 undef, i32 16384)
%9 = tail call i32 @mpf_set_prec(i32 undef, i32 16384)
%10 = tail call i32 @mpf_set_ui(i32 undef, i32 1)
%11 = tail call i32 @mpf_set_ui(i32 undef, i32 1103)
%12 = sitofp i32 %0 to double
%13 = icmp sgt i32 %0, 1
br i1 %13, label %14, label %38
14: ; preds = %1, %14
%15 = phi double [ %36, %14 ], [ 1.000000e+00, %1 ]
%16 = fmul double %15, 4.000000e+00
%17 = tail call double @llvm.fmuladd.f64(double %15, double 4.000000e+00, double -1.000000e+00)
%18 = fmul double %16, %17
%19 = tail call double @llvm.fmuladd.f64(double %15, double 4.000000e+00, double -2.000000e+00)
%20 = fmul double %19, %18
%21 = tail call double @llvm.fmuladd.f64(double %15, double 4.000000e+00, double -3.000000e+00)
%22 = fmul double %21, %20
%23 = fptosi double %22 to i32
%24 = tail call i32 @mpf_set_d(i32 undef, i32 %23)
%25 = fmul double %15, %15
%26 = fmul double %25, 3.960000e+02
%27 = fmul double %26, 3.960000e+02
%28 = fptosi double %27 to i32
%29 = tail call i32 @mpf_div_ui(i32 undef, i32 undef, i32 %28)
%30 = tail call i32 @mpf_div_ui(i32 undef, i32 undef, i32 %28)
%31 = tail call i32 @mpf_mul(i32 undef, i32 undef, i32 undef)
%32 = tail call double @llvm.fmuladd.f64(double %15, double 2.639000e+04, double 1.103000e+03)
%33 = fptosi double %32 to i32
%34 = tail call i32 @mpf_mul_ui(i32 undef, i32 undef, i32 %33)
%35 = tail call i32 @mpf_add(i32 undef, i32 undef, i32 undef)
%36 = fadd double %15, 1.000000e+00
%37 = fcmp olt double %36, %12
br i1 %37, label %14, label %38
38: ; preds = %14, %1
%39 = tail call i32 @mpf_sqrt_ui(i32 undef, i32 2)
%40 = tail call i32 @mpf_mul_ui(i32 undef, i32 undef, i32 2)
%41 = tail call i32 @mpf_div_ui(i32 undef, i32 undef, i32 9801)
%42 = tail call i32 @mpf_mul(i32 undef, i32 undef, i32 undef)
%43 = tail call i32 @mpf_ui_div(i32 undef, i32 1, i32 undef)
%44 = load i32, i32* @stdout
%45 = tail call i32 @mpf_out_str(i32 %44, i32 10, i32 0, i32 undef)
%46 = tail call i32 @putchar(i32 10)
%47 = load i32, i32* @M_PI
%48 = tail call i32 @mpf_set_d(i32 undef, i32 %47)
%49 = tail call i32 @mpf_sub(i32 undef, i32 undef, i32 undef)
%50 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%51 = load i32, i32* @stdout
%52 = tail call i32 @mpf_out_str(i32 %51, i32 10, i32 0, i32 undef)
%53 = tail call i32 @putchar(i32 10)
ret void
}