user: Translate the below assembly code into C programming language:

```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    L20
  mov    %rcx,%rax
  test   %rcx,%rcx
  js     L92
  movl   $0x2b,0xc(%rsp)
  test   $0x2,%r11b
  jne    L20
  lea    0x0(,%r11,8),%eax
  and    $0x20,%eax
  mov    %eax,0xc(%rsp)
  jmp    L20
L92:
  neg    %rax
  mov    %rax,%rsi
  movl   $0x2d,0xc(%rsp)
L20:
  test   $0x20,%r11b
  lea    D1(%rip),%rdi
  lea    D16(%rip),%rax
  cmove  %rax,%rdi
  mov    $0x1,%ecx
  mov    %r8d,%r8d
  lea    0xf(%rsp),%r10
L156:
  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    L156
  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     L56
  cmp    %ebx,%ebp
  cmovl  %ebx,%ebp
  mov    %r11d,%ebx
  and    $0x1,%ebx
  je     L61
  mov    $0x0,%ebx
L64:
  neg    %ebx
  jmp    L61
L56:
  test   $0x1,%r11b
  jne    L64
  test   %r9d,%r9d
  jle    L61
  mov    %ebx,%r15d
L175:
  mov    $0x20,%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  sub    $0x1,%r15d
  test   %r15d,%r15d
  jg     L175
  test   %ebx,%ebx
  mov    $0x1,%eax
  cmovg  %ebx,%eax
  sub    %eax,%ebx
L61:
  cmpl   $0x0,0xc(%rsp)
  jne    L51
L155:
  test   %ebp,%ebp
  jle    L16
L10:
  mov    $0x30,%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  sub    $0x1,%ebp
  jne    L10
L16:
  mov    0x8(%rsp),%eax
  movslq %eax,%rbp
  lea    0xf(%rsp),%r15
  test   %eax,%eax
  jle    L143
L27:
  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     L27
L143:
  test   %ebx,%ebx
  jns    L185
L53:
  mov    $0x20,%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  add    $0x1,%ebx
  jne    L53
L185:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L119
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L51:
  movsbl 0xc(%rsp),%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  jmp    L155
L119:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D1
datatype: string
name: extract_symbolic_data
arguments: tag: D16
datatype: string

tool: D1: 0123456789ABCDEF

tool: D16: 0123456789abcdef

assistant: ```c
void fmtint(char *buffer, size_t *curlen, 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;
  int zpadlen = 0;
  int caps = 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, curlen, maxlen, ' ');
    --spadlen;
  }
  if (signvalue)
    dopr_outch(buffer, curlen, maxlen, signvalue);
  if (zpadlen > 0) {
    while (zpadlen > 0) {
      dopr_outch(buffer, curlen, maxlen, '0');
      --zpadlen;
    }
  }
  while (place > 0)
    dopr_outch(buffer, curlen, maxlen, convert[--place]);
  while (spadlen < 0) {
    dopr_outch(buffer, curlen, maxlen, ' ');
    ++spadlen;
  }
}
```