#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*/ mpz_t;
typedef int /*<<< orphan*/ mpf_t;

/* Variables and functions */
int /*<<< orphan*/ fp_inv_pow(int /*<<< orphan*/, unsigned int, unsigned int);
int /*<<< orphan*/ mpf_add(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpf_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpf_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpf_mul(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpf_set_ui(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpf_set_z(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpf_sub(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_bin_uiui(int /*<<< orphan*/, unsigned int, unsigned int);
int /*<<< orphan*/ mpz_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
void fp_bin_xform_pow_compute(mpf_t bxp, unsigned int n, unsigned int s) {
  mpz_t bin;
  mpz_init(bin);
  mpf_t vp, term;
  mpf_init(vp);
  mpf_init(term);
  mpf_set_ui(bxp, 0);
  unsigned int k;
  for (k = 0; k <= n; k++) {
    mpz_bin_uiui(bin, n, k);
    mpf_set_z(term, bin);
    fp_inv_pow(vp, k + 1, s);
    mpf_mul(term, term, vp);
    if (k % 2) {
      mpf_sub(bxp, bxp, term);
    } else {
      mpf_add(bxp, bxp, term);
    }
  }
  mpz_clear(bin);
  mpf_clear(vp);
  mpf_clear(term);
}


x86 assembly (clang, -O0):
<fp_bin_xform_pow_compute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x10(%rbp),%edi
call   1060 <mpz_init@plt>
mov    -0x14(%rbp),%edi
call   1070 <mpf_init@plt>
mov    -0x18(%rbp),%edi
call   1070 <mpf_init@plt>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1090 <mpf_set_ui@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
ja     1271 <fp_bin_xform_pow_compute+0xc1>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1040 <mpz_bin_uiui@plt>
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%esi
call   10a0 <mpf_set_z@plt>
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
call   1030 <fp_inv_pow@plt>
mov    -0x18(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
call   10c0 <mpf_mul@plt>
mov    -0x1c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1250 <fp_bin_xform_pow_compute+0xa0>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x18(%rbp),%edx
call   10b0 <mpf_sub@plt>
jmp    125e <fp_bin_xform_pow_compute+0xae>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <mpf_add@plt>
jmp    1263 <fp_bin_xform_pow_compute+0xb3>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ea <fp_bin_xform_pow_compute+0x3a>
mov    -0x10(%rbp),%edi
call   10d0 <mpz_clear@plt>
mov    -0x14(%rbp),%edi
call   1080 <mpf_clear@plt>
mov    -0x18(%rbp),%edi
call   1080 <mpf_clear@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fp_bin_xform_pow_compute>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%r12d
call   1060 <mpz_init@plt>
call   1070 <mpf_init@plt>
call   1070 <mpf_init@plt>
xor    %ebp,%ebp
mov    %r12d,%edi
xor    %esi,%esi
call   1090 <mpf_set_ui@plt>
jmp    11ea <fp_bin_xform_pow_compute+0x3a>
xchg   %ax,%ax
call   1050 <mpf_add@plt>
cmp    %r15d,%ebp
ja     1222 <fp_bin_xform_pow_compute+0x72>
mov    %ebp,%ebx
mov    %r15d,%esi
mov    %ebp,%edx
call   1040 <mpz_bin_uiui@plt>
call   10a0 <mpf_set_z@plt>
lea    0x1(%rbx),%ebp
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <fp_inv_pow@plt>
call   10c0 <mpf_mul@plt>
mov    %r12d,%edi
mov    %r12d,%esi
test   $0x1,%bl
je     11e0 <fp_bin_xform_pow_compute+0x30>
call   10b0 <mpf_sub@plt>
cmp    %r15d,%ebp
jbe    11ea <fp_bin_xform_pow_compute+0x3a>
call   10d0 <mpz_clear@plt>
call   1080 <mpf_clear@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <mpf_clear@plt>

LLVM IR (-O0):
define void @fp_bin_xform_pow_compute(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = load i32, i32* %7
%12 = call i32 @mpz_init(i32 %11)
%13 = load i32, i32* %8
%14 = call i32 @mpf_init(i32 %13)
%15 = load i32, i32* %9
%16 = call i32 @mpf_init(i32 %15)
%17 = load i32, i32* %4
%18 = call i32 @mpf_set_ui(i32 %17, i32 0)
store i32 0, i32* %10
br label %19
19: ; preds = %54, %3
%20 = load i32, i32* %10
%21 = load i32, i32* %5
%22 = icmp ule i32 %20, %21
br i1 %22, label %23, label %57
23: ; preds = %19
%24 = load i32, i32* %7
%25 = load i32, i32* %5
%26 = load i32, i32* %10
%27 = call i32 @mpz_bin_uiui(i32 %24, i32 %25, i32 %26)
%28 = load i32, i32* %9
%29 = load i32, i32* %7
%30 = call i32 @mpf_set_z(i32 %28, i32 %29)
%31 = load i32, i32* %8
%32 = load i32, i32* %10
%33 = add i32 %32, 1
%34 = load i32, i32* %6
%35 = call i32 @fp_inv_pow(i32 %31, i32 %33, i32 %34)
%36 = load i32, i32* %9
%37 = load i32, i32* %9
%38 = load i32, i32* %8
%39 = call i32 @mpf_mul(i32 %36, i32 %37, i32 %38)
%40 = load i32, i32* %10
%41 = urem i32 %40, 2
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %48
43: ; preds = %23
%44 = load i32, i32* %4
%45 = load i32, i32* %4
%46 = load i32, i32* %9
%47 = call i32 @mpf_sub(i32 %44, i32 %45, i32 %46)
br label %53
48: ; preds = %23
%49 = load i32, i32* %4
%50 = load i32, i32* %4
%51 = load i32, i32* %9
%52 = call i32 @mpf_add(i32 %49, i32 %50, i32 %51)
br label %53
53: ; preds = %48, %43
br label %54
54: ; preds = %53
%55 = load i32, i32* %10
%56 = add i32 %55, 1
store i32 %56, i32* %10
br label %19
57: ; preds = %19
%58 = load i32, i32* %7
%59 = call i32 @mpz_clear(i32 %58)
%60 = load i32, i32* %8
%61 = call i32 @mpf_clear(i32 %60)
%62 = load i32, i32* %9
%63 = call i32 @mpf_clear(i32 %62)
ret void
}

LLVM IR (-O2):
define void @fp_bin_xform_pow_compute(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @mpz_init(i32 undef)
%5 = tail call i32 @mpf_init(i32 undef)
%6 = tail call i32 @mpf_init(i32 undef)
%7 = tail call i32 @mpf_set_ui(i32 %0, i32 0)
br label %8
8: ; preds = %3, %21
%9 = phi i32 [ 0, %3 ], [ %12, %21 ]
%10 = tail call i32 @mpz_bin_uiui(i32 undef, i32 %1, i32 %9)
%11 = tail call i32 @mpf_set_z(i32 undef, i32 undef)
%12 = add i32 %9, 1
%13 = tail call i32 @fp_inv_pow(i32 undef, i32 %12, i32 %2)
%14 = tail call i32 @mpf_mul(i32 undef, i32 undef, i32 undef)
%15 = and i32 %9, 1
%16 = icmp eq i32 %15, 0
br i1 %16, label %19, label %17
17: ; preds = %8
%18 = tail call i32 @mpf_sub(i32 %0, i32 %0, i32 undef)
br label %21
19: ; preds = %8
%20 = tail call i32 @mpf_add(i32 %0, i32 %0, i32 undef)
br label %21
21: ; preds = %17, %19
%22 = icmp ugt i32 %12, %1
br i1 %22, label %23, label %8
23: ; preds = %21
%24 = tail call i32 @mpz_clear(i32 undef)
%25 = tail call i32 @mpf_clear(i32 undef)
%26 = tail call i32 @mpf_clear(i32 undef)
ret void
}