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

```asm
<_timespec_to_string>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    (%rdi),%eax
  mov    %rdx,%rbx
  test   %eax,%eax
  je     L125
  movslq %eax,%rcx
  cltd
  mov    %eax,%r12d
  mov    %rbx,%r13
  imul   $0xffffffffc22e4507,%rcx,%rcx
  shr    $0x20,%rcx
  add    %eax,%ecx
  sar    $0x10,%ecx
  sub    %edx,%ecx
  imul   $0x15180,%ecx,%edx
  sub    %edx,%r12d
  cmp    $0x1517f,%eax
  jg     L30
L66:
  movslq %r12d,%rcx
  mov    %r12d,%eax
  mov    %r12d,%r14d
  imul   $0xffffffff91a2b3c5,%rcx,%rcx
  sar    $0x1f,%eax
  shr    $0x20,%rcx
  add    %r12d,%ecx
  sar    $0xb,%ecx
  sub    %eax,%ecx
  imul   $0xe10,%ecx,%eax
  sub    %eax,%r14d
  cmp    $0xe0f,%r12d
  jg     L3
L12:
  movslq %r14d,%rcx
  mov    %r14d,%eax
  mov    %r14d,%r12d
  imul   $0xffffffff88888889,%rcx,%rcx
  sar    $0x1f,%eax
  shr    $0x20,%rcx
  add    %r14d,%ecx
  sar    $0x5,%ecx
  sub    %eax,%ecx
  imul   $0x3c,%ecx,%eax
  sub    %eax,%r12d
  cmp    $0x3b,%r14d
  jg     L77
  test   %r12d,%r12d
  jg     L48
L118:
  mov    %rbx,%rax
  sub    %r13,%rax
L19:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L30:
  mov    %rbp,%rdi
  lea    D5(%rip),%r8
  mov    %rbx,%rsi
  xor    %eax,%eax
  lea    D49(%rip),%rdx
  call   <snprintf@plt>
  add    %rax,%rbp
  sub    %rax,%r13
  jne    L66
L113:
  mov    %rbx,%rax
  jmp    L19
  nopl   0x0(%rax)
L3:
  mov    %rbp,%rdi
  lea    D20(%rip),%r8
  mov    %r13,%rsi
  xor    %eax,%eax
  lea    D49(%rip),%rdx
  call   <snprintf@plt>
  add    %rax,%rbp
  sub    %rax,%r13
  jne    L12
  jmp    L113
  nopl   0x0(%rax)
L77:
  mov    %rbp,%rdi
  lea    D73(%rip),%r8
  mov    %r13,%rsi
  xor    %eax,%eax
  lea    D49(%rip),%rdx
  call   <snprintf@plt>
  add    %rax,%rbp
  sub    %rax,%r13
  je     L113
  test   %r12d,%r12d
  jle    L118
L48:
  mov    %r13,%rsi
  xor    %eax,%eax
  lea    D19(%rip),%r8
  mov    %r12d,%ecx
  lea    D49(%rip),%rdx
  mov    %rbp,%rdi
  call   <snprintf@plt>
  sub    %rax,%r13
  jne    L118
  jmp    L113
  nopl   0x0(%rax,%rax,1)
L125:
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  lea    D25(%rip),%rdx
  xor    %eax,%eax
  call   <snprintf@plt>
  mov    %rax,%r8
  mov    %rbx,%rax
  pop    %rbx
  pop    %rbp
  sub    %r8,%rax
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: read_data
arguments: label: D5
type_guessed: string
name: read_data
arguments: label: D49
type_guessed: string
name: read_data
arguments: label: D20
type_guessed: string
name: read_data
arguments: label: D73
type_guessed: string
name: read_data
arguments: label: D19
type_guessed: string
name: read_data
arguments: label: D25
type_guessed: string

tool: D5: d

tool: D49: %ld%s

tool: D20: h

tool: D73: m

tool: D19: s

tool: D25: 0s

assistant: ```c
size_t _timespec_to_string(const struct timespec *value, char *out_result, size_t result_size) {
  const time_t divisors[] = {24 * 60 * 60, 60 * 60, 60, 1};
  const char *labels[] = {"d", "h", "m", "s"};
  time_t remainder_seconds = value->tv_sec;
  if (remainder_seconds == 0) {
    size_t written = snprintf(out_result, result_size, "0s");
    return result_size - written;
  }
  char *output = out_result;
  ssize_t output_remaining = result_size;
  for (int i = 0; i < sizeof(divisors) / sizeof(divisors[0]); ++i) {
    time_t quotient = remainder_seconds / divisors[i];
    remainder_seconds %= divisors[i];
    if (quotient > 0) {
      size_t written = snprintf(output, output_remaining, "%ld%s", quotient, labels[i]);
      output_remaining -= written;
      output += written;
      if (output_remaining <= 0) {
        return result_size - output_remaining;
      }
    }
  }
  return result_size - output_remaining;
}
```