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

```asm
<fmtint>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %r9d,%r13d
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rsi,%rbp
  mov    %rcx,%rsi
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    0x70(%rsp),%r14d
  mov    0x78(%rsp),%edi
  test   %r14d,%r14d
  cmovs  %eax,%r14d
  test   $0x40,%dil
  jne    L30
  test   %rcx,%rcx
  js     L8
  test   $0x2,%dil
  je     L174
  movl   $0x2b,0x8(%rsp)
  mov    $0x1,%r11d
  jmp    L126
  nopw   0x0(%rax,%rax,1)
L30:
  movl   $0x0,0x8(%rsp)
  xor    %r11d,%r11d
L126:
  test   $0x20,%dil
  mov    %r8d,%r8d
  lea    0xf(%rsp),%r15
  mov    $0x1,%ecx
  lea    D10(%rip),%r9
  lea    D15(%rip),%rax
  cmove  %rax,%r9
  xchg   %ax,%ax
L168:
  mov    %rsi,%rax
  xor    %edx,%edx
  mov    %ecx,%r10d
  div    %r8
  movzbl (%r9,%rdx,1),%edx
  mov    %dl,(%r15,%rcx,1)
  mov    %rsi,%rdx
  mov    %rax,%rsi
  cmp    %r8,%rdx
  setae  %dl
  cmp    $0x13,%ecx
  setle  %al
  add    $0x1,%rcx
  test   %al,%dl
  jne    L168
  cmp    $0x14,%r10d
  mov    $0x13,%eax
  mov    $0x0,%edx
  cmove  %eax,%r10d
  mov    %edx,%esi
  movslq %r10d,%rax
  cmp    %r10d,%r14d
  mov    %rax,(%rsp)
  movb   $0x0,0x10(%rsp,%rax,1)
  mov    %r10d,%eax
  cmovge %r14d,%eax
  sub    %eax,%r13d
  mov    %r13d,%eax
  mov    %edi,%r13d
  sub    %r11d,%eax
  sub    %r10d,%r14d
  cmovs  %edx,%r14d
  test   %eax,%eax
  cmovns %eax,%esi
  and    $0x1,%r13d
  and    $0x10,%edi
  mov    %esi,0xc(%rsp)
  je     L72
  cmp    %esi,%r14d
  cmovl  %esi,%r14d
  xor    %r13d,%r13d
L191:
  mov    0x8(%rsp),%eax
  test   %eax,%eax
  jne    L172
L70:
  test   %r14d,%r14d
  jne    L47
L205:
  mov    (%rsp),%r14
L37:
  movsbl (%r15,%r14,1),%ecx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  sub    $0x1,%r14
  call   <dopr_outch@plt>
  test   %r14d,%r14d
  jne    L37
  test   %r13d,%r13d
  je     L164
  nopl   0x0(%rax)
L131:
  mov    $0x20,%ecx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <dopr_outch@plt>
  add    $0x1,%r13d
  jne    L131
L164:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L112
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L47:
  mov    $0x30,%ecx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <dopr_outch@plt>
  sub    $0x1,%r14d
  jne    L47
  jmp    L205
  cs nopw 0x0(%rax,%rax,1)
L72:
  test   %r13d,%r13d
  mov    0xc(%rsp),%r13d
  jne    L158
  test   %eax,%eax
  jle    L191
  nopw   0x0(%rax,%rax,1)
L55:
  mov    $0x20,%ecx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <dopr_outch@plt>
  sub    $0x1,%r13d
  jne    L55
  mov    0xc(%rsp),%edi
  mov    $0x1,%eax
  test   %edi,%edi
  cmovg  %edi,%eax
  sub    %eax,%edi
  mov    0x8(%rsp),%eax
  mov    %edi,%r13d
  test   %eax,%eax
  je     L70
L172:
  mov    0x8(%rsp),%ecx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <dopr_outch@plt>
  jmp    L70
  nopw   0x0(%rax,%rax,1)
L158:
  neg    %r13d
  jmp    L191
  nopl   0x0(%rax,%rax,1)
L8:
  movl   $0x2d,0x8(%rsp)
  neg    %rsi
  mov    $0x1,%r11d
  jmp    L126
  cs nopw 0x0(%rax,%rax,1)
L174:
  lea    0x0(,%rdi,8),%eax
  and    $0x20,%eax
  setne  %r11b
  mov    %eax,0x8(%rsp)
  movzbl %r11b,%r11d
  jmp    L126
L112:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D10
type_infered: string
name: unpack_data
arguments: data_tag: D15
type_infered: string

tool: D10: 0123456789ABCDEF

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