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

/* Variables and functions */
int /*<<< orphan*/ fp_pi(int /*<<< orphan*/, int);
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_mul_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ mpf_pow_ui(int /*<<< orphan*/, int /*<<< orphan*/,
                              unsigned int);
int /*<<< orphan*/ mpf_set_q(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpq_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpq_div(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpq_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpq_mul(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpq_neg(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpq_set_ui(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ mpq_set_z(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_fac_ui(int /*<<< orphan*/, unsigned int);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ q_bernoulli(int /*<<< orphan*/, unsigned int);
void fp_zeta_even(mpf_t zeta, unsigned int n, int prec) {
  mpq_t bern, b2, bb;
  mpq_init(bern);
  mpq_init(b2);
  mpq_init(bb);
  q_bernoulli(bern, n);
  mpq_set_ui(bb, 1, 2);
  mpq_mul(b2, bern, bb);
  mpz_t fact;
  mpz_init(fact);
  mpz_fac_ui(fact, n);
  mpq_set_z(bern, fact);
  mpq_div(bb, b2, bern);
  if (0 == n % 4)
    mpq_neg(bb, bb);
  mpf_t pi, pip;
  mpf_init(pi);
  mpf_init(pip);
  fp_pi(pi, prec);
  mpf_mul_ui(pi, pi, 2);
  mpf_pow_ui(pip, pi, n);
  mpf_set_q(pi, bb);
  mpf_mul(zeta, pi, pip);
  mpf_clear(pi);
  mpf_clear(pip);
  mpq_clear(bern);
  mpq_clear(b2);
  mpq_clear(bb);
  mpz_clear(fact);
}


x86 assembly (clang, -O0):
<fp_zeta_even>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x10(%rbp),%edi
call   10a0 <mpq_init@plt>
mov    -0x14(%rbp),%edi
call   10a0 <mpq_init@plt>
mov    -0x18(%rbp),%edi
call   10a0 <mpq_init@plt>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <q_bernoulli@plt>
mov    -0x18(%rbp),%edi
mov    $0x1,%esi
mov    $0x2,%edx
call   10e0 <mpq_set_ui@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%edx
call   10f0 <mpq_mul@plt>
mov    -0x1c(%rbp),%edi
call   1070 <mpz_init@plt>
mov    -0x1c(%rbp),%edi
mov    -0x8(%rbp),%esi
call   10b0 <mpz_fac_ui@plt>
mov    -0x10(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1040 <mpq_set_z@plt>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1140 <mpq_div@plt>
mov    -0x8(%rbp),%ecx
and    $0x3,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jne    12bb <fp_zeta_even+0x9b>
mov    -0x18(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1130 <mpq_neg@plt>
mov    -0x20(%rbp),%edi
call   1080 <mpf_init@plt>
mov    -0x24(%rbp),%edi
call   1080 <mpf_init@plt>
mov    -0x20(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1120 <fp_pi@plt>
mov    -0x20(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    $0x2,%edx
call   10c0 <mpf_mul_ui@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x8(%rbp),%edx
call   10d0 <mpf_pow_ui@plt>
mov    -0x20(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <mpf_set_q@plt>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1100 <mpf_mul@plt>
mov    -0x20(%rbp),%edi
call   1090 <mpf_clear@plt>
mov    -0x24(%rbp),%edi
call   1090 <mpf_clear@plt>
mov    -0x10(%rbp),%edi
call   1060 <mpq_clear@plt>
mov    -0x14(%rbp),%edi
call   1060 <mpq_clear@plt>
mov    -0x18(%rbp),%edi
call   1060 <mpq_clear@plt>
mov    -0x1c(%rbp),%edi
call   1110 <mpz_clear@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fp_zeta_even>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r14d
call   10a0 <mpq_init@plt>
call   10a0 <mpq_init@plt>
call   10a0 <mpq_init@plt>
mov    %ebp,%esi
call   1050 <q_bernoulli@plt>
mov    $0x1,%esi
mov    $0x2,%edx
call   10e0 <mpq_set_ui@plt>
call   10f0 <mpq_mul@plt>
call   1070 <mpz_init@plt>
mov    %ebp,%esi
call   10b0 <mpz_fac_ui@plt>
call   1040 <mpq_set_z@plt>
call   1140 <mpq_div@plt>
test   $0x3,%bpl
jne    1276 <fp_zeta_even+0x56>
call   1130 <mpq_neg@plt>
call   1080 <mpf_init@plt>
call   1080 <mpf_init@plt>
mov    %ebx,%esi
call   1120 <fp_pi@plt>
mov    $0x2,%edx
call   10c0 <mpf_mul_ui@plt>
mov    %ebp,%edx
call   10d0 <mpf_pow_ui@plt>
call   1030 <mpf_set_q@plt>
mov    %r14d,%edi
call   1100 <mpf_mul@plt>
call   1090 <mpf_clear@plt>
call   1090 <mpf_clear@plt>
call   1060 <mpq_clear@plt>
call   1060 <mpq_clear@plt>
call   1060 <mpq_clear@plt>
pop    %rbx
pop    %r14
pop    %rbp
jmp    1110 <mpz_clear@plt>

LLVM IR (-O0):
define void @fp_zeta_even(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
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%13 = load i32, i32* %7
%14 = call i32 @mpq_init(i32 %13)
%15 = load i32, i32* %8
%16 = call i32 @mpq_init(i32 %15)
%17 = load i32, i32* %9
%18 = call i32 @mpq_init(i32 %17)
%19 = load i32, i32* %7
%20 = load i32, i32* %5
%21 = call i32 @q_bernoulli(i32 %19, i32 %20)
%22 = load i32, i32* %9
%23 = call i32 @mpq_set_ui(i32 %22, i32 1, i32 2)
%24 = load i32, i32* %8
%25 = load i32, i32* %7
%26 = load i32, i32* %9
%27 = call i32 @mpq_mul(i32 %24, i32 %25, i32 %26)
%28 = load i32, i32* %10
%29 = call i32 @mpz_init(i32 %28)
%30 = load i32, i32* %10
%31 = load i32, i32* %5
%32 = call i32 @mpz_fac_ui(i32 %30, i32 %31)
%33 = load i32, i32* %7
%34 = load i32, i32* %10
%35 = call i32 @mpq_set_z(i32 %33, i32 %34)
%36 = load i32, i32* %9
%37 = load i32, i32* %8
%38 = load i32, i32* %7
%39 = call i32 @mpq_div(i32 %36, i32 %37, i32 %38)
%40 = load i32, i32* %5
%41 = urem i32 %40, 4
%42 = icmp eq i32 0, %41
br i1 %42, label %43, label %47
43: ; preds = %3
%44 = load i32, i32* %9
%45 = load i32, i32* %9
%46 = call i32 @mpq_neg(i32 %44, i32 %45)
br label %47
47: ; preds = %43, %3
%48 = load i32, i32* %11
%49 = call i32 @mpf_init(i32 %48)
%50 = load i32, i32* %12
%51 = call i32 @mpf_init(i32 %50)
%52 = load i32, i32* %11
%53 = load i32, i32* %6
%54 = call i32 @fp_pi(i32 %52, i32 %53)
%55 = load i32, i32* %11
%56 = load i32, i32* %11
%57 = call i32 @mpf_mul_ui(i32 %55, i32 %56, i32 2)
%58 = load i32, i32* %12
%59 = load i32, i32* %11
%60 = load i32, i32* %5
%61 = call i32 @mpf_pow_ui(i32 %58, i32 %59, i32 %60)
%62 = load i32, i32* %11
%63 = load i32, i32* %9
%64 = call i32 @mpf_set_q(i32 %62, i32 %63)
%65 = load i32, i32* %4
%66 = load i32, i32* %11
%67 = load i32, i32* %12
%68 = call i32 @mpf_mul(i32 %65, i32 %66, i32 %67)
%69 = load i32, i32* %11
%70 = call i32 @mpf_clear(i32 %69)
%71 = load i32, i32* %12
%72 = call i32 @mpf_clear(i32 %71)
%73 = load i32, i32* %7
%74 = call i32 @mpq_clear(i32 %73)
%75 = load i32, i32* %8
%76 = call i32 @mpq_clear(i32 %75)
%77 = load i32, i32* %9
%78 = call i32 @mpq_clear(i32 %77)
%79 = load i32, i32* %10
%80 = call i32 @mpz_clear(i32 %79)
ret void
}

LLVM IR (-O2):
define void @fp_zeta_even(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @mpq_init(i32 undef)
%5 = tail call i32 @mpq_init(i32 undef)
%6 = tail call i32 @mpq_init(i32 undef)
%7 = tail call i32 @q_bernoulli(i32 undef, i32 %1)
%8 = tail call i32 @mpq_set_ui(i32 undef, i32 1, i32 2)
%9 = tail call i32 @mpq_mul(i32 undef, i32 undef, i32 undef)
%10 = tail call i32 @mpz_init(i32 undef)
%11 = tail call i32 @mpz_fac_ui(i32 undef, i32 %1)
%12 = tail call i32 @mpq_set_z(i32 undef, i32 undef)
%13 = tail call i32 @mpq_div(i32 undef, i32 undef, i32 undef)
%14 = and i32 %1, 3
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %3
%17 = tail call i32 @mpq_neg(i32 undef, i32 undef)
br label %18
18: ; preds = %16, %3
%19 = tail call i32 @mpf_init(i32 undef)
%20 = tail call i32 @mpf_init(i32 undef)
%21 = tail call i32 @fp_pi(i32 undef, i32 %2)
%22 = tail call i32 @mpf_mul_ui(i32 undef, i32 undef, i32 2)
%23 = tail call i32 @mpf_pow_ui(i32 undef, i32 undef, i32 %1)
%24 = tail call i32 @mpf_set_q(i32 undef, i32 undef)
%25 = tail call i32 @mpf_mul(i32 %0, i32 undef, i32 undef)
%26 = tail call i32 @mpf_clear(i32 undef)
%27 = tail call i32 @mpf_clear(i32 undef)
%28 = tail call i32 @mpq_clear(i32 undef)
%29 = tail call i32 @mpq_clear(i32 undef)
%30 = tail call i32 @mpq_clear(i32 undef)
%31 = tail call i32 @mpz_clear(i32 undef)
ret void
}