user: What is the c source code of the assembly code below?

```asm
<my_atoi>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  movsbl (%rdi),%edi
  cmp    $0x30,%dil
  je     L21
  cmp    $0x2d,%dil
  je     L160
  xor    %r12d,%r12d
  test   %dil,%dil
  jne    L209
L7:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L174:
  movsbl (%rbx),%eax
  movsbl 0x1(%rbx),%edi
  lea    (%r12,%r12,4),%edx
  add    $0x1,%rbx
  lea    -0x30(%rax,%rdx,2),%r12d
  test   %dil,%dil
  je     L7
L209:
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L174
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L21:
  movsbl 0x1(%rbx),%esi
  mov    %esi,%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L93
  movsbl 0x2(%rbx),%edi
  lea    0x2(%rbx),%rbp
  xor    %r12d,%r12d
  test   %dil,%dil
  je     L7
  lea    D19(%rip),%rbx
  lea    D9(%rip),%r13
  jmp    L83
  nopl   (%rax)
L9:
  movsbl 0x0(%rbp),%eax
  shl    $0x4,%r12d
  lea    -0x30(%r12,%rax,1),%r12d
L203:
  movsbl 0x1(%rbp),%edi
  add    $0x1,%rbp
  test   %dil,%dil
  je     L7
L83:
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L9
  movsbl 0x0(%rbp),%esi
  mov    %rbx,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L116
  movsbl 0x0(%rbp),%eax
  shl    $0x4,%r12d
  lea    -0x37(%r12,%rax,1),%r12d
  jmp    L203
L93:
  add    $0x1,%rbx
  xor    %r12d,%r12d
  lea    D2(%rip),%rbp
  test   %sil,%sil
  jne    L118
  jmp    L7
  nopl   0x0(%rax,%rax,1)
L100:
  movsbl (%rbx),%eax
  movsbl 0x1(%rbx),%esi
  add    $0x1,%rbx
  lea    -0x30(%rax,%r12,8),%r12d
  test   %sil,%sil
  je     L7
L118:
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L100
  jmp    L7
  nopl   0x0(%rax,%rax,1)
L116:
  movsbl 0x0(%rbp),%esi
  mov    %r13,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L7
  movsbl 0x0(%rbp),%eax
  shl    $0x4,%r12d
  lea    -0x57(%r12,%rax,1),%r12d
  jmp    L203
  nopw   0x0(%rax,%rax,1)
L160:
  add    $0x1,%rbx
  xor    %r12d,%r12d
  jmp    L44
  nopl   0x0(%rax)
L187:
  movsbl (%rbx),%eax
  lea    (%r12,%r12,4),%edx
  add    $0x1,%rbx
  lea    -0x30(%rax,%rdx,2),%r12d
L44:
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L187
  add    $0x8,%rsp
  neg    %r12d
  pop    %rbx
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

tool_calls: name: retrieve_data
arguments: label: D19
data_type: string
name: retrieve_data
arguments: label: D9
data_type: string
name: retrieve_data
arguments: label: D2
data_type: string

tool: D19: ABCDEF

tool: D9: abcdef

tool: D2: 01234567

assistant: ```c
int my_atoi(const char *s) {
  int a = 0;
  if (*s == '0') {
    s++;
    if (*s == 'x' || *s == 'X') {
      s++;
      while (*s) {
        if (isdigit(*s))
          a = (a << 4) + *s - '0';
        else if (strchr("ABCDEF", *s))
          a = (a << 4) + *s - 'A' + 10;
        else if (strchr("abcdef", *s))
          a = (a << 4) + *s - 'a' + 10;
        else
          return a;
        s++;
      }
      return a;
    }
    while (*s) {
      if (strchr("01234567", *s))
        a = (a << 3) + *s - '0';
      else
        return a;
      s++;
    }
    return a;
  }
  if (*s == '-') {
    s++;
    for (;;) {
      if (isdigit(*s))
        a = (a * 10) + *s - '0';
      else
        return -a;
      s++;
    }
  }
  while (*s) {
    if (isdigit(*s))
      a = (a * 10) + *s - '0';
    else
      return a;
    s++;
  }
  return a;
}
```