// File: /workspace/github_cpp_makefile_star2_O3/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 $0x28, %rsp
testq %r9, %r9
jne 0x81f0
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %r11
cmpl $-0x1, %edx
je 0x8075
cmpl $0x1, %edx
jne 0x8233
leal 0x1(%r8), %eax
cmpl $0x3, %eax
jae 0x81f5
xorl %eax, %eax
cmpl $0x1, %r8d
movl $0x0, %edi
sbbl %edi, %edi
orl %r8d, %edi
leaq (%r14,%r14), %rcx
cmpl %edx, %edi
cmoveq %rax, %rcx
leaq -0x1(%r15), %rsi
imulq %r14, %rsi
movq %rcx, %r12
negq %r12
cmpl $0x1, %edx
cmovneq %rax, %rsi
cmovneq %rcx, %r12
addq 0x10(%rbp), %rsi
cmpl $0x1, %edi
leaq -0x1(%r14,%rsi), %r13
cmovneq %rsi, %r13
movq %r14, %rbx
imulq %r15, %rbx
addq $0x7, %rbx
movq %rbx, %rcx
shrq $0x3, %rcx
movslq (%r11), %rax
cmpq %rax, %rcx
jle 0x813a
movl %edi, -0x2c(%rbp)
cmpq $0x1, %rcx
movq %rcx, -0x38(%rbp)
adcq $0x0, %rcx
movq %rcx, -0x40(%rbp)
movq 0x8(%r11), %rdi
leaq (,%rcx,8), %rdx
xorl %esi, %esi
movq %r11, -0x48(%rbp)
callq *0x7f9e(%rip)           # 0x100a8
movq -0x48(%rbp), %r11
movq %rax, 0x8(%r11)
movq -0x40(%rbp), %rsi
movl %esi, (%r11)
movl 0x4(%r11), %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
cmpq %rdx, %rsi
jae 0x8131
movl $0x0, 0x4(%r11)
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %edi
jmp 0x813e
movq 0x8(%r11), %rax
testq %r15, %r15
je 0x81b9
movq %rcx, %rbx
movslq %edi, %rsi
negq %rsi
xorl %edx, %edx
xorl %r8d, %r8d
xorl %edi, %edi
testq %r14, %r14
je 0x8193
movq %r14, %r9
movq %r8, %rcx
movq %rdi, %r10
movzbl (%r13), %edi
leaq 0x1(%rcx), %r8
shll $0x3, %ecx
shlq %cl, %rdi
orq %r10, %rdi
cmpq $0x8, %r8
jne 0x8185
movq %rdi, (%rax,%rdx,8)
incq %rdx
xorl %edi, %edi
xorl %r8d, %r8d
addq %rsi, %r13
movq %r8, %rcx
movq %rdi, %r10
decq %r9
jne 0x8161
addq %r12, %r13
decq %r15
jne 0x8153
cmpq $0x1, %r8
movq %rdx, %rcx
sbbq $-0x1, %rcx
cmpq %rbx, %rcx
jne 0x8214
testq %rdi, %rdi
je 0x81d4
movq %rdi, (%rax,%rdx,8)
incq %rdx
jmp 0x81c1
cmpq $0x8, %rbx
jae 0x8214
xorl %edx, %edx
movl %edx, 0x4(%r11)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %rdx, %rdx
jle 0x81c1
cmpq $0x0, -0x8(%rax,%rdx,8)
jne 0x81c1
leaq -0x1(%rdx), %rcx
cmpq $0x1, %rdx
movq %rcx, %rdx
jg 0x81d9
jmp 0x81bf
callq 0x1248
leaq 0x2749(%rip), %rdi      # 0xa945
leaq 0x1e61(%rip), %rsi      # 0xa064
leaq 0x26eb(%rip), %rcx      # 0xa8f5
movl $0x1090, %edx           # imm = 0x1090
callq 0x1090
leaq 0x2746(%rip), %rdi      # 0xa961
leaq 0x1e42(%rip), %rsi      # 0xa064
leaq 0x26cc(%rip), %rcx      # 0xa8f5
movl $0x10b6, %edx           # imm = 0x10B6
callq 0x1090
leaq 0x26a1(%rip), %rdi      # 0xa8db
leaq 0x1e23(%rip), %rsi      # 0xa064
leaq 0x26ad(%rip), %rcx      # 0xa8f5
movl $0x108f, %edx           # imm = 0x108F
callq 0x1090