// File: /workspace/github_cpp_makefile_star2_O2/marxn[P]pupp/3rdparty/gmp/printf/doprnti.c
// Function: _gmp_doprnt_integer
int
__gmp_doprnt_integer (const struct doprnt_funs_t *funs,
		      void *data,
		      const struct doprnt_params_t *p,
		      const char *s)
{
  int         retval = 0;
  int         slen, justlen, showbaselen, sign, signlen, slashlen, zeros;
  int         justify, den_showbaselen;
  const char  *slash, *showbase;

  /* '+' or ' ' if wanted, and don't already have '-' */
  sign = p->sign;
  if (s[0] == '-')
    {
      sign = s[0];
      s++;
    }
  signlen = (sign != '\0');

  /* if the precision was explicitly 0, print nothing for a 0 value */
  if (*s == '0' && p->prec == 0)
    s++;

  slen = strlen (s);
  slash = strchr (s, '/');

  showbase = NULL;
  showbaselen = 0;

  if (p->showbase != DOPRNT_SHOWBASE_NO)
    {
      switch (p->base) {
      case 16:  showbase = "0x"; showbaselen = 2; break;
      case -16: showbase = "0X"; showbaselen = 2; break;
      case 8:   showbase = "0";  showbaselen = 1; break;
      }
    }

  den_showbaselen = showbaselen;
  if (slash == NULL
      || (p->showbase == DOPRNT_SHOWBASE_NONZERO && slash[1] == '0'))
    den_showbaselen = 0;

  if (p->showbase == DOPRNT_SHOWBASE_NONZERO && s[0] == '0')
    showbaselen = 0;

  /* the influence of p->prec on mpq is currently undefined */
  zeros = MAX (0, p->prec - slen);

  /* space left over after actual output length */
  justlen = p->width
    - (strlen(s) + signlen + showbaselen + den_showbaselen + zeros);

  justify = p->justify;
  if (justlen <= 0) /* no justifying if exceed width */
    justify = DOPRNT_JUSTIFY_NONE;

  if (justify == DOPRNT_JUSTIFY_RIGHT)             /* pad right */
    DOPRNT_REPS (p->fill, justlen);

  DOPRNT_REPS_MAYBE (sign, signlen);               /* sign */

  DOPRNT_MEMORY_MAYBE (showbase, showbaselen);     /* base */

  DOPRNT_REPS_MAYBE ('0', zeros);                  /* zeros */

  if (justify == DOPRNT_JUSTIFY_INTERNAL)          /* pad internal */
    DOPRNT_REPS (p->fill, justlen);

  /* if there's a showbase on the denominator, then print the numerator
     separately so it can be inserted */
  if (den_showbaselen != 0)
    {
      ASSERT (slash != NULL);
      slashlen = slash+1 - s;
      DOPRNT_MEMORY (s, slashlen);                 /* numerator and slash */
      slen -= slashlen;
      s += slashlen;
      DOPRNT_MEMORY (showbase, den_showbaselen);
    }

  DOPRNT_MEMORY (s, slen);                         /* number, or denominator */

  if (justify == DOPRNT_JUSTIFY_LEFT)              /* pad left */
    DOPRNT_REPS (p->fill, justlen);

 done:
  return retval;

 error:
  retval = -1;
  goto done;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %r15
movq %rsi, 0x18(%rsp)
movq %rdi, 0x20(%rsp)
xorl %eax, %eax
cmpb $0x2d, (%rcx)
sete %dl
je 0x2ce7b
movl 0x2c(%r15), %ebx
jmp 0x2ce7e
pushq $0x2d
popq %rbx
movb %dl, %al
leaq (%rcx,%rax), %r14
testb %bl, %bl
setne 0xf(%rsp)
cmpb $0x30, (%rcx,%rax)
jne 0x2ce9a
cmpl $0x1, 0x1c(%r15)
adcq $0x0, %r14
movq %r14, %rdi
callq 0x6110
movq %rax, %r13
pushq $0x2f
popq %rsi
movq %r14, %rdi
callq 0x60f0
movl 0x20(%r15), %edx
movq $0x0, 0x10(%rsp)
cmpl $0x2, %edx
movq %r14, 0x50(%rsp)
jne 0x2ced6
xorl %esi, %esi
movq $0x0, 0x28(%rsp)
xorl %ebp, %ebp
jmp 0x2cf45
movl (%r15), %ecx
cmpl $-0x10, %ecx
je 0x2cf00
cmpl $0x8, %ecx
je 0x2cef4
cmpl $0x10, %ecx
jne 0x2cf11
pushq $0x2
popq %rbp
leaq 0x797c(%rip), %rcx      # 0x3486e
jmp 0x2cf0a
pushq $0x1
popq %rbp
leaq 0x7065(%rip), %rcx      # 0x33f63
jmp 0x2cf0a
pushq $0x2
popq %rbp
leaq 0x7967(%rip), %rcx      # 0x34871
movq %rcx, 0x28(%rsp)
jmp 0x2cf1c
movq $0x0, 0x28(%rsp)
xorl %ebp, %ebp
testq %rax, %rax
je 0x2cf31
cmpl $0x3, %edx
jne 0x2cf43
xorl %esi, %esi
cmpb $0x30, 0x1(%rax)
cmovnel %ebp, %esi
jmp 0x2cf38
xorl %esi, %esi
cmpl $0x3, %edx
jne 0x2cf45
xorl %ecx, %ecx
cmpb $0x30, (%r14)
cmovel %ecx, %ebp
jmp 0x2cf45
movl %ebp, %esi
movq %rax, 0x38(%rsp)
movl 0x1c(%r15), %r12d
subl %r13d, %r12d
testl %r12d, %r12d
movq %r13, %rcx
movl $0x0, %r13d
cmovgl %r12d, %r13d
movl %ebx, %eax
negb %al
movl $0x0, %r14d
sbbl %r14d, %r14d
movq %rcx, 0x40(%rsp)
subl %ecx, %r14d
movq %rsi, 0x48(%rsp)
leal (%rsi,%rbp), %eax
addl 0x30(%r15), %r14d
addl %r13d, %eax
subl %eax, %r14d
movl $0x0, %eax
testl %r14d, %r14d
jle 0x2cf96
movl 0x18(%r15), %eax
movl %eax, 0x34(%rsp)
cmpl $0x2, %eax
jne 0x2cfc2
movsbl 0x14(%r15), %esi
movq 0x18(%rsp), %rdi
movl %r14d, %edx
movq 0x20(%rsp), %rax
callq *0x10(%rax)
movq %rax, 0x10(%rsp)
cmpl $-0x1, %eax
je 0x2d134
testb %bl, %bl
je 0x2cff0
movsbl %bl, %esi
xorl %edx, %edx
movb 0xf(%rsp), %al
movb %al, %dl
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rax
callq *0x10(%rax)
cmpl $-0x1, %eax
je 0x2d134
addl 0x10(%rsp), %eax
movq %rax, 0x10(%rsp)
movl %ebp, %edx
testq %rdx, %rdx
je 0x2d01b
movq 0x18(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rax
callq *0x8(%rax)
cmpl $-0x1, %eax
je 0x2d134
addl 0x10(%rsp), %eax
movq %rax, 0x10(%rsp)
testl %r12d, %r12d
jle 0x2d045
pushq $0x30
popq %rsi
movq 0x18(%rsp), %rdi
movl %r13d, %edx
movq 0x20(%rsp), %rax
callq *0x10(%rax)
cmpl $-0x1, %eax
je 0x2d134
addl 0x10(%rsp), %eax
movq %rax, 0x10(%rsp)
cmpl $0x3, 0x34(%rsp)
jne 0x2d073
movsbl 0x14(%r15), %esi
movq 0x18(%rsp), %rdi
movl %r14d, %edx
movq 0x20(%rsp), %rax
callq *0x10(%rax)
cmpl $-0x1, %eax
je 0x2d134
addl 0x10(%rsp), %eax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rax
movl %eax, %r13d
testq %r13, %r13
movq 0x50(%rsp), %rsi
je 0x2d0ef
movq 0x38(%rsp), %rax
subq %rsi, %rax
incq %rax
movq %rax, 0x38(%rsp)
movslq %eax, %rdx
movq 0x18(%rsp), %rdi
movq %rsi, %r12
movq %rdx, %rbp
movq 0x20(%rsp), %rax
callq *0x8(%rax)
cmpl $-0x1, %eax
je 0x2d134
movl %eax, %ebx
movq 0x18(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %r13, %rdx
movq 0x20(%rsp), %rax
callq *0x8(%rax)
cmpl $-0x1, %eax
je 0x2d134
addl 0x10(%rsp), %ebx
movq 0x40(%rsp), %rcx
subq 0x38(%rsp), %rcx
movq %r12, %rsi
addq %rbp, %rsi
addl %eax, %ebx
movl %ebx, %eax
movq %rax, 0x10(%rsp)
jmp 0x2d0f4
movq 0x40(%rsp), %rcx
movslq %ecx, %rdx
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rax
callq *0x8(%rax)
cmpl $-0x1, %eax
je 0x2d134
movl %eax, %ebx
addl 0x10(%rsp), %ebx
cmpl $0x1, 0x34(%rsp)
jne 0x2d137
movsbl 0x14(%r15), %esi
movq 0x18(%rsp), %rdi
movl %r14d, %edx
movq 0x20(%rsp), %rax
callq *0x10(%rax)
cmpl $-0x1, %eax
je 0x2d134
addl %eax, %ebx
jmp 0x2d137
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq