// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %r9, %r9
jne 0x7436
movq %rcx, %r14
movl %edx, %r10d
cmpl $-0x1, %edx
je 0x72bc
cmpl $0x1, %r10d
jne 0x7461
leal 0x1(%r8), %eax
cmpl $0x3, %eax
jae 0x7442
movq 0x10(%rbp), %rbx
movl 0x4(%rbx), %eax
testq %r14, %r14
je 0x7411
testl %eax, %eax
je 0x7419
movl %eax, %r13d
negl %r13d
cmovsl %eax, %r13d
movq 0x8(%rbx), %rax
movq -0x8(%rax,%r13,8), %rcx
testq %rcx, %rcx
je 0x7480
movq %rsi, -0x40(%rbp)
leaq (%r14,%r13,8), %rax
addq $-0x9, %rax
movq %rcx, %rdx
shrq $0x8, %rdx
incq %rax
cmpq $0xff, %rcx
movq %rdx, %rcx
ja 0x730c
xorl %r12d, %r12d
xorl %edx, %edx
divq %r14
movq %rax, %r15
testq %rdi, %rdi
jne 0x734f
movq %r15, %rdi
imulq %r14, %rdi
movl %r10d, -0x2c(%rbp)
movq %r8, -0x38(%rbp)
callq *0x7d54(%rip)           # 0xf098
movq -0x38(%rbp), %r8
movl -0x2c(%rbp), %r10d
movq %rax, %rdi
cmpl $0x1, %r8d
movl $0x0, %edx
sbbl %edx, %edx
orl %r8d, %edx
leaq (%r14,%r14), %rcx
cmpl %r10d, %edx
cmoveq %r12, %rcx
leaq -0x1(%r15), %rsi
imulq %r14, %rsi
movq %rcx, %rax
negq %rax
cmpl $0x1, %r10d
cmovneq %r12, %rsi
cmovneq %rcx, %rax
addq %rdi, %rsi
cmpl $0x1, %edx
leaq -0x1(%r14,%rsi), %rcx
cmovneq %rsi, %rcx
movslq %edx, %rdx
negq %rdx
pushq $0x8
popq %rsi
xorl %r9d, %r9d
xorl %r10d, %r10d
xorl %r8d, %r8d
cmpq %r15, %r12
jae 0x73e0
movq %r14, %r11
subq $0x1, %r11
jb 0x73d8
testq %r10, %r10
jne 0x73c9
cmpq %r13, %r8
jge 0x73c6
movq 0x8(%rbx), %r9
movq (%r9,%r8,8), %r9
incq %r8
movq %rsi, %r10
movb %r9b, (%rcx)
shrq $0x8, %r9
decq %r10
addq %rdx, %rcx
jmp 0x73ab
incq %r12
addq %rax, %rcx
jmp 0x73a3
cmpq %r13, %r8
jne 0x749f
cmpq %r15, %r12
movq -0x40(%rbp), %rsi
je 0x741c
leaq 0x2600(%rip), %rdi      # 0x99f9
leaq 0x1c64(%rip), %rsi      # 0x9064
leaq 0x2570(%rip), %rcx      # 0x9977
movl $0x110f, %edx           # imm = 0x110F
callq 0x1090
testl %eax, %eax
jne 0x74be
xorl %r15d, %r15d
testq %rsi, %rsi
je 0x7424
movq %r15, (%rsi)
movq %rdi, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x247d(%rip), %rdi      # 0x98ba
callq 0x4fde
leaq 0x24fc(%rip), %rdi      # 0x9945
leaq 0x1c14(%rip), %rsi      # 0x9064
leaq 0x2520(%rip), %rcx      # 0x9977
movl $0x10ca, %edx           # imm = 0x10CA
callq 0x1090
leaq 0x2473(%rip), %rdi      # 0x98db
leaq 0x1bf5(%rip), %rsi      # 0x9064
leaq 0x2501(%rip), %rcx      # 0x9977
movl $0x10c9, %edx           # imm = 0x10C9
callq 0x1090
leaq 0x2560(%rip), %rdi      # 0x99e7
leaq 0x1bd6(%rip), %rsi      # 0x9064
leaq 0x24e2(%rip), %rcx      # 0x9977
movl $0x10df, %edx           # imm = 0x10DF
callq 0x1090
leaq 0x254b(%rip), %rdi      # 0x99f1
leaq 0x1bb7(%rip), %rsi      # 0x9064
leaq 0x24c3(%rip), %rcx      # 0x9977
movl $0x110e, %edx           # imm = 0x110E
callq 0x1090
leaq 0x2505(%rip), %rdi      # 0x99ca
leaq 0x1b98(%rip), %rsi      # 0x9064
leaq 0x24a4(%rip), %rcx      # 0x9977
movl $0x10cb, %edx           # imm = 0x10CB
callq 0x1090