user: Please show me the C implementation that matches the assembly code listed below:

```asm
<ft_ahtoi>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0xc(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <ft_strlen@plt>
  mov    %eax,-0x4(%rbp)
  movl   $0x0,-0x8(%rbp)
  jmp    L157
L198:
  addl   $0x1,-0xc(%rbp)
L157:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x8,%al
  jle    L56
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xd,%al
  jle    L198
L56:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x20,%al
  je     L198
  jmp    L89
L36:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L138
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jle    L12
L138:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jle    L21
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x46,%al
  jle    L12
L21:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jle    L73
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x66,%al
  jg     L73
L12:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jg     L43
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  lea    -0x30(%rax),%edx
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  sub    -0xc(%rbp),%eax
  shl    $0x2,%eax
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  add    %eax,-0x8(%rbp)
  jmp    L73
L43:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x41,%al
  jg     L57
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x45,%al
  jle    L57
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  lea    -0x37(%rax),%edx
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  sub    -0xc(%rbp),%eax
  shl    $0x2,%eax
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  add    %eax,-0x8(%rbp)
  jmp    L73
L57:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x61,%al
  jg     L73
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x65,%al
  jle    L73
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  lea    -0x57(%rax),%edx
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  sub    -0xc(%rbp),%eax
  shl    $0x2,%eax
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  add    %eax,-0x8(%rbp)
L73:
  addl   $0x1,-0xc(%rbp)
L89:
  mov    -0xc(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jge    L19
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L36
L19:
  mov    -0x8(%rbp),%eax
  leave
  ret
```

assistant: ```c
int ft_ahtoi(char const *str) {
  int i;
  int len;
  int val;
  i = 0;
  len = ft_strlen(str);
  val = 0;
  while ((str[i] >= 9 && str[i] <= 13) || str[i] == 32)
    i++;
  while (i < len && str[i] != 0) {
    if ((str[i] >= 48 && str[i] <= 57) || (str[i] >= 65 && str[i] <= 70) || (str[i] >= 97 && str[i] <= 102)) {
      if (str[i] <= 57)
        val += (str[i] - 48) * (1 << (4 * (len - 1 - i)));
      else if (str[i] <= 65 && str[i] >= 70)
        val += (str[i] - 55) * (1 << (4 * (len - 1 - i)));
      else if (str[i] <= 97 && str[i] >= 102)
        val += (str[i] - 87) * (1 << (4 * (len - 1 - i)));
    }
    i++;
  }
  return (val);
}
```