#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;
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ mpfr_clears(int /*<<< orphan*/, int /*<<< orphan*/,
                               int /*<<< orphan*/ *);
char *mpfr_get_default_prec();
char *mpfr_get_prec(int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_inits(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/ *);
int mpfr_set(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int mpfr_set_d(int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_set_default_prec(int);
int /*<<< orphan*/ mpfr_set_inf(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpfr_set_nan(int /*<<< orphan*/);
int mpfr_set_si(int /*<<< orphan*/, int, int /*<<< orphan*/);
int mpfr_set_str(int /*<<< orphan*/, char *, int /*<<< orphan*/,
                 int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_set_zero(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
char *rounding_to_string(int);
int main() {
  mpfr_set_default_prec(12345);
  printf("default_precision: %ld\n", mpfr_get_default_prec());
  char *buffer;
  mpfr_t one, x;
  mpfr_inits(one, x, NULL);
  int r = mpfr_set_si(one, 1, MPFR_RNDN);
  buffer = rounding_to_string(r);
  printf("%s\n", buffer);
  free(buffer);
  r = mpfr_set(x, one, MPFR_RNDN);
  buffer = rounding_to_string(r);
  printf("%s\n", buffer);
  free(buffer);
  r = mpfr_set_d(x, 1., MPFR_RNDN);
  buffer = rounding_to_string(r);
  printf("%s\n", buffer);
  free(buffer);
  r = mpfr_set_str(x, "1", 0, MPFR_RNDN);
  buffer = rounding_to_string(r);
  printf("%s\n", buffer);
  free(buffer);
  mpfr_set_nan(x);
  printf("None\n");
  mpfr_set_inf(x, 1);
  printf("None\n");
  mpfr_set_zero(x, -1);
  printf("None\n");
  printf("%ld\n", mpfr_get_prec(x));
  mpfr_clears(one, x, NULL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3039,%edi
call   1100 <mpfr_set_default_prec@plt>
mov    $0x0,%al
call   10c0 <mpfr_get_default_prec@plt>
mov    %rax,%rsi
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edx
call   10f0 <mpfr_inits@plt>
mov    -0x14(%rbp),%edi
mov    0x2dae(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%esi
call   10e0 <mpfr_set_si@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1060 <rounding_to_string@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xdb8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    0x2d6b(%rip),%rax
mov    (%rax),%edx
call   10a0 <mpfr_set@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1060 <rounding_to_string@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%edi
mov    0x2d30(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%esi
call   1050 <mpfr_set_d@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1060 <rounding_to_string@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%edi
mov    0x2cf0(%rip),%rax
mov    (%rax),%ecx
lea    0xd1b(%rip),%rsi
xor    %edx,%edx
call   10d0 <mpfr_set_str@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1060 <rounding_to_string@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xcf6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%edi
call   1040 <mpfr_set_nan@plt>
lea    0xcdd(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%edi
mov    $0x1,%esi
call   10b0 <mpfr_set_inf@plt>
lea    0xcc2(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%edi
mov    $0xffffffff,%esi
call   1080 <mpfr_set_zero@plt>
lea    0xca7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%edi
call   1110 <mpfr_get_prec@plt>
mov    %rax,%rsi
lea    0xc83(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edx
call   1090 <mpfr_clears@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x3039,%edi
call   1110 <mpfr_set_default_prec@plt>
xor    %eax,%eax
call   10d0 <mpfr_get_default_prec@plt>
lea    0xde4(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %edx,%edx
call   1100 <mpfr_inits@plt>
mov    0x2db4(%rip),%r14
mov    (%r14),%edx
mov    $0x1,%esi
call   10f0 <mpfr_set_si@plt>
mov    %eax,%edi
call   1070 <rounding_to_string@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    (%r14),%edx
call   10b0 <mpfr_set@plt>
mov    %eax,%edi
call   1070 <rounding_to_string@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    (%r14),%edx
mov    $0x1,%esi
call   1060 <mpfr_set_d@plt>
mov    %eax,%edi
call   1070 <rounding_to_string@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    (%r14),%ecx
lea    0xd6a(%rip),%rsi
xor    %edx,%edx
call   10e0 <mpfr_set_str@plt>
mov    %eax,%edi
call   1070 <rounding_to_string@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
call   1040 <mpfr_set_nan@plt>
lea    0xd3f(%rip),%rbx
mov    %rbx,%rdi
call   1050 <puts@plt>
mov    $0x1,%esi
call   10c0 <mpfr_set_inf@plt>
mov    %rbx,%rdi
call   1050 <puts@plt>
mov    $0xffffffff,%esi
call   1090 <mpfr_set_zero@plt>
mov    %rbx,%rdi
call   1050 <puts@plt>
call   1120 <mpfr_get_prec@plt>
lea    0xd00(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %edx,%edx
call   10a0 <mpfr_clears@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [24 x i8] c"default_precision: %ld\0A\00"
@MPFR_RNDN = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [6 x i8] c"None\0A\00"
@.str.4 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @mpfr_set_default_prec(i32 12345)
%7 = call i8* (...) @mpfr_get_default_prec()
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @mpfr_inits(i32 %9, i32 %10, i32* null)
%12 = load i32, i32* %3
%13 = load i32, i32* @MPFR_RNDN
%14 = call i32 @mpfr_set_si(i32 %12, i32 1, i32 %13)
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = call i8* @rounding_to_string(i32 %15)
store i8* %16, i8** %2
%17 = load i8*, i8** %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i8*, i8** %2
%20 = call i32 @free(i8* %19)
%21 = load i32, i32* %4
%22 = load i32, i32* %3
%23 = load i32, i32* @MPFR_RNDN
%24 = call i32 @mpfr_set(i32 %21, i32 %22, i32 %23)
store i32 %24, i32* %5
%25 = load i32, i32* %5
%26 = call i8* @rounding_to_string(i32 %25)
store i8* %26, i8** %2
%27 = load i8*, i8** %2
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = load i8*, i8** %2
%30 = call i32 @free(i8* %29)
%31 = load i32, i32* %4
%32 = load i32, i32* @MPFR_RNDN
%33 = call i32 @mpfr_set_d(i32 %31, i32 1, i32 %32)
store i32 %33, i32* %5
%34 = load i32, i32* %5
%35 = call i8* @rounding_to_string(i32 %34)
store i8* %35, i8** %2
%36 = load i8*, i8** %2
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %36)
%38 = load i8*, i8** %2
%39 = call i32 @free(i8* %38)
%40 = load i32, i32* %4
%41 = load i32, i32* @MPFR_RNDN
%42 = call i32 @mpfr_set_str(i32 %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 %41)
store i32 %42, i32* %5
%43 = load i32, i32* %5
%44 = call i8* @rounding_to_string(i32 %43)
store i8* %44, i8** %2
%45 = load i8*, i8** %2
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %45)
%47 = load i8*, i8** %2
%48 = call i32 @free(i8* %47)
%49 = load i32, i32* %4
%50 = call i32 @mpfr_set_nan(i32 %49)
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%52 = load i32, i32* %4
%53 = call i32 @mpfr_set_inf(i32 %52, i32 1)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%55 = load i32, i32* %4
%56 = call i32 @mpfr_set_zero(i32 %55, i32 -1)
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%58 = load i32, i32* %4
%59 = call i8* @mpfr_get_prec(i32 %58)
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %59)
%61 = load i32, i32* %3
%62 = load i32, i32* %4
%63 = call i32 @mpfr_clears(i32 %61, i32 %62, i32* null)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"default_precision: %ld\0A\00"
@MPFR_RNDN = global i32 0
@.str.2 = [2 x i8] c"1\00"
@.str.4 = [5 x i8] c"%ld\0A\00"
@str.6 = [5 x i8] c"None\00"
define i32 @main() {
%1 = tail call i32 @mpfr_set_default_prec(i32 12345)
%2 = tail call i8* (...) @mpfr_get_default_prec()
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @mpfr_inits(i32 undef, i32 undef, i32* null)
%5 = load i32, i32* @MPFR_RNDN
%6 = tail call i32 @mpfr_set_si(i32 undef, i32 1, i32 %5)
%7 = tail call i8* @rounding_to_string(i32 %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
%9 = tail call i32 @free(i8* %7)
%10 = load i32, i32* @MPFR_RNDN
%11 = tail call i32 @mpfr_set(i32 undef, i32 undef, i32 %10)
%12 = tail call i8* @rounding_to_string(i32 %11)
%13 = tail call i32 @puts(i8* dereferenceable(1) %12)
%14 = tail call i32 @free(i8* %12)
%15 = load i32, i32* @MPFR_RNDN
%16 = tail call i32 @mpfr_set_d(i32 undef, i32 1, i32 %15)
%17 = tail call i8* @rounding_to_string(i32 %16)
%18 = tail call i32 @puts(i8* dereferenceable(1) %17)
%19 = tail call i32 @free(i8* %17)
%20 = load i32, i32* @MPFR_RNDN
%21 = tail call i32 @mpfr_set_str(i32 undef, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 %20)
%22 = tail call i8* @rounding_to_string(i32 %21)
%23 = tail call i32 @puts(i8* dereferenceable(1) %22)
%24 = tail call i32 @free(i8* %22)
%25 = tail call i32 @mpfr_set_nan(i32 undef)
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.6, i64 0, i64 0))
%27 = tail call i32 @mpfr_set_inf(i32 undef, i32 1)
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.6, i64 0, i64 0))
%29 = tail call i32 @mpfr_set_zero(i32 undef, i32 -1)
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.6, i64 0, i64 0))
%31 = tail call i8* @mpfr_get_prec(i32 undef)
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %31)
%33 = tail call i32 @mpfr_clears(i32 undef, i32 undef, i32* null)
ret i32 0
}