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

```asm
<substr_combine>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  mov    %rcx,%r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbx
  mov    %edx,%ebx
  sub    $0x38,%rsp
  mov    %rdi,-0x50(%rbp)
  lea    D4(%rip),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  call   <puts@plt>
  test   %ebx,%ebx
  je     L78
  lea    -0x1(%rbx),%eax
  mov    %r12,%r15
  lea    D48(%rip),%r13
  xor    %ebx,%ebx
  lea    0x4(%r12,%rax,4),%rax
  mov    %rax,-0x48(%rbp)
  nopl   0x0(%rax)
L16:
  mov    (%r15),%edi
  add    $0x4,%r15
  call   <substr_len@plt>
  mov    %r13,%rdi
  add    %rax,%rbx
  xor    %eax,%eax
  mov    %rbx,%rsi
  call   <printf@plt>
  cmp    -0x48(%rbp),%r15
  jne    L16
  lea    D53(%rip),%rdi
  call   <puts@plt>
  cmp    %rbx,%r14
  jbe    L53
  xor    %r13d,%r13d
L108:
  mov    (%r12),%r14d
  mov    %rsp,%r15
  mov    %r14d,%edi
  call   <substr_size@plt>
  mov    %rsp,%rdx
  mov    %eax,%ecx
  mov    %eax,%eax
  add    $0xf,%rax
  shr    $0x4,%rax
  shl    $0x4,%rax
  mov    %rax,%rsi
  and    $0xfffffffffffff000,%rsi
  sub    %rsi,%rdx
  cmp    %rdx,%rsp
  je     L100
L87:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rdx,%rsp
  jne    L87
L100:
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L91
  orq    $0x0,-0x8(%rsp,%rax,1)
L91:
  mov    %ecx,%edx
  mov    %rsp,%rdi
  mov    %r14d,%esi
  mov    %ecx,-0x54(%rbp)
  call   <substr_assemble@plt>
  mov    -0x54(%rbp),%edx
  mov    %rsp,%rsi
  mov    %r13d,%edi
  add    -0x50(%rbp),%rdi
  add    $0x4,%r12
  call   <strcpy_limit@plt>
  mov    -0x54(%rbp),%ecx
  mov    %r14d,%edx
  lea    D52(%rip),%rdi
  add    %eax,%r13d
  xor    %eax,%eax
  mov    %r13d,%esi
  call   <printf@plt>
  mov    %r15,%rsp
  cmp    -0x48(%rbp),%r12
  jne    L108
  add    %rbx,-0x50(%rbp)
L63:
  lea    D6(%rip),%rdi
  call   <puts@plt>
  mov    -0x50(%rbp),%rax
  movb   $0x0,(%rax)
L8:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L105
  lea    -0x28(%rbp),%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopl   0x0(%rax,%rax,1)
L78:
  lea    D53(%rip),%rdi
  call   <puts@plt>
  test   %r14,%r14
  je     L53
  xor    %r13d,%r13d
  jmp    L63
L53:
  lea    D20(%rip),%rdi
  mov    $0xffffffff,%r13d
  call   <puts@plt>
  jmp    L8
L105:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D4
type_infered: string
name: retrieve_data
arguments: label: D48
type_infered: string
name: retrieve_data
arguments: label: D53
type_infered: string
name: retrieve_data
arguments: label: D52
type_infered: string
name: retrieve_data
arguments: label: D6
type_infered: string
name: retrieve_data
arguments: label: D20
type_infered: string

tool: D4: 1111

tool: D48: total_len %d


tool: D53: 22222

tool: D52: offs %d, id%d, max %d


tool: D6: 44444

tool: D20: 33333

assistant: ```c
int substr_combine(char *dst, int *substr_ids, unsigned int n_ints, size_t dst_sz) {
  printf("1111\n");
  unsigned int i = 0;
  size_t total_len = 0;
  for (i = 0; i < n_ints; ++i) {
    total_len += substr_len(substr_ids[i]);
    printf("total_len %d\n", total_len);
  }
  printf("22222\n");
  if (total_len >= dst_sz) {
    printf("33333\n");
    return -1;
  }
  unsigned int offs = 0;
  unsigned int max = 0;
  for (i = 0; i < n_ints; ++i) {
    int id = substr_ids[i];
    max = substr_size(id);
    char src[max];
    substr_assemble(src, id, max);
    offs += strcpy_limit(&dst[offs], src, max);
    printf("offs %d, id%d, max %d\n", offs, id, max);
  }
  printf("44444\n");
  dst[total_len] = '\0';
  return offs;
}
```