// File: 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
subq $0x80, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xad79
leaq 0x3bc7(%rip), %rdi      # 0xe93b
callq 0x7b50
cmpl $0x1, -0x14(%rbp)
je 0xad85
cmpl $-0x1, -0x14(%rbp)
jne 0xad87
jmp 0xada6
leaq 0x3bce(%rip), %rdi      # 0xe95c
leaq 0x333f(%rip), %rsi      # 0xe0d4
movl $0x108f, %edx           # imm = 0x108F
leaq 0x3bd5(%rip), %rcx      # 0xe976
callq 0x1070
cmpl $-0x1, -0x24(%rbp)
jl 0xadb4
cmpl $0x1, -0x24(%rbp)
jg 0xadb4
jmp 0xadd3
leaq 0x3c0b(%rip), %rdi      # 0xe9c6
leaq 0x3312(%rip), %rsi      # 0xe0d4
movl $0x1090, %edx           # imm = 0x1090
leaq 0x3ba8(%rip), %rcx      # 0xe976
callq 0x1070
cmpl $0x0, -0x24(%rbp)
jne 0xade1
callq 0xb000
movl %eax, -0x24(%rbp)
movq 0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x24(%rbp), %eax
je 0xadfe
movq -0x20(%rbp), %rax
shlq %rax
movq %rax, -0x78(%rbp)
jmp 0xae06
xorl %eax, %eax
movq %rax, -0x78(%rbp)
jmp 0xae06
movq -0x78(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpl $0x1, -0x14(%rbp)
jne 0xae36
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
subq $0x1, %rcx
imulq %rcx, %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
xorl %eax, %eax
subq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpl $0x1, -0x24(%rbp)
jne 0xae4c
movq -0x20(%rbp), %rax
subq $0x1, %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
imulq -0x10(%rbp), %rax
addq $0x8, %rax
subq $0x1, %rax
shrq $0x3, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x8(%rbp), %rcx
movslq (%rcx), %rcx
cmpq %rcx, %rax
jle 0xae88
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x3440
movq %rax, -0x80(%rbp)
jmp 0xae94
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
cmpq $0x0, -0x10(%rbp)
jbe 0xaf6e
movq $0x0, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0xaf4f
movq -0x38(%rbp), %rax
movzbl (%rax), %eax
movq -0x60(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x60(%rbp)
shlq $0x3, %rcx
shlq %cl, %rax
orq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x8, -0x60(%rbp)
jne 0xaf28
movq -0x58(%rbp), %rdx
movq -0x48(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x68(%rbp)
movq %rdx, (%rax,%rcx,8)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x58(%rbp)
jmp 0xaf2a
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
movslq -0x24(%rbp), %rdx
movq -0x38(%rbp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
jmp 0xaec7
jmp 0xaf51
movq -0x10(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x10(%rbp)
movq -0x40(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0xaeb4
movq -0x68(%rbp), %rax
cmpq $0x0, -0x60(%rbp)
seta %cl
andb $0x1, %cl
movzbl %cl, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
cmpq -0x50(%rbp), %rax
jne 0xaf8e
jmp 0xafad
leaq 0x3a4d(%rip), %rdi      # 0xe9e2
leaq 0x3138(%rip), %rsi      # 0xe0d4
movl $0x10b6, %edx           # imm = 0x10B6
leaq 0x39ce(%rip), %rcx      # 0xe976
callq 0x1070
cmpq $0x0, -0x58(%rbp)
je 0xafd1
movq -0x58(%rbp), %rdx
movq -0x48(%rbp), %rax
movq -0x68(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x68(%rbp)
movq %rdx, (%rax,%rcx,8)
jmp 0xafe2
movq -0x48(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x14d0
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)