user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<fpconv_g_fmt>:
  endbr64
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    $0x2,%edi
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rcx
  lea    0x8(%rsp),%rdx
  lea    0x10(%rsp),%r8
  call   <dtoa@plt>
  mov    0xc(%rsp),%ecx
  mov    %rax,%rbp
  test   %ecx,%ecx
  je     L101
  mov    0x8(%rsp),%r8d
  movb   $0x2d,(%rbx)
  lea    0x1(%rbx),%rcx
  cmp    $0x270f,%r8d
  je     L47
L107:
  cmp    %r12d,%r8d
  jg     L238
  cmp    $0xfffffffd,%r8d
  jge    L259
L238:
  movzbl 0x0(%rbp),%eax
  lea    0x1(%rcx),%rdi
  mov    %al,(%rcx)
  cmpb   $0x0,0x1(%rbp)
  je     L262
  movb   $0x2e,0x1(%rcx)
  movzbl 0x1(%rbp),%edx
  lea    0x2(%rcx),%rdi
  lea    0x2(%rbp),%rax
  mov    %dl,0x2(%rcx)
  test   %dl,%dl
  je     L262
  nopl   0x0(%rax)
L250:
  movzbl (%rax),%edx
  add    $0x1,%rdi
  add    $0x1,%rax
  mov    %dl,(%rdi)
  test   %dl,%dl
  jne    L250
L262:
  mov    %r8d,%ecx
  movb   $0x65,(%rdi)
  sub    $0x1,%ecx
  js     L171
  movb   $0x2b,0x1(%rdi)
L195:
  cmp    $0x63,%ecx
  jle    L255
  mov    $0x2,%edx
  mov    $0x64,%eax
  nopw   0x0(%rax,%rax,1)
L176:
  mov    %eax,%esi
  lea    (%rax,%rax,4),%eax
  mov    %edx,%r8d
  add    $0x1,%edx
  add    %eax,%eax
  cmp    %ecx,%eax
  jle    L176
L142:
  mov    %ecx,%eax
  lea    0x3(%rdi),%r12
  cltd
  idiv   %esi
  add    $0x30,%eax
  mov    %al,0x2(%rdi)
  lea    -0x1(%r8),%eax
  lea    0x4(%rdi,%rax,1),%r9
  mov    %r12,%rdi
  nopl   0x0(%rax)
L313:
  mov    %ecx,%eax
  add    $0x1,%rdi
  cltd
  idiv   %esi
  lea    (%rdx,%rdx,4),%ecx
  add    %ecx,%ecx
  mov    %ecx,%eax
  cltd
  idiv   %esi
  add    $0x30,%eax
  mov    %al,-0x1(%rdi)
  cmp    %rdi,%r9
  jne    L313
  add    %r8,%r12
  mov    %ecx,0x8(%rsp)
  movb   $0x0,(%r12)
L78:
  mov    %rbp,%rdi
  call   <freedtoa@plt>
  mov    %r12d,%eax
  sub    %ebx,%eax
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L183
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L101:
  mov    0x8(%rsp),%r8d
  mov    %rbx,%rcx
  cmp    $0x270f,%r8d
  jne    L107
L47:
  mov    %rbp,%rax
L134:
  movzbl (%rax),%edx
  mov    %rcx,%r12
  add    $0x1,%rax
  add    $0x1,%rcx
  mov    %dl,-0x1(%rcx)
  test   %dl,%dl
  jne    L134
  jmp    L78
  nopw   0x0(%rax,%rax,1)
L171:
  mov    $0x1,%ecx
  movb   $0x2d,0x1(%rdi)
  sub    %r8d,%ecx
  jmp    L195
  nopl   0x0(%rax)
L259:
  test   %r8d,%r8d
  jle    L296
  movzbl 0x0(%rbp),%esi
  lea    -0x1(%r8),%eax
  lea    0x1(%rbp),%rdx
  mov    %sil,(%rcx)
  test   %sil,%sil
  je     L291
  nopl   (%rax)
L223:
  mov    %eax,0x8(%rsp)
  lea    0x1(%rcx),%r12
  mov    %eax,%r8d
  test   %eax,%eax
  jne    L149
  cmpb   $0x0,(%rdx)
  jne    L44
  movb   $0x0,0x1(%rcx)
L193:
  movb   $0x0,(%r12)
  jmp    L78
  nopw   0x0(%rax,%rax,1)
L149:
  mov    %r12,%rcx
L224:
  movzbl (%rdx),%esi
  sub    $0x1,%eax
  add    $0x1,%rdx
  mov    %sil,(%rcx)
  test   %sil,%sil
  jne    L223
  test   %r8d,%r8d
  jle    L65
L291:
  test   %r8d,%r8d
  movslq %r8d,%r12
  mov    $0x1,%eax
  mov    $0x30,%esi
  cmovle %rax,%r12
  mov    %rcx,%rdi
  mov    %r12,%rdx
  call   <memset@plt>
  movl   $0x0,0x8(%rsp)
  add    %rax,%r12
  jmp    L193
  nopw   0x0(%rax,%rax,1)
L44:
  movb   $0x2e,0x1(%rcx)
  add    $0x2,%rcx
  jmp    L224
  nopw   0x0(%rax,%rax,1)
L296:
  mov    $0x2e30,%edx
  lea    0x2(%rcx),%rax
  mov    %dx,(%rcx)
  je     L135
  neg    %r8d
  mov    %r8d,%esi
  je     L61
  xor    %edx,%edx
L60:
  mov    %edx,%ecx
  add    $0x1,%edx
  movb   $0x30,(%rax,%rcx,1)
  cmp    %r8d,%edx
  jb     L60
L61:
  movl   $0x0,0x8(%rsp)
  add    %rsi,%rax
L135:
  mov    %rbp,%rdx
  nopl   0x0(%rax)
L86:
  movzbl (%rdx),%ecx
  mov    %rax,%r12
  add    $0x1,%rdx
  add    $0x1,%rax
  mov    %cl,-0x1(%rax)
  test   %cl,%cl
  jne    L86
  jmp    L78
  nopw   0x0(%rax,%rax,1)
L255:
  mov    $0x1,%r8d
  mov    $0xa,%esi
  jmp    L142
L183:
  call   <__stack_chk_fail@plt>
L65:
  mov    %rcx,%r12
  jmp    L193
```

assistant: ```c
int fpconv_g_fmt(char *b, double x, int precision) {
  register int i, k;
  register char *s;
  int decpt, j, sign;
  char *b0, *s0, *se;
  b0 = b;
  s = s0 = dtoa(x, 2, precision, &decpt, &sign, &se);
  if (sign)
    *b++ = '-';
  if (decpt == 9999) {
    while ((*b++ = *s++))
      ;
    b--;
    goto done0;
  }
  if (decpt <= -4 || decpt > precision) {
    *b++ = *s++;
    if (*s) {
      *b++ = '.';
      while ((*b = *s++))
        b++;
    }
    *b++ = 'e';
    if (--decpt < 0) {
      *b++ = '-';
      decpt = -decpt;
    } else
      *b++ = '+';
    for (j = 2, k = 10; 10 * k <= decpt; j++, k *= 10)
      ;
    for (;;) {
      i = decpt / k;
      *b++ = i + '0';
      if (--j <= 0)
        break;
      decpt -= i * k;
      decpt *= 10;
    }
    *b = 0;
  } else if (decpt <= 0) {
    *b++ = '0';
    *b++ = '.';
    for (; decpt < 0; decpt++)
      *b++ = '0';
    while ((*b++ = *s++))
      ;
    b--;
  } else {
    while ((*b = *s++)) {
      b++;
      if (--decpt == 0 && *s)
        *b++ = '.';
    }
    for (; decpt > 0; decpt--)
      *b++ = '0';
    *b = 0;
  }
done0:
  freedtoa(s0);
  return b - b0;
}
```