user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<wcshdo_format>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %edi,0x14(%rsp)
  mov    %esi,%r13d
  mov    %rdx,%r14
  mov    %rcx,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  cmp    $0x47,%edi
  je     L67
  test   %esi,%esi
  jle    L204
L195:
  mov    $0x0,%ebp
  mov    $0xfffffc19,%r12d
  lea    0x32(%rsp),%rbx
  lea    0x30(%rsp),%rax
  mov    %rax,0x8(%rsp)
  lea    0x40(%rsp),%r15
  jmp    L164
L67:
  test   %esi,%esi
  jle    L170
  mov    %rdx,%rbx
  lea    -0x1(%rsi),%eax
  lea    0x8(%rdx,%rax,8),%rbp
L82:
  movsd  (%rbx),%xmm0
  call   <fabs@plt>
  test   %eax,%eax
  jle    L112
  movsd  (%rbx),%xmm0
  comisd D16(%rip),%xmm0
  ja     L115
  add    $0x8,%rbx
  cmp    %rbp,%rbx
  jne    L82
  movl   $0x66,0x14(%rsp)
  jmp    L195
L118:
  mov    %r15,%rbx
  jmp    L74
L168:
  mov    %rax,%rbx
L74:
  lea    0x2c(%rsp),%rdx
  lea    0x42(%rsp),%rdi
  lea    D42(%rip),%rsi
  call   <sscanf@plt>
  mov    0x2c(%rsp),%eax
  cmp    %eax,%r12d
  cmovl  %eax,%r12d
  add    $0x1,%rbp
  cmp    %ebp,%r13d
  jle    L128
L164:
  movsd  (%r14,%rbp,8),%xmm0
  lea    D35(%rip),%rsi
  mov    0x8(%rsp),%rdi
  call   <wcsutil_double2str@plt>
  lea    0x40(%rsp),%rax
  cmp    %r15,%rbx
  jae    L118
L176:
  cmpb   $0x30,(%rax)
  jne    L168
  sub    $0x1,%rax
  cmp    %rbx,%rax
  jne    L176
  jmp    L74
L128:
  lea    0x32(%rsp),%rax
  sub    %rax,%rbx
  cmpl   $0x66,0x14(%rsp)
  je     L154
  mov    %ebx,%edx
  test   %ebx,%ebx
  jle    L206
  cmp    $0xe,%ebx
  jg     L192
  cmp    $0xd,%ebx
  jle    L125
L64:
  lea    D55(%rip),%rsi
  mov    0x18(%rsp),%rdi
  call   <sprintf@plt>
L248:
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L75
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L170:
  mov    $0xfffffc19,%r12d
  mov    $0x0,%ebx
  jmp    L154
L193:
  mov    $0xfffffc19,%r12d
  mov    $0x0,%ebx
L154:
  mov    %ebx,%edx
  sub    %r12d,%edx
  mov    $0x11,%eax
  cmp    %eax,%edx
  cmovg  %eax,%edx
  test   %edx,%edx
  mov    $0x1,%eax
  cmovle %eax,%edx
  lea    D14(%rip),%rsi
  mov    0x18(%rsp),%rdi
  call   <sprintf@plt>
  jmp    L248
L206:
  mov    $0x1,%edx
L125:
  lea    D44(%rip),%rsi
  mov    0x18(%rsp),%rdi
  call   <sprintf@plt>
  jmp    L248
L192:
  mov    $0xe,%edx
  jmp    L64
L112:
  movl   $0x45,0x14(%rsp)
  jmp    L195
L115:
  movl   $0x45,0x14(%rsp)
  jmp    L195
L204:
  cmpl   $0x66,0x14(%rsp)
  je     L193
  mov    $0x1,%edx
  jmp    L125
L75:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D16
data_type: f64
name: parse_data
arguments: data_label: D42
data_type: string
name: parse_data
arguments: data_label: D35
data_type: string
name: parse_data
arguments: data_label: D55
data_type: string
name: parse_data
arguments: data_label: D14
data_type: string
name: parse_data
arguments: data_label: D44
data_type: string

tool: D16: 1000000000000

tool: D42: %d

tool: D35: %21.14E

tool: D55: %%21.%dE

tool: D14: %%20.%df

tool: D44: %%20.%dE

assistant: ```c
void wcshdo_format(int fmt, int nval, const double val[], char *format) {
  char *cp, *cp0, cval[24];
  int i, expmax, expon, nsig, precision;
  if (fmt == 'G') {
    fmt = 'f';
    for (i = 0; i < nval; i++) {
      if (fabs(val[i]) < 1e-4 || 1e12 < val[i]) {
        fmt = 'E';
        break;
      }
    }
  }
  cp0 = cval + 2;
  expmax = -999;
  for (i = 0; i < nval; i++) {
    wcsutil_double2str(cval, "%21.14E", val[i]);
    cp = cval + 16;
    while (cp0 < cp && *cp == '0')
      cp--;
    cp0 = cp;
    sscanf(cval + 18, "%d", &expon);
    if (expmax < expon)
      expmax = expon;
  }
  nsig = cp0 - (cval + 2) + 1;
  if (fmt == 'f') {
    precision = nsig - (expmax + 1);
    if (precision < 1)
      precision = 1;
    if (17 < precision)
      precision = 17;
    sprintf(format, "%%20.%df", precision);
  } else {
    precision = nsig - 1;
    if (precision < 1)
      precision = 1;
    if (14 < precision)
      precision = 14;
    if (precision < 14) {
      sprintf(format, "%%20.%dE", precision);
    } else {
      sprintf(format, "%%21.%dE", precision);
    }
  }
}
```