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    L94
  mov    %rcx,%rax
  test   %rcx,%rcx
  js     L0
  movl   $0x2b,0xc(%rsp)
  test   $0x2,%r11b
  jne    L94
  lea    0x0(,%r11,8),%eax
  and    $0x20,%eax
  mov    %eax,0xc(%rsp)
  jmp    L94
L0:
  neg    %rax
  mov    %rax,%rsi
  movl   $0x2d,0xc(%rsp)
L94:
  test   $0x20,%r11b
  lea    D8(%rip),%rdi
  lea    D15(%rip),%rax
  cmove  %rax,%rdi
  mov    $0x1,%ecx
  mov    %r8d,%r8d
  lea    0xf(%rsp),%r10
L148:
  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    L148
  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     L47
  cmp    %ebx,%ebp
  cmovl  %ebx,%ebp
  mov    %r11d,%ebx
  and    $0x1,%ebx
  je     L85
  mov    $0x0,%ebx
L162:
  neg    %ebx
  jmp    L85
L47:
  test   $0x1,%r11b
  jne    L162
  test   %r9d,%r9d
  jle    L85
  mov    %ebx,%r15d
L97:
  mov    $0x20,%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  sub    $0x1,%r15d
  test   %r15d,%r15d
  jg     L97
  test   %ebx,%ebx
  mov    $0x1,%eax
  cmovg  %ebx,%eax
  sub    %eax,%ebx
L85:
  cmpl   $0x0,0xc(%rsp)
  jne    L155
L128:
  test   %ebp,%ebp
  jle    L105
L70:
  mov    $0x30,%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  sub    $0x1,%ebp
  jne    L70
L105:
  mov    0x8(%rsp),%eax
  movslq %eax,%rbp
  lea    0xf(%rsp),%r15
  test   %eax,%eax
  jle    L90
L168:
  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     L168
L90:
  test   %ebx,%ebx
  jns    L172
L2:
  mov    $0x20,%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  add    $0x1,%ebx
  jne    L2
L172:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L133
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L155:
  movsbl 0xc(%rsp),%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  jmp    L128
L133:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D8
type: string
name: extract_symbolic_data
arguments: tag: D15
type: string

tool: D8: 0123456789ABCDEF

tool: D15: 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;
  }
}
```