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

```asm
<xatoi>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  movb   $0x0,-0x9(%rbp)
  mov    -0x20(%rbp),%rax
  movq   $0x0,(%rax)
  jmp    L118
L28:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,(%rax)
L118:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  mov    %al,-0xb(%rbp)
  cmpb   $0x20,-0xb(%rbp)
  je     L28
  cmpb   $0x2d,-0xb(%rbp)
  jne    L198
  movb   $0x1,-0x9(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  mov    %al,-0xb(%rbp)
L198:
  cmpb   $0x30,-0xb(%rbp)
  jne    L141
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  mov    %al,-0xb(%rbp)
  movzbl -0xb(%rbp),%eax
  cmp    $0x62,%eax
  je     L229
  cmp    $0x78,%eax
  jne    L142
  movb   $0x10,-0xa(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  mov    %al,-0xb(%rbp)
  jmp    L34
L229:
  movb   $0x2,-0xa(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  mov    %al,-0xb(%rbp)
  jmp    L34
L142:
  cmpb   $0x20,-0xb(%rbp)
  ja     L169
  mov    $0x1,%eax
  jmp    L41
L169:
  cmpb   $0x2f,-0xb(%rbp)
  jbe    L23
  cmpb   $0x39,-0xb(%rbp)
  jbe    L126
L23:
  mov    $0x0,%eax
  jmp    L41
L126:
  movb   $0x8,-0xa(%rbp)
  jmp    L34
L141:
  cmpb   $0x2f,-0xb(%rbp)
  jbe    L26
  cmpb   $0x39,-0xb(%rbp)
  jbe    L65
L26:
  mov    $0x0,%eax
  jmp    L41
L65:
  movb   $0xa,-0xa(%rbp)
L34:
  movq   $0x0,-0x8(%rbp)
  jmp    L217
L101:
  cmpb   $0x60,-0xb(%rbp)
  jbe    L119
  subb   $0x20,-0xb(%rbp)
L119:
  subb   $0x30,-0xb(%rbp)
  cmpb   $0x10,-0xb(%rbp)
  jbe    L10
  subb   $0x7,-0xb(%rbp)
L10:
  movzbl -0xb(%rbp),%eax
  cmp    -0xa(%rbp),%al
  jb     L153
  mov    $0x0,%eax
  jmp    L41
L153:
  movzbl -0xa(%rbp),%eax
  imul   -0x8(%rbp),%rax
  mov    %rax,%rdx
  movzbl -0xb(%rbp),%eax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  mov    %al,-0xb(%rbp)
L217:
  cmpb   $0x20,-0xb(%rbp)
  ja     L101
  cmpb   $0x0,-0x9(%rbp)
  je     L84
  negq   -0x8(%rbp)
L84:
  mov    -0x8(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,(%rax)
  mov    $0x1,%eax
L41:
  pop    %rbp
  ret
```

assistant: ```c
int xatoi(char **str, long *res) {
  unsigned long val;
  unsigned char c, r, s = 0;
  *res = 0;
  while ((c = **str) == ' ')
    (*str)++;
  if (c == '-') {
    s = 1;
    c = *(++(*str));
  }
  if (c == '0') {
    c = *(++(*str));
    switch (c) {
    case 'x':
      r = 16;
      c = *(++(*str));
      break;
    case 'b':
      r = 2;
      c = *(++(*str));
      break;
    default:
      if (c <= ' ')
        return 1;
      if (c < '0' || c > '9')
        return 0;
      r = 8;
    }
  } else {
    if (c < '0' || c > '9')
      return 0;
    r = 10;
  }
  val = 0;
  while (c > ' ') {
    if (c >= 'a')
      c -= 0x20;
    c -= '0';
    if (c >= 17) {
      c -= 7;
    }
    if (c >= r)
      return 0;
    val = val * r + c;
    c = *(++(*str));
  }
  if (s)
    val = 0 - val;
  *res = val;
  return 1;
}
```