#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 mp_bitcnt_t;

/* Variables and functions */
int /*<<< orphan*/ mpz_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_lcm(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_mul(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_mul_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_nextprime(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_set_ui(int /*<<< orphan*/, int);
int mpz_sizeinbase(int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_sub_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
void generator_gd_precompute(mpz_t pi, mpz_t nu, mpz_t lambda, mpz_t rho,
                             mp_bitcnt_t bitcnt) {
  mpz_t p, t;
  mpz_init(p);
  mpz_init(t);
  mpz_set_ui(nu, 1);
  mpz_set_ui(lambda, 1);
  mpz_set_ui(p, 2);
  do {
    mpz_nextprime(p, p);
    mpz_sub_ui(t, p, 1);
    mpz_lcm(lambda, lambda, t);
    mpz_mul(nu, nu, p);
  } while (mpz_sizeinbase(nu, 2) < bitcnt - 16);
  mpz_mul_ui(pi, nu, 1729);
  mpz_mul_ui(rho, nu, 4180);
  mpz_clear(p);
  mpz_clear(t);
}


x86 assembly (clang, -O0):
<generator_gd_precompute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <mpz_init@plt>
mov    -0x1c(%rbp),%edi
call   1030 <mpz_init@plt>
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
call   1080 <mpz_set_ui@plt>
mov    -0xc(%rbp),%edi
mov    $0x1,%esi
call   1080 <mpz_set_ui@plt>
mov    -0x18(%rbp),%edi
mov    $0x2,%esi
call   1080 <mpz_set_ui@plt>
mov    -0x18(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1070 <mpz_nextprime@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    $0x1,%edx
call   1060 <mpz_sub_ui@plt>
mov    -0xc(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   10b0 <mpz_lcm@plt>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <mpz_mul@plt>
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
call   1050 <mpz_sizeinbase@plt>
mov    -0x14(%rbp),%ecx
sub    $0x10,%ecx
cmp    %ecx,%eax
jl     11df <generator_gd_precompute+0x4f>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x6c1,%edx
call   10a0 <mpz_mul_ui@plt>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x1054,%edx
call   10a0 <mpz_mul_ui@plt>
mov    -0x18(%rbp),%edi
call   1090 <mpz_clear@plt>
mov    -0x1c(%rbp),%edi
call   1090 <mpz_clear@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generator_gd_precompute>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r12d
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r15d
call   1030 <mpz_init@plt>
call   1030 <mpz_init@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   1080 <mpz_set_ui@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1080 <mpz_set_ui@plt>
mov    $0x2,%esi
call   1080 <mpz_set_ui@plt>
add    $0xfffffff0,%r12d
cs nopw 0x0(%rax,%rax,1)
nop
call   1070 <mpz_nextprime@plt>
mov    $0x1,%edx
call   1060 <mpz_sub_ui@plt>
mov    %ebx,%edi
mov    %ebx,%esi
call   10b0 <mpz_lcm@plt>
mov    %ebp,%edi
mov    %ebp,%esi
call   1040 <mpz_mul@plt>
mov    %ebp,%edi
mov    $0x2,%esi
call   1050 <mpz_sizeinbase@plt>
cmp    %r12d,%eax
jl     11e0 <generator_gd_precompute+0x50>
mov    %r15d,%edi
mov    %ebp,%esi
mov    $0x6c1,%edx
call   10a0 <mpz_mul_ui@plt>
mov    %r14d,%edi
mov    %ebp,%esi
mov    $0x1054,%edx
call   10a0 <mpz_mul_ui@plt>
call   1090 <mpz_clear@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <mpz_clear@plt>

LLVM IR (-O0):
define void @generator_gd_precompute(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%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* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%13 = load i32, i32* %11
%14 = call i32 @mpz_init(i32 %13)
%15 = load i32, i32* %12
%16 = call i32 @mpz_init(i32 %15)
%17 = load i32, i32* %7
%18 = call i32 @mpz_set_ui(i32 %17, i32 1)
%19 = load i32, i32* %8
%20 = call i32 @mpz_set_ui(i32 %19, i32 1)
%21 = load i32, i32* %11
%22 = call i32 @mpz_set_ui(i32 %21, i32 2)
br label %23
23: ; preds = %38, %5
%24 = load i32, i32* %11
%25 = load i32, i32* %11
%26 = call i32 @mpz_nextprime(i32 %24, i32 %25)
%27 = load i32, i32* %12
%28 = load i32, i32* %11
%29 = call i32 @mpz_sub_ui(i32 %27, i32 %28, i32 1)
%30 = load i32, i32* %8
%31 = load i32, i32* %8
%32 = load i32, i32* %12
%33 = call i32 @mpz_lcm(i32 %30, i32 %31, i32 %32)
%34 = load i32, i32* %7
%35 = load i32, i32* %7
%36 = load i32, i32* %11
%37 = call i32 @mpz_mul(i32 %34, i32 %35, i32 %36)
br label %38
38: ; preds = %23
%39 = load i32, i32* %7
%40 = call i32 @mpz_sizeinbase(i32 %39, i32 2)
%41 = load i32, i32* %10
%42 = sub nsw i32 %41, 16
%43 = icmp slt i32 %40, %42
br i1 %43, label %23, label %44
44: ; preds = %38
%45 = load i32, i32* %6
%46 = load i32, i32* %7
%47 = call i32 @mpz_mul_ui(i32 %45, i32 %46, i32 1729)
%48 = load i32, i32* %9
%49 = load i32, i32* %7
%50 = call i32 @mpz_mul_ui(i32 %48, i32 %49, i32 4180)
%51 = load i32, i32* %11
%52 = call i32 @mpz_clear(i32 %51)
%53 = load i32, i32* %12
%54 = call i32 @mpz_clear(i32 %53)
ret void
}

LLVM IR (-O2):
define void @generator_gd_precompute(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @mpz_init(i32 undef)
%7 = tail call i32 @mpz_init(i32 undef)
%8 = tail call i32 @mpz_set_ui(i32 %1, i32 1)
%9 = tail call i32 @mpz_set_ui(i32 %2, i32 1)
%10 = tail call i32 @mpz_set_ui(i32 undef, i32 2)
%11 = add nsw i32 %4, -16
br label %12
12: ; preds = %12, %5
%13 = tail call i32 @mpz_nextprime(i32 undef, i32 undef)
%14 = tail call i32 @mpz_sub_ui(i32 undef, i32 undef, i32 1)
%15 = tail call i32 @mpz_lcm(i32 %2, i32 %2, i32 undef)
%16 = tail call i32 @mpz_mul(i32 %1, i32 %1, i32 undef)
%17 = tail call i32 @mpz_sizeinbase(i32 %1, i32 2)
%18 = icmp slt i32 %17, %11
br i1 %18, label %12, label %19
19: ; preds = %12
%20 = tail call i32 @mpz_mul_ui(i32 %0, i32 %1, i32 1729)
%21 = tail call i32 @mpz_mul_ui(i32 %3, i32 %1, i32 4180)
%22 = tail call i32 @mpz_clear(i32 undef)
%23 = tail call i32 @mpz_clear(i32 undef)
ret void
}