// File: marxn[P]pupp/3rdparty/gmp/gen-psqr.c
// Function: print
void
print (int limb_bits, int nail_bits)
{
  int    i;
  mpz_t  mhi, mlo;

  printf ("/* This file generated by gen-psqr.c - DO NOT EDIT. */\n");
  printf ("\n");

  printf ("#if GMP_LIMB_BITS != %d || GMP_NAIL_BITS != %d\n",
          limb_bits, nail_bits);
  printf ("Error, error, this data is for %d bit limb and %d bit nail\n",
          limb_bits, nail_bits);
  printf ("#endif\n");
  printf ("\n");

  printf ("/* Non-zero bit indicates a quadratic residue mod 0x100.\n");
  printf ("   This test identifies %.2f%% as non-squares (%d/256). */\n",
          (1.0 - sq_res_0x100_fraction) * 100.0,
          0x100 - sq_res_0x100_num);
  printf ("static const mp_limb_t\n");
  printf ("sq_res_0x100[%d] = {\n", nsq_res_0x100);
  for (i = 0; i < nsq_res_0x100; i++)
    {
      printf ("  CNST_LIMB(0x");
      mpz_out_str (stdout, 16, sq_res_0x100[i]);
      printf ("),\n");
    }
  printf ("};\n");
  printf ("\n");

  if (mpz_sgn (pp) != 0)
    {
      printf ("/* mpn_mod_34lsub1 not used due to %s */\n", mod34_excuse);
      printf ("/* PERFSQR_PP = ");
    }
  else
    printf ("/* 2^%d-1 = ", mod34_bits);
  for (i = 0; i < nrawfactor; i++)
    {
      if (i != 0)
        printf (" * ");
      printf ("%d", rawfactor[i].divisor);
      if (rawfactor[i].multiplicity != 1)
        printf ("^%d", rawfactor[i].multiplicity);
    }
  printf (" %s*/\n", mpz_sgn (pp) == 0 ? "... " : "");

  printf ("#define PERFSQR_MOD_BITS  %d\n", mod_bits);
  if (mpz_sgn (pp) != 0)
    {
      printf ("#define PERFSQR_PP            CNST_LIMB(0x");
      mpz_out_str (stdout, 16, pp);
      printf (")\n");
      printf ("#define PERFSQR_PP_NORM       CNST_LIMB(0x");
      mpz_out_str (stdout, 16, pp_norm);
      printf (")\n");
      printf ("#define PERFSQR_PP_INVERTED   CNST_LIMB(0x");
      mpz_out_str (stdout, 16, pp_inverted);
      printf (")\n");
    }
  printf ("\n");

  mpz_init (mhi);
  mpz_init (mlo);

  printf ("/* This test identifies %.2f%% as non-squares. */\n",
          (1.0 - total_fraction) * 100.0);
  printf ("#define PERFSQR_MOD_TEST(up, usize) \\\n");
  printf ("  do {                              \\\n");
  printf ("    mp_limb_t  r;                   \\\n");
  if (mpz_sgn (pp) != 0)
    printf ("    PERFSQR_MOD_PP (r, up, usize);  \\\n");
  else
    printf ("    PERFSQR_MOD_34 (r, up, usize);  \\\n");

  for (i = 0; i < nfactor; i++)
    {
      printf ("                                    \\\n");
      printf ("    /* %5.2f%% */                    \\\n",
              (1.0 - factor[i].fraction) * 100.0);

      printf ("    PERFSQR_MOD_%d (r, CNST_LIMB(%2d), CNST_LIMB(0x",
              factor[i].divisor <= limb_bits ? 1 : 2,
              factor[i].divisor);
      mpz_out_str (stdout, 16, factor[i].inverse);
      printf ("), \\\n");
      printf ("                   CNST_LIMB(0x");

      if ( factor[i].divisor <= limb_bits)
        {
          mpz_out_str (stdout, 16, factor[i].mask);
        }
      else
        {
          mpz_tdiv_r_2exp (mlo, factor[i].mask, (unsigned long) limb_bits);
          mpz_tdiv_q_2exp (mhi, factor[i].mask, (unsigned long) limb_bits);
          mpz_out_str (stdout, 16, mhi);
          printf ("), CNST_LIMB(0x");
          mpz_out_str (stdout, 16, mlo);
        }
      printf (")); \\\n");
    }

  printf ("  } while (0)\n");
  printf ("\n");

  printf ("/* Grand total sq_res_0x100 and PERFSQR_MOD_TEST, %.2f%% non-squares. */\n",
          (1.0 - (total_fraction * 44.0/256.0)) * 100.0);
  printf ("\n");

  printf ("/* helper for tests/mpz/t-perfsqr.c */\n");
  printf ("#define PERFSQR_DIVISORS  { 256,");
  for (i = 0; i < nfactor; i++)
      printf (" %d,", factor[i].divisor);
  printf (" }\n");


  mpz_clear (mhi);
  mpz_clear (mlo);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
leaq 0x27e7(%rip), %rdi      # 0xec3c
movb $0x0, %al
callq 0x1080
leaq 0x2bdf(%rip), %rdi      # 0xf042
movb $0x0, %al
callq 0x1080
movl -0x4(%rbp), %esi
movl -0x8(%rbp), %edx
leaq 0x27fd(%rip), %rdi      # 0xec74
movb $0x0, %al
callq 0x1080
movl -0x4(%rbp), %esi
movl -0x8(%rbp), %edx
leaq 0x2819(%rip), %rdi      # 0xeca4
movb $0x0, %al
callq 0x1080
leaq 0x2847(%rip), %rdi      # 0xece0
movb $0x0, %al
callq 0x1080
leaq 0x2b9b(%rip), %rdi      # 0xf042
movb $0x0, %al
callq 0x1080
leaq 0x2833(%rip), %rdi      # 0xece8
movb $0x0, %al
callq 0x1080
movsd 0x1b4c(%rip), %xmm0     # 0xe010
subsd 0x6c1c(%rip), %xmm0     # 0x130e8
movsd 0x1b5c(%rip), %xmm1     # 0xe030
mulsd %xmm1, %xmm0
movl $0x100, %esi            # imm = 0x100
subl 0x6bfd(%rip), %esi      # 0x130e0
leaq 0x2838(%rip), %rdi      # 0xed22
movb $0x1, %al
callq 0x1080
leaq 0x2866(%rip), %rdi      # 0xed5e
movb $0x0, %al
callq 0x1080
movl 0x6bcf(%rip), %esi      # 0x130d4
leaq 0x286a(%rip), %rdi      # 0xed76
movb $0x0, %al
callq 0x1080
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl 0x6bb1(%rip), %eax      # 0x130d4
jge 0xc572
leaq 0x2af3(%rip), %rdi      # 0xf01f
movb $0x0, %al
callq 0x1080
movq 0x6a9e(%rip), %rax      # 0x12fd8
movq (%rax), %rdi
movq 0x6b94(%rip), %rdx      # 0x130d8
movslq -0xc(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdx
movl $0x10, %esi
callq 0xad10
leaq 0x282c(%rip), %rdi      # 0xed8c
movb $0x0, %al
callq 0x1080
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xc51a
leaq 0x2817(%rip), %rdi      # 0xed90
movb $0x0, %al
callq 0x1080
leaq 0x2abb(%rip), %rdi      # 0xf042
movb $0x0, %al
callq 0x1080
leaq 0x6b5b(%rip), %rdi      # 0x130f0
callq 0x4070
cmpl $0x0, %eax
je 0xc5c4
leaq 0x27ee(%rip), %rdi      # 0xed94
leaq 0x6b93(%rip), %rsi      # 0x13140
movb $0x0, %al
callq 0x1080
leaq 0x2803(%rip), %rdi      # 0xedbe
movb $0x0, %al
callq 0x1080
jmp 0xc5d8
movl 0x6bfe(%rip), %esi      # 0x131c8
leaq 0x27fe(%rip), %rdi      # 0xedcf
movb $0x0, %al
callq 0x1080
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl 0x6be4(%rip), %eax      # 0x131cc
jge 0xc656
cmpl $0x0, -0xc(%rbp)
je 0xc5fe
leaq 0x27e5(%rip), %rdi      # 0xeddc
movb $0x0, %al
callq 0x1080
movq 0x6b2b(%rip), %rax      # 0x13130
movslq -0xc(%rbp), %rcx
movl (%rax,%rcx,8), %esi
leaq 0x27ce(%rip), %rdi      # 0xede1
movb $0x0, %al
callq 0x1080
movq 0x6b0f(%rip), %rax      # 0x13130
movslq -0xc(%rbp), %rcx
cmpl $0x1, 0x4(%rax,%rcx,8)
je 0xc649
movq 0x6afd(%rip), %rax      # 0x13130
movslq -0xc(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %esi
leaq 0x279e(%rip), %rdi      # 0xede0
movb $0x0, %al
callq 0x1080
jmp 0xc64b
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xc5df
leaq 0x6a93(%rip), %rdi      # 0x130f0
callq 0x4070
movl %eax, %ecx
leaq 0x29d8(%rip), %rsi      # 0xf043
leaq 0x2779(%rip), %rax      # 0xedeb
cmpl $0x0, %ecx
cmoveq %rax, %rsi
leaq 0x2764(%rip), %rdi      # 0xede4
movb $0x0, %al
callq 0x1080
movl 0x6a43(%rip), %esi      # 0x130d0
leaq 0x275c(%rip), %rdi      # 0xedf0
movb $0x0, %al
callq 0x1080
leaq 0x6a4e(%rip), %rdi      # 0x130f0
callq 0x4070
cmpl $0x0, %eax
je 0xc755
leaq 0x2757(%rip), %rdi      # 0xee0e
movb $0x0, %al
callq 0x1080
movq 0x6913(%rip), %rax      # 0x12fd8
movq (%rax), %rdi
movl $0x10, %esi
leaq 0x6a1c(%rip), %rdx      # 0x130f0
callq 0xad10
leaq 0x2961(%rip), %rdi      # 0xf041
movb $0x0, %al
callq 0x1080
leaq 0x274b(%rip), %rdi      # 0xee39
movb $0x0, %al
callq 0x1080
movq 0x68dc(%rip), %rax      # 0x12fd8
movq (%rax), %rdi
movl $0x10, %esi
leaq 0x69f5(%rip), %rdx      # 0x13100
callq 0xad10
leaq 0x292a(%rip), %rdi      # 0xf041
movb $0x0, %al
callq 0x1080
leaq 0x273f(%rip), %rdi      # 0xee64
movb $0x0, %al
callq 0x1080
movq 0x68a5(%rip), %rax      # 0x12fd8
movq (%rax), %rdi
movl $0x10, %esi
leaq 0x69ce(%rip), %rdx      # 0x13110
callq 0xad10
leaq 0x28f3(%rip), %rdi      # 0xf041
movb $0x0, %al
callq 0x1080
leaq 0x28e6(%rip), %rdi      # 0xf042
movb $0x0, %al
callq 0x1080
leaq -0x20(%rbp), %rdi
callq 0x3220
leaq -0x30(%rbp), %rdi
callq 0x3220
movsd 0x1893(%rip), %xmm0     # 0xe010
subsd 0x6a53(%rip), %xmm0     # 0x131d8
movsd 0x18a3(%rip), %xmm1     # 0xe030
mulsd %xmm1, %xmm0
leaq 0x26f7(%rip), %rdi      # 0xee8f
movb $0x1, %al
callq 0x1080
leaq 0x271c(%rip), %rdi      # 0xeec2
movb $0x0, %al
callq 0x1080
leaq 0x2735(%rip), %rdi      # 0xeee9
movb $0x0, %al
callq 0x1080
leaq 0x274e(%rip), %rdi      # 0xef10
movb $0x0, %al
callq 0x1080
leaq 0x6920(%rip), %rdi      # 0x130f0
callq 0x4070
cmpl $0x0, %eax
je 0xc7ea
leaq 0x2756(%rip), %rdi      # 0xef37
movb $0x0, %al
callq 0x1080
jmp 0xc7f8
leaq 0x276d(%rip), %rdi      # 0xef5e
movb $0x0, %al
callq 0x1080
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl 0x69c8(%rip), %eax      # 0x131d0
jge 0xc9cb
leaq 0x2770(%rip), %rdi      # 0xef85
movb $0x0, %al
callq 0x1080
movq 0x6905(%rip), %rax      # 0x13128
movslq -0xc(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x17da(%rip), %xmm0     # 0xe010
subsd 0x28(%rax), %xmm0
movsd 0x17ed(%rip), %xmm1     # 0xe030
mulsd %xmm1, %xmm0
leaq 0x275e(%rip), %rdi      # 0xefac
movb $0x1, %al
callq 0x1080
movq 0x68cc(%rip), %rax      # 0x13128
movslq -0xc(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %ecx
movl -0x4(%rbp), %edx
movl $0x2, %esi
movl $0x1, %eax
cmpl %edx, %ecx
cmovlel %eax, %esi
movq 0x68a6(%rip), %rax      # 0x13128
movslq -0xc(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edx
leaq 0x273e(%rip), %rdi      # 0xefd4
movb $0x0, %al
callq 0x1080
movq 0x6734(%rip), %rax      # 0x12fd8
movq (%rax), %rdi
movq 0x687a(%rip), %rdx      # 0x13128
movslq -0xc(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdx
addq $0x8, %rdx
movl $0x10, %esi
callq 0xad10
leaq 0x273a(%rip), %rdi      # 0xf008
movb $0x0, %al
callq 0x1080
leaq 0x2732(%rip), %rdi      # 0xf00e
movb $0x0, %al
callq 0x1080
movq 0x683e(%rip), %rax      # 0x13128
movslq -0xc(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
cmpl -0x4(%rbp), %eax
jg 0xc92b
movq 0x66d5(%rip), %rax      # 0x12fd8
movq (%rax), %rdi
movq 0x681b(%rip), %rdx      # 0x13128
movslq -0xc(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdx
addq $0x18, %rdx
movl $0x10, %esi
callq 0xad10
jmp 0xc9af
leaq -0x30(%rbp), %rdi
movq 0x67f2(%rip), %rsi      # 0x13128
movslq -0xc(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rsi
addq $0x18, %rsi
movslq -0x4(%rbp), %rdx
callq 0x6000
leaq -0x20(%rbp), %rdi
movq 0x67cf(%rip), %rsi      # 0x13128
movslq -0xc(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rsi
addq $0x18, %rsi
movslq -0x4(%rbp), %rdx
callq 0x5bc0
movq 0x6660(%rip), %rax      # 0x12fd8
movq (%rax), %rdi
leaq -0x20(%rbp), %rdx
movl $0x10, %esi
callq 0xad10
leaq 0x2668(%rip), %rdi      # 0xeff8
movb $0x0, %al
callq 0x1080
movq 0x663a(%rip), %rax      # 0x12fd8
movq (%rax), %rdi
leaq -0x30(%rbp), %rdx
movl $0x10, %esi
callq 0xad10
leaq 0x2678(%rip), %rdi      # 0xf02e
movb $0x0, %al
callq 0x1080
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xc7ff
leaq 0x2663(%rip), %rdi      # 0xf035
movb $0x0, %al
callq 0x1080
leaq 0x2662(%rip), %rdi      # 0xf042
movb $0x0, %al
callq 0x1080
movsd 0x1649(%rip), %xmm1     # 0xe038
mulsd 0x67e1(%rip), %xmm1     # 0x131d8
movsd 0x1629(%rip), %xmm0     # 0xe028
divsd %xmm0, %xmm1
movsd 0x1605(%rip), %xmm0     # 0xe010
subsd %xmm1, %xmm0
movsd 0x1619(%rip), %xmm1     # 0xe030
mulsd %xmm1, %xmm0
leaq 0x2622(%rip), %rdi      # 0xf044
movb $0x1, %al
callq 0x1080
leaq 0x2612(%rip), %rdi      # 0xf042
movb $0x0, %al
callq 0x1080
leaq 0x2650(%rip), %rdi      # 0xf08e
movb $0x0, %al
callq 0x1080
leaq 0x266a(%rip), %rdi      # 0xf0b6
movb $0x0, %al
callq 0x1080
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpl 0x676d(%rip), %eax      # 0x131d0
jge 0xca92
movq 0x66bc(%rip), %rax      # 0x13128
movslq -0xc(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %esi
leaq 0x2657(%rip), %rdi      # 0xf0d7
movb $0x0, %al
callq 0x1080
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xca5a
leaq 0x2643(%rip), %rdi      # 0xf0dc
movb $0x0, %al
callq 0x1080
leaq -0x20(%rbp), %rdi
callq 0x3300
leaq -0x30(%rbp), %rdi
callq 0x3300
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)