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


x86 assembly (clang, -O0):
<atan2lfr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,-0x48(%rbp)
call   1070 <mpfr_inits@plt>
mov    -0x28(%rbp),%edi
fldt   -0x10(%rbp)
mov    0x2e5c(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    (%rax),%esi
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <mpfr_set_ld@plt>
mov    -0x50(%rbp),%rax
mov    -0x24(%rbp),%edi
fldt   -0x20(%rbp)
mov    (%rax),%esi
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <mpfr_set_ld@plt>
mov    -0x50(%rbp),%rax
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%esi
mov    (%rax),%ecx
mov    %edx,%edi
call   1040 <mpfr_atan2@plt>
mov    -0x50(%rbp),%rax
mov    -0x24(%rbp),%edi
mov    (%rax),%esi
call   1060 <mpfr_get_ld@plt>
mov    -0x48(%rbp),%rdx
fstpt  -0x40(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1050 <mpfr_clears@plt>
fldt   -0x40(%rbp)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atan2lfr>:
push   %rbx
sub    $0x30,%rsp
fldt   0x50(%rsp)
fstpt  0x18(%rsp)
fldt   0x40(%rsp)
fstpt  0x24(%rsp)
xor    %edx,%edx
call   1070 <mpfr_inits@plt>
mov    0x2e6d(%rip),%rbx
mov    (%rbx),%esi
fldt   0x24(%rsp)
fstpt  (%rsp)
call   1030 <mpfr_set_ld@plt>
mov    (%rbx),%esi
fldt   0x18(%rsp)
fstpt  (%rsp)
call   1030 <mpfr_set_ld@plt>
mov    (%rbx),%ecx
call   1040 <mpfr_atan2@plt>
mov    (%rbx),%esi
call   1060 <mpfr_get_ld@plt>
fstpt  0x18(%rsp)
xor    %edx,%edx
call   1050 <mpfr_clears@plt>
fldt   0x18(%rsp)
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@GMP_RNDN = global i32 0
define x86_fp80 @atan2lfr(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
%5 = alloca i32
%6 = alloca i32
%7 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 %1, x86_fp80* %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 x86_fp80, x86_fp80* %3
%13 = load i32, i32* @GMP_RNDN
%14 = call i32 @mpfr_set_ld(i32 %11, x86_fp80 %12, i32 %13)
%15 = load i32, i32* %5
%16 = load x86_fp80, x86_fp80* %4
%17 = load i32, i32* @GMP_RNDN
%18 = call i32 @mpfr_set_ld(i32 %15, x86_fp80 %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 x86_fp80 @mpfr_get_ld(i32 %24, i32 %25)
store x86_fp80 %26, x86_fp80* %7
%27 = load i32, i32* %5
%28 = load i32, i32* %6
%29 = call i32 @mpfr_clears(i32 %27, i32 %28, i32* null)
%30 = load x86_fp80, x86_fp80* %7
ret x86_fp80 %30
}

LLVM IR (-O2):
@GMP_RNDN = global i32 0
define x86_fp80 @atan2lfr(x86_fp80 %0, x86_fp80 %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_ld(i32 undef, x86_fp80 %0, i32 %4)
%6 = load i32, i32* @GMP_RNDN
%7 = tail call i32 @mpfr_set_ld(i32 undef, x86_fp80 %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 x86_fp80 @mpfr_get_ld(i32 undef, i32 %10)
%12 = tail call i32 @mpfr_clears(i32 undef, i32 undef, i32* null)
ret x86_fp80 %11
}