user: 请将以下的汇编代码转换成C语言代码：

```asm
<itoa>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x28(%rbp)
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  movl   $0xa,-0x10(%rbp)
  movl   $0x0,-0xc(%rbp)
  cmpl   $0x2,-0x28(%rbp)
  je     L42
  cmpl   $0xa,-0x28(%rbp)
  je     L42
  cmpl   $0x10,-0x28(%rbp)
  je     L42
  mov    -0x30(%rbp),%rax
  movb   $0x0,(%rax)
  jmp    L94
L42:
  cmpl   $0x0,-0x24(%rbp)
  jne    L101
  mov    -0x18(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x18(%rbp)
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movb   $0x30,(%rax)
L101:
  cmpl   $0xa,-0x28(%rbp)
  jne    L27
  cmpl   $0x0,-0x24(%rbp)
  jns    L27
  movl   $0x1,-0xc(%rbp)
  negl   -0x24(%rbp)
  jmp    L22
L27:
  cmpl   $0x10,-0x28(%rbp)
  jne    L102
  movl   $0x10,-0x10(%rbp)
L22:
  jmp    L102
L129:
  mov    -0x24(%rbp),%eax
  cltd
  idivl  -0x10(%rbp)
  mov    %edx,-0x4(%rbp)
  cmpl   $0x9,-0x4(%rbp)
  jg     L166
  mov    -0x4(%rbp),%eax
  add    $0x30,%eax
  mov    %eax,%ecx
  jmp    L122
L166:
  mov    -0x4(%rbp),%eax
  add    $0x57,%eax
  mov    %eax,%ecx
L122:
  mov    -0x18(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x18(%rbp)
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    %cl,(%rax)
  mov    -0x24(%rbp),%eax
  cltd
  idivl  -0x10(%rbp)
  mov    %eax,-0x24(%rbp)
L102:
  cmpl   $0x0,-0x24(%rbp)
  jg     L129
  cmpl   $0xa,-0x28(%rbp)
  jne    L150
  cmpl   $0x0,-0xc(%rbp)
  je     L150
  mov    -0x18(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x18(%rbp)
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movb   $0x2d,(%rax)
L150:
  cmpl   $0x10,-0x28(%rbp)
  jne    L57
  mov    -0x18(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x18(%rbp)
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movb   $0x78,(%rax)
  mov    -0x18(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x18(%rbp)
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movb   $0x30,(%rax)
L57:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  subl   $0x1,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L124
L147:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    -0x14(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x30(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    -0x8(%rbp),%edx
  mov    %dl,(%rax)
  subl   $0x1,-0x18(%rbp)
  addl   $0x1,-0x14(%rbp)
L124:
  mov    -0x14(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jl     L147
L94:
  pop    %rbp
  ret
```

assistant: ```c
void itoa(int value, char *str, int base) {
  uint8_t i = 0;
  uint8_t j = 0;
  uint8_t divisor = 10;
  uint8_t is_negative = 0;
  uint8_t remainder;
  uint8_t tmp;
  if ((base != 2) && (base != 10) && (base != 16)) {
    *str = '\0';
    return;
  }
  if (value == 0)
    str[i++] = '0';
  if (base == 10 && value < 0) {
    is_negative = 1;
    value = -value;
  } else if (base == 16)
    divisor = 16;
  while (value > 0) {
    remainder = value % divisor;
    str[i++] = (remainder < 10) ? remainder + '0' : remainder + 'a' - 10;
    value = value / divisor;
  }
  if (base == 10 && is_negative)
    str[i++] = '-';
  if (base == 16) {
    str[i++] = 'x';
    str[i++] = '0';
  }
  str[i] = '\0';
  for (i = i - 1, j = 0; j < i; i--, j++) {
    tmp = str[j];
    str[j] = str[i];
    str[i] = tmp;
  }
}
```