user: Please show me the C implementation that matches the assembly code listed below:

```asm
<sec2str>:
  endbr64
  push   %r15
  xor    %esi,%esi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  call   <gettimeofday@plt>
  movslq 0x4(%rbx),%rax
  mov    %rax,%rdx
  imul   $0x431bde83,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x32,%rax
  sub    %edx,%eax
  movslq 0x4(%rsp),%rdx
  add    (%rbx),%eax
  sub    (%rsp),%eax
  mov    %rdx,%rbx
  imul   $0x431bde83,%rdx,%rdx
  sar    $0x1f,%ebx
  sar    $0x32,%rdx
  sub    %edx,%ebx
  add    %eax,%ebx
  movslq %ebx,%rbp
  mov    %ebx,%edx
  imul   $0xffffffff91a2b3c5,%rbp,%rax
  sar    $0x1f,%edx
  imul   $0xffffffffc22e4507,%rbp,%rcx
  shr    $0x20,%rax
  add    %ebx,%eax
  shr    $0x20,%rcx
  sar    $0xb,%eax
  add    %ebx,%ecx
  sub    %edx,%eax
  sar    $0x10,%ecx
  movslq %eax,%r13
  mov    %eax,%esi
  imul   $0x2aaaaaab,%r13,%r13
  sar    $0x1f,%esi
  sar    $0x22,%r13
  sub    %esi,%r13d
  lea    0x0(%r13,%r13,2),%esi
  shl    $0x3,%esi
  sub    %esi,%eax
  mov    %eax,%r13d
  imul   $0xffffffff88888889,%rbp,%rax
  shr    $0x20,%rax
  add    %ebx,%eax
  sar    $0x5,%eax
  sub    %edx,%eax
  movslq %eax,%r12
  mov    %eax,%esi
  imul   $0xffffffff88888889,%r12,%r12
  sar    $0x1f,%esi
  shr    $0x20,%r12
  add    %eax,%r12d
  sar    $0x5,%r12d
  sub    %esi,%r12d
  imul   $0x3c,%r12d,%esi
  sub    %esi,%eax
  mov    %eax,%r12d
  sub    %edx,%ecx
  jne    L43
  mov    $0x100,%esi
  test   %r13d,%r13d
  jne    L26
  lea    D21(%rip),%rdi
  test   %eax,%eax
  jne    L29
L91:
  imul   $0xffffffff88888889,%rbp,%rax
  mov    %ebx,%edx
  mov    %ebx,%ecx
  sar    $0x1f,%edx
  shr    $0x20,%rax
  add    %ebx,%eax
  sar    $0x5,%eax
  sub    %edx,%eax
  lea    D87(%rip),%rdx
  imul   $0x3c,%eax,%eax
  sub    %eax,%ecx
  call   <snprintf@plt>
  lea    D21(%rip),%rax
L13:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L11
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L29:
  mov    $0x100,%r13d
  mov    %rdi,%r15
L38:
  mov    %r12d,%ecx
  lea    D25(%rip),%rdx
  mov    %r15,%rdi
  call   <snprintf@plt>
  test   %eax,%eax
  js     L2
  cltq
  cmp    %r13,%rax
  jge    L2
  lea    (%r15,%rax,1),%rdi
  lea    D58(%rip),%rsi
  sub    %edi,%esi
  jmp    L91
  nopl   0x0(%rax,%rax,1)
L43:
  lea    D21(%rip),%r15
  lea    D2(%rip),%rdx
  mov    $0x100,%esi
  mov    %r15,%rdi
  call   <snprintf@plt>
  cmp    $0xff,%eax
  jbe    L116
L2:
  lea    D57(%rip),%rax
  jmp    L13
  xchg   %ax,%ax
L116:
  cltq
  lea    D58(%rip),%r14
  add    %rax,%r15
  sub    %r15,%r14
  mov    %r14d,%esi
L82:
  mov    %r13d,%ecx
  lea    D104(%rip),%rdx
  mov    %r15,%rdi
  call   <snprintf@plt>
  test   %eax,%eax
  js     L2
  cltq
  cmp    %rax,%r14
  jle    L2
  add    %rax,%r15
  lea    D58(%rip),%r13
  sub    %r15,%r13
  mov    %r13d,%esi
  jmp    L38
  nopl   0x0(%rax)
L26:
  mov    $0x100,%r14d
  lea    D21(%rip),%r15
  jmp    L82
L11:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D87
type_guessed: string
name: read_data
arguments: label: D25
type_guessed: string
name: read_data
arguments: label: D2
type_guessed: string
name: read_data
arguments: label: D57
type_guessed: string
name: read_data
arguments: label: D104
type_guessed: string

tool: D87: %ds

tool: D25: %dm

tool: D2: %dd

tool: D57: ?

tool: D104: %dh

assistant: ```c
const char *sec2str(const struct timeval *total) {
  static char result[256];
  int days, hours, mins, secs;
  int first = 1;
  char *p = result;
  char *ep = &result[sizeof(result)];
  int n;
  struct timeval now;
  time_t tsec;
  gettimeofday(&now, NULL);
  tsec = total->tv_sec;
  tsec += total->tv_usec / 1000000;
  tsec -= now.tv_sec;
  tsec -= now.tv_usec / 1000000;
  days = tsec / 3600 / 24;
  hours = (tsec / 3600) % 24;
  mins = (tsec / 60) % 60;
  secs = tsec % 60;
  if (days) {
    first = 0;
    n = snprintf(p, ep - p, "%dd", days);
    if (n < 0 || n >= ep - p)
      return "?";
    p += n;
  }
  if (!first || hours) {
    first = 0;
    n = snprintf(p, ep - p, "%dh", hours);
    if (n < 0 || n >= ep - p)
      return "?";
    p += n;
  }
  if (!first || mins) {
    first = 0;
    n = snprintf(p, ep - p, "%dm", mins);
    if (n < 0 || n >= ep - p)
      return "?";
    p += n;
  }
  snprintf(p, ep - p, "%ds", secs);
  return (result);
}
```