// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_printf.c
// Function: ntoa_format
static size_t _ntoa_format(out_fct_type out, char* buffer, size_t idx, size_t maxlen, char* buf, size_t len, bool negative, unsigned int base, unsigned int prec, unsigned int width, unsigned int flags)
{
  // pad leading zeros
  if (!(flags & FLAGS_LEFT)) {
    if (width && (flags & FLAGS_ZEROPAD) && (negative || (flags & (FLAGS_PLUS | FLAGS_SPACE)))) {
      width--;
    }
    while ((len < prec) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
      buf[len++] = '0';
    }
    while ((flags & FLAGS_ZEROPAD) && (len < width) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
      buf[len++] = '0';
    }
  }

  // handle hash
  if (flags & FLAGS_HASH) {
    if (!(flags & FLAGS_PRECISION) && len && ((len == prec) || (len == width))) {
      len--;
      if (len && (base == 16U)) {
        len--;
      }
    }
    if ((base == 16U) && !(flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
      buf[len++] = 'x';
    }
    else if ((base == 16U) && (flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
      buf[len++] = 'X';
    }
    else if ((base == 2U) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
      buf[len++] = 'b';
    }
    if (len < PRINTF_NTOA_BUFFER_SIZE) {
      buf[len++] = '0';
    }
  }

  if (len < PRINTF_NTOA_BUFFER_SIZE) {
    if (negative) {
      buf[len++] = '-';
    }
    else if (flags & FLAGS_PLUS) {
      buf[len++] = '+';  // ignore the space if the '+' exists
    }
    else if (flags & FLAGS_SPACE) {
      buf[len++] = ' ';
    }
  }

  return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl 0x30(%rbp), %eax
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movb 0x10(%rbp), %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
andb $0x1, %al
movb %al, -0x31(%rbp)
movl 0x30(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x49ef4
cmpl $0x0, 0x28(%rbp)
je 0x49e5e
movl 0x30(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x49e5e
testb $0x1, -0x31(%rbp)
jne 0x49e55
movl 0x30(%rbp), %eax
andl $0xc, %eax
cmpl $0x0, %eax
je 0x49e5e
movl 0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, 0x28(%rbp)
jmp 0x49e60
movq -0x30(%rbp), %rcx
movl 0x20(%rbp), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x32(%rbp)
jae 0x49e7e
cmpq $0x20, -0x30(%rbp)
setb %al
movb %al, -0x32(%rbp)
movb -0x32(%rbp), %al
testb $0x1, %al
jne 0x49e87
jmp 0x49ea0
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb $0x30, (%rax,%rcx)
jmp 0x49e60
jmp 0x49ea2
movl 0x30(%rbp), %ecx
andl $0x1, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x33(%rbp)
je 0x49ed0
movq -0x30(%rbp), %rcx
movl 0x28(%rbp), %eax
movl %eax, %edx
xorl %eax, %eax
cmpq %rdx, %rcx
movb %al, -0x33(%rbp)
jae 0x49ed0
cmpq $0x20, -0x30(%rbp)
setb %al
movb %al, -0x33(%rbp)
movb -0x33(%rbp), %al
testb $0x1, %al
jne 0x49ed9
jmp 0x49ef2
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb $0x30, (%rax,%rcx)
jmp 0x49ea2
jmp 0x49ef4
movl 0x30(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x4a000
movl 0x30(%rbp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
jne 0x49f56
cmpq $0x0, -0x30(%rbp)
je 0x49f56
movq -0x30(%rbp), %rax
movl 0x20(%rbp), %ecx
cmpq %rcx, %rax
je 0x49f2f
movq -0x30(%rbp), %rax
movl 0x28(%rbp), %ecx
cmpq %rcx, %rax
jne 0x49f56
movq -0x30(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x49f54
cmpl $0x10, 0x18(%rbp)
jne 0x49f54
movq -0x30(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x49f56
cmpl $0x10, 0x18(%rbp)
jne 0x49f87
movl 0x30(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
jne 0x49f87
cmpq $0x20, -0x30(%rbp)
jae 0x49f87
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb $0x78, (%rax,%rcx)
jmp 0x49fe0
cmpl $0x10, 0x18(%rbp)
jne 0x49fb8
movl 0x30(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x49fb8
cmpq $0x20, -0x30(%rbp)
jae 0x49fb8
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb $0x58, (%rax,%rcx)
jmp 0x49fde
cmpl $0x2, 0x18(%rbp)
jne 0x49fdc
cmpq $0x20, -0x30(%rbp)
jae 0x49fdc
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb $0x62, (%rax,%rcx)
jmp 0x49fde
jmp 0x49fe0
cmpq $0x20, -0x30(%rbp)
jae 0x49ffe
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb $0x30, (%rax,%rcx)
jmp 0x4a000
cmpq $0x20, -0x30(%rbp)
jae 0x4a072
testb $0x1, -0x31(%rbp)
je 0x4a026
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb $0x2d, (%rax,%rcx)
jmp 0x4a070
movl 0x30(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x4a04a
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb $0x2b, (%rax,%rcx)
jmp 0x4a06e
movl 0x30(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x4a06c
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb $0x20, (%rax,%rcx)
jmp 0x4a06e
jmp 0x4a070
jmp 0x4a072
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
movl 0x28(%rbp), %r10d
movl 0x30(%rbp), %eax
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x4a0b0
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)