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

/* Variables and functions */
int getMpzSize(int /*<<< orphan*/);
int /*<<< orphan*/ gmp_printf(char *, int /*<<< orphan*/);
scalar_t__ mpz_getlimbn(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init_set_str(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ mpz_init_set_ui(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_invert(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/);
int /*<<< orphan*/ mpz_mod(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_mul(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_sub(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_ui_pow_ui(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ printf(char *, unsigned int);
int main() {
  int i;
  mpz_t m, x, y, r, r_aux, n_cons, zero, recons;
  char *template;
  mpz_init_set_str(
      m,
      "00f7d41c34be5878fc1202ae8e82609a0da7e7f1dca245ae319f05b58c4dc9b1fbcb323f"
      "030fba596dfa1f6a52c5458bf7fe33d2d0d984fa13bf8e7007d78f0b05",
      16);
  mpz_init(r);
  mpz_init(r_aux);
  mpz_init(n_cons);
  mpz_init_set_ui(zero, 0);
  mpz_ui_pow_ui(r, 2, 16 * (getMpzSize(m) + 1));
  mpz_mul(r_aux, r, r);
  mpz_mod(r_aux, r_aux, m);
  mpz_sub(n_cons, zero, m);
  mpz_invert(n_cons, n_cons, r);
  printf("n_c <= %x;\n\n", (unsigned int)mpz_getlimbn(n_cons, 0) & 0xffff);
  gmp_printf("r_c <= %Zx\n\n", r_aux);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0xc(%rbp),%edi
lea    0xe27(%rip),%rsi
mov    $0x10,%edx
call   1050 <mpz_init_set_str@plt>
mov    -0x18(%rbp),%edi
call   1080 <mpz_init@plt>
mov    -0x1c(%rbp),%edi
call   1080 <mpz_init@plt>
mov    -0x20(%rbp),%edi
call   1080 <mpz_init@plt>
mov    -0x24(%rbp),%edi
xor    %esi,%esi
call   10b0 <mpz_init_set_ui@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0xc(%rbp),%edi
call   1090 <getMpzSize@plt>
mov    -0x34(%rbp),%edi
mov    %eax,%edx
add    $0x1,%edx
shl    $0x4,%edx
mov    $0x2,%esi
call   10e0 <mpz_ui_pow_ui@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x18(%rbp),%edx
call   10a0 <mpz_mul@plt>
mov    -0x1c(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0xc(%rbp),%edx
call   10c0 <mpz_mod@plt>
mov    -0x20(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <mpz_sub@plt>
mov    -0x20(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1070 <mpz_invert@plt>
mov    -0x20(%rbp),%edi
xor    %esi,%esi
call   1060 <mpz_getlimbn@plt>
mov    %eax,%esi
and    $0xffff,%esi
lea    0xe0a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe08(%rip),%rdi
call   10d0 <gmp_printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe38(%rip),%rsi
mov    $0x10,%edx
call   1050 <mpz_init_set_str@plt>
call   1080 <mpz_init@plt>
call   1080 <mpz_init@plt>
call   1080 <mpz_init@plt>
xor    %esi,%esi
call   10b0 <mpz_init_set_ui@plt>
call   1090 <getMpzSize@plt>
shl    $0x4,%eax
lea    0x10(%rax),%edx
mov    $0x2,%esi
call   10e0 <mpz_ui_pow_ui@plt>
call   10a0 <mpz_mul@plt>
call   10c0 <mpz_mod@plt>
call   1030 <mpz_sub@plt>
call   1070 <mpz_invert@plt>
xor    %esi,%esi
call   1060 <mpz_getlimbn@plt>
movzwl %ax,%esi
lea    0xe61(%rip),%rdi
call   1040 <printf@plt>
lea    0xe62(%rip),%rdi
call   10d0 <gmp_printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [131 x i8] c"00f7d41c34be5878fc1202ae8e82609a0da7e7f1dca245ae319f05b58c4dc9b1fbcb323f030fba596dfa1f6a52c5458bf7fe33d2d0d984fa13bf8e7007d78f0b05\00"
@.str.1 = [13 x i8] c"n_c <= %x;\0A\0A\00"
@.str.2 = [13 x i8] c"r_c <= %Zx\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
store i32 0, i32* %1
%12 = load i32, i32* %3
%13 = call i32 @mpz_init_set_str(i32 %12, i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str, i64 0, i64 0), i32 16)
%14 = load i32, i32* %6
%15 = call i32 @mpz_init(i32 %14)
%16 = load i32, i32* %7
%17 = call i32 @mpz_init(i32 %16)
%18 = load i32, i32* %8
%19 = call i32 @mpz_init(i32 %18)
%20 = load i32, i32* %9
%21 = call i32 @mpz_init_set_ui(i32 %20, i32 0)
%22 = load i32, i32* %6
%23 = load i32, i32* %3
%24 = call i32 @getMpzSize(i32 %23)
%25 = add nsw i32 %24, 1
%26 = mul nsw i32 16, %25
%27 = call i32 @mpz_ui_pow_ui(i32 %22, i32 2, i32 %26)
%28 = load i32, i32* %7
%29 = load i32, i32* %6
%30 = load i32, i32* %6
%31 = call i32 @mpz_mul(i32 %28, i32 %29, i32 %30)
%32 = load i32, i32* %7
%33 = load i32, i32* %7
%34 = load i32, i32* %3
%35 = call i32 @mpz_mod(i32 %32, i32 %33, i32 %34)
%36 = load i32, i32* %8
%37 = load i32, i32* %9
%38 = load i32, i32* %3
%39 = call i32 @mpz_sub(i32 %36, i32 %37, i32 %38)
%40 = load i32, i32* %8
%41 = load i32, i32* %8
%42 = load i32, i32* %6
%43 = call i32 @mpz_invert(i32 %40, i32 %41, i32 %42)
%44 = load i32, i32* %8
%45 = call i64 @mpz_getlimbn(i32 %44, i32 0)
%46 = trunc i64 %45 to i32
%47 = and i32 %46, 65535
%48 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %7
%50 = call i32 @gmp_printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %49)
ret i32 0
}

LLVM IR (-O2):
@.str = [131 x i8] c"00f7d41c34be5878fc1202ae8e82609a0da7e7f1dca245ae319f05b58c4dc9b1fbcb323f030fba596dfa1f6a52c5458bf7fe33d2d0d984fa13bf8e7007d78f0b05\00"
@.str.1 = [13 x i8] c"n_c <= %x;\0A\0A\00"
@.str.2 = [13 x i8] c"r_c <= %Zx\0A\0A\00"
define i32 @main() {
%1 = tail call i32 @mpz_init_set_str(i32 undef, i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str, i64 0, i64 0), i32 16)
%2 = tail call i32 @mpz_init(i32 undef)
%3 = tail call i32 @mpz_init(i32 undef)
%4 = tail call i32 @mpz_init(i32 undef)
%5 = tail call i32 @mpz_init_set_ui(i32 undef, i32 0)
%6 = tail call i32 @getMpzSize(i32 undef)
%7 = shl i32 %6, 4
%8 = add i32 %7, 16
%9 = tail call i32 @mpz_ui_pow_ui(i32 undef, i32 2, i32 %8)
%10 = tail call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%11 = tail call i32 @mpz_mod(i32 undef, i32 undef, i32 undef)
%12 = tail call i32 @mpz_sub(i32 undef, i32 undef, i32 undef)
%13 = tail call i32 @mpz_invert(i32 undef, i32 undef, i32 undef)
%14 = tail call i64 @mpz_getlimbn(i32 undef, i32 0)
%15 = trunc i64 %14 to i32
%16 = and i32 %15, 65535
%17 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = tail call i32 @gmp_printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 undef)
ret i32 0
}