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),%r11d
  mov    0x78(%rsp),%ebx
  mov    %fs:0x28,%rdx
  mov    %rdx,0x28(%rsp)
  xor    %edx,%edx
  test   %r11d,%r11d
  cmovs  %edx,%r11d
  mov    %rcx,%rsi
  movl   $0x0,0xc(%rsp)
  test   $0x40,%bl
  jne    L140
  mov    %rcx,%rax
  test   %rcx,%rcx
  js     L185
  movl   $0x2b,0xc(%rsp)
  test   $0x2,%bl
  jne    L140
  lea    0x0(,%rbx,8),%eax
  and    $0x20,%eax
  mov    %eax,0xc(%rsp)
  jmp    L140
L185:
  neg    %rax
  mov    %rax,%rsi
  movl   $0x2d,0xc(%rsp)
L140:
  test   $0x20,%bl
  lea    D14(%rip),%rdi
  lea    D10(%rip),%rax
  cmove  %rax,%rdi
  mov    $0x1,%ecx
  mov    %r8d,%r8d
  lea    0xf(%rsp),%r10
L192:
  mov    %ecx,(%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    $0x17,%ecx
  setbe  %al
  add    $0x1,%rcx
  test   %al,%dl
  jne    L192
  mov    (%rsp),%esi
  cmp    $0x18,%esi
  mov    $0x17,%eax
  cmovne %esi,%eax
  mov    %eax,%edi
  mov    %eax,(%rsp)
  cltq
  movb   $0x0,0x10(%rsp,%rax,1)
  cmp    %r11d,%edi
  mov    %edi,%eax
  cmovl  %r11d,%eax
  sub    %eax,%r9d
  cmpl   $0x1,0xc(%rsp)
  adc    $0xffffffff,%r9d
  sub    %edi,%r11d
  mov    $0x0,%eax
  cmovns %r11d,%eax
  mov    %eax,0x8(%rsp)
  test   %r9d,%r9d
  mov    $0x0,%ebp
  cmovns %r9d,%ebp
  test   $0x10,%bl
  je     L175
  cmp    %ebp,%eax
  cmovge %eax,%ebp
  mov    %ebp,0x8(%rsp)
  and    $0x1,%ebx
  mov    %ebx,%ebp
  je     L183
  mov    $0x0,%ebp
L85:
  neg    %ebp
  mov    $0x0,%ebx
  jmp    L183
L175:
  and    $0x1,%ebx
  jne    L85
  test   %r9d,%r9d
  jle    L183
  mov    %ebp,%r15d
L53:
  mov    $0x20,%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  add    %eax,%ebx
  sub    $0x1,%r15d
  test   %r15d,%r15d
  jg     L53
  test   %ebp,%ebp
  mov    $0x1,%eax
  cmovg  %ebp,%eax
  sub    %eax,%ebp
L183:
  cmpl   $0x0,0xc(%rsp)
  jne    L110
L129:
  cmpl   $0x0,0x8(%rsp)
  jle    L197
L60:
  mov    $0x30,%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  add    %eax,%ebx
  subl   $0x1,0x8(%rsp)
  jne    L60
L197:
  mov    (%rsp),%eax
  movslq %eax,%r15
  lea    0xf(%rsp),%rsi
  mov    %rsi,(%rsp)
  test   %eax,%eax
  jle    L131
L69:
  mov    (%rsp),%rax
  movsbl (%rax,%r15,1),%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  add    %eax,%ebx
  sub    $0x1,%r15
  test   %r15d,%r15d
  jg     L69
L131:
  test   %ebp,%ebp
  jns    L49
L124:
  mov    $0x20,%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  add    %eax,%ebx
  add    $0x1,%ebp
  jne    L124
L49:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L115
  mov    %ebx,%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L110:
  movsbl 0xc(%rsp),%ecx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <dopr_outch@plt>
  add    %eax,%ebx
  jmp    L129
L115:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D14
type: string
name: unpack_data
arguments: data_tag: D10
type: string

tool: D14: 0123456789ABCDEF

tool: D10: 0123456789abcdef

assistant: ```c
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[24];
  int place = 0;
  int spadlen = 0;
  int zpadlen = 0;
  const char *digits;
  int total = 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))
    digits = "0123456789ABCDEF";
  else
    digits = "0123456789abcdef";
  do {
    convert[place++] = digits[uvalue % (unsigned)base];
    uvalue = (uvalue / (unsigned)base);
  } while (uvalue && (place < sizeof(convert)));
  if (place == sizeof(convert))
    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) {
    total += dopr_outch(buffer, currlen, maxlen, ' ');
    --spadlen;
  }
  if (signvalue)
    total += dopr_outch(buffer, currlen, maxlen, signvalue);
  if (zpadlen > 0) {
    while (zpadlen > 0) {
      total += dopr_outch(buffer, currlen, maxlen, '0');
      --zpadlen;
    }
  }
  while (place > 0)
    total += dopr_outch(buffer, currlen, maxlen, convert[--place]);
  while (spadlen < 0) {
    total += dopr_outch(buffer, currlen, maxlen, ' ');
    ++spadlen;
  }
  return total;
}
```