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

```asm
<scan_double>:
  endbr64
  test   %rdi,%rdi
  je     L164
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    (%rdi),%rax
  test   %rsi,%rsi
  je     L181
  test   %rax,%rax
  je     L181
  movsbl (%rax),%edi
  test   %edx,%edx
  mov    %edx,%ebp
  mov    $0x270f,%edx
  cmovs  %edx,%ebp
  xor    %r13d,%r13d
  cmp    $0x2d,%dil
  jne    L68
  lea    0x1(%rax),%rdx
  mov    $0x1,%r13d
  mov    %rdx,(%r14)
  movsbl 0x1(%rax),%edi
L68:
  test   %dil,%dil
  je     L181
  movq   $0x0,(%rsp)
  xor    %ebx,%ebx
  jmp    L165
  nopl   0x0(%rax)
L85:
  cmp    %ebx,%ebp
  jle    L100
  lea    0x1(%rax),%rdx
  add    $0x1,%ebx
  mov    %rdx,(%r14)
  movsbl (%rax),%edi
  call   <digit_to_num@plt>
  movsd  D44(%rip),%xmm0
  pxor   %xmm1,%xmm1
  mulsd  (%rsp),%xmm0
  cvtsi2sd %eax,%xmm1
  mov    (%r14),%rax
  movsbl (%rax),%edi
  addsd  %xmm0,%xmm1
  movsd  %xmm1,(%rsp)
  test   %dil,%dil
  je     L104
L165:
  call   <TOR_ISDIGIT@plt>
  test   %rax,%rax
  mov    (%r14),%rax
  jne    L85
L100:
  cmpb   $0x2e,(%rax)
  jne    L117
  lea    0x1(%rax),%rdx
  movsd  D25(%rip),%xmm6
  xor    %r15d,%r15d
  add    $0x1,%ebx
  mov    %rdx,(%r14)
  movsbl 0x1(%rax),%edi
  movq   %r15,%xmm0
  movsd  %xmm6,0x8(%rsp)
  test   %dil,%dil
  jne    L132
  jmp    L50
  nopl   0x0(%rax)
L186:
  cmp    %ebx,%ebp
  jle    L87
  mov    (%r14),%rax
  add    $0x1,%ebx
  lea    0x1(%rax),%rdx
  mov    %rdx,(%r14)
  movsbl (%rax),%edi
  call   <digit_to_num@plt>
  movq   %r15,%xmm0
  pxor   %xmm1,%xmm1
  movsd  0x8(%rsp),%xmm3
  mulsd  D44(%rip),%xmm0
  cvtsi2sd %eax,%xmm1
  mov    (%r14),%rax
  mulsd  D44(%rip),%xmm3
  movsbl (%rax),%edi
  addsd  %xmm0,%xmm1
  movsd  %xmm3,0x8(%rsp)
  movq   %xmm1,%r15
  test   %dil,%dil
  je     L108
L132:
  call   <TOR_ISDIGIT@plt>
  test   %rax,%rax
  jne    L186
L87:
  movq   %r15,%xmm0
  divsd  0x8(%rsp),%xmm0
L50:
  addsd  (%rsp),%xmm0
  movsd  %xmm0,(%rsp)
L104:
  test   %r13d,%r13d
  jne    L168
L142:
  movsd  (%rsp),%xmm4
  xor    %eax,%eax
  movsd  %xmm4,(%r12)
L133:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L168:
  movsd  (%rsp),%xmm5
  xorpd  D9(%rip),%xmm5
  movsd  %xmm5,(%rsp)
  jmp    L142
  nopl   0x0(%rax)
L117:
  test   %ebx,%ebx
  jne    L104
L181:
  mov    $0xffffffff,%eax
  jmp    L133
  nopl   0x0(%rax,%rax,1)
L108:
  movapd %xmm1,%xmm0
  divsd  %xmm3,%xmm0
  jmp    L50
L164:
  or     $0xffffffff,%eax
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D44
type_guessed: f32[2]
name: retrieve_data
arguments: data_label: D25
type_guessed: f64
name: retrieve_data
arguments: data_label: D9
type_guessed: f32[4]

tool: {"D44": [0.0,2.5625]}

tool: D25: 1

tool: {"D9": [0.0,-0.0,0.0,0.0]}

assistant: ```c
int scan_double(const char **bufp, double *out, int width) {
  int neg = 0;
  double result = 0;
  int scanned_so_far = 0;
  if (!bufp || !*bufp || !out)
    return -1;
  if (width < 0)
    width = 9999;
  if (**bufp == '-') {
    neg = 1;
    ++*bufp;
  }
  while (**bufp && TOR_ISDIGIT(**bufp) && scanned_so_far < width) {
    const int digit = digit_to_num(*(*bufp)++);
    result = result * 10 + digit;
    ++scanned_so_far;
  }
  if (**bufp == '.') {
    double fracval = 0, denominator = 1;
    ++*bufp;
    ++scanned_so_far;
    while (**bufp && TOR_ISDIGIT(**bufp) && scanned_so_far < width) {
      const int digit = digit_to_num(*(*bufp)++);
      fracval = fracval * 10 + digit;
      denominator *= 10;
      ++scanned_so_far;
    }
    result += fracval / denominator;
  }
  if (!scanned_so_far)
    return -1;
  *out = neg ? -result : result;
  return 0;
}
```