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

```asm
<digit>:
  endbr64
  push   %r15
  pxor   %xmm5,%xmm5
  movaps %xmm0,%xmm4
  pxor   %xmm6,%xmm6
  push   %r14
  cvtss2sd %xmm0,%xmm5
  lea    -0x1(%rcx),%eax
  cvtss2sd %xmm1,%xmm6
  push   %r13
  movaps %xmm1,%xmm7
  mov    %rsi,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %ecx,%ebx
  sub    $0x58,%rsp
  movl   $0x1,(%rdx)
  movss  %xmm0,0x30(%rsp)
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  %xmm6,0x48(%rsp)
  subsd  %xmm5,%xmm6
  movss  %xmm1,0x34(%rsp)
  movsd  %xmm5,0x40(%rsp)
  movapd %xmm6,%xmm1
  divsd  %xmm0,%xmm1
  movss  D143(%rip),%xmm0
  andps  %xmm0,%xmm4
  andps  %xmm7,%xmm0
  comiss %xmm0,%xmm4
  movaps %xmm4,%xmm2
  movsd  %xmm1,0x18(%rsp)
  jbe    L80
  pxor   %xmm7,%xmm7
  cvtss2sd %xmm4,%xmm7
  pxor   %xmm4,%xmm4
  movsd  %xmm7,0x20(%rsp)
  movapd %xmm7,%xmm1
  cvtss2sd %xmm0,%xmm4
  movsd  %xmm4,0x28(%rsp)
L342:
  mulsd  D172(%rip),%xmm1
  movsd  0x18(%rsp),%xmm6
  movsd  D119(%rip),%xmm7
  comisd %xmm6,%xmm7
  divsd  %xmm6,%xmm1
  movsd  %xmm1,0x8(%rsp)
  movapd %xmm6,%xmm1
  jbe    L105
  movsd  D64(%rip),%xmm4
  mov    $0xffffffff,%r14d
  movsd  %xmm4,(%rsp)
  nopl   0x0(%rax)
L34:
  mulsd  (%rsp),%xmm1
  movsd  D119(%rip),%xmm5
  sub    $0x1,%r14d
  comisd %xmm1,%xmm5
  ja     L34
  jmp    L235
  nopl   0x0(%rax)
L41:
  mulsd  (%rsp),%xmm1
  sub    $0x1,%r14d
L235:
  movapd %xmm1,%xmm0
  movsd  %xmm1,0x10(%rsp)
  call   <round@plt>
  movsd  0x10(%rsp),%xmm1
  movsd  0x8(%rsp),%xmm2
  subsd  %xmm1,%xmm0
  mulsd  %xmm1,%xmm2
  movapd %xmm0,%xmm3
  andpd  D60(%rip),%xmm3
  comisd %xmm2,%xmm3
  ja     L41
  andpd  D60(%rip),%xmm0
  comisd %xmm0,%xmm2
  jbe    L273
  nopl   0x0(%rax)
L127:
  divsd  (%rsp),%xmm1
  movapd %xmm1,%xmm0
  movsd  %xmm1,0x10(%rsp)
  add    $0x1,%r14d
  call   <round@plt>
  movsd  0x10(%rsp),%xmm1
  movsd  0x8(%rsp),%xmm2
  mulsd  %xmm1,%xmm2
  subsd  %xmm1,%xmm0
  andpd  D60(%rip),%xmm0
  comisd %xmm0,%xmm2
  ja     L127
L273:
  mov    %r14d,%r15d
  pxor   %xmm1,%xmm1
  movsd  (%rsp),%xmm0
  neg    %r15d
  cvtsi2sd %r15d,%xmm1
  call   <pow@plt>
  movsd  0x20(%rsp),%xmm1
  movapd %xmm0,%xmm5
  movsd  %xmm0,0x38(%rsp)
  mulsd  %xmm0,%xmm1
  movsd  0x28(%rsp),%xmm0
  mulsd  %xmm5,%xmm0
  maxsd  %xmm0,%xmm1
  movsd  0x18(%rsp),%xmm0
  mulsd  D67(%rip),%xmm0
  mulsd  %xmm5,%xmm0
  addsd  %xmm1,%xmm0
  call   <log10@plt>
  addsd  D119(%rip),%xmm0
  cvttsd2si %xmm0,%eax
  lea    (%r14,%rax,1),%r9d
  cmp    $0x3,%r14d
  jg     L86
  cmp    $0xfffffffd,%r9d
  jge    L77
L86:
  xor    %edx,%edx
  pxor   %xmm7,%xmm7
  lea    -0x1(%rax),%ecx
  cmp    $0x1,%eax
  setg   %dl
  add    %eax,%edx
  comiss 0x30(%rsp),%xmm7
  ja     L50
  comiss 0x34(%rsp),%xmm7
  ja     L50
L89:
  sub    %eax,%r15d
  pxor   %xmm1,%xmm1
  movsd  (%rsp),%xmm0
  mov    %ecx,0x10(%rsp)
  add    $0x1,%r15d
  mov    %r9d,0x18(%rsp)
  cvtsi2sd %r15d,%xmm1
  mov    %edx,0x8(%rsp)
  call   <pow@plt>
  cmp    $0x3,%r14d
  mov    0x8(%rsp),%edx
  mov    0x10(%rsp),%ecx
  cvtsd2ss %xmm0,%xmm0
  mov    0x18(%rsp),%r9d
  movss  %xmm0,0x0(%r13)
  jle    L29
  xor    %eax,%eax
  lea    -0x1(%r9),%r8d
  lea    D79(%rip),%rsi
  mov    %r12,%rdi
  call   <sprintf@plt>
  cmp    $0x3,%ebx
  je     L221
L15:
  cmp    $0x2,%ebx
  je     L5
L121:
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L80:
  pxor   %xmm4,%xmm4
  pxor   %xmm7,%xmm7
  cvtss2sd %xmm0,%xmm4
  cvtss2sd %xmm2,%xmm7
  movsd  %xmm4,0x28(%rsp)
  movapd %xmm4,%xmm1
  movsd  %xmm7,0x20(%rsp)
  jmp    L342
  nopl   (%rax)
L50:
  add    $0x1,%edx
  jmp    L89
  nopl   0x0(%rax,%rax,1)
L77:
  test   %r14d,%r14d
  js     L339
  xor    %r15d,%r15d
  pxor   %xmm0,%xmm0
  comiss 0x30(%rsp),%xmm0
  ja     L59
L299:
  comiss 0x34(%rsp),%xmm0
  ja     L59
L126:
  movl   $0x3f800000,0x0(%r13)
  mov    %r15d,%ecx
  mov    %r12,%rdi
  xor    %eax,%eax
  add    $0x58,%rsp
  mov    %r9d,%edx
  lea    D42(%rip),%rsi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10b0 <sprintf@plt>
  nopl   0x0(%rax,%rax,1)
L29:
  mov    $0x1,%r8d
  xor    %eax,%eax
  lea    D38(%rip),%rsi
  mov    %r12,%rdi
  sub    %r9d,%r8d
  call   <sprintf@plt>
  cmp    $0x3,%ebx
  jne    L15
L221:
  movsd  0x40(%rsp),%xmm0
  movsd  0x38(%rsp),%xmm7
  mulsd  %xmm7,%xmm0
  cvtsd2ss %xmm0,%xmm0
  ucomiss D156(%rip),%xmm0
  jp     L121
  jne    L121
  movsd  0x48(%rsp),%xmm0
  mulsd  %xmm7,%xmm0
  cvtsd2ss %xmm0,%xmm0
  ucomiss D17(%rip),%xmm0
  jp     L121
L349:
  jne    L121
L111:
  movl   $0x0,0x0(%rbp)
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L339:
  mov    $0x1,%edx
  xor    %ecx,%ecx
  pxor   %xmm0,%xmm0
  sub    %r14d,%edx
  sub    %eax,%edx
  cmp    %eax,%r15d
  cmovl  %ecx,%edx
  comiss 0x30(%rsp),%xmm0
  lea    0x1(%rax,%rdx,1),%r9d
  jbe    L299
L59:
  add    $0x1,%r9d
  jmp    L126
  nop
L5:
  movss  0x30(%rsp),%xmm6
  pxor   %xmm4,%xmm4
  ucomiss %xmm4,%xmm6
  jp     L280
  je     L327
L280:
  movsd  0x40(%rsp),%xmm0
  mulsd  0x38(%rsp),%xmm0
  cvtsd2ss %xmm0,%xmm0
  ucomiss D156(%rip),%xmm0
  jp     L121
  jne    L121
L327:
  movss  0x34(%rsp),%xmm4
  pxor   %xmm6,%xmm6
  ucomiss %xmm6,%xmm4
  jp     L255
  je     L111
L255:
  movsd  0x48(%rsp),%xmm0
  mulsd  0x38(%rsp),%xmm0
  cvtsd2ss %xmm0,%xmm0
  ucomiss D17(%rip),%xmm0
  jnp    L349
  jmp    L121
  nopl   0x0(%rax,%rax,1)
L105:
  movsd  D64(%rip),%xmm4
  movsd  0x18(%rsp),%xmm1
  mov    $0xffffffff,%r14d
  movsd  %xmm4,(%rsp)
  jmp    L235
```

tool_calls: name: unpack_data
arguments: data_label: D143
datatype: dword
name: unpack_data
arguments: data_label: D172
datatype: byte[8]
name: unpack_data
arguments: data_label: D119
datatype: f64
name: unpack_data
arguments: data_label: D64
datatype: f64
name: unpack_data
arguments: data_label: D60
datatype: qword[2]
name: unpack_data
arguments: data_label: D67
datatype: f64
name: unpack_data
arguments: data_label: D79
datatype: string
name: unpack_data
arguments: data_label: D42
datatype: string
name: unpack_data
arguments: data_label: D38
datatype: string
name: unpack_data
arguments: data_label: D156
datatype: byte[4]
name: unpack_data
arguments: data_label: D17
datatype: byte[4]

tool: D143: 2147483647

tool: {"D172": [0x8d,0xed,0xb5,0xa0,0xf7,0xc6,0xb0,0x3e]}

tool: D119: 1

tool: D64: 10

tool: {"D60": [0x7fffffffffffffff,0x0000000000000000]}

tool: D67: 0.1

tool: D79: %%%d.%dfe+%2.2d

tool: D42: %%%d.%df

tool: D38: %%%d.%dfe-%2.2d

tool: {"D156": [0x00,0x00,0x80,0xbf]}

tool: {"D17": [0x00,0x00,0x80,0x3f]}

assistant: ```c
void digit(char *format, float *scale, int *digflag, float xlo, float xhi, int nlab) {
  double sig, delta, x, y, log10(), pow();
  int p, q, width, digits;
  *digflag = 1;
  x = delta = ((double)xhi - (double)xlo) / (nlab - 1);
  sig = (1.0e-6) * (((fabs(xlo)) > (fabs(xhi)) ? (fabs(xlo)) : (fabs(xhi)))) / x;
  for (p = -1; x < 1.0;) {
    x *= 10.0;
    p--;
  }
  while (fabs(round(x) - x) > x * sig) {
    x *= 10.0;
    p--;
  }
  while (fabs(round(x) - x) < x * sig) {
    x /= 10.0;
    p++;
  }
  y = pow((double)10, (double)(-p));
  q = (int)(1.0 + log10(((fabs((double)xlo) * y) > (fabs((double)xhi) * y) ? (fabs((double)xlo) * y) : (fabs((double)xhi) * y)) + 0.1 * delta * y));
  if (p >= 4 || p + q < -3) {
    digits = q - 1;
    width = q;
    if (q > 1)
      width++;
    if (xlo < 0 || xhi < 0)
      (width)++;
    *scale = pow((double)10, (double)(-p - q + 1));
    if (p >= 4)
      sprintf(format, "%%%d.%dfe+%2.2d", width, digits, p + q - 1);
    else
      sprintf(format, "%%%d.%dfe-%2.2d", width, digits, 1 - (p + q));
    if (nlab == 3) {
      if ((float)(xlo * y) == -1.0 && (float)(xhi * y) == 1.0)
        *digflag = 0;
    } else if (nlab == 2) {
      if (((float)xlo == 0.0 || (float)(xlo * y) == -1.0) && ((float)xhi == 0.0 || (float)(xhi * y) == 1.0))
        *digflag = 0;
    }
  } else {
    if (p >= 0) {
      digits = 0;
      width = p + q;
    } else {
      digits = -p;
      width = 1 + q + ((-p) >= q) * (1 + (-p) - q);
    }
    if (xlo < 0 || xhi < 0)
      (width)++;
    *scale = 1.0;
    sprintf(format, "%%%d.%df", width, digits);
  }
}
```