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

/* Variables and functions */
int /*<<< orphan*/ MPFR_RNDN;
int /*<<< orphan*/ mpfr_const_pi(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_div(int /*<<< orphan*/, int /*<<< orphan*/,
                            int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_div_si(int /*<<< orphan*/, int /*<<< orphan*/, int,
                               int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_exp2(int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_fmod(int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/);
double mpfr_get_d(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_init2(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpfr_mul_si(int /*<<< orphan*/, int /*<<< orphan*/, int,
                               int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_set(int /*<<< orphan*/, int /*<<< orphan*/,
                            int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_set_d(int /*<<< orphan*/, double, int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_set_si(int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_sub(int /*<<< orphan*/, int /*<<< orphan*/,
                            int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  mpfr_t pi;
  mpfr_t two_pi;
  mpfr_t t;
  mpfr_t t2;
  mpfr_t perfect_n;
  double d = 0;
  uint64_t u = 0;
  mpfr_init2(pi, 10000);
  mpfr_init2(two_pi, 10000);
  mpfr_init2(t, 10000);
  mpfr_init2(t2, 10000);
  mpfr_init2(perfect_n, 10000);
  mpfr_const_pi(pi, MPFR_RNDN);
  mpfr_mul_si(two_pi, pi, 2, MPFR_RNDN);
  for (long e = 25; e <= 1023; e += 50) {
    mpfr_set_si(t, e, MPFR_RNDN);
    mpfr_exp2(t, t, MPFR_RNDN);
    mpfr_fmod(t2, t, two_pi, MPFR_RNDN);
    mpfr_set(t, t2, MPFR_RNDN);
    d = mpfr_get_d(t, MPFR_RNDN);
    u = (*((uint64_t *)((char *)&d)));
    printf("(%#018lx, ", u);
    mpfr_set_d(t2, d, MPFR_RNDN);
    mpfr_sub(t, t, t2, MPFR_RNDN);
    d = mpfr_get_d(t, MPFR_RNDN);
    u = (*((uint64_t *)((char *)&d)));
    printf("%#018lx, ", u);
    mpfr_set_d(t2, d, MPFR_RNDN);
    mpfr_sub(t, t, t2, MPFR_RNDN);
    d = mpfr_get_d(t, MPFR_RNDN);
    u = (*((uint64_t *)((char *)&d)));
    printf("%#018lx), /* 2^%ld mod 2pi */\n", u, e);
  }
  printf("\n");
  printf("1000 bits of pi/2:\n");
  mpfr_const_pi(pi, MPFR_RNDN);
  mpfr_div_si(pi, pi, 2, MPFR_RNDN);
  for (int bits_obtained = 0; bits_obtained < 1000; bits_obtained += 53) {
    d = mpfr_get_d(pi, MPFR_RNDN);
    u = (*((uint64_t *)((char *)&d)));
    printf("%#018lx\n", u);
    mpfr_set_d(t, d, MPFR_RNDN);
    mpfr_sub(pi, pi, t, MPFR_RNDN);
  }
  printf("\n");
  printf("1000 bits of pi/4:\n");
  mpfr_const_pi(pi, MPFR_RNDN);
  mpfr_div_si(pi, pi, 4, MPFR_RNDN);
  for (int bits_obtained = 0; bits_obtained < 1000; bits_obtained += 53) {
    d = mpfr_get_d(pi, MPFR_RNDN);
    u = (*((uint64_t *)((char *)&d)));
    printf("%#018lx\n", u);
    mpfr_set_d(t, d, MPFR_RNDN);
    mpfr_sub(pi, pi, t, MPFR_RNDN);
  }
  printf("\n");
  printf("Pre-computed 2/pi:\n");
  mpfr_const_pi(pi, MPFR_RNDN);
  mpfr_set_si(t, 2, MPFR_RNDN);
  mpfr_div(pi, t, pi, MPFR_RNDN);
  d = mpfr_get_d(pi, MPFR_RNDN);
  u = (*((uint64_t *)((char *)&d)));
  printf("%#018lx\n", u);
  printf("\n");
  printf("Pre-computed 1/(pi/1024):\n");
  mpfr_const_pi(pi, MPFR_RNDN);
  mpfr_set_si(t, 1024, MPFR_RNDN);
  mpfr_div(pi, t, pi, MPFR_RNDN);
  d = mpfr_get_d(pi, MPFR_RNDN);
  u = (*((uint64_t *)((char *)&d)));
  printf("%#018lx\n", u);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x2710,%esi
call   10d0 <mpfr_init2@plt>
mov    -0xc(%rbp),%edi
mov    $0x2710,%esi
call   10d0 <mpfr_init2@plt>
mov    -0x10(%rbp),%edi
mov    $0x2710,%esi
call   10d0 <mpfr_init2@plt>
mov    -0x14(%rbp),%edi
mov    $0x2710,%esi
call   10d0 <mpfr_init2@plt>
mov    -0x18(%rbp),%edi
mov    $0x2710,%esi
call   10d0 <mpfr_init2@plt>
mov    -0x8(%rbp),%edi
mov    0x2daf(%rip),%rax
mov    (%rax),%esi
call   1040 <mpfr_const_pi@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x2d9b(%rip),%rax
mov    (%rax),%ecx
mov    $0x2,%edx
call   10c0 <mpfr_mul_si@plt>
movq   $0x19,-0x30(%rbp)
cmpq   $0x3ff,-0x30(%rbp)
jg     13bb <main+0x1eb>
mov    -0x10(%rbp),%edi
mov    -0x30(%rbp),%rax
mov    %eax,%esi
mov    0x2d69(%rip),%rax
mov    (%rax),%edx
call   10b0 <mpfr_set_si@plt>
mov    -0x10(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    0x2d55(%rip),%rax
mov    (%rax),%edx
call   10f0 <mpfr_exp2@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    0x2d3e(%rip),%rax
mov    (%rax),%ecx
call   10e0 <mpfr_fmod@plt>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    0x2d2a(%rip),%rax
mov    (%rax),%edx
call   1080 <mpfr_set@plt>
mov    -0x10(%rbp),%edi
mov    0x2d19(%rip),%rax
mov    (%rax),%esi
call   1050 <mpfr_get_d@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xd15(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%edi
movsd  -0x20(%rbp),%xmm0
mov    0x2ce7(%rip),%rax
mov    (%rax),%esi
call   1060 <mpfr_set_d@plt>
mov    -0x10(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    0x2cd0(%rip),%rax
mov    (%rax),%ecx
call   1030 <mpfr_sub@plt>
mov    -0x10(%rbp),%edi
mov    0x2cbf(%rip),%rax
mov    (%rax),%esi
call   1050 <mpfr_get_d@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xcbc(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%edi
movsd  -0x20(%rbp),%xmm0
mov    0x2c8d(%rip),%rax
mov    (%rax),%esi
call   1060 <mpfr_set_d@plt>
mov    -0x10(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    0x2c76(%rip),%rax
mov    (%rax),%ecx
call   1030 <mpfr_sub@plt>
mov    -0x10(%rbp),%edi
mov    0x2c65(%rip),%rax
mov    (%rax),%esi
call   1050 <mpfr_get_d@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
mov    -0x30(%rbp),%rdx
lea    0xc68(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x30(%rbp),%rax
add    $0x32,%rax
mov    %rax,-0x30(%rbp)
jmp    1261 <main+0x91>
lea    0xc66(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xc5a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2c07(%rip),%rax
mov    (%rax),%esi
call   1040 <mpfr_const_pi@plt>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x2bf3(%rip),%rax
mov    (%rax),%ecx
mov    $0x2,%edx
call   10a0 <mpfr_div_si@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x3e8,-0x34(%rbp)
jge    147d <main+0x2ad>
mov    -0x8(%rbp),%edi
mov    0x2bc9(%rip),%rax
mov    (%rax),%esi
call   1050 <mpfr_get_d@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xc03(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%edi
movsd  -0x20(%rbp),%xmm0
mov    0x2b97(%rip),%rax
mov    (%rax),%esi
call   1060 <mpfr_set_d@plt>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    0x2b80(%rip),%rax
mov    (%rax),%ecx
call   1030 <mpfr_sub@plt>
mov    -0x34(%rbp),%eax
add    $0x35,%eax
mov    %eax,-0x34(%rbp)
jmp    1408 <main+0x238>
lea    0xba4(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xbb5(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2b45(%rip),%rax
mov    (%rax),%esi
call   1040 <mpfr_const_pi@plt>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x2b31(%rip),%rax
mov    (%rax),%ecx
mov    $0x4,%edx
call   10a0 <mpfr_div_si@plt>
movl   $0x0,-0x38(%rbp)
cmpl   $0x3e8,-0x38(%rbp)
jge    153f <main+0x36f>
mov    -0x8(%rbp),%edi
mov    0x2b07(%rip),%rax
mov    (%rax),%esi
call   1050 <mpfr_get_d@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xb41(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%edi
movsd  -0x20(%rbp),%xmm0
mov    0x2ad5(%rip),%rax
mov    (%rax),%esi
call   1060 <mpfr_set_d@plt>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    0x2abe(%rip),%rax
mov    (%rax),%ecx
call   1030 <mpfr_sub@plt>
mov    -0x38(%rbp),%eax
add    $0x35,%eax
mov    %eax,-0x38(%rbp)
jmp    14ca <main+0x2fa>
lea    0xae2(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xb07(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2a83(%rip),%rax
mov    (%rax),%esi
call   1040 <mpfr_const_pi@plt>
mov    -0x10(%rbp),%edi
mov    0x2a72(%rip),%rax
mov    (%rax),%edx
mov    $0x2,%esi
call   10b0 <mpfr_set_si@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    0x2a56(%rip),%rax
mov    (%rax),%ecx
call   1090 <mpfr_div@plt>
mov    -0x8(%rbp),%edi
mov    0x2a45(%rip),%rax
mov    (%rax),%esi
call   1050 <mpfr_get_d@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xa7f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xa5b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xa94(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x29fc(%rip),%rax
mov    (%rax),%esi
call   1040 <mpfr_const_pi@plt>
mov    -0x10(%rbp),%edi
mov    0x29eb(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   10b0 <mpfr_set_si@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    0x29cf(%rip),%rax
mov    (%rax),%ecx
call   1090 <mpfr_div@plt>
mov    -0x8(%rbp),%edi
mov    0x29be(%rip),%rax
mov    (%rax),%esi
call   1050 <mpfr_get_d@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0x9f8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x2710,%esi
call   10f0 <mpfr_init2@plt>
mov    $0x2710,%esi
call   10f0 <mpfr_init2@plt>
mov    $0x2710,%esi
call   10f0 <mpfr_init2@plt>
mov    $0x2710,%esi
call   10f0 <mpfr_init2@plt>
mov    $0x2710,%esi
call   10f0 <mpfr_init2@plt>
mov    0x2db4(%rip),%r13
mov    0x0(%r13),%esi
call   1050 <mpfr_const_pi@plt>
mov    0x0(%r13),%ecx
mov    $0x2,%edx
call   10e0 <mpfr_mul_si@plt>
mov    $0x19,%ebx
lea    0xda9(%rip),%r14
lea    0xda3(%rip),%r15
lea    0xda6(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x0(%r13),%edx
mov    %ebx,%esi
call   10d0 <mpfr_set_si@plt>
mov    0x0(%r13),%edx
call   1110 <mpfr_exp2@plt>
mov    0x0(%r13),%ecx
call   1100 <mpfr_fmod@plt>
mov    0x0(%r13),%edx
call   10a0 <mpfr_set@plt>
mov    0x0(%r13),%esi
call   1070 <mpfr_get_d@plt>
movq   %xmm0,(%rsp)
movq   %xmm0,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x0(%r13),%esi
movq   (%rsp),%xmm0
call   1080 <mpfr_set_d@plt>
mov    0x0(%r13),%ecx
call   1040 <mpfr_sub@plt>
mov    0x0(%r13),%esi
call   1070 <mpfr_get_d@plt>
movq   %xmm0,(%rsp)
movq   %xmm0,%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x0(%r13),%esi
movq   (%rsp),%xmm0
call   1080 <mpfr_set_d@plt>
mov    0x0(%r13),%ecx
call   1040 <mpfr_sub@plt>
mov    0x0(%r13),%esi
call   1070 <mpfr_get_d@plt>
movq   %xmm0,%rsi
mov    %r12,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1090 <printf@plt>
lea    0x32(%rbx),%rax
cmp    $0x3ce,%rbx
mov    %rax,%rbx
jb     1270 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xcf5(%rip),%rdi
call   1060 <puts@plt>
mov    0x0(%r13),%esi
call   1050 <mpfr_const_pi@plt>
mov    0x0(%r13),%ecx
mov    $0x2,%edx
call   10c0 <mpfr_div_si@plt>
mov    $0xffffffcb,%ebp
lea    0xcc4(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    0x0(%r13),%esi
call   1070 <mpfr_get_d@plt>
movq   %xmm0,(%rsp)
movq   %xmm0,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x0(%r13),%esi
movq   (%rsp),%xmm0
call   1080 <mpfr_set_d@plt>
mov    0x0(%r13),%ecx
call   1040 <mpfr_sub@plt>
add    $0x35,%ebp
cmp    $0x3b3,%ebp
jb     1370 <main+0x180>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc86(%rip),%rdi
call   1060 <puts@plt>
mov    0x0(%r13),%esi
call   1050 <mpfr_const_pi@plt>
mov    0x0(%r13),%ecx
mov    $0x4,%edx
call   10c0 <mpfr_div_si@plt>
mov    $0xffffffcb,%ebp
lea    0xc42(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13),%esi
call   1070 <mpfr_get_d@plt>
movq   %xmm0,(%rsp)
movq   %xmm0,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x0(%r13),%esi
movq   (%rsp),%xmm0
call   1080 <mpfr_set_d@plt>
mov    0x0(%r13),%ecx
call   1040 <mpfr_sub@plt>
add    $0x35,%ebp
cmp    $0x3b3,%ebp
jb     13f0 <main+0x200>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc19(%rip),%rdi
call   1060 <puts@plt>
mov    0x0(%r13),%esi
call   1050 <mpfr_const_pi@plt>
mov    0x0(%r13),%edx
mov    $0x2,%esi
call   10d0 <mpfr_set_si@plt>
mov    0x0(%r13),%ecx
call   10b0 <mpfr_div@plt>
mov    0x0(%r13),%esi
call   1070 <mpfr_get_d@plt>
movq   %xmm0,%rsi
lea    0xbb0(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xbd7(%rip),%rdi
call   1060 <puts@plt>
mov    0x0(%r13),%esi
call   1050 <mpfr_const_pi@plt>
mov    0x0(%r13),%edx
mov    $0x400,%esi
call   10d0 <mpfr_set_si@plt>
mov    0x0(%r13),%ecx
call   10b0 <mpfr_div@plt>
mov    0x0(%r13),%esi
call   1070 <mpfr_get_d@plt>
movq   %xmm0,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1090 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@MPFR_RNDN = global i32 0
@.str = [11 x i8] c"(%lx, \00"
@.str.1 = [10 x i8] c"%lx, \00"
@.str.2 = [31 x i8] c"%lx), /* 2^%ld mod 2pi */\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [20 x i8] c"1000 bits of pi/2:\0A\00"
@.str.5 = [9 x i8] c"%lx\0A\00"
@.str.6 = [20 x i8] c"1000 bits of pi/4:\0A\00"
@.str.7 = [20 x i8] c"Pre-computed 2/pi:\0A\00"
@.str.8 = [27 x i8] c"Pre-computed 1/(pi/1024):\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca i32
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
store double 0.000000e+00, double* %7
store i32 0, i32* %8
%12 = load i32, i32* %2
%13 = call i32 @mpfr_init2(i32 %12, i32 10000)
%14 = load i32, i32* %3
%15 = call i32 @mpfr_init2(i32 %14, i32 10000)
%16 = load i32, i32* %4
%17 = call i32 @mpfr_init2(i32 %16, i32 10000)
%18 = load i32, i32* %5
%19 = call i32 @mpfr_init2(i32 %18, i32 10000)
%20 = load i32, i32* %6
%21 = call i32 @mpfr_init2(i32 %20, i32 10000)
%22 = load i32, i32* %2
%23 = load i32, i32* @MPFR_RNDN
%24 = call i32 @mpfr_const_pi(i32 %22, i32 %23)
%25 = load i32, i32* %3
%26 = load i32, i32* %2
%27 = load i32, i32* @MPFR_RNDN
%28 = call i32 @mpfr_mul_si(i32 %25, i32 %26, i32 2, i32 %27)
store i64 25, i64* %9
br label %29
29: ; preds = %94, %0
%30 = load i64, i64* %9
%31 = icmp sle i64 %30, 1023
br i1 %31, label %32, label %97
32: ; preds = %29
%33 = load i32, i32* %4
%34 = load i64, i64* %9
%35 = trunc i64 %34 to i32
%36 = load i32, i32* @MPFR_RNDN
%37 = call i32 @mpfr_set_si(i32 %33, i32 %35, i32 %36)
%38 = load i32, i32* %4
%39 = load i32, i32* %4
%40 = load i32, i32* @MPFR_RNDN
%41 = call i32 @mpfr_exp2(i32 %38, i32 %39, i32 %40)
%42 = load i32, i32* %5
%43 = load i32, i32* %4
%44 = load i32, i32* %3
%45 = load i32, i32* @MPFR_RNDN
%46 = call i32 @mpfr_fmod(i32 %42, i32 %43, i32 %44, i32 %45)
%47 = load i32, i32* %4
%48 = load i32, i32* %5
%49 = load i32, i32* @MPFR_RNDN
%50 = call i32 @mpfr_set(i32 %47, i32 %48, i32 %49)
%51 = load i32, i32* %4
%52 = load i32, i32* @MPFR_RNDN
%53 = call double @mpfr_get_d(i32 %51, i32 %52)
store double %53, double* %7
%54 = bitcast double* %7 to i8*
%55 = bitcast i8* %54 to i32*
%56 = load i32, i32* %55
store i32 %56, i32* %8
%57 = load i32, i32* %8
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %57)
%59 = load i32, i32* %5
%60 = load double, double* %7
%61 = load i32, i32* @MPFR_RNDN
%62 = call i32 @mpfr_set_d(i32 %59, double %60, i32 %61)
%63 = load i32, i32* %4
%64 = load i32, i32* %4
%65 = load i32, i32* %5
%66 = load i32, i32* @MPFR_RNDN
%67 = call i32 @mpfr_sub(i32 %63, i32 %64, i32 %65, i32 %66)
%68 = load i32, i32* %4
%69 = load i32, i32* @MPFR_RNDN
%70 = call double @mpfr_get_d(i32 %68, i32 %69)
store double %70, double* %7
%71 = bitcast double* %7 to i8*
%72 = bitcast i8* %71 to i32*
%73 = load i32, i32* %72
store i32 %73, i32* %8
%74 = load i32, i32* %8
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %74)
%76 = load i32, i32* %5
%77 = load double, double* %7
%78 = load i32, i32* @MPFR_RNDN
%79 = call i32 @mpfr_set_d(i32 %76, double %77, i32 %78)
%80 = load i32, i32* %4
%81 = load i32, i32* %4
%82 = load i32, i32* %5
%83 = load i32, i32* @MPFR_RNDN
%84 = call i32 @mpfr_sub(i32 %80, i32 %81, i32 %82, i32 %83)
%85 = load i32, i32* %4
%86 = load i32, i32* @MPFR_RNDN
%87 = call double @mpfr_get_d(i32 %85, i32 %86)
store double %87, double* %7
%88 = bitcast double* %7 to i8*
%89 = bitcast i8* %88 to i32*
%90 = load i32, i32* %89
store i32 %90, i32* %8
%91 = load i32, i32* %8
%92 = load i64, i64* %9
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %91, i64 %92)
br label %94
94: ; preds = %32
%95 = load i64, i64* %9
%96 = add nsw i64 %95, 50
store i64 %96, i64* %9
br label %29
97: ; preds = %29
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%100 = load i32, i32* %2
%101 = load i32, i32* @MPFR_RNDN
%102 = call i32 @mpfr_const_pi(i32 %100, i32 %101)
%103 = load i32, i32* %2
%104 = load i32, i32* %2
%105 = load i32, i32* @MPFR_RNDN
%106 = call i32 @mpfr_div_si(i32 %103, i32 %104, i32 2, i32 %105)
store i32 0, i32* %10
br label %107
107: ; preds = %128, %97
%108 = load i32, i32* %10
%109 = icmp slt i32 %108, 1000
br i1 %109, label %110, label %131
110: ; preds = %107
%111 = load i32, i32* %2
%112 = load i32, i32* @MPFR_RNDN
%113 = call double @mpfr_get_d(i32 %111, i32 %112)
store double %113, double* %7
%114 = bitcast double* %7 to i8*
%115 = bitcast i8* %114 to i32*
%116 = load i32, i32* %115
store i32 %116, i32* %8
%117 = load i32, i32* %8
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %117)
%119 = load i32, i32* %4
%120 = load double, double* %7
%121 = load i32, i32* @MPFR_RNDN
%122 = call i32 @mpfr_set_d(i32 %119, double %120, i32 %121)
%123 = load i32, i32* %2
%124 = load i32, i32* %2
%125 = load i32, i32* %4
%126 = load i32, i32* @MPFR_RNDN
%127 = call i32 @mpfr_sub(i32 %123, i32 %124, i32 %125, i32 %126)
br label %128
128: ; preds = %110
%129 = load i32, i32* %10
%130 = add nsw i32 %129, 53
store i32 %130, i32* %10
br label %107
131: ; preds = %107
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%134 = load i32, i32* %2
%135 = load i32, i32* @MPFR_RNDN
%136 = call i32 @mpfr_const_pi(i32 %134, i32 %135)
%137 = load i32, i32* %2
%138 = load i32, i32* %2
%139 = load i32, i32* @MPFR_RNDN
%140 = call i32 @mpfr_div_si(i32 %137, i32 %138, i32 4, i32 %139)
store i32 0, i32* %11
br label %141
141: ; preds = %162, %131
%142 = load i32, i32* %11
%143 = icmp slt i32 %142, 1000
br i1 %143, label %144, label %165
144: ; preds = %141
%145 = load i32, i32* %2
%146 = load i32, i32* @MPFR_RNDN
%147 = call double @mpfr_get_d(i32 %145, i32 %146)
store double %147, double* %7
%148 = bitcast double* %7 to i8*
%149 = bitcast i8* %148 to i32*
%150 = load i32, i32* %149
store i32 %150, i32* %8
%151 = load i32, i32* %8
%152 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %151)
%153 = load i32, i32* %4
%154 = load double, double* %7
%155 = load i32, i32* @MPFR_RNDN
%156 = call i32 @mpfr_set_d(i32 %153, double %154, i32 %155)
%157 = load i32, i32* %2
%158 = load i32, i32* %2
%159 = load i32, i32* %4
%160 = load i32, i32* @MPFR_RNDN
%161 = call i32 @mpfr_sub(i32 %157, i32 %158, i32 %159, i32 %160)
br label %162
162: ; preds = %144
%163 = load i32, i32* %11
%164 = add nsw i32 %163, 53
store i32 %164, i32* %11
br label %141
165: ; preds = %141
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
%168 = load i32, i32* %2
%169 = load i32, i32* @MPFR_RNDN
%170 = call i32 @mpfr_const_pi(i32 %168, i32 %169)
%171 = load i32, i32* %4
%172 = load i32, i32* @MPFR_RNDN
%173 = call i32 @mpfr_set_si(i32 %171, i32 2, i32 %172)
%174 = load i32, i32* %2
%175 = load i32, i32* %4
%176 = load i32, i32* %2
%177 = load i32, i32* @MPFR_RNDN
%178 = call i32 @mpfr_div(i32 %174, i32 %175, i32 %176, i32 %177)
%179 = load i32, i32* %2
%180 = load i32, i32* @MPFR_RNDN
%181 = call double @mpfr_get_d(i32 %179, i32 %180)
store double %181, double* %7
%182 = bitcast double* %7 to i8*
%183 = bitcast i8* %182 to i32*
%184 = load i32, i32* %183
store i32 %184, i32* %8
%185 = load i32, i32* %8
%186 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %185)
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%188 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
%189 = load i32, i32* %2
%190 = load i32, i32* @MPFR_RNDN
%191 = call i32 @mpfr_const_pi(i32 %189, i32 %190)
%192 = load i32, i32* %4
%193 = load i32, i32* @MPFR_RNDN
%194 = call i32 @mpfr_set_si(i32 %192, i32 1024, i32 %193)
%195 = load i32, i32* %2
%196 = load i32, i32* %4
%197 = load i32, i32* %2
%198 = load i32, i32* @MPFR_RNDN
%199 = call i32 @mpfr_div(i32 %195, i32 %196, i32 %197, i32 %198)
%200 = load i32, i32* %2
%201 = load i32, i32* @MPFR_RNDN
%202 = call double @mpfr_get_d(i32 %200, i32 %201)
store double %202, double* %7
%203 = bitcast double* %7 to i8*
%204 = bitcast i8* %203 to i32*
%205 = load i32, i32* %204
store i32 %205, i32* %8
%206 = load i32, i32* %8
%207 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %206)
ret i32 0
}

LLVM IR (-O2):
@MPFR_RNDN = global i32 0
@.str = [11 x i8] c"(%lx, \00"
@.str.1 = [10 x i8] c"%lx, \00"
@.str.2 = [31 x i8] c"%lx), /* 2^%ld mod 2pi */\0A\00"
@.str.5 = [9 x i8] c"%lx\0A\00"
@str = [19 x i8] c"1000 bits of pi/2:\00"
@str.9 = [19 x i8] c"1000 bits of pi/4:\00"
@str.10 = [19 x i8] c"Pre-computed 2/pi:\00"
@str.11 = [26 x i8] c"Pre-computed 1/(pi/1024):\00"
define i32 @main() {
%1 = tail call i32 @mpfr_init2(i32 undef, i32 10000)
%2 = tail call i32 @mpfr_init2(i32 undef, i32 10000)
%3 = tail call i32 @mpfr_init2(i32 undef, i32 10000)
%4 = tail call i32 @mpfr_init2(i32 undef, i32 10000)
%5 = tail call i32 @mpfr_init2(i32 undef, i32 10000)
%6 = load i32, i32* @MPFR_RNDN
%7 = tail call i32 @mpfr_const_pi(i32 undef, i32 %6)
%8 = load i32, i32* @MPFR_RNDN
%9 = tail call i32 @mpfr_mul_si(i32 undef, i32 undef, i32 2, i32 %8)
br label %17
10: ; preds = %17
%11 = tail call i32 @putchar(i32 10)
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%13 = load i32, i32* @MPFR_RNDN
%14 = tail call i32 @mpfr_const_pi(i32 undef, i32 %13)
%15 = load i32, i32* @MPFR_RNDN
%16 = tail call i32 @mpfr_div_si(i32 undef, i32 undef, i32 2, i32 %15)
br label %60
17: ; preds = %0, %17
%18 = phi i64 [ 25, %0 ], [ %51, %17 ]
%19 = trunc i64 %18 to i32
%20 = load i32, i32* @MPFR_RNDN
%21 = tail call i32 @mpfr_set_si(i32 undef, i32 %19, i32 %20)
%22 = load i32, i32* @MPFR_RNDN
%23 = tail call i32 @mpfr_exp2(i32 undef, i32 undef, i32 %22)
%24 = load i32, i32* @MPFR_RNDN
%25 = tail call i32 @mpfr_fmod(i32 undef, i32 undef, i32 undef, i32 %24)
%26 = load i32, i32* @MPFR_RNDN
%27 = tail call i32 @mpfr_set(i32 undef, i32 undef, i32 %26)
%28 = load i32, i32* @MPFR_RNDN
%29 = tail call double @mpfr_get_d(i32 undef, i32 %28)
%30 = bitcast double %29 to i64
%31 = trunc i64 %30 to i32
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = load i32, i32* @MPFR_RNDN
%34 = tail call i32 @mpfr_set_d(i32 undef, double %29, i32 %33)
%35 = load i32, i32* @MPFR_RNDN
%36 = tail call i32 @mpfr_sub(i32 undef, i32 undef, i32 undef, i32 %35)
%37 = load i32, i32* @MPFR_RNDN
%38 = tail call double @mpfr_get_d(i32 undef, i32 %37)
%39 = bitcast double %38 to i64
%40 = trunc i64 %39 to i32
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = load i32, i32* @MPFR_RNDN
%43 = tail call i32 @mpfr_set_d(i32 undef, double %38, i32 %42)
%44 = load i32, i32* @MPFR_RNDN
%45 = tail call i32 @mpfr_sub(i32 undef, i32 undef, i32 undef, i32 %44)
%46 = load i32, i32* @MPFR_RNDN
%47 = tail call double @mpfr_get_d(i32 undef, i32 %46)
%48 = bitcast double %47 to i64
%49 = trunc i64 %48 to i32
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %49, i64 %18)
%51 = add nuw nsw i64 %18, 50
%52 = icmp ult i64 %18, 974
br i1 %52, label %17, label %10
53: ; preds = %60
%54 = tail call i32 @putchar(i32 10)
%55 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.9, i64 0, i64 0))
%56 = load i32, i32* @MPFR_RNDN
%57 = tail call i32 @mpfr_const_pi(i32 undef, i32 %56)
%58 = load i32, i32* @MPFR_RNDN
%59 = tail call i32 @mpfr_div_si(i32 undef, i32 undef, i32 4, i32 %58)
br label %100
60: ; preds = %10, %60
%61 = phi i32 [ 0, %10 ], [ %71, %60 ]
%62 = load i32, i32* @MPFR_RNDN
%63 = tail call double @mpfr_get_d(i32 undef, i32 %62)
%64 = bitcast double %63 to i64
%65 = trunc i64 %64 to i32
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %65)
%67 = load i32, i32* @MPFR_RNDN
%68 = tail call i32 @mpfr_set_d(i32 undef, double %63, i32 %67)
%69 = load i32, i32* @MPFR_RNDN
%70 = tail call i32 @mpfr_sub(i32 undef, i32 undef, i32 undef, i32 %69)
%71 = add nuw nsw i32 %61, 53
%72 = icmp ult i32 %61, 947
br i1 %72, label %60, label %53
73: ; preds = %100
%74 = tail call i32 @putchar(i32 10)
%75 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.10, i64 0, i64 0))
%76 = load i32, i32* @MPFR_RNDN
%77 = tail call i32 @mpfr_const_pi(i32 undef, i32 %76)
%78 = load i32, i32* @MPFR_RNDN
%79 = tail call i32 @mpfr_set_si(i32 undef, i32 2, i32 %78)
%80 = load i32, i32* @MPFR_RNDN
%81 = tail call i32 @mpfr_div(i32 undef, i32 undef, i32 undef, i32 %80)
%82 = load i32, i32* @MPFR_RNDN
%83 = tail call double @mpfr_get_d(i32 undef, i32 %82)
%84 = bitcast double %83 to i64
%85 = trunc i64 %84 to i32
%86 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %85)
%87 = tail call i32 @putchar(i32 10)
%88 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.11, i64 0, i64 0))
%89 = load i32, i32* @MPFR_RNDN
%90 = tail call i32 @mpfr_const_pi(i32 undef, i32 %89)
%91 = load i32, i32* @MPFR_RNDN
%92 = tail call i32 @mpfr_set_si(i32 undef, i32 1024, i32 %91)
%93 = load i32, i32* @MPFR_RNDN
%94 = tail call i32 @mpfr_div(i32 undef, i32 undef, i32 undef, i32 %93)
%95 = load i32, i32* @MPFR_RNDN
%96 = tail call double @mpfr_get_d(i32 undef, i32 %95)
%97 = bitcast double %96 to i64
%98 = trunc i64 %97 to i32
%99 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %98)
ret i32 0
100: ; preds = %53, %100
%101 = phi i32 [ 0, %53 ], [ %111, %100 ]
%102 = load i32, i32* @MPFR_RNDN
%103 = tail call double @mpfr_get_d(i32 undef, i32 %102)
%104 = bitcast double %103 to i64
%105 = trunc i64 %104 to i32
%106 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %105)
%107 = load i32, i32* @MPFR_RNDN
%108 = tail call i32 @mpfr_set_d(i32 undef, double %103, i32 %107)
%109 = load i32, i32* @MPFR_RNDN
%110 = tail call i32 @mpfr_sub(i32 undef, i32 undef, i32 undef, i32 %109)
%111 = add nuw nsw i32 %101, 53
%112 = icmp ult i32 %101, 947
br i1 %112, label %100, label %73
}