#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*/ mpfr_clear(int /*<<< orphan*/);
scalar_t__ mpfr_cmp_ui(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpfr_init2(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpfr_set_str(int /*<<< orphan*/, char *, int /*<<< orphan*/,
                                int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void failure_test(void) {
  mpfr_t x;
  mpfr_init2(x, 128);
  mpfr_set_str(x, "17", 0, MPFR_RNDN);
  if (mpfr_cmp_ui(x, 17) != 0)
    printf("\nFailure in mpfr_set_str! Probably an unmatched ABI!\n");
  mpfr_clear(x);
}


x86 assembly (clang, -O0):
<failure_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x4(%rbp),%edi
mov    $0x80,%esi
call   1070 <mpfr_init2@plt>
mov    -0x4(%rbp),%edi
mov    0x2e79(%rip),%rax
mov    (%rax),%ecx
lea    0xe88(%rip),%rsi
xor    %edx,%edx
call   1060 <mpfr_set_str@plt>
mov    -0x4(%rbp),%edi
mov    $0x11,%esi
call   1030 <mpfr_cmp_ui@plt>
cmp    $0x0,%rax
je     11a2 <failure_test+0x52>
lea    0xe66(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1050 <mpfr_clear@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<failure_test>:
push   %rax
mov    $0x80,%esi
call   1070 <mpfr_init2@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%ecx
lea    0xe95(%rip),%rsi
xor    %edx,%edx
call   1060 <mpfr_set_str@plt>
mov    $0x11,%esi
call   1040 <mpfr_cmp_ui@plt>
test   %rax,%rax
je     118d <failure_test+0x3d>
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
pop    %rax
jmp    1050 <mpfr_clear@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"17\00"
@MPFR_RNDN = global i32 0
@.str.1 = [54 x i8] c"\0AFailure in mpfr_set_str! Probably an unmatched ABI!\0A\00"
define void @failure_test() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = call i32 @mpfr_init2(i32 %2, i32 128)
%4 = load i32, i32* %1
%5 = load i32, i32* @MPFR_RNDN
%6 = call i32 @mpfr_set_str(i32 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0, i32 %5)
%7 = load i32, i32* %1
%8 = call i64 @mpfr_cmp_ui(i32 %7, i32 17)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %0
%13 = load i32, i32* %1
%14 = call i32 @mpfr_clear(i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"17\00"
@MPFR_RNDN = global i32 0
@str = [53 x i8] c"\0AFailure in mpfr_set_str! Probably an unmatched ABI!\00"
define void @failure_test() {
%1 = tail call i32 @mpfr_init2(i32 undef, i32 128)
%2 = load i32, i32* @MPFR_RNDN
%3 = tail call i32 @mpfr_set_str(i32 undef, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 0, i32 %2)
%4 = tail call i64 @mpfr_cmp_ui(i32 undef, i32 17)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = tail call i32 @mpfr_clear(i32 undef)
ret void
}