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

```asm
<exp_str>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %rdi,%rbx
  movq   %xmm0,%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    $0x1869f,%eax
  cmp    %eax,%esi
  cmovle %esi,%eax
  mov    %eax,%ebp
  test   %eax,%eax
  mov    $0x1,%eax
  cmovle %eax,%ebp
  test   %edx,%edx
  mov    $0x0,%eax
  cmovns %edx,%eax
  mov    %eax,%r12d
  mov    $0x1869f,%eax
  cmp    %eax,%r12d
  cmovg  %eax,%r12d
  pxor   %xmm0,%xmm0
  cvtsi2sd %ebp,%xmm0
  mov    %rsp,%r14
  mov    %r12d,%edx
  lea    D18(%rip),%rsi
  mov    %r14,%rdi
  mov    $0x1,%eax
  call   <sprintf@plt>
  movq   %r13,%xmm0
  mov    %r14,%rsi
  mov    %rbx,%rdi
  mov    $0x1,%eax
  call   <sprintf@plt>
  movzbl (%rbx),%edx
  mov    %edx,%eax
  and    $0xffffffdf,%eax
  cmp    $0x45,%al
  je     L173
  test   %dl,%dl
  je     L173
  mov    $0x1,%eax
L178:
  mov    %eax,%ecx
  movzbl (%rbx,%rax,1),%edx
  mov    %rax,%rdi
  add    $0x1,%rax
  mov    %edx,%esi
  and    $0xffffffdf,%esi
  cmp    $0x45,%sil
  je     L184
  test   %dl,%dl
  jne    L178
L184:
  test   %dl,%dl
  je     L61
  cmpb   $0x0,0x1(%rbx,%rdi,1)
  je     L61
  lea    0x2(%rcx),%esi
  movslq %esi,%rax
  movzbl (%rbx,%rax,1),%eax
  sub    $0x30,%eax
  cmp    $0x9,%al
  ja     L61
  lea    0x3(%rcx),%eax
  cltq
L161:
  mov    %eax,%ecx
  movzbl (%rbx,%rax,1),%edi
  lea    -0x30(%rdi),%edx
  add    $0x1,%rax
  cmp    $0x9,%dl
  jbe    L161
  sub    %esi,%ecx
  cmp    $0x2,%ecx
  jle    L61
  add    $0x1,%ebp
  pxor   %xmm0,%xmm0
  cvtsi2sd %ebp,%xmm0
  mov    %rsp,%rbp
  mov    %r12d,%edx
  lea    D18(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x1,%eax
  call   <sprintf@plt>
  movq   %r13,%xmm0
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  mov    $0x1,%eax
  call   <sprintf@plt>
  movzbl (%rbx),%eax
  mov    %eax,%edx
  and    $0xffffffdf,%edx
  cmp    $0x45,%dl
  je     L50
  test   %al,%al
  je     L50
  mov    $0x1,%eax
L119:
  mov    %eax,%esi
  movzbl (%rbx,%rax,1),%edx
  add    $0x1,%rax
  mov    %edx,%ecx
  and    $0xffffffdf,%ecx
  cmp    $0x45,%cl
  je     L108
  test   %dl,%dl
  jne    L119
L108:
  add    $0x2,%esi
  movslq %esi,%rsi
  lea    (%rbx,%rsi,1),%rcx
  movzbl (%rcx),%edi
  lea    -0x30(%rdi),%eax
  cmp    $0x9,%al
  ja     L169
  mov    %rcx,%rdx
L115:
  movzbl 0x1(%rdx),%eax
  sub    $0x30,%eax
  add    $0x1,%rdx
  cmp    $0x9,%al
  jbe    L115
L169:
  cmp    $0x30,%dil
  je     L87
  movb   $0x39,(%rcx)
  movb   $0x39,0x1(%rbx,%rsi,1)
L191:
  movb   $0x0,0x2(%rbx,%rsi,1)
L61:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L122
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L173:
  mov    $0x0,%ecx
  mov    $0x0,%edi
  jmp    L184
L50:
  mov    $0x0,%esi
  jmp    L108
L87:
  lea    0x1(%rbx,%rsi,1),%rax
  movzbl (%rax),%edx
  mov    %dl,(%rcx)
  movzbl 0x2(%rbx,%rsi,1),%edx
  mov    %dl,(%rax)
  jmp    L191
L122:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D18
type_infered: string

tool: D18: %%%d.%de

assistant: ```c
void exp_str(char *buf, int maxlen, int decimals, double value) {
  char fmt[16];
  int i, j, zero;
  if (maxlen < 1)
    maxlen = 1;
  if (maxlen > 99999)
    maxlen = 99999;
  if (decimals > 99999)
    decimals = 99999;
  if (decimals < 0)
    decimals = 0;
  sprintf(fmt, "%%%d.%de", maxlen, decimals);
  sprintf(buf, fmt, value);
  for (i = 0; buf[i] != 'e' && buf[i] != 'E' && buf[i] != '\0'; i++)
    ;
  if (buf[i] == '\0' || buf[i + 1] == '\0')
    return;
  for (i = i + 2, j = i; buf[i] >= '0' && buf[i] <= '9'; i++)
    ;
  if (i - j < 3)
    return;
  maxlen++;
  sprintf(fmt, "%%%d.%de", maxlen, decimals);
  sprintf(buf, fmt, value);
  for (i = 0; buf[i] != 'e' && buf[i] != 'E' && buf[i] != '\0'; i++)
    ;
  for (i = i + 2, j = i; buf[i] >= '0' && buf[i] <= '9'; i++)
    ;
  zero = (buf[j] == '0');
  if (!zero) {
    buf[j] = '9';
    buf[j + 1] = '9';
  } else {
    buf[j] = buf[j + 1];
    buf[j + 1] = buf[j + 2];
  }
  buf[j + 2] = '\0';
}
```