// File: /workspace/github_c_makefile_star2_O0/liuhaotian[P]xmppsh/libstrophe/src/snprintf.c
// Function: fmtint
static int fmtint (char *buffer, size_t *currlen, size_t maxlen,
		   long value, int base, int min, int max, int flags)
{
  int signvalue = 0;
  unsigned long uvalue;
  char convert[20];
  int place = 0;
  int spadlen = 0; /* amount to space pad */
  int zpadlen = 0; /* amount to zero pad */
  int caps = 0;
  int total = 0;
  
  if (max < 0)
    max = 0;

  uvalue = value;

  if(!(flags & DP_F_UNSIGNED))
  {
    if( value < 0 ) {
      signvalue = '-';
      uvalue = -value;
    }
    else
      if (flags & DP_F_PLUS)  /* Do a sign (+/i) */
	signvalue = '+';
    else
      if (flags & DP_F_SPACE)
	signvalue = ' ';
  }
  
  if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */

  do {
    convert[place++] =
      (caps? "0123456789ABCDEF":"0123456789abcdef")
      [uvalue % (unsigned)base  ];
    uvalue = (uvalue / (unsigned)base );
  } while(uvalue && (place < 20));
  if (place == 20) place--;
  convert[place] = 0;

  zpadlen = max - place;
  spadlen = min - MAX (max, place) - (signvalue ? 1 : 0);
  if (zpadlen < 0) zpadlen = 0;
  if (spadlen < 0) spadlen = 0;
  if (flags & DP_F_ZERO)
  {
    zpadlen = MAX(zpadlen, spadlen);
    spadlen = 0;
  }
  if (flags & DP_F_MINUS) 
    spadlen = -spadlen; /* Left Justifty */

#ifdef DEBUG_SNPRINTF
  dprint (1, (debugfile, "zpad: %d, spad: %d, min: %d, max: %d, place: %d\n",
      zpadlen, spadlen, min, max, place));
#endif

  /* Spaces */
  while (spadlen > 0) 
  {
    total += dopr_outch (buffer, currlen, maxlen, ' ');
    --spadlen;
  }

  /* Sign */
  if (signvalue) 
    total += dopr_outch (buffer, currlen, maxlen, signvalue);

  /* Zeros */
  if (zpadlen > 0) 
  {
    while (zpadlen > 0)
    {
      total += dopr_outch (buffer, currlen, maxlen, '0');
      --zpadlen;
    }
  }

  /* Digits */
  while (place > 0) 
    total += dopr_outch (buffer, currlen, maxlen, convert[--place]);
  
  /* Left Justified spaces */
  while (spadlen < 0) {
    total += dopr_outch (buffer, currlen, maxlen, ' ');
    ++spadlen;
  }

  return total;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x54(%rbp)
movl $0x0, -0x58(%rbp)
movl $0x0, -0x5c(%rbp)
movl $0x0, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
cmpl $0x0, 0x10(%rbp)
jge 0x10190
movl $0x0, 0x10(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movl 0x18(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0x101e9
cmpq $0x0, -0x20(%rbp)
jge 0x101bd
movl $0x2d, -0x2c(%rbp)
xorl %eax, %eax
subq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x101e7
movl 0x18(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x101d1
movl $0x2b, -0x2c(%rbp)
jmp 0x101e5
movl 0x18(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x101e3
movl $0x20, -0x2c(%rbp)
jmp 0x101e5
jmp 0x101e7
jmp 0x101e9
movl 0x18(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x101fb
movl $0x1, -0x60(%rbp)
jmp 0x101fd
movl -0x60(%rbp), %edx
leaq 0x4fc2(%rip), %rax      # 0x151c9
leaq 0x4faa(%rip), %rcx      # 0x151b8
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x38(%rbp), %rax
movl -0x24(%rbp), %ecx
xorl %edx, %edx
divq %rcx
movq -0x70(%rbp), %rax
movb (%rax,%rdx), %cl
movl -0x54(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x54(%rbp)
cltq
movb %cl, -0x50(%rbp,%rax)
movq -0x38(%rbp), %rax
movl -0x24(%rbp), %ecx
xorl %edx, %edx
divq %rcx
movq %rax, -0x38(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x38(%rbp)
movb %al, -0x71(%rbp)
je 0x10263
cmpl $0x14, -0x54(%rbp)
setl %al
movb %al, -0x71(%rbp)
movb -0x71(%rbp), %al
testb $0x1, %al
jne 0x101fd
cmpl $0x14, -0x54(%rbp)
jne 0x10279
movl -0x54(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x54(%rbp)
movslq -0x54(%rbp), %rax
movb $0x0, -0x50(%rbp,%rax)
movl 0x10(%rbp), %eax
subl -0x54(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x78(%rbp)
movl 0x10(%rbp), %eax
cmpl -0x54(%rbp), %eax
jl 0x102a1
movl 0x10(%rbp), %eax
movl %eax, -0x7c(%rbp)
jmp 0x102a7
movl -0x54(%rbp), %eax
movl %eax, -0x7c(%rbp)
movl -0x78(%rbp), %eax
movl -0x7c(%rbp), %ecx
subl %ecx, %eax
movl -0x2c(%rbp), %esi
xorl %ecx, %ecx
movl $0x1, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
subl %ecx, %eax
movl %eax, -0x58(%rbp)
cmpl $0x0, -0x5c(%rbp)
jge 0x102d1
movl $0x0, -0x5c(%rbp)
cmpl $0x0, -0x58(%rbp)
jge 0x102de
movl $0x0, -0x58(%rbp)
movl 0x18(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x1030c
movl -0x5c(%rbp), %eax
cmpl -0x58(%rbp), %eax
jl 0x102f9
movl -0x5c(%rbp), %eax
movl %eax, -0x80(%rbp)
jmp 0x102ff
movl -0x58(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl $0x0, -0x58(%rbp)
movl 0x18(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1031f
xorl %eax, %eax
subl -0x58(%rbp), %eax
movl %eax, -0x58(%rbp)
jmp 0x10321
cmpl $0x0, -0x58(%rbp)
jle 0x1034e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl $0x20, %ecx
callq 0x100e0
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
movl -0x58(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x10321
cmpl $0x0, -0x2c(%rbp)
je 0x10371
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x2c(%rbp), %eax
movsbl %al, %ecx
callq 0x100e0
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x5c(%rbp)
jle 0x103a8
jmp 0x10379
cmpl $0x0, -0x5c(%rbp)
jle 0x103a6
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl $0x30, %ecx
callq 0x100e0
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
movl -0x5c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x10379
jmp 0x103a8
jmp 0x103aa
cmpl $0x0, -0x54(%rbp)
jle 0x103d9
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x54(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x54(%rbp)
cltq
movsbl -0x50(%rbp,%rax), %ecx
callq 0x100e0
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
jmp 0x103aa
jmp 0x103db
cmpl $0x0, -0x58(%rbp)
jge 0x10408
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl $0x20, %ecx
callq 0x100e0
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x103db
movl -0x64(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)