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

```asm
<secs2hms_mask>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %edi,-0x44(%rbp)
  mov    %esi,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x38(%rbp)
  mov    -0x44(%rbp),%eax
  movslq %eax,%rdx
  imul   $0xffffffff91a2b3c5,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0xb,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x44(%rbp),%eax
  movslq %eax,%rdx
  imul   $0xffffffff91a2b3c5,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0xb,%edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  imul   $0xe10,%edx,%edx
  sub    %edx,%eax
  mov    %eax,-0x44(%rbp)
  mov    -0x44(%rbp),%eax
  movslq %eax,%rdx
  imul   $0xffffffff88888889,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0x5,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x30(%rbp)
  mov    -0x44(%rbp),%eax
  movslq %eax,%rdx
  imul   $0xffffffff88888889,%rdx,%rdx
  shr    $0x20,%rdx
  add    %eax,%edx
  sar    $0x5,%edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  imul   $0x3c,%edx,%edx
  sub    %edx,%eax
  mov    %eax,-0x2c(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  je     L42
  mov    -0x48(%rbp),%eax
  and    $0x4,%eax
  test   %eax,%eax
  je     L42
  mov    -0x48(%rbp),%eax
  and    $0x8,%eax
  test   %eax,%eax
  je     L61
  mov    -0x38(%rbp),%eax
  cltq
  lea    -0x20(%rbp),%rdx
  lea    (%rdx,%rax,1),%rcx
  mov    -0x34(%rbp),%eax
  mov    %eax,%edx
  lea    D35(%rip),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <sprintf@plt>
  mov    %eax,%edx
  mov    -0x38(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x38(%rbp)
  jmp    L42
L61:
  mov    -0x38(%rbp),%eax
  cltq
  lea    -0x20(%rbp),%rdx
  lea    (%rdx,%rax,1),%rcx
  mov    -0x34(%rbp),%eax
  mov    %eax,%edx
  lea    D48(%rip),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <sprintf@plt>
  mov    %eax,%edx
  mov    -0x38(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x38(%rbp)
L42:
  mov    -0x48(%rbp),%eax
  and    $0x2,%eax
  test   %eax,%eax
  je     L26
  mov    -0x48(%rbp),%eax
  and    $0x8,%eax
  test   %eax,%eax
  je     L96
  mov    -0x38(%rbp),%eax
  cltq
  lea    -0x20(%rbp),%rdx
  lea    (%rdx,%rax,1),%rcx
  mov    -0x30(%rbp),%eax
  mov    %eax,%edx
  lea    D46(%rip),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <sprintf@plt>
  mov    %eax,%edx
  mov    -0x38(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x38(%rbp)
  jmp    L26
L96:
  mov    -0x38(%rbp),%eax
  cltq
  lea    -0x20(%rbp),%rdx
  lea    (%rdx,%rax,1),%rcx
  mov    -0x30(%rbp),%eax
  mov    %eax,%edx
  lea    D33(%rip),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <sprintf@plt>
  mov    %eax,%edx
  mov    -0x38(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x38(%rbp)
L26:
  mov    -0x48(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L39
  mov    -0x48(%rbp),%eax
  and    $0x8,%eax
  test   %eax,%eax
  je     L29
  mov    -0x38(%rbp),%eax
  cltq
  lea    -0x20(%rbp),%rdx
  lea    (%rdx,%rax,1),%rcx
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edx
  lea    D28(%rip),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <sprintf@plt>
  mov    %eax,%edx
  mov    -0x38(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x38(%rbp)
  jmp    L39
L29:
  mov    -0x38(%rbp),%eax
  cltq
  lea    -0x20(%rbp),%rdx
  lea    (%rdx,%rax,1),%rcx
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edx
  lea    D0(%rip),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <sprintf@plt>
  mov    %eax,%edx
  mov    -0x38(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x38(%rbp)
L39:
  cmpl   $0x0,-0x38(%rbp)
  jns    L13
  movl   $0x0,-0x38(%rbp)
L13:
  mov    -0x38(%rbp),%edx
  lea    -0x20(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <statstr_dup@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L18
  call   <__stack_chk_fail@plt>
L18:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D35
type_infered: string
name: unpack_data
arguments: tag: D48
type_infered: string
name: unpack_data
arguments: tag: D46
type_infered: string
name: unpack_data
arguments: tag: D33
type_infered: string
name: unpack_data
arguments: tag: D28
type_infered: string
name: unpack_data
arguments: tag: D0
type_infered: string

tool: D35: %d :

tool: D48: %d:

tool: D46:  %d

tool: D33: %02d

tool: D28:  : %02d

tool: D0: :%02d

assistant: ```c
char *secs2hms_mask(int t, int mask) {
  char tstr[20], *this;
  int h, m, s;
  int pos = 0;
  h = t / 3600;
  t = t % 3600;
  m = t / 60;
  s = t % 60;
  if (h && (mask & 4)) {
    if (mask & 8)
      pos += sprintf(tstr + pos, "%d :", h);
    else
      pos += sprintf(tstr + pos, "%d:", h);
  }
  if (mask & 2) {
    if (mask & 8)
      pos += sprintf(tstr + pos, " %d", m);
    else
      pos += sprintf(tstr + pos, "%02d", m);
  }
  if (mask & 1) {
    if (mask & 8)
      pos += sprintf(tstr + pos, " : %02d", s);
    else
      pos += sprintf(tstr + pos, ":%02d", s);
  }
  if (pos < 0)
    pos = 0;
  this = statstr_dup(tstr, pos);
  return this;
}
```