#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;
typedef int /*<<< orphan*/ mpfr_rnd_t;
typedef int /*<<< orphan*/ mpfr_prec_t;

/* Variables and functions */
int /*<<< orphan*/ m_clear(int /*<<< orphan*/);
int /*<<< orphan*/ m_init2(int /*<<< orphan*/, int /*<<< orphan*/ const);
int /*<<< orphan*/ mpfr_set(int /*<<< orphan*/, int /*<<< orphan*/,
                            int /*<<< orphan*/ const);
int /*<<< orphan*/ mpfr_set_prec(int /*<<< orphan*/, int /*<<< orphan*/ const);
int m_setPrecisionWithRoundingMode(mpfr_t *value, const mpfr_prec_t pre,
                                   const mpfr_rnd_t roundingMode) {
  int roundingDirection = 0;
  mpfr_t result;
  m_init2(result, pre);
  mpfr_set(result, *value, roundingMode);
  mpfr_set_prec(*value, pre);
  mpfr_set(*value, result, roundingMode);
  m_clear(result);
  return roundingDirection;
}


x86 assembly (clang, -O0):
<m_setPrecisionWithRoundingMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x18(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <m_init2@plt>
mov    -0x18(%rbp),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%edx
call   1040 <mpfr_set@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%esi
call   1030 <mpfr_set_prec@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <mpfr_set@plt>
mov    -0x18(%rbp),%edi
call   1050 <m_clear@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_setPrecisionWithRoundingMode>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
call   1060 <m_init2@plt>
mov    (%rbx),%esi
mov    %r14d,%edx
call   1040 <mpfr_set@plt>
mov    (%rbx),%edi
mov    %ebp,%esi
call   1030 <mpfr_set_prec@plt>
mov    (%rbx),%edi
mov    %r14d,%edx
call   1040 <mpfr_set@plt>
call   1050 <m_clear@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @m_setPrecisionWithRoundingMode(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
%9 = load i32, i32* %8
%10 = load i32, i32* %5
%11 = call i32 @m_init2(i32 %9, i32 %10)
%12 = load i32, i32* %8
%13 = load i32*, i32** %4
%14 = load i32, i32* %13
%15 = load i32, i32* %6
%16 = call i32 @mpfr_set(i32 %12, i32 %14, i32 %15)
%17 = load i32*, i32** %4
%18 = load i32, i32* %17
%19 = load i32, i32* %5
%20 = call i32 @mpfr_set_prec(i32 %18, i32 %19)
%21 = load i32*, i32** %4
%22 = load i32, i32* %21
%23 = load i32, i32* %8
%24 = load i32, i32* %6
%25 = call i32 @mpfr_set(i32 %22, i32 %23, i32 %24)
%26 = load i32, i32* %8
%27 = call i32 @m_clear(i32 %26)
%28 = load i32, i32* %7
ret i32 %28
}

LLVM IR (-O2):
define i32 @m_setPrecisionWithRoundingMode(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @m_init2(i32 undef, i32 %1)
%5 = load i32, i32* %0
%6 = tail call i32 @mpfr_set(i32 undef, i32 %5, i32 %2)
%7 = load i32, i32* %0
%8 = tail call i32 @mpfr_set_prec(i32 %7, i32 %1)
%9 = load i32, i32* %0
%10 = tail call i32 @mpfr_set(i32 %9, i32 undef, i32 %2)
%11 = tail call i32 @m_clear(i32 undef)
ret i32 0
}