user: 请从给定的汇编指令推导出C源代码:

```asm
<fmtint>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%r12
  mov    %rsi,%r13
  mov    %rdx,%r14
  mov    0x70(%rsp),%ebp
  mov    0x78(%rsp),%r11d
  mov    %fs:0x28,%rdx
  mov    %rdx,0x28(%rsp)
  xor    %edx,%edx
  test   %ebp,%ebp
  cmovs  %edx,%ebp
  mov    %rcx,%rsi
  movl   $0x0,0xc(%rsp)
  test   $0x40,%r11b
  jne    L184
  mov    %rcx,%rax
  test   %rcx,%rcx
  js     L45
  movl   $0x2b,0xc(%rsp)
  test   $0x2,%r11b
  jne    L184
  lea    0x0(,%r11,8),%eax
  and    $0x20,%eax
  mov    %eax,0xc(%rsp)
  jmp    L184
L45:
  neg    %rax
  mov    %rax,%rsi
  movl   $0x2d,0xc(%rsp)
L184:
  test   $0x20,%r11b
  lea    D14(%rip),%rdi
  lea    D9(%rip),%rax
  cmove  %rax,%rdi
  mov    $0x1,%ecx
  mov    %r8d,%r8d
  lea    0xf(%rsp),%r10
L190:
  mov    %ecx,0x8(%rsp)
  mov    %rsi,%rax
  mov    $0x0,%edx
  div    %r8
  movzbl (%rdi,%rdx,1),%edx
  mov    %dl,(%r10,%rcx,1)
  mov    %rsi,%rdx
  mov    %rax,%rsi
  cmp    %rdx,%r8
  setbe  %dl
  cmp    $0x13,%ecx
  setle  %al
  add    $0x1,%rcx
  test   %al,%dl
  jne    L190
  mov    0x8(%rsp),%ebx
  cmp    $0x14,%ebx
  mov    $0x13,%eax
  cmovne %ebx,%eax
  mov    %eax,%ebx
  mov    %eax,0x8(%rsp)
  cltq
  movb   $0x0,0x10(%rsp,%rax,1)
  cmp    %ebx,%ebp
  mov    %ebx,%eax
  cmovge %ebp,%eax
  sub    %eax,%r9d
  cmpl   $0x1,0xc(%rsp)
  adc    $0xffffffff,%r9d
  sub    %ebx,%ebp
  mov    $0x0,%eax
  cmovs  %eax,%ebp
  test   %r9d,%r9d
  mov    $0x0,%ebx
  cmovns %r9d,%ebx
  test   $0x10,%r11b
  je     L43
  cmp    %ebx,%ebp
  cmovl  %ebx,%ebp
  mov    %r11d,%ebx
  and    $0x1,%ebx
  je     L94
  mov    $0x0,%ebx
L14:
  neg    %ebx
  jmp    L94
L43:
  test   $0x1,%r11b
  jne    L14
  test   %r9d,%r9d
  jle    L94
  mov    %ebx,%r15d
L107:
  mov    $0x20,%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  sub    $0x1,%r15d
  test   %r15d,%r15d
  jg     L107
  test   %ebx,%ebx
  mov    $0x1,%eax
  cmovg  %ebx,%eax
  sub    %eax,%ebx
L94:
  cmpl   $0x0,0xc(%rsp)
  jne    L3
L147:
  test   %ebp,%ebp
  jle    L4
L109:
  mov    $0x30,%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  sub    $0x1,%ebp
  jne    L109
L4:
  mov    0x8(%rsp),%eax
  movslq %eax,%rbp
  lea    0xf(%rsp),%r15
  test   %eax,%eax
  jle    L100
L77:
  movsbl (%r15,%rbp,1),%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  sub    $0x1,%rbp
  test   %ebp,%ebp
  jg     L77
L100:
  test   %ebx,%ebx
  jns    L7
L163:
  mov    $0x20,%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  add    $0x1,%ebx
  jne    L163
L7:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L29
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L3:
  movsbl 0xc(%rsp),%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  jmp    L147
L29:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D14
type_infered: string
name: unpack_data
arguments: data_label: D9
type_infered: string

tool: D14: 0123456789ABCDEF

tool: D9: 0123456789abcdef

assistant: ```c
void fmtint(char *buffer, size_t *currlen, size_t maxlen, long value, int base, int min, int max, int flags) {
  unsigned long uvalue;
  char convert[20];
  int signvalue = 0, place = 0, caps = 0;
  int spadlen = 0;
  int zpadlen = 0;
  if (max < 0)
    max = 0;
  uvalue = value;
  if (!(flags & (1 << 6))) {
    if (value < 0) {
      signvalue = '-';
      uvalue = -value;
    } else if (flags & (1 << 1))
      signvalue = '+';
    else if (flags & (1 << 2))
      signvalue = ' ';
  }
  if (flags & (1 << 5))
    caps = 1;
  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) > (place) ? (max) : (place)) - (signvalue ? 1 : 0);
  if (zpadlen < 0)
    zpadlen = 0;
  if (spadlen < 0)
    spadlen = 0;
  if (flags & (1 << 4)) {
    zpadlen = ((zpadlen) > (spadlen) ? (zpadlen) : (spadlen));
    spadlen = 0;
  }
  if (flags & (1 << 0))
    spadlen = -spadlen;
  while (spadlen > 0) {
    dopr_outch(buffer, currlen, maxlen, ' ');
    --spadlen;
  }
  if (signvalue)
    dopr_outch(buffer, currlen, maxlen, signvalue);
  if (zpadlen > 0) {
    while (zpadlen > 0) {
      dopr_outch(buffer, currlen, maxlen, '0');
      --zpadlen;
    }
  }
  while (place > 0)
    dopr_outch(buffer, currlen, maxlen, convert[--place]);
  while (spadlen < 0) {
    dopr_outch(buffer, currlen, maxlen, ' ');
    ++spadlen;
  }
}
```