user: 请从给定的汇编指令推导出C源代码：

```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     L101
  cmp    $0x2d,%dil
  je     L58
  xor    %r12d,%r12d
  test   %dil,%dil
  jne    L116
L135:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L202:
  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     L135
L116:
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L202
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L101:
  movsbl 0x1(%rbx),%esi
  mov    %esi,%eax
  and    $0xffffffdf,%eax
  cmp    $0x58,%al
  jne    L196
  movsbl 0x2(%rbx),%edi
  lea    0x2(%rbx),%rbp
  xor    %r12d,%r12d
  test   %dil,%dil
  je     L135
  lea    D6(%rip),%rbx
  lea    D15(%rip),%r13
  jmp    L76
  nopl   (%rax)
L103:
  movsbl 0x0(%rbp),%eax
  shl    $0x4,%r12d
  lea    -0x30(%r12,%rax,1),%r12d
L145:
  movsbl 0x1(%rbp),%edi
  add    $0x1,%rbp
  test   %dil,%dil
  je     L135
L76:
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L103
  movsbl 0x0(%rbp),%esi
  mov    %rbx,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L67
  movsbl 0x0(%rbp),%eax
  shl    $0x4,%r12d
  lea    -0x37(%r12,%rax,1),%r12d
  jmp    L145
L196:
  add    $0x1,%rbx
  xor    %r12d,%r12d
  lea    D9(%rip),%rbp
  test   %sil,%sil
  jne    L2
  jmp    L135
  nopl   0x0(%rax,%rax,1)
L121:
  movsbl (%rbx),%eax
  movsbl 0x1(%rbx),%esi
  add    $0x1,%rbx
  lea    -0x30(%rax,%r12,8),%r12d
  test   %sil,%sil
  je     L135
L2:
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L121
  jmp    L135
  nopl   0x0(%rax,%rax,1)
L67:
  movsbl 0x0(%rbp),%esi
  mov    %r13,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L135
  movsbl 0x0(%rbp),%eax
  shl    $0x4,%r12d
  lea    -0x57(%r12,%rax,1),%r12d
  jmp    L145
  nopw   0x0(%rax,%rax,1)
L58:
  add    $0x1,%rbx
  xor    %r12d,%r12d
  jmp    L21
  nopl   0x0(%rax)
L115:
  movsbl (%rbx),%eax
  lea    (%r12,%r12,4),%edx
  add    $0x1,%rbx
  lea    -0x30(%rax,%rdx,2),%r12d
L21:
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L115
  add    $0x8,%rsp
  neg    %r12d
  pop    %rbx
  mov    %r12d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D6
type_infered: string
name: retrieve_data
arguments: tag: D15
type_infered: string
name: retrieve_data
arguments: tag: D9
type_infered: string

tool: D6: ABCDEF

tool: D15: abcdef

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