user: 请将以下的汇编代码转换成C语言代码:

```asm
<scan_double>:
  endbr64
  test   %rdi,%rdi
  je     L67
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%r15
  mov    %edx,%r13d
  mov    (%rdi),%rax
  test   %rsi,%rsi
  je     L169
  test   %rax,%rax
  je     L169
  test   %edx,%edx
  mov    $0x270f,%edx
  cmovs  %edx,%r13d
  mov    $0x0,%r14d
  cmpb   $0x2d,(%rax)
  je     L11
L31:
  mov    (%rbx),%rax
  movzbl (%rax),%edi
  test   %dil,%dil
  je     L116
  mov    $0x0,%ebp
  mov    D20(%rip),%r12
L49:
  movsbl %dil,%edi
  call   <TOR_ISDIGIT@plt>
  cmp    %ebp,%r13d
  jle    L130
  test   %rax,%rax
  je     L130
  mov    (%rbx),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,(%rbx)
  movsbl (%rax),%edi
  call   <digit_to_num@plt>
  movq   %r12,%xmm0
  mulsd  D51(%rip),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  addsd  %xmm0,%xmm1
  movq   %xmm1,%r12
  add    $0x1,%ebp
  mov    (%rbx),%rax
  movzbl (%rax),%edi
  test   %dil,%dil
  jne    L49
  jmp    L174
L11:
  add    $0x1,%rax
  mov    %rax,(%rdi)
  mov    $0x1,%r14d
  jmp    L31
L130:
  mov    (%rbx),%rax
  cmpb   $0x2e,(%rax)
  jne    L174
  lea    0x1(%rax),%rdx
  mov    %rdx,(%rbx)
  add    $0x1,%ebp
  movzbl 0x1(%rax),%edi
  movsd  D7(%rip),%xmm5
  movsd  %xmm5,0x8(%rsp)
  pxor   %xmm6,%xmm6
  movsd  %xmm6,(%rsp)
  test   %dil,%dil
  je     L39
L5:
  movsbl %dil,%edi
  call   <TOR_ISDIGIT@plt>
  cmp    %ebp,%r13d
  jle    L39
  test   %rax,%rax
  je     L39
  mov    (%rbx),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,(%rbx)
  movsbl (%rax),%edi
  call   <digit_to_num@plt>
  movsd  (%rsp),%xmm0
  mulsd  D51(%rip),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  addsd  %xmm0,%xmm1
  movsd  %xmm1,(%rsp)
  movsd  0x8(%rsp),%xmm2
  mulsd  D51(%rip),%xmm2
  movsd  %xmm2,0x8(%rsp)
  add    $0x1,%ebp
  mov    (%rbx),%rax
  movzbl (%rax),%edi
  test   %dil,%dil
  jne    L5
L39:
  movsd  (%rsp),%xmm0
  divsd  0x8(%rsp),%xmm0
  movq   %r12,%xmm4
  addsd  %xmm0,%xmm4
  movq   %xmm4,%r12
L174:
  test   %ebp,%ebp
  je     L160
  test   %r14d,%r14d
  je     L74
  movq   %r12,%xmm3
  xorpd  D49(%rip),%xmm3
  movq   %xmm3,%r12
L74:
  mov    %r12,(%r15)
  mov    $0x0,%eax
L195:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L67:
  mov    $0xffffffff,%eax
  ret
L169:
  mov    $0xffffffff,%eax
  jmp    L195
L116:
  mov    $0xffffffff,%eax
  jmp    L195
L160:
  mov    $0xffffffff,%eax
  jmp    L195
```

tool_calls: name: unpack_data
arguments: label: D20
datatype: f64
name: unpack_data
arguments: label: D51
datatype: byte[8]
name: unpack_data
arguments: label: D7
datatype: f64
name: unpack_data
arguments: label: D49
datatype: byte[16]

tool: D20: 0

tool: {"D51": [0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x40]}

tool: D7: 1

tool: {"D49": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

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;
}
```