// File: marxn[P]pupp/3rdparty/gmp/gen-psqr.c
// Function: generate_mod
void
generate_mod (int limb_bits, int nail_bits)
{
  int    numb_bits = limb_bits - nail_bits;
  int    i, divisor;

  mpz_init_set_ui (pp, 0L);
  mpz_init_set_ui (pp_norm, 0L);
  mpz_init_set_ui (pp_inverted, 0L);

  /* no more than limb_bits many factors in a one limb modulus (and of
     course in reality nothing like that many) */
  factor_alloc = limb_bits;
  factor = (struct factor_t *) xmalloc (factor_alloc * sizeof (*factor));
  rawfactor = (struct rawfactor_t *) xmalloc (factor_alloc * sizeof (*rawfactor));

  if (numb_bits % 4 != 0)
    {
      strcpy (mod34_excuse, "GMP_NUMB_BITS % 4 != 0");
      goto use_pp;
    }

  max_divisor = 2*limb_bits;
  max_divisor_bits = log2_ceil (max_divisor);

  if (numb_bits / 4 < max_divisor_bits)
    {
      /* Wind back to one limb worth of max_divisor, if that will let us use
         mpn_mod_34lsub1.  */
      max_divisor = limb_bits;
      max_divisor_bits = log2_ceil (max_divisor);

      if (numb_bits / 4 < max_divisor_bits)
        {
          strcpy (mod34_excuse, "GMP_NUMB_BITS / 4 too small");
          goto use_pp;
        }
    }

  {
    /* Can use mpn_mod_34lsub1, find small factors of 2^mod34_bits-1. */
    mpz_t  m, q, r;
    int    multiplicity;

    mod34_bits = (numb_bits / 4) * 3;

    /* mpn_mod_34lsub1 returns a full limb value, PERFSQR_MOD_34 folds it at
       the mod34_bits mark, adding the two halves for a remainder of at most
       mod34_bits+1 many bits */
    mod_bits = mod34_bits + 1;

    mpz_init_set_ui (m, 1L);
    mpz_mul_2exp (m, m, mod34_bits);
    mpz_sub_ui (m, m, 1L);

    mpz_init (q);
    mpz_init (r);

    for (i = 3; i <= max_divisor; i+=2)
      {
        if (! isprime (i))
          continue;

        mpz_tdiv_qr_ui (q, r, m, (unsigned long) i);
        if (mpz_sgn (r) != 0)
          continue;

        /* if a repeated prime is found it's used as an i^n in one factor */
        divisor = 1;
        multiplicity = 0;
        do
          {
            if (divisor > max_divisor / i)
              break;
            multiplicity++;
            mpz_set (m, q);
            mpz_tdiv_qr_ui (q, r, m, (unsigned long) i);
          }
        while (mpz_sgn (r) == 0);

        assert (nrawfactor < factor_alloc);
        rawfactor[nrawfactor].divisor = i;
        rawfactor[nrawfactor].multiplicity = multiplicity;
        nrawfactor++;
      }

    mpz_clear (m);
    mpz_clear (q);
    mpz_clear (r);
  }

  if (nrawfactor <= 2)
    {
      mpz_t  new_pp;

      sprintf (mod34_excuse, "only %d small factor%s",
               nrawfactor, nrawfactor == 1 ? "" : "s");

    use_pp:
      /* reset to two limbs of max_divisor, in case the mpn_mod_34lsub1 code
         tried with just one */
      max_divisor = 2*limb_bits;
      max_divisor_bits = log2_ceil (max_divisor);

      mpz_init (new_pp);
      nrawfactor = 0;
      mod_bits = MIN (numb_bits, limb_bits - max_divisor_bits);

      /* one copy of each small prime */
      mpz_set_ui (pp, 1L);
      for (i = 3; i <= max_divisor; i+=2)
        {
          if (! isprime (i))
            continue;

          mpz_mul_ui (new_pp, pp, (unsigned long) i);
          if (mpz_sizeinbase (new_pp, 2) > mod_bits)
            break;
          mpz_set (pp, new_pp);

          assert (nrawfactor < factor_alloc);
          rawfactor[nrawfactor].divisor = i;
          rawfactor[nrawfactor].multiplicity = 1;
          nrawfactor++;
        }

      /* Plus an extra copy of one or more of the primes selected, if that
         still fits in max_divisor and the total in mod_bits.  Usually only
         3 or 5 will be candidates */
      for (i = nrawfactor-1; i >= 0; i--)
        {
          if (rawfactor[i].divisor > max_divisor / rawfactor[i].divisor)
            continue;
          mpz_mul_ui (new_pp, pp, (unsigned long) rawfactor[i].divisor);
          if (mpz_sizeinbase (new_pp, 2) > mod_bits)
            continue;
          mpz_set (pp, new_pp);

          rawfactor[i].multiplicity++;
        }

      mod_bits = mpz_sizeinbase (pp, 2);

      mpz_set (pp_norm, pp);
      while (mpz_sizeinbase (pp_norm, 2) < numb_bits)
        mpz_add (pp_norm, pp_norm, pp_norm);

      mpz_preinv_invert (pp_inverted, pp_norm, numb_bits);

      mpz_clear (new_pp);
    }

  /* start the factor array */
  for (i = 0; i < nrawfactor; i++)
    {
      int  j;
      assert (nfactor < factor_alloc);
      factor[nfactor].divisor = 1;
      for (j = 0; j < rawfactor[i].multiplicity; j++)
        factor[nfactor].divisor *= rawfactor[i].divisor;
      nfactor++;
    }

 combine:
  /* Combine entries in the factor array.  Combine the smallest entry with
     the biggest one that will fit with it (ie. under max_divisor), then
     repeat that with the new smallest entry. */
  qsort (factor, nfactor, sizeof (factor[0]), f_cmp_divisor);
  for (i = nfactor-1; i >= 1; i--)
    {
      if (factor[i].divisor <= max_divisor / factor[0].divisor)
        {
          factor[0].divisor *= factor[i].divisor;
          COLLAPSE_ELEMENT (factor, i, nfactor);
          goto combine;
        }
    }

  total_fraction = 1.0;
  for (i = 0; i < nfactor; i++)
    {
      mpz_init (factor[i].inverse);
      mpz_invert_ui_2exp (factor[i].inverse,
                          (unsigned long) factor[i].divisor,
                          (unsigned long) mod_bits);

      mpz_init (factor[i].mask);
      square_mask (factor[i].mask, factor[i].divisor);

      /* fraction of possible squares */
      factor[i].fraction = (double) mpz_popcount (factor[i].mask)
        / factor[i].divisor;

      /* total fraction of possible squares */
      total_fraction *= factor[i].fraction;
    }

  /* best tests first (ie. smallest fraction) */
  qsort (factor, nfactor, sizeof (factor[0]), f_cmp_fraction);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl -0x4(%rbp), %eax
subl -0x8(%rbp), %eax
movl %eax, -0xc(%rbp)
leaq 0x755f(%rip), %rdi      # 0x130f0
xorl %eax, %eax
movl %eax, %esi
callq 0x3560
leaq 0x755f(%rip), %rdi      # 0x13100
xorl %eax, %eax
movl %eax, %esi
callq 0x3560
leaq 0x755f(%rip), %rdi      # 0x13110
xorl %eax, %eax
movl %eax, %esi
callq 0x3560
movl -0x4(%rbp), %eax
movl %eax, 0x755d(%rip)      # 0x13120
movslq 0x7556(%rip), %rax      # 0x13120
imulq $0x30, %rax, %rdi
callq 0x1300
movq %rax, 0x754e(%rip)      # 0x13128
movslq 0x753f(%rip), %rdi      # 0x13120
shlq $0x3, %rdi
callq 0x1300
movq %rax, 0x753f(%rip)      # 0x13130
movl -0xc(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
je 0xbc19
leaq 0x7538(%rip), %rdi      # 0x13140
leaq 0x2f96(%rip), %rsi      # 0xeba5
callq 0x1050
jmp 0xbe7e
movl -0x4(%rbp), %eax
shll %eax
movl %eax, 0x759c(%rip)      # 0x131c0
movl 0x7596(%rip), %edi      # 0x131c0
callq 0xb550
movl %eax, 0x758f(%rip)      # 0x131c4
movl -0xc(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
cmpl 0x757e(%rip), %eax      # 0x131c4
jge 0xbc8f
movl -0x4(%rbp), %eax
movl %eax, 0x756f(%rip)      # 0x131c0
movl 0x7569(%rip), %edi      # 0x131c0
callq 0xb550
movl %eax, 0x7562(%rip)      # 0x131c4
movl -0xc(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
cmpl 0x7551(%rip), %eax      # 0x131c4
jge 0xbc8d
leaq 0x74c4(%rip), %rdi      # 0x13140
leaq 0x2f39(%rip), %rsi      # 0xebbc
callq 0x1050
jmp 0xbe7e
jmp 0xbc8f
movl -0xc(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
imull $0x3, %eax, %eax
movl %eax, 0x7525(%rip)      # 0x131c8
movl 0x751f(%rip), %eax      # 0x131c8
addl $0x1, %eax
movl %eax, 0x741e(%rip)      # 0x130d0
leaq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0x3560
leaq -0x30(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movslq 0x74f9(%rip), %rdx      # 0x131c8
callq 0x5040
leaq -0x30(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x1, %edx
callq 0x4800
leaq -0x40(%rbp), %rdi
callq 0x3220
leaq -0x50(%rbp), %rdi
callq 0x3220
movl $0x3, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl 0x74b8(%rip), %eax      # 0x131c0
jg 0xbe20
movslq -0x10(%rbp), %rdi
callq 0xb3f0
cmpl $0x0, %eax
jne 0xbd21
jmp 0xbe12
leaq -0x40(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x30(%rbp), %rdx
movslq -0x10(%rbp), %rcx
callq 0x6490
leaq -0x50(%rbp), %rdi
callq 0x4070
cmpl $0x0, %eax
je 0xbd49
jmp 0xbe12
movl $0x1, -0x14(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x78(%rbp)
movl 0x745d(%rip), %eax      # 0x131c0
cltd
idivl -0x10(%rbp)
movl %eax, %ecx
movl -0x78(%rbp), %eax
cmpl %ecx, %eax
jle 0xbd72
jmp 0xbdab
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x33d0
leaq -0x40(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x30(%rbp), %rdx
movslq -0x10(%rbp), %rcx
callq 0x6490
leaq -0x50(%rbp), %rdi
callq 0x4070
cmpl $0x0, %eax
je 0xbd57
movl 0x741b(%rip), %eax      # 0x131cc
cmpl 0x7369(%rip), %eax      # 0x13120
jge 0xbdbb
jmp 0xbdda
leaq 0x2e16(%rip), %rdi      # 0xebd8
leaq 0x2dbb(%rip), %rsi      # 0xeb84
movl $0x139, %edx            # imm = 0x139
leaq 0x2e1d(%rip), %rcx      # 0xebf2
callq 0x1090
movl -0x10(%rbp), %edx
movq 0x734c(%rip), %rax      # 0x13130
movslq 0x73e1(%rip), %rcx      # 0x131cc
movl %edx, (%rax,%rcx,8)
movl -0x54(%rbp), %edx
movq 0x7338(%rip), %rax      # 0x13130
movslq 0x73cd(%rip), %rcx      # 0x131cc
movl %edx, 0x4(%rax,%rcx,8)
movl 0x73c3(%rip), %eax      # 0x131cc
addl $0x1, %eax
movl %eax, 0x73ba(%rip)      # 0x131cc
movl -0x10(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x10(%rbp)
jmp 0xbcff
leaq -0x30(%rbp), %rdi
callq 0x3300
leaq -0x40(%rbp), %rdi
callq 0x3300
leaq -0x50(%rbp), %rdi
callq 0x3300
cmpl $0x2, 0x738a(%rip)      # 0x131cc
jg 0xc0fa
movl 0x737e(%rip), %edx      # 0x131cc
movl 0x7378(%rip), %esi      # 0x131cc
leaq 0x2dc8(%rip), %rcx      # 0xec23
leaq 0x31e1(%rip), %rax      # 0xf043
cmpl $0x1, %esi
cmoveq %rax, %rcx
leaq 0x72d0(%rip), %rdi      # 0x13140
leaq 0x2d97(%rip), %rsi      # 0xec0e
movb $0x0, %al
callq 0x10f0
movl -0x4(%rbp), %eax
shll %eax
movl %eax, 0x7337(%rip)      # 0x131c0
movl 0x7331(%rip), %edi      # 0x131c0
callq 0xb550
movl %eax, 0x732a(%rip)      # 0x131c4
leaq -0x70(%rbp), %rdi
callq 0x3220
movl $0x0, 0x731f(%rip)      # 0x131cc
movl -0xc(%rbp), %eax
movl -0x4(%rbp), %ecx
subl 0x730b(%rip), %ecx      # 0x131c4
cmpl %ecx, %eax
jge 0xbec5
movl -0xc(%rbp), %eax
movl %eax, -0x7c(%rbp)
jmp 0xbed1
movl -0x4(%rbp), %eax
subl 0x72f6(%rip), %eax      # 0x131c4
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, 0x71f6(%rip)      # 0x130d0
leaq 0x720f(%rip), %rdi      # 0x130f0
movl $0x1, %esi
callq 0x3390
movl $0x3, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl 0x72c5(%rip), %eax      # 0x131c0
jg 0xbfcd
movslq -0x10(%rbp), %rdi
callq 0xb3f0
cmpl $0x0, %eax
jne 0xbf14
jmp 0xbfbf
leaq -0x70(%rbp), %rdi
movslq -0x10(%rbp), %rdx
leaq 0x71cd(%rip), %rsi      # 0x130f0
callq 0x4d90
leaq -0x70(%rbp), %rdi
movl $0x2, %esi
callq 0x8270
movslq 0x7193(%rip), %rcx      # 0x130d0
cmpq %rcx, %rax
jbe 0xbf47
jmp 0xbfcd
leaq -0x70(%rbp), %rsi
leaq 0x719e(%rip), %rdi      # 0x130f0
callq 0x33d0
movl 0x726f(%rip), %eax      # 0x131cc
cmpl 0x71bd(%rip), %eax      # 0x13120
jge 0xbf67
jmp 0xbf86
leaq 0x2c6a(%rip), %rdi      # 0xebd8
leaq 0x2c0f(%rip), %rsi      # 0xeb84
movl $0x161, %edx            # imm = 0x161
leaq 0x2c71(%rip), %rcx      # 0xebf2
callq 0x1090
movl -0x10(%rbp), %edx
movq 0x71a0(%rip), %rax      # 0x13130
movslq 0x7235(%rip), %rcx      # 0x131cc
movl %edx, (%rax,%rcx,8)
movq 0x718f(%rip), %rax      # 0x13130
movslq 0x7224(%rip), %rcx      # 0x131cc
movl $0x1, 0x4(%rax,%rcx,8)
movl 0x7216(%rip), %eax      # 0x131cc
addl $0x1, %eax
movl %eax, 0x720d(%rip)      # 0x131cc
movl -0x10(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x10(%rbp)
jmp 0xbef2
movl 0x71f9(%rip), %eax      # 0x131cc
subl $0x1, %eax
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jl 0xc083
movq 0x7146(%rip), %rax      # 0x13130
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,8), %eax
movl %eax, -0x80(%rbp)
movl 0x71c6(%rip), %eax      # 0x131c0
movq 0x712f(%rip), %rcx      # 0x13130
movslq -0x10(%rbp), %rsi
cltd
idivl (%rcx,%rsi,8)
movl %eax, %ecx
movl -0x80(%rbp), %eax
cmpl %ecx, %eax
jle 0xc014
jmp 0xc075
leaq -0x70(%rbp), %rdi
movq 0x7111(%rip), %rax      # 0x13130
movslq -0x10(%rbp), %rcx
movslq (%rax,%rcx,8), %rdx
leaq 0x70c2(%rip), %rsi      # 0x130f0
callq 0x4d90
leaq -0x70(%rbp), %rdi
movl $0x2, %esi
callq 0x8270
movslq 0x7088(%rip), %rcx      # 0x130d0
cmpq %rcx, %rax
jbe 0xc04f
jmp 0xc075
leaq -0x70(%rbp), %rsi
leaq 0x7096(%rip), %rdi      # 0x130f0
callq 0x33d0
movq 0x70ca(%rip), %rax      # 0x13130
movslq -0x10(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %edx
addl $0x1, %edx
movl %edx, 0x4(%rax,%rcx,8)
movl -0x10(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xbfd9
leaq 0x7066(%rip), %rdi      # 0x130f0
movl $0x2, %esi
callq 0x8270
movl %eax, 0x7036(%rip)      # 0x130d0
leaq 0x705f(%rip), %rdi      # 0x13100
leaq 0x7048(%rip), %rsi      # 0x130f0
callq 0x33d0
leaq 0x704c(%rip), %rdi      # 0x13100
movl $0x2, %esi
callq 0x8270
movslq -0xc(%rbp), %rcx
cmpq %rcx, %rax
jae 0xc0db
leaq 0x7032(%rip), %rdx      # 0x13100
movq %rdx, %rdi
movq %rdx, %rsi
callq 0x48e0
jmp 0xc0ad
movl -0xc(%rbp), %edx
leaq 0x702b(%rip), %rdi      # 0x13110
leaq 0x7014(%rip), %rsi      # 0x13100
callq 0xb5b0
leaq -0x70(%rbp), %rdi
callq 0x3300
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl 0x70c2(%rip), %eax      # 0x131cc
jge 0xc1c5
movl 0x70ba(%rip), %eax      # 0x131d0
cmpl 0x7004(%rip), %eax      # 0x13120
jge 0xc120
jmp 0xc13f
leaq 0x2afe(%rip), %rdi      # 0xec25
leaq 0x2a56(%rip), %rsi      # 0xeb84
movl $0x185, %edx            # imm = 0x185
leaq 0x2ab8(%rip), %rcx      # 0xebf2
callq 0x1090
movq 0x6fe2(%rip), %rax      # 0x13128
movslq 0x7083(%rip), %rcx      # 0x131d0
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl $0x1, (%rax)
movl $0x0, -0x74(%rbp)
movl -0x74(%rbp), %eax
movq 0x6fc5(%rip), %rcx      # 0x13130
movslq -0x10(%rbp), %rdx
cmpl 0x4(%rcx,%rdx,8), %eax
jge 0xc1a8
movq 0x6fb4(%rip), %rax      # 0x13130
movslq -0x10(%rbp), %rcx
movl (%rax,%rcx,8), %ecx
movq 0x6f9e(%rip), %rax      # 0x13128
movslq 0x703f(%rip), %rdx      # 0x131d0
imulq $0x30, %rdx, %rdx
addq %rdx, %rax
imull (%rax), %ecx
movl %ecx, (%rax)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0xc161
movl 0x7022(%rip), %eax      # 0x131d0
addl $0x1, %eax
movl %eax, 0x7019(%rip)      # 0x131d0
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xc101
jmp 0xc1c7
movq 0x6f5a(%rip), %rdi      # 0x13128
movslq 0x6ffb(%rip), %rsi      # 0x131d0
movl $0x30, %edx
leaq -0x9a1(%rip), %rcx      # 0xb840
callq 0x1060
movl 0x6fe4(%rip), %eax      # 0x131d0
subl $0x1, %eax
movl %eax, -0x10(%rbp)
cmpl $0x1, -0x10(%rbp)
jl 0xc2b7
movq 0x6f25(%rip), %rax      # 0x13128
movslq -0x10(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x84(%rbp)
movl 0x6fa4(%rip), %eax      # 0x131c0
movq 0x6f05(%rip), %rcx      # 0x13128
cltd
idivl (%rcx)
movl %eax, %ecx
movl -0x84(%rbp), %eax
cmpl %ecx, %eax
jg 0xc2a7
movq 0x6eef(%rip), %rax      # 0x13128
movslq -0x10(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %ecx
movq 0x6edb(%rip), %rax      # 0x13128
imull (%rax), %ecx
movl %ecx, (%rax)
movq 0x6ecf(%rip), %rdi      # 0x13128
movslq -0x10(%rbp), %rax
imulq $0x30, %rax, %rax
addq %rax, %rdi
movq 0x6ebd(%rip), %rsi      # 0x13128
movl -0x10(%rbp), %eax
addl $0x1, %eax
cltq
imulq $0x30, %rax, %rax
addq %rax, %rsi
movl 0x6f50(%rip), %eax      # 0x131d0
movl -0x10(%rbp), %ecx
addl $0x1, %ecx
subl %ecx, %eax
cltq
imulq $0x30, %rax, %rdx
callq 0x10d0
movl 0x6f37(%rip), %eax      # 0x131d0
addl $-0x1, %eax
movl %eax, 0x6f2e(%rip)      # 0x131d0
jmp 0xc1c7
jmp 0xc2a9
movl -0x10(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xc1f2
movsd 0x1d51(%rip), %xmm0     # 0xe010
movsd %xmm0, 0x6f11(%rip)     # 0x131d8
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl 0x6ef9(%rip), %eax      # 0x131d0
jge 0xc409
movq 0x6e44(%rip), %rax      # 0x13128
movslq -0x10(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
leaq 0x8(%rax,%rcx), %rdi
callq 0x3220
movq 0x6e27(%rip), %rax      # 0x13128
movslq -0x10(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
leaq 0x8(%rax,%rcx), %rdi
movslq (%rax,%rcx), %rsi
movslq 0x6db3(%rip), %rdx      # 0x130d0
callq 0xb7f0
movq 0x6dff(%rip), %rax      # 0x13128
movslq -0x10(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
leaq 0x18(%rax,%rcx), %rdi
callq 0x3220
movq 0x6de2(%rip), %rax      # 0x13128
movslq -0x10(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
leaq 0x18(%rax,%rcx), %rdi
movl (%rax,%rcx), %esi
callq 0xb9a0
movq 0x6dc2(%rip), %rax      # 0x13128
movslq -0x10(%rbp), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
leaq 0x18(%rax,%rcx), %rdi
callq 0x9e60
movq %rax, %xmm0
movaps 0x1cb8(%rip), %xmm1     # 0xe040
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x1cbc(%rip), %xmm1     # 0xe050
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq 0x6d7e(%rip), %rax      # 0x13128
movslq -0x10(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
cvtsi2sdl (%rax), %xmm1
divsd %xmm1, %xmm0
movq 0x6d64(%rip), %rax      # 0x13128
movslq -0x10(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd %xmm0, 0x28(%rax)
movq 0x6d4d(%rip), %rax      # 0x13128
movslq -0x10(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
mulsd 0x6de5(%rip), %xmm0     # 0x131d8
movsd %xmm0, 0x6ddd(%rip)     # 0x131d8
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xc2ce
movq 0x6d18(%rip), %rdi      # 0x13128
movslq 0x6db9(%rip), %rsi      # 0x131d0
movl $0x30, %edx
leaq -0xb83(%rip), %rcx      # 0xb8a0
callq 0x1060
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)