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

```asm
<fmtint>:
  endbr64
  push   %r15
  mov    %rcx,%rax
  mov    %r8d,%ecx
  push   %r14
  push   %r13
  mov    %r9d,%r13d
  push   %r12
  mov    %rdi,%r12
  mov    %rax,%rdi
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x78,%rsp
  mov    %fs:0x28,%rdx
  mov    %rdx,0x68(%rsp)
  xor    %edx,%edx
  mov    0xb8(%rsp),%r14d
  mov    %r14d,%r10d
  and    $0x20,%r10d
  test   $0x80,%r14b
  je     L315
  movl   $0x0,0x14(%rsp)
  xor    %r15d,%r15d
L445:
  lea    0x30(%rsp),%r9
  mov    %r14d,%r8d
  mov    $0x2b,%edx
  mov    %r10d,0x10(%rsp)
  and    $0x40,%r8d
  mov    %r9,%rsi
  mov    %r9,0x8(%rsp)
  mov    %r8d,0x24(%rsp)
  mov    %ecx,0x20(%rsp)
  mov    %rdi,0x18(%rsp)
  call   <convert@plt>
  test   $0x8,%r14b
  mov    0x8(%rsp),%r9
  mov    0x10(%rsp),%r10d
  mov    %eax,%edx
  je     L256
  mov    0x18(%rsp),%rdi
  mov    0x20(%rsp),%ecx
  mov    0x24(%rsp),%r8d
  test   %rdi,%rdi
  jne    L231
L256:
  mov    0xb0(%rsp),%ecx
L125:
  sub    %edx,%ecx
  mov    %edx,%r11d
  cmp    %edx,0xb0(%rsp)
  cmovge 0xb0(%rsp),%r11d
  xor    %esi,%esi
  xor    %r8d,%r8d
L88:
  test   %r10d,%r10d
  jne    L93
L45:
  mov    %r13d,%eax
  mov    %r14d,%r13d
  sub    %r11d,%eax
  sub    0x14(%rsp),%eax
  sub    %esi,%eax
  xor    %esi,%esi
  test   %ecx,%ecx
  cmovs  %esi,%ecx
  test   %eax,%eax
  cmovns %eax,%esi
  and    $0x1,%r13d
  je     L165
  neg    %esi
  mov    %esi,%r13d
L494:
  test   %r15b,%r15b
  je     L475
  mov    (%rbx),%rsi
  lea    0x1(%rsi),%rax
  cmp    %rbp,%rax
  jb     L12
L267:
  mov    %rax,(%rbx)
L475:
  test   %r8b,%r8b
  je     L448
  mov    (%rbx),%rax
  lea    0x1(%rax),%rsi
  cmp    %rbp,%rsi
  jae    L255
  movb   $0x30,(%r12,%rax,1)
  mov    (%rbx),%rax
  lea    0x1(%rax),%rsi
L255:
  add    $0x2,%rax
  mov    %rsi,(%rbx)
  cmp    %rbp,%rax
  jb     L242
L285:
  mov    %rax,(%rbx)
L448:
  test   %ecx,%ecx
  je     L352
  mov    (%rbx),%rax
  nopl   0x0(%rax,%rax,1)
L99:
  lea    0x1(%rax),%rsi
  cmp    %rbp,%rsi
  jae    L115
  movb   $0x30,(%r12,%rax,1)
  mov    (%rbx),%rax
  add    $0x1,%rax
  mov    %rax,(%rbx)
  sub    $0x1,%ecx
  jne    L99
L352:
  test   %edx,%edx
  jle    L247
  test   %r10d,%r10d
  mov    %r12,%rdi
  mov    (%rbx),%rcx
  mov    %r9,%r12
  setg   %r15b
  sub    $0x1,%edx
  movslq %edx,%r14
  jmp    L307
  nopl   (%rax)
L7:
  imul   $0xaaaaaaab,%edx,%edx
  cmp    $0x55555555,%edx
  jbe    L298
L47:
  mov    %rax,%rcx
  sub    $0x1,%r14
L307:
  lea    0x1(%rcx),%rax
  mov    %r14d,%edx
  cmp    %rbp,%rax
  jae    L506
  movzbl (%r12,%r14,1),%eax
  mov    %al,(%rdi,%rcx,1)
  mov    (%rbx),%rax
  add    $0x1,%rax
L506:
  mov    %rax,(%rbx)
  test   %r14d,%r14d
  jle    L350
  test   %r15b,%r15b
  jne    L7
  test   %r14d,%r14d
  jg     L47
  cs nopw 0x0(%rax,%rax,1)
L350:
  mov    %rdi,%r12
L247:
  test   %r13d,%r13d
  je     L241
  mov    (%rbx),%rax
  nopl   0x0(%rax,%rax,1)
L514:
  lea    0x1(%rax),%rdx
  cmp    %rbp,%rdx
  jae    L286
  movb   $0x20,(%r12,%rax,1)
  mov    (%rbx),%rax
  add    $0x1,%rax
  mov    %rax,(%rbx)
  add    $0x1,%r13d
  jne    L514
L241:
  mov    0x68(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L158
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L115:
  mov    %rsi,(%rbx)
  sub    $0x1,%ecx
  je     L352
  mov    %rsi,%rax
  jmp    L99
  nopl   0x0(%rax)
L286:
  mov    %rdx,(%rbx)
  add    $0x1,%r13d
  je     L241
  mov    %rdx,%rax
  jmp    L514
  xchg   %ax,%ax
L298:
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    %rdi,0x8(%rsp)
  call   <printsep@plt>
  mov    (%rbx),%rax
  mov    0x8(%rsp),%rdi
  jmp    L47
  nopl   (%rax)
L165:
  and    $0x10,%r14d
  je     L433
  cmpl   $0xffffffff,0xb0(%rsp)
  je     L449
L433:
  test   %eax,%eax
  jle    L106
  mov    (%rbx),%rax
  mov    %esi,%edi
  nopl   (%rax)
L379:
  lea    0x1(%rax),%r11
  cmp    %rbp,%r11
  jae    L20
  movb   $0x20,(%r12,%rax,1)
  mov    (%rbx),%rax
  add    $0x1,%rax
  mov    %rax,(%rbx)
  sub    $0x1,%edi
  jne    L379
L184:
  test   %esi,%esi
  mov    $0x1,%eax
  cmovg  %esi,%eax
  sub    %eax,%esi
L106:
  mov    %esi,%r13d
  jmp    L494
  nopl   (%rax)
L315:
  neg    %rdi
  cmovs  %rax,%rdi
  test   %rax,%rax
  js     L289
  test   $0x2,%r14b
  je     L203
  movl   $0x1,0x14(%rsp)
  mov    $0x2b,%r15d
  jmp    L445
  nopl   (%rax)
L242:
  mov    %r8b,(%r12,%rsi,1)
  mov    (%rbx),%rax
  add    $0x1,%rax
  jmp    L285
  nopl   0x0(%rax,%rax,1)
L12:
  mov    %r15b,(%r12,%rsi,1)
  mov    (%rbx),%rax
  add    $0x1,%rax
  jmp    L267
L231:
  cmp    $0x8,%ecx
  je     L365
  cmp    $0x10,%ecx
  mov    0xb0(%rsp),%ecx
  jne    L125
  sub    %eax,%ecx
  mov    %eax,%r11d
  cmp    %eax,0xb0(%rsp)
  cmovge 0xb0(%rsp),%r11d
  cmp    $0x1,%r8d
  mov    $0x2,%esi
  sbb    %r8d,%r8d
  and    $0x20,%r8d
  add    $0x58,%r8d
  jmp    L88
  nopw   0x0(%rax,%rax,1)
L289:
  movl   $0x1,0x14(%rsp)
  mov    $0x2d,%r15d
  jmp    L445
  nopl   0x0(%rax,%rax,1)
L20:
  mov    %r11,(%rbx)
  sub    $0x1,%edi
  je     L184
  mov    %r11,%rax
  jmp    L379
  nopl   0x0(%rax)
L93:
  mov    %edx,%edi
  mov    %r9,0x28(%rsp)
  mov    %esi,0x24(%rsp)
  mov    %r11d,0x20(%rsp)
  mov    %ecx,0x18(%rsp)
  mov    %r8b,0x10(%rsp)
  mov    %edx,0x8(%rsp)
  call   <getnumsep@plt>
  mov    0x18(%rsp),%ecx
  mov    0x28(%rsp),%r9
  mov    0x24(%rsp),%esi
  mov    0x20(%rsp),%r11d
  mov    %eax,%r10d
  sub    %eax,%r13d
  movzbl 0x10(%rsp),%r8d
  mov    0x8(%rsp),%edx
  sub    %eax,%ecx
  jmp    L45
  nopl   0x0(%rax,%rax,1)
L203:
  mov    %r14d,%r15d
  xor    %eax,%eax
  shr    $0x2,%r15d
  and    $0x1,%r15d
  shl    $0x5,%r15b
  setne  %al
  mov    %eax,0x14(%rsp)
  jmp    L445
L365:
  cmp    %eax,0xb0(%rsp)
  jg     L279
  lea    0x1(%rax),%r11d
  xor    %esi,%esi
  mov    $0x1,%ecx
  xor    %r8d,%r8d
  jmp    L88
L449:
  add    %esi,%ecx
  jmp    L494
L279:
  mov    0xb0(%rsp),%ecx
  mov    0xb0(%rsp),%r11d
  xor    %esi,%esi
  xor    %r8d,%r8d
  sub    %eax,%ecx
  jmp    L88
L158:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void fmtint(char *str, size_t *len, size_t size, long int value, int base, int width, int precision, int flags) {
  unsigned long int uvalue;
  char iconvert[43];
  char sign = 0;
  char hexprefix = 0;
  int spadlen = 0;
  int zpadlen = 0;
  int pos;
  int separators = (flags & (1 << 5));
  int noprecision = (precision == -1);
  if (flags & (1 << 7))
    uvalue = value;
  else {
    uvalue = (value >= 0) ? value : -value;
    if (value < 0)
      sign = '-';
    else if (flags & (1 << 1))
      sign = '+';
    else if (flags & (1 << 2))
      sign = ' ';
  }
  pos = convert(uvalue, iconvert, sizeof(iconvert), base, flags & (1 << 6));
  if (flags & (1 << 3) && uvalue != 0) {
    switch (base) {
    case 8:
      if (precision <= pos)
        precision = pos + 1;
      break;
    case 16:
      hexprefix = (flags & (1 << 6)) ? 'X' : 'x';
      break;
    }
  }
  if (separators)
    separators = getnumsep(pos);
  zpadlen = precision - pos - separators;
  spadlen = width - separators - ((precision >= pos) ? precision : pos) - ((sign != 0) ? 1 : 0) - ((hexprefix != 0) ? 2 : 0);
  if (zpadlen < 0)
    zpadlen = 0;
  if (spadlen < 0)
    spadlen = 0;
  if (flags & (1 << 0))
    spadlen = -spadlen;
  else if (flags & (1 << 4) && noprecision) {
    zpadlen += spadlen;
    spadlen = 0;
  }
  while (spadlen > 0) {
    do {
      if (*len + 1 < size)
        str[*len] = ' ';
      (*len)++;
    } while (0);
    spadlen--;
  }
  if (sign != 0)
    do {
      if (*len + 1 < size)
        str[*len] = sign;
      (*len)++;
    } while (0);
  if (hexprefix != 0) {
    do {
      if (*len + 1 < size)
        str[*len] = '0';
      (*len)++;
    } while (0);
    do {
      if (*len + 1 < size)
        str[*len] = hexprefix;
      (*len)++;
    } while (0);
  }
  while (zpadlen > 0) {
    do {
      if (*len + 1 < size)
        str[*len] = '0';
      (*len)++;
    } while (0);
    zpadlen--;
  }
  while (pos > 0) {
    pos--;
    do {
      if (*len + 1 < size)
        str[*len] = iconvert[pos];
      (*len)++;
    } while (0);
    if (separators > 0 && pos > 0 && pos % 3 == 0)
      printsep(str, len, size);
  }
  while (spadlen < 0) {
    do {
      if (*len + 1 < size)
        str[*len] = ' ';
      (*len)++;
    } while (0);
    spadlen++;
  }
}
```