#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_RNDD;
int /*<<< orphan*/ MPFR_RNDU;
int /*<<< orphan*/ mpfr_add(int /*<<< orphan*/, int /*<<< orphan*/,
                            int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_div(int /*<<< orphan*/, int /*<<< orphan*/,
                            int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_init2(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpfr_mul_ui(int /*<<< orphan*/, int /*<<< orphan*/,
                               unsigned int, int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_out_str(int /*<<< orphan*/, int, int /*<<< orphan*/,
                                int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_set_d(int /*<<< orphan*/, double, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stdout;
int main(void) {
  unsigned int i;
  mpfr_t s, t, u;
  mpfr_init2(t, 200);
  mpfr_set_d(t, 1.0, MPFR_RNDD);
  mpfr_init2(s, 200);
  mpfr_set_d(s, 1.0, MPFR_RNDD);
  mpfr_init2(u, 200);
  for (i = 1; i <= 100; i++) {
    mpfr_mul_ui(t, t, i, MPFR_RNDU);
    mpfr_set_d(u, 1.0, MPFR_RNDD);
    mpfr_div(u, u, t, MPFR_RNDD);
    mpfr_add(s, s, u, MPFR_RNDD);
  }
  printf("Sum is ");
  mpfr_out_str(stdout, 10, 0, s, MPFR_RNDD);
  putchar('\n');
  mpfr_clear(s);
  mpfr_clear(t);
  mpfr_clear(u);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%edi
mov    $0xc8,%esi
call   10b0 <mpfr_init2@plt>
mov    -0x10(%rbp),%edi
mov    0x2e32(%rip),%rax
mov    (%rax),%esi
movsd  0xe40(%rip),%xmm0
call   1050 <mpfr_set_d@plt>
mov    -0xc(%rbp),%edi
mov    $0xc8,%esi
call   10b0 <mpfr_init2@plt>
mov    -0xc(%rbp),%edi
mov    0x2e0c(%rip),%rax
mov    (%rax),%esi
movsd  0xe1a(%rip),%xmm0
call   1050 <mpfr_set_d@plt>
mov    -0x14(%rbp),%edi
mov    $0xc8,%esi
call   10b0 <mpfr_init2@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
ja     1275 <main+0xe5>
mov    -0x10(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    0x2dbf(%rip),%rax
mov    (%rax),%ecx
call   1030 <mpfr_mul_ui@plt>
mov    -0x14(%rbp),%edi
mov    0x2dbe(%rip),%rax
mov    (%rax),%esi
movsd  0xdcc(%rip),%xmm0
call   1050 <mpfr_set_d@plt>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    0x2d9f(%rip),%rax
mov    (%rax),%ecx
call   10a0 <mpfr_div@plt>
mov    -0xc(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    0x2d88(%rip),%rax
mov    (%rax),%ecx
call   1090 <mpfr_add@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ff <main+0x6f>
lea    0xd8c(%rip),%rdi
call   1060 <printf@plt>
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%ecx
mov    0x2d54(%rip),%rax
mov    (%rax),%r8d
mov    $0xa,%esi
xor    %edx,%edx
call   1080 <mpfr_out_str@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    -0xc(%rbp),%edi
call   1070 <mpfr_clear@plt>
mov    -0x10(%rbp),%edi
call   1070 <mpfr_clear@plt>
mov    -0x14(%rbp),%edi
call   1070 <mpfr_clear@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0xc8,%esi
call   10b0 <mpfr_init2@plt>
mov    0x2e42(%rip),%r14
mov    (%r14),%esi
movsd  0xe4f(%rip),%xmm0
call   1050 <mpfr_set_d@plt>
mov    $0xc8,%esi
call   10b0 <mpfr_init2@plt>
mov    (%r14),%esi
movsd  0xe35(%rip),%xmm0
call   1050 <mpfr_set_d@plt>
mov    $0xc8,%esi
call   10b0 <mpfr_init2@plt>
mov    $0x1,%ebx
mov    0x2df2(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    (%r15),%ecx
mov    %ebx,%edx
call   1030 <mpfr_mul_ui@plt>
mov    (%r14),%esi
movsd  0xdfb(%rip),%xmm0
call   1050 <mpfr_set_d@plt>
mov    (%r14),%ecx
call   10a0 <mpfr_div@plt>
mov    (%r14),%ecx
call   1090 <mpfr_add@plt>
add    $0x1,%ebx
cmp    $0x65,%ebx
jne    11f0 <main+0x60>
lea    0xddf(%rip),%rdi
call   1060 <printf@plt>
mov    0x2d9b(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%r8d
mov    $0xa,%esi
xor    %edx,%edx
call   1080 <mpfr_out_str@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
call   1070 <mpfr_clear@plt>
call   1070 <mpfr_clear@plt>
call   1070 <mpfr_clear@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@MPFR_RNDD = global i32 0
@MPFR_RNDU = global i32 0
@.str = [8 x i8] c"Sum is \00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = load i32, i32* %4
%7 = call i32 @mpfr_init2(i32 %6, i32 200)
%8 = load i32, i32* %4
%9 = load i32, i32* @MPFR_RNDD
%10 = call i32 @mpfr_set_d(i32 %8, double 1.000000e+00, i32 %9)
%11 = load i32, i32* %3
%12 = call i32 @mpfr_init2(i32 %11, i32 200)
%13 = load i32, i32* %3
%14 = load i32, i32* @MPFR_RNDD
%15 = call i32 @mpfr_set_d(i32 %13, double 1.000000e+00, i32 %14)
%16 = load i32, i32* %5
%17 = call i32 @mpfr_init2(i32 %16, i32 200)
store i32 1, i32* %2
br label %18
18: ; preds = %40, %0
%19 = load i32, i32* %2
%20 = icmp ule i32 %19, 100
br i1 %20, label %21, label %43
21: ; preds = %18
%22 = load i32, i32* %4
%23 = load i32, i32* %4
%24 = load i32, i32* %2
%25 = load i32, i32* @MPFR_RNDU
%26 = call i32 @mpfr_mul_ui(i32 %22, i32 %23, i32 %24, i32 %25)
%27 = load i32, i32* %5
%28 = load i32, i32* @MPFR_RNDD
%29 = call i32 @mpfr_set_d(i32 %27, double 1.000000e+00, i32 %28)
%30 = load i32, i32* %5
%31 = load i32, i32* %5
%32 = load i32, i32* %4
%33 = load i32, i32* @MPFR_RNDD
%34 = call i32 @mpfr_div(i32 %30, i32 %31, i32 %32, i32 %33)
%35 = load i32, i32* %3
%36 = load i32, i32* %3
%37 = load i32, i32* %5
%38 = load i32, i32* @MPFR_RNDD
%39 = call i32 @mpfr_add(i32 %35, i32 %36, i32 %37, i32 %38)
br label %40
40: ; preds = %21
%41 = load i32, i32* %2
%42 = add i32 %41, 1
store i32 %42, i32* %2
br label %18
43: ; preds = %18
%44 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%45 = load i32, i32* @stdout
%46 = load i32, i32* %3
%47 = load i32, i32* @MPFR_RNDD
%48 = call i32 @mpfr_out_str(i32 %45, i32 10, i32 0, i32 %46, i32 %47)
%49 = call i32 @putchar(i8 signext 10)
%50 = load i32, i32* %3
%51 = call i32 @mpfr_clear(i32 %50)
%52 = load i32, i32* %4
%53 = call i32 @mpfr_clear(i32 %52)
%54 = load i32, i32* %5
%55 = call i32 @mpfr_clear(i32 %54)
ret i32 0
}

LLVM IR (-O2):
@MPFR_RNDD = global i32 0
@MPFR_RNDU = global i32 0
@.str = [8 x i8] c"Sum is \00"
@stdout = global i32 0
define i32 @main() {
%1 = tail call i32 @mpfr_init2(i32 undef, i32 200)
%2 = load i32, i32* @MPFR_RNDD
%3 = tail call i32 @mpfr_set_d(i32 undef, double 1.000000e+00, i32 %2)
%4 = tail call i32 @mpfr_init2(i32 undef, i32 200)
%5 = load i32, i32* @MPFR_RNDD
%6 = tail call i32 @mpfr_set_d(i32 undef, double 1.000000e+00, i32 %5)
%7 = tail call i32 @mpfr_init2(i32 undef, i32 200)
br label %8
8: ; preds = %0, %8
%9 = phi i32 [ 1, %0 ], [ %18, %8 ]
%10 = load i32, i32* @MPFR_RNDU
%11 = tail call i32 @mpfr_mul_ui(i32 undef, i32 undef, i32 %9, i32 %10)
%12 = load i32, i32* @MPFR_RNDD
%13 = tail call i32 @mpfr_set_d(i32 undef, double 1.000000e+00, i32 %12)
%14 = load i32, i32* @MPFR_RNDD
%15 = tail call i32 @mpfr_div(i32 undef, i32 undef, i32 undef, i32 %14)
%16 = load i32, i32* @MPFR_RNDD
%17 = tail call i32 @mpfr_add(i32 undef, i32 undef, i32 undef, i32 %16)
%18 = add nuw nsw i32 %9, 1
%19 = icmp eq i32 %18, 101
br i1 %19, label %20, label %8
20: ; preds = %8
%21 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%22 = load i32, i32* @stdout
%23 = load i32, i32* @MPFR_RNDD
%24 = tail call i32 @mpfr_out_str(i32 %22, i32 10, i32 0, i32 undef, i32 %23)
%25 = tail call i32 @putchar(i8 signext 10)
%26 = tail call i32 @mpfr_clear(i32 undef)
%27 = tail call i32 @mpfr_clear(i32 undef)
%28 = tail call i32 @mpfr_clear(i32 undef)
ret i32 0
}