user: Converte this assembly snippet into its equivalent C code:

```asm
<fpconv_g_fmt>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r12
  push   %rbx
  sub    $0x50,%rsp
  mov    %rdi,-0x48(%rbp)
  movsd  %xmm0,-0x50(%rbp)
  mov    %esi,-0x54(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  mov    -0x48(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  lea    -0x30(%rbp),%rdi
  lea    -0x38(%rbp),%rcx
  lea    -0x3c(%rbp),%rdx
  mov    -0x54(%rbp),%esi
  mov    -0x50(%rbp),%rax
  mov    %rdi,%r8
  mov    $0x2,%edi
  movq   %rax,%xmm0
  call   <dtoa@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rbx
  mov    -0x38(%rbp),%eax
  test   %eax,%eax
  je     L242
  mov    -0x48(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x48(%rbp)
  movb   $0x2d,(%rax)
L242:
  mov    -0x3c(%rbp),%eax
  cmp    $0x270f,%eax
  jne    L101
  nop
L107:
  mov    %rbx,%rdx
  lea    0x1(%rdx),%rbx
  mov    -0x48(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x48(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  movzbl (%rax),%eax
  test   %al,%al
  jne    L107
  subq   $0x1,-0x48(%rbp)
  jmp    L130
L101:
  mov    -0x3c(%rbp),%eax
  cmp    $0xfffffffd,%eax
  jl     L180
  mov    -0x3c(%rbp),%eax
  cmp    %eax,-0x54(%rbp)
  jge    L17
L180:
  mov    %rbx,%rdx
  lea    0x1(%rdx),%rbx
  mov    -0x48(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x48(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  movzbl (%rbx),%eax
  test   %al,%al
  je     L194
  mov    -0x48(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x48(%rbp)
  movb   $0x2e,(%rax)
  jmp    L91
L232:
  addq   $0x1,-0x48(%rbp)
L91:
  mov    %rbx,%rax
  lea    0x1(%rax),%rbx
  movzbl (%rax),%edx
  mov    -0x48(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L232
L194:
  mov    -0x48(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x48(%rbp)
  movb   $0x65,(%rax)
  mov    -0x3c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x3c(%rbp)
  mov    -0x3c(%rbp),%eax
  test   %eax,%eax
  jns    L104
  mov    -0x48(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x48(%rbp)
  movb   $0x2d,(%rax)
  mov    -0x3c(%rbp),%eax
  neg    %eax
  mov    %eax,-0x3c(%rbp)
  jmp    L122
L104:
  mov    -0x48(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x48(%rbp)
  movb   $0x2b,(%rax)
L122:
  movl   $0x2,-0x34(%rbp)
  mov    $0xa,%ebx
  jmp    L16
L176:
  addl   $0x1,-0x34(%rbp)
  mov    %ebx,%eax
  shl    $0x2,%eax
  add    %ebx,%eax
  add    %eax,%eax
  mov    %eax,%ebx
L16:
  mov    %ebx,%eax
  shl    $0x2,%eax
  add    %ebx,%eax
  add    %eax,%eax
  mov    %eax,%edx
  mov    -0x3c(%rbp),%eax
  cmp    %eax,%edx
  jle    L176
L212:
  mov    -0x3c(%rbp),%eax
  cltd
  idiv   %ebx
  mov    %eax,%r12d
  mov    %r12d,%eax
  lea    0x30(%rax),%ecx
  mov    -0x48(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x48(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  subl   $0x1,-0x34(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jle    L269
  mov    -0x3c(%rbp),%eax
  mov    %r12d,%edx
  imul   %ebx,%edx
  sub    %edx,%eax
  mov    %eax,-0x3c(%rbp)
  mov    -0x3c(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,-0x3c(%rbp)
  jmp    L212
L269:
  nop
  mov    -0x48(%rbp),%rax
  movb   $0x0,(%rax)
  jmp    L130
L17:
  mov    -0x3c(%rbp),%eax
  test   %eax,%eax
  jg     L259
  mov    -0x48(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x48(%rbp)
  movb   $0x30,(%rax)
  mov    -0x48(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x48(%rbp)
  movb   $0x2e,(%rax)
  jmp    L208
L75:
  mov    -0x48(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x48(%rbp)
  movb   $0x30,(%rax)
  mov    -0x3c(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x3c(%rbp)
L208:
  mov    -0x3c(%rbp),%eax
  test   %eax,%eax
  js     L75
  nop
L21:
  mov    %rbx,%rdx
  lea    0x1(%rdx),%rbx
  mov    -0x48(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x48(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
  movzbl (%rax),%eax
  test   %al,%al
  jne    L21
  subq   $0x1,-0x48(%rbp)
  jmp    L130
L265:
  addq   $0x1,-0x48(%rbp)
  mov    -0x3c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x3c(%rbp)
  mov    -0x3c(%rbp),%eax
  test   %eax,%eax
  jne    L259
  movzbl (%rbx),%eax
  test   %al,%al
  je     L259
  mov    -0x48(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x48(%rbp)
  movb   $0x2e,(%rax)
L259:
  mov    %rbx,%rax
  lea    0x1(%rax),%rbx
  movzbl (%rax),%edx
  mov    -0x48(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L265
  jmp    L19
L109:
  mov    -0x48(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x48(%rbp)
  movb   $0x30,(%rax)
  mov    -0x3c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x3c(%rbp)
L19:
  mov    -0x3c(%rbp),%eax
  test   %eax,%eax
  jg     L109
  mov    -0x48(%rbp),%rax
  movb   $0x0,(%rax)
L130:
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <freedtoa@plt>
  mov    -0x48(%rbp),%rax
  sub    -0x28(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L29
  call   <__stack_chk_fail@plt>
L29:
  add    $0x50,%rsp
  pop    %rbx
  pop    %r12
  pop    %rbp
  ret
```

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