// File: marxn[P]pupp/3rdparty/gmp/mpn/sqr.c
// Function: _gmpn_sqr
void
mpn_sqr (mp_ptr p, mp_srcptr a, mp_size_t n)
{
  ASSERT (n >= 1);
  ASSERT (! MPN_OVERLAP_P (p, 2 * n, a, n));

  if (BELOW_THRESHOLD (n, SQR_BASECASE_THRESHOLD))
    { /* mul_basecase is faster than sqr_basecase on small sizes sometimes */
      mpn_mul_basecase (p, a, n, a, n);
    }
  else if (BELOW_THRESHOLD (n, SQR_TOOM2_THRESHOLD))
    {
      mpn_sqr_basecase (p, a, n);
    }
  else if (BELOW_THRESHOLD (n, SQR_TOOM3_THRESHOLD))
    {
      /* Allocate workspace of fixed size on stack: fast! */
      mp_limb_t ws[mpn_toom2_sqr_itch (SQR_TOOM3_THRESHOLD_LIMIT-1)];
      ASSERT (SQR_TOOM3_THRESHOLD <= SQR_TOOM3_THRESHOLD_LIMIT);
      mpn_toom2_sqr (p, a, n, ws);
    }
  else if (BELOW_THRESHOLD (n, SQR_TOOM4_THRESHOLD))
    {
      mp_ptr ws;
      TMP_SDECL;
      TMP_SMARK;
      ws = TMP_SALLOC_LIMBS (mpn_toom3_sqr_itch (n));
      mpn_toom3_sqr (p, a, n, ws);
      TMP_SFREE;
    }
  else if (BELOW_THRESHOLD (n, SQR_TOOM6_THRESHOLD))
    {
      mp_ptr ws;
      TMP_SDECL;
      TMP_SMARK;
      ws = TMP_SALLOC_LIMBS (mpn_toom4_sqr_itch (n));
      mpn_toom4_sqr (p, a, n, ws);
      TMP_SFREE;
    }
  else if (BELOW_THRESHOLD (n, SQR_TOOM8_THRESHOLD))
    {
      mp_ptr ws;
      TMP_SDECL;
      TMP_SMARK;
      ws = TMP_SALLOC_LIMBS (mpn_toom6_sqr_itch (n));
      mpn_toom6_sqr (p, a, n, ws);
      TMP_SFREE;
    }
  else if (BELOW_THRESHOLD (n, SQR_FFT_THRESHOLD))
    {
      mp_ptr ws;
      TMP_DECL;
      TMP_MARK;
      ws = TMP_ALLOC_LIMBS (mpn_toom8_sqr_itch (n));
      mpn_toom8_sqr (p, a, n, ws);
      TMP_FREE;
    }
  else
    {
      /* The current FFT code allocates its own space.  That should probably
	 change.  */
      mpn_fft_mul (p, a, n, a, n);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc50, %rsp            # imm = 0xC50
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
jmp 0x392c9
jmp 0x392cb
jmp 0x392cd
cmpq $0x22, -0x18(%rbp)
jge 0x392ea
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x39930
jmp 0x394ce
cmpq $0x81, -0x18(%rbp)
jge 0x39315
jmp 0x392f6
jmp 0x392f8
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0xc20(%rbp), %rcx
callq 0x48d00
jmp 0x394cc
cmpq $0x20f, -0x18(%rbp)     # imm = 0x20F
jge 0x39360
movq -0x18(%rbp), %rax
leaq (%rax,%rax,2), %rax
leaq 0x20f(,%rax,8), %rcx
andq $-0x10, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0xc28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0xc28(%rbp), %rcx
callq 0x49120
jmp 0x394ca
cmpq $0x232, -0x18(%rbp)     # imm = 0x232
jge 0x393ab
movq -0x18(%rbp), %rax
leaq (%rax,%rax,2), %rax
leaq 0x20f(,%rax,8), %rcx
andq $-0x10, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0xc30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0xc30(%rbp), %rcx
callq 0x49660
jmp 0x394c8
cmpq $0x1680, -0x18(%rbp)    # imm = 0x1680
jge 0x394ad
movq $0x0, -0xc40(%rbp)
imulq $0xf, -0x18(%rbp), %rax
sarq $0x3, %rax
subq $0x0, %rax
addq $0x272, %rax            # imm = 0x272
shlq $0x3, %rax
cmpq $0x7f00, %rax           # imm = 0x7F00
setbe %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x39429
movq -0x18(%rbp), %rax
leaq (%rax,%rax,4), %rax
leaq (%rax,%rax,2), %rcx
andq $-0x8, %rcx
addq $0x139f, %rcx           # imm = 0x139F
andq $-0x10, %rcx
movq %rsp, %rax
subq %rcx, %rax
movq %rax, %rsp
movq %rax, -0xc48(%rbp)
jmp 0x39454
imulq $0xf, -0x18(%rbp), %rsi
sarq $0x3, %rsi
subq $0x0, %rsi
addq $0x272, %rsi            # imm = 0x272
shlq $0x3, %rsi
leaq -0xc40(%rbp), %rdi
callq 0x56430
movq %rax, -0xc48(%rbp)
movq -0xc48(%rbp), %rax
movq %rax, -0xc38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0xc38(%rbp), %rcx
callq 0x47480
cmpq $0x0, -0xc40(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x394a9
movq -0xc40(%rbp), %rdi
callq 0x564a0
jmp 0x394ab
jmp 0x394c6
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
callq 0x3a1c0
jmp 0x394c8
jmp 0x394ca
jmp 0x394cc
jmp 0x394ce
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)