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

```asm
<scan_double>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  movl   $0x0,-0x28(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movl   $0x0,-0x24(%rbp)
  cmpq   $0x0,-0x38(%rbp)
  je     L179
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L179
  cmpq   $0x0,-0x40(%rbp)
  jne    L88
L179:
  mov    $0xffffffff,%eax
  jmp    L48
L88:
  cmpl   $0x0,-0x44(%rbp)
  jns    L30
  movl   $0x270f,-0x44(%rbp)
L30:
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L70
  movl   $0x1,-0x28(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,(%rax)
  jmp    L70
L0:
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rcx
  mov    -0x38(%rbp),%rdx
  mov    %rcx,(%rdx)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <digit_to_num@plt>
  mov    %eax,-0x20(%rbp)
  movsd  -0x18(%rbp),%xmm1
  movsd  D16(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x20(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  addl   $0x1,-0x24(%rbp)
L70:
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L136
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <TOR_ISDIGIT@plt>
  test   %rax,%rax
  je     L136
  mov    -0x24(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L0
L136:
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L84
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movsd  D35(%rip),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,(%rax)
  addl   $0x1,-0x24(%rbp)
  jmp    L99
L65:
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rcx
  mov    -0x38(%rbp),%rdx
  mov    %rcx,(%rdx)
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <digit_to_num@plt>
  mov    %eax,-0x1c(%rbp)
  movsd  -0x10(%rbp),%xmm1
  movsd  D16(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x1c(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movsd  -0x8(%rbp),%xmm1
  movsd  D16(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  addl   $0x1,-0x24(%rbp)
L99:
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L124
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <TOR_ISDIGIT@plt>
  test   %rax,%rax
  je     L124
  mov    -0x24(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L65
L124:
  movsd  -0x10(%rbp),%xmm0
  divsd  -0x8(%rbp),%xmm0
  movsd  -0x18(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
L84:
  cmpl   $0x0,-0x24(%rbp)
  jne    L143
  mov    $0xffffffff,%eax
  jmp    L48
L143:
  cmpl   $0x0,-0x28(%rbp)
  je     L158
  movsd  -0x18(%rbp),%xmm0
  movq   D44(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  jmp    L150
L158:
  movsd  -0x18(%rbp),%xmm0
L150:
  mov    -0x40(%rbp),%rax
  movsd  %xmm0,(%rax)
  mov    $0x0,%eax
L48:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D16
type_guessed: f32[2]
name: unpack_data
arguments: tag: D35
type_guessed: f64
name: unpack_data
arguments: tag: D44
type_guessed: f32[2]

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

tool: D35: 1

tool: {"D44": [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;
}
```