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

```asm
<smart_ulltoa4>:
  endbr64
  mov    %rsi,%rax
  mov    %rdx,%r10
  cmp    $0x270f,%rdi
  jbe    L12
  lea    (%rdi,%rdi,4),%rdx
  add    %rdx,%rdx
  mov    $0x0,%ecx
L0:
  mov    %rdx,%rsi
  shr    $0xa,%rdx
  add    $0x1,%ecx
  cmp    $0x9c3fff,%rsi
  ja     L0
  mov    %edx,%r8d
  mov    %edx,%esi
  mov    $0xcccccccd,%edi
  imul   %rdi,%rsi
  shr    $0x23,%rsi
  lea    (%rsi,%rsi,4),%r9d
  add    %r9d,%r9d
  mov    %edx,%edi
  sub    %r9d,%edi
  test   %ecx,%ecx
  je     L41
  cmp    $0x63,%edx
  jbe    L27
  mov    %edx,%r8d
  imul   $0x10624dd3,%r8,%r8
  shr    $0x26,%r8
  lea    D4(%rip),%rdx
  movzbl (%rdx,%r8,1),%edx
  mov    %dl,(%rax)
  cmp    $0x20,%dl
  lea    D4(%rip),%r9
  lea    D42(%rip),%rdx
  cmovne %rdx,%r9
  mov    %esi,%edi
  mov    $0xcccccccd,%r11d
  imul   %r11,%rdi
  shr    $0x23,%rdi
  mov    %edi,%r8d
  lea    (%rdi,%rdi,4),%edx
  add    %edx,%edx
  mov    %esi,%edi
  sub    %edx,%edi
  mov    %r8d,%edx
  imul   %r11,%rdx
  shr    $0x23,%rdx
  lea    (%rdx,%rdx,4),%edx
  add    %edx,%edx
  sub    %edx,%r8d
  movzbl (%r9,%r8,1),%edx
L10:
  mov    %dl,0x1(%rax)
  mov    %edi,%edi
  lea    D42(%rip),%rdx
  movzbl (%rdx,%rdi,1),%edx
  mov    %dl,0x2(%rax)
  mov    %ecx,%ecx
  movzbl (%r10,%rcx,1),%edx
  jmp    L46
L27:
  mov    %esi,%esi
  lea    D42(%rip),%rdx
  movzbl (%rdx,%rsi,1),%edx
  mov    %dl,(%rax)
  mov    $0x2e,%edx
  jmp    L10
L12:
  mov    %edi,%r8d
  mov    %edi,%esi
  mov    $0xcccccccd,%edx
  imul   %rdx,%rsi
  shr    $0x23,%rsi
  lea    (%rsi,%rsi,4),%edx
  add    %edx,%edx
  sub    %edx,%edi
L41:
  mov    %r8d,%r8d
  imul   $0x10624dd3,%r8,%r8
  shr    $0x26,%r8
  lea    D4(%rip),%rdx
  movzbl (%rdx,%r8,1),%edx
  mov    %dl,(%rax)
  cmp    $0x20,%dl
  lea    D4(%rip),%r8
  lea    D42(%rip),%rdx
  cmovne %rdx,%r8
  mov    %esi,%edx
  mov    $0xcccccccd,%r9d
  imul   %r9,%rdx
  shr    $0x23,%rdx
  mov    %edx,%ecx
  imul   %r9,%rcx
  shr    $0x23,%rcx
  lea    (%rcx,%rcx,4),%ecx
  add    %ecx,%ecx
  sub    %ecx,%edx
  movzbl (%r8,%rdx,1),%edx
  mov    %dl,0x1(%rax)
  cmp    $0x20,%dl
  lea    D42(%rip),%rdx
  cmovne %rdx,%r8
  mov    %esi,%edx
  imul   %r9,%rdx
  shr    $0x23,%rdx
  lea    (%rdx,%rdx,4),%edx
  add    %edx,%edx
  sub    %edx,%esi
  movzbl (%r8,%rsi,1),%edx
  mov    %dl,0x2(%rax)
  mov    %edi,%edi
  lea    D42(%rip),%rdx
  movzbl (%rdx,%rdi,1),%edx
L46:
  mov    %dl,0x3(%rax)
  add    $0x4,%rax
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D4
type_guessed: string
name: disassemble_data
arguments: data_label: D42
type_guessed: string

tool: D4:  123456789

tool: D42: 0123456789

assistant: ```c
char *smart_ulltoa4(unsigned long long ul, char buf[4], const char *scale) {
  const char *fmt;
  char c;
  unsigned v, u, idx = 0;
  if (ul > 9999) {
    ul *= 10;
    do {
      ul /= 1024;
      idx++;
    } while (ul >= 10000);
  }
  v = ul;
  fmt = " 123456789";
  u = v / 10;
  v = v % 10;
  if (!idx) {
    c = buf[0] = " 123456789"[u / 100];
    if (c != ' ')
      fmt = "0123456789";
    c = buf[1] = fmt[u / 10 % 10];
    if (c != ' ')
      fmt = "0123456789";
    buf[2] = fmt[u % 10];
    buf[3] = "0123456789"[v];
  } else {
    if (u >= 10) {
      c = buf[0] = " 123456789"[u / 100];
      if (c != ' ')
        fmt = "0123456789";
      v = u % 10;
      u = u / 10;
      buf[1] = fmt[u % 10];
    } else {
      buf[0] = "0123456789"[u];
      buf[1] = '.';
    }
    buf[2] = "0123456789"[v];
    buf[3] = scale[idx];
  }
  return buf + 4;
}
```