// File: /workspace/github_cpp_makefile_star2_O1/marxn[P]pupp/3rdparty/gmp/./mini-gmp/mini-gmp.c
// Function: mpz_import
void
mpz_import (mpz_t r, size_t count, int order, size_t size, int endian,
	    size_t nails, const void *src)
{
  const unsigned char *p;
  ptrdiff_t word_step;
  mp_ptr rp;
  mp_size_t rn;

  /* The current (partial) limb. */
  mp_limb_t limb;
  /* The number of bytes already copied to this limb (starting from
     the low end). */
  size_t bytes;
  /* The index where the limb should be stored, when completed. */
  mp_size_t i;

  if (nails != 0)
    gmp_die ("mpz_import: Nails not supported.");

  assert (order == 1 || order == -1);
  assert (endian >= -1 && endian <= 1);

  if (endian == 0)
    endian = gmp_detect_endian ();

  p = (unsigned char *) src;

  word_step = (order != endian) ? 2 * size : 0;

  /* Process bytes from the least significant end, so point p at the
     least significant word. */
  if (order == 1)
    {
      p += size * (count - 1);
      word_step = - word_step;
    }

  /* And at least significant byte of that word. */
  if (endian == 1)
    p += (size - 1);

  rn = (size * count + sizeof(mp_limb_t) - 1) / sizeof(mp_limb_t);
  rp = MPZ_REALLOC (r, rn);

  for (limb = 0, bytes = 0, i = 0; count > 0; count--, p += word_step)
    {
      size_t j;
      for (j = 0; j < size; j++, p -= (ptrdiff_t) endian)
	{
	  limb |= (mp_limb_t) *p << (bytes++ * CHAR_BIT);
	  if (bytes == sizeof(mp_limb_t))
	    {
	      rp[i++] = limb;
	      bytes = 0;
	      limb = 0;
	    }
	}
    }
  assert (i + (bytes > 0) == rn);
  if (limb != 0)
    rp[i++] = limb;
  else
    i = mpn_normalized_size (rp, i);

  r->_mp_size = i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %r9, %r9
jne 0x8356
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %r11
cmpl $-0x1, %edx
je 0x81dc
cmpl $0x1, %edx
jne 0x8399
leal 0x1(%r8), %eax
cmpl $0x3, %eax
jae 0x835b
xorl %eax, %eax
cmpl $0x1, %r8d
movl $0x0, %r12d
sbbl %r12d, %r12d
orl %r8d, %r12d
leaq (%r14,%r14), %rcx
cmpl %edx, %r12d
cmoveq %rax, %rcx
leaq -0x1(%r15), %rsi
imulq %r14, %rsi
movq %rcx, %r13
negq %r13
cmpl $0x1, %edx
cmovneq %rax, %rsi
cmovneq %rcx, %r13
addq 0x10(%rbp), %rsi
cmpl $0x1, %r12d
leaq -0x1(%r14,%rsi), %rbx
cmovneq %rsi, %rbx
movq %r14, %rdi
imulq %r15, %rdi
addq $0x7, %rdi
shrq $0x3, %rdi
movslq (%r11), %rax
cmpq %rax, %rdi
movq %rdi, -0x30(%rbp)
jle 0x82a1
cmpq $0x2, %rdi
movl $0x1, %eax
cmovgeq %rdi, %rax
movq %rax, -0x38(%rbp)
movq 0x8(%r11), %rdi
leaq (,%rax,8), %rdx
xorl %esi, %esi
movq %r11, -0x40(%rbp)
callq *0x7e34(%rip)           # 0x100a8
movq -0x40(%rbp), %r11
movq %rax, 0x8(%r11)
movq -0x38(%rbp), %rsi
movl %esi, (%r11)
movl 0x4(%r11), %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
cmpq %rdx, %rsi
jae 0x829b
movl $0x0, 0x4(%r11)
movq -0x30(%rbp), %rdi
jmp 0x82a5
movq 0x8(%r11), %rax
testq %r15, %r15
je 0x830b
movslq %r12d, %rdi
negq %rdi
xorl %edx, %edx
xorl %r8d, %r8d
xorl %esi, %esi
testq %r14, %r14
je 0x82f5
movq %r14, %r9
movq %r8, %rcx
movq %rsi, %r10
movzbl (%rbx), %esi
leaq 0x1(%rcx), %r8
shll $0x3, %ecx
shlq %cl, %rsi
orq %r10, %rsi
cmpq $0x8, %r8
jne 0x82e7
movq %rsi, (%rax,%rdx,8)
incq %rdx
xorl %esi, %esi
xorl %r8d, %r8d
addq %rdi, %rbx
movq %r8, %rcx
movq %rsi, %r10
decq %r9
jne 0x82c5
addq %r13, %rbx
decq %r15
jne 0x82b7
xorl %ecx, %ecx
testq %r8, %r8
setne %cl
movq -0x30(%rbp), %rdi
jmp 0x8311
xorl %esi, %esi
xorl %ecx, %ecx
xorl %edx, %edx
addq %rdx, %rcx
cmpq %rdi, %rcx
jne 0x837a
testq %rsi, %rsi
je 0x8338
movq %rsi, (%rax,%rdx,8)
incq %rdx
movl %edx, 0x4(%r11)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %rdx, %rdx
jle 0x8325
cmpq $0x0, -0x8(%rax,%rdx,8)
jne 0x8325
leaq -0x1(%rdx), %rcx
cmpq $0x1, %rdx
movq %rcx, %rdx
jg 0x833d
xorl %edx, %edx
jmp 0x8325
callq 0x1248
leaq 0x25e3(%rip), %rdi      # 0xa945
leaq 0x1cfb(%rip), %rsi      # 0xa064
leaq 0x2585(%rip), %rcx      # 0xa8f5
movl $0x1090, %edx           # imm = 0x1090
callq 0x1090
leaq 0x25e0(%rip), %rdi      # 0xa961
leaq 0x1cdc(%rip), %rsi      # 0xa064
leaq 0x2566(%rip), %rcx      # 0xa8f5
movl $0x10b6, %edx           # imm = 0x10B6
callq 0x1090
leaq 0x253b(%rip), %rdi      # 0xa8db
leaq 0x1cbd(%rip), %rsi      # 0xa064
leaq 0x2547(%rip), %rcx      # 0xa8f5
movl $0x108f, %edx           # imm = 0x108F
callq 0x1090