// File: marxn[P]pupp/3rdparty/gmp/./mini-gmp/mini-gmp.c
// Function: mpz_export
void *
mpz_export (void *r, size_t *countp, int order, size_t size, int endian,
	    size_t nails, const mpz_t u)
{
  size_t count;
  mp_size_t un;

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

  assert (order == 1 || order == -1);
  assert (endian >= -1 && endian <= 1);
  assert (size > 0 || u->_mp_size == 0);

  un = u->_mp_size;
  count = 0;
  if (un != 0)
    {
      size_t k;
      unsigned char *p;
      ptrdiff_t word_step;
      /* The current (partial) limb. */
      mp_limb_t limb;
      /* The number of bytes left to to in this limb. */
      size_t bytes;
      /* The index where the limb was read. */
      mp_size_t i;

      un = GMP_ABS (un);

      /* Count bytes in top limb. */
      limb = u->_mp_d[un-1];
      assert (limb != 0);

      k = 0;
      do {
	k++; limb >>= CHAR_BIT;
      } while (limb != 0);

      count = (k + (un-1) * sizeof (mp_limb_t) + size - 1) / size;

      if (!r)
	r = gmp_xalloc (count * size);

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

      p = (unsigned char *) r;

      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);

      for (bytes = 0, i = 0, k = 0; k < count; k++, p += word_step)
	{
	  size_t j;
	  for (j = 0; j < size; j++, p -= (ptrdiff_t) endian)
	    {
	      if (bytes == 0)
		{
		  if (i < un)
		    limb = u->_mp_d[i++];
		  bytes = sizeof (mp_limb_t);
		}
	      *p = limb;
	      limb >>= CHAR_BIT;
	      bytes--;
	    }
	}
      assert (i == un);
      assert (k == count);
    }

  if (countp)
    *countp = count;

  return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %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 0xb059
leaq 0x38e7(%rip), %rdi      # 0xe93b
callq 0x7b50
cmpl $0x1, -0x14(%rbp)
je 0xb065
cmpl $-0x1, -0x14(%rbp)
jne 0xb067
jmp 0xb086
leaq 0x38ee(%rip), %rdi      # 0xe95c
leaq 0x305f(%rip), %rsi      # 0xe0d4
movl $0x10c9, %edx           # imm = 0x10C9
leaq 0x3977(%rip), %rcx      # 0xe9f8
callq 0x1070
cmpl $-0x1, -0x24(%rbp)
jl 0xb094
cmpl $0x1, -0x24(%rbp)
jg 0xb094
jmp 0xb0b3
leaq 0x392b(%rip), %rdi      # 0xe9c6
leaq 0x3032(%rip), %rsi      # 0xe0d4
movl $0x10ca, %edx           # imm = 0x10CA
leaq 0x394a(%rip), %rcx      # 0xe9f8
callq 0x1070
cmpq $0x0, -0x20(%rbp)
ja 0xb0c4
movq 0x10(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jne 0xb0c6
jmp 0xb0e5
leaq 0x397e(%rip), %rdi      # 0xea4b
leaq 0x3000(%rip), %rsi      # 0xe0d4
movl $0x10cb, %edx           # imm = 0x10CB
leaq 0x3918(%rip), %rcx      # 0xe9f8
callq 0x1070
movq 0x10(%rbp), %rax
movslq 0x4(%rax), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x38(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0xb388
cmpq $0x0, -0x40(%rbp)
jl 0xb115
movq -0x40(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0xb11f
xorl %eax, %eax
subq -0x40(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x40(%rbp)
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x40(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0xb148
jmp 0xb167
leaq 0x3919(%rip), %rdi      # 0xea68
leaq 0x2f7e(%rip), %rsi      # 0xe0d4
movl $0x10df, %edx           # imm = 0x10DF
leaq 0x3896(%rip), %rcx      # 0xe9f8
callq 0x1070
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x60(%rbp), %rax
shrq $0x8, %rax
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0xb16f
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
subq $0x1, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
addq -0x20(%rbp), %rax
subq $0x1, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x20(%rbp)
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0xb1d2
movq 0x7ec5(%rip), %rax      # 0x13088
movq -0x38(%rbp), %rdi
imulq -0x20(%rbp), %rdi
callq *%rax
movq %rax, -0x8(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0xb1e0
callq 0xb000
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x24(%rbp), %eax
je 0xb200
movq -0x20(%rbp), %rax
shlq %rax
movq %rax, -0x88(%rbp)
jmp 0xb20b
xorl %eax, %eax
movq %rax, -0x88(%rbp)
jmp 0xb20b
movq -0x88(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpl $0x1, -0x14(%rbp)
jne 0xb23e
movq -0x20(%rbp), %rax
movq -0x38(%rbp), %rcx
subq $0x1, %rcx
imulq %rcx, %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
xorl %eax, %eax
subq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpl $0x1, -0x24(%rbp)
jne 0xb254
movq -0x20(%rbp), %rax
subq $0x1, %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0xb330
movq $0x0, -0x78(%rbp)
movq -0x78(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0xb311
cmpq $0x0, -0x68(%rbp)
jne 0xb2c8
movq -0x70(%rbp), %rax
cmpq -0x40(%rbp), %rax
jge 0xb2c0
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x70(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x70(%rbp)
movq (%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
movq $0x8, -0x68(%rbp)
movq -0x60(%rbp), %rax
movb %al, %cl
movq -0x50(%rbp), %rax
movb %cl, (%rax)
movq -0x60(%rbp), %rax
shrq $0x8, %rax
movq %rax, -0x60(%rbp)
movq -0x68(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x68(%rbp)
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
movslq -0x24(%rbp), %rdx
movq -0x50(%rbp), %rax
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
jmp 0xb282
jmp 0xb313
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x58(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0xb26c
movq -0x70(%rbp), %rax
cmpq -0x40(%rbp), %rax
jne 0xb33c
jmp 0xb35b
leaq 0x372f(%rip), %rdi      # 0xea72
leaq 0x2d8a(%rip), %rsi      # 0xe0d4
movl $0x110e, %edx           # imm = 0x110E
leaq 0x36a2(%rip), %rcx      # 0xe9f8
callq 0x1070
movq -0x48(%rbp), %rax
cmpq -0x38(%rbp), %rax
jne 0xb367
jmp 0xb386
leaq 0x370c(%rip), %rdi      # 0xea7a
leaq 0x2d5f(%rip), %rsi      # 0xe0d4
movl $0x110f, %edx           # imm = 0x110F
leaq 0x3677(%rip), %rcx      # 0xe9f8
callq 0x1070
jmp 0xb388
cmpq $0x0, -0x10(%rbp)
je 0xb39a
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)