#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*/ GMP_RNDN;
int /*<<< orphan*/ mpfr_atan2(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_clears(int /*<<< orphan*/, int /*<<< orphan*/,
                               int /*<<< orphan*/ *);
double mpfr_get_d(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpfr_inits(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/ *);
int /*<<< orphan*/ mpfr_set_d(int /*<<< orphan*/, double, int /*<<< orphan*/);
double atan2fr(double y, double x) {
  mpfr_t frx, fry;
  mpfr_inits(frx, fry, NULL);
  mpfr_set_d(fry, y, GMP_RNDN);
  mpfr_set_d(frx, x, GMP_RNDN);
  mpfr_atan2(frx, fry, frx, GMP_RNDN);
  double ret = mpfr_get_d(frx, GMP_RNDN);
  mpfr_clears(frx, fry, NULL);
  return ret;
}


x86 assembly (clang, -O0):
<atan2fr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edx
call   1070 <mpfr_inits@plt>
mov    -0x18(%rbp),%edi
movsd  -0x8(%rbp),%xmm0
mov    0x2e60(%rip),%rax
mov    (%rax),%esi
call   1040 <mpfr_set_d@plt>
mov    -0x14(%rbp),%edi
movsd  -0x10(%rbp),%xmm0
mov    0x2e4a(%rip),%rax
mov    (%rax),%esi
call   1040 <mpfr_set_d@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    0x2e33(%rip),%rax
mov    (%rax),%ecx
call   1050 <mpfr_atan2@plt>
mov    -0x14(%rbp),%edi
mov    0x2e22(%rip),%rax
mov    (%rax),%esi
call   1030 <mpfr_get_d@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edx
call   1060 <mpfr_clears@plt>
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atan2fr>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x8(%rsp)
xor    %edx,%edx
call   1070 <mpfr_inits@plt>
mov    0x2e72(%rip),%rbx
mov    (%rbx),%esi
movsd  0x8(%rsp),%xmm0
call   1040 <mpfr_set_d@plt>
mov    (%rbx),%esi
movsd  (%rsp),%xmm0
call   1040 <mpfr_set_d@plt>
mov    (%rbx),%ecx
call   1050 <mpfr_atan2@plt>
mov    (%rbx),%esi
call   1030 <mpfr_get_d@plt>
movsd  %xmm0,(%rsp)
xor    %edx,%edx
call   1060 <mpfr_clears@plt>
movsd  (%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@GMP_RNDN = global i32 0
define double @atan2fr(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store double %0, double* %3
store double %1, double* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @mpfr_inits(i32 %8, i32 %9, i32* null)
%11 = load i32, i32* %6
%12 = load double, double* %3
%13 = load i32, i32* @GMP_RNDN
%14 = call i32 @mpfr_set_d(i32 %11, double %12, i32 %13)
%15 = load i32, i32* %5
%16 = load double, double* %4
%17 = load i32, i32* @GMP_RNDN
%18 = call i32 @mpfr_set_d(i32 %15, double %16, i32 %17)
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = load i32, i32* %5
%22 = load i32, i32* @GMP_RNDN
%23 = call i32 @mpfr_atan2(i32 %19, i32 %20, i32 %21, i32 %22)
%24 = load i32, i32* %5
%25 = load i32, i32* @GMP_RNDN
%26 = call double @mpfr_get_d(i32 %24, i32 %25)
store double %26, double* %7
%27 = load i32, i32* %5
%28 = load i32, i32* %6
%29 = call i32 @mpfr_clears(i32 %27, i32 %28, i32* null)
%30 = load double, double* %7
ret double %30
}

LLVM IR (-O2):
@GMP_RNDN = global i32 0
define double @atan2fr(double %0, double %1) {
%3 = tail call i32 @mpfr_inits(i32 undef, i32 undef, i32* null)
%4 = load i32, i32* @GMP_RNDN
%5 = tail call i32 @mpfr_set_d(i32 undef, double %0, i32 %4)
%6 = load i32, i32* @GMP_RNDN
%7 = tail call i32 @mpfr_set_d(i32 undef, double %1, i32 %6)
%8 = load i32, i32* @GMP_RNDN
%9 = tail call i32 @mpfr_atan2(i32 undef, i32 undef, i32 undef, i32 %8)
%10 = load i32, i32* @GMP_RNDN
%11 = tail call double @mpfr_get_d(i32 undef, i32 %10)
%12 = tail call i32 @mpfr_clears(i32 undef, i32 undef, i32* null)
ret double %11
}