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

```asm
<string_join>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  mov    %rsi,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x38,%rsp
  mov    %rsi,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  test   %rdi,%rdi
  setne  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  xor    %edi,%edi
  test   %r15,%r15
  setne  %dil
  call   <assert@plt>
  mov    (%rbx),%r12
  test   %r12,%r12
  je     L49
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L70:
  mov    %rax,%r13
  lea    0x1(%rax),%rax
  cmpq   $0x0,(%rbx,%rax,8)
  lea    0x0(,%rax,8),%rdx
  jne    L70
  add    $0xf,%rdx
  mov    %rsp,%rdi
  mov    %rdx,%rax
  and    $0xfffffffffffff000,%rdx
  sub    %rdx,%rdi
  and    $0xfffffffffffffff0,%rax
  cmp    %rdi,%rsp
  je     L108
L82:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rdi,%rsp
  jne    L82
L108:
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  jne    L46
L58:
  mov    -0x58(%rbp),%rdi
  mov    %rsp,-0x48(%rbp)
  xor    %r14d,%r14d
  xor    %r15d,%r15d
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %rax,-0x50(%rbp)
  jmp    L26
  nopl   (%rax)
L38:
  mov    (%rbx,%rax,8),%rdi
  mov    %rax,%r14
L26:
  test   %rdi,%rdi
  je     L10
  call   <strlen@plt>
  mov    -0x48(%rbp),%rcx
  add    %rax,%r15
  mov    %rax,(%rcx,%r14,8)
  mov    -0x50(%rbp),%rax
  add    %r15,%rax
  cmp    %r14,%r13
  cmova  %rax,%r15
L10:
  lea    0x1(%r14),%rax
  cmp    %r14,%r13
  jne    L38
  lea    0x1(%r15),%rdi
  call   <malloc@plt>
  mov    %rax,-0x60(%rbp)
  test   %rax,%rax
  je     L49
  movb   $0x0,(%rax,%r15,1)
  mov    %rax,%rdi
  xor    %r14d,%r14d
  jmp    L59
  xchg   %ax,%ax
L50:
  lea    0x1(%r14),%rax
  cmp    %r14,%r13
  je     L37
L20:
  mov    (%rbx,%rax,8),%r12
  mov    %rax,%r14
L59:
  test   %r12,%r12
  je     L50
  mov    -0x48(%rbp),%rax
  mov    %r12,%rsi
  mov    (%rax,%r14,8),%r15
  mov    %r15,%rdx
  call   <strncpy@plt>
  mov    %rax,%rdi
  add    %r15,%rdi
  cmp    %r14,%r13
  jbe    L50
  mov    -0x50(%rbp),%r15
  mov    -0x58(%rbp),%rsi
  mov    %r15,%rdx
  call   <strncpy@plt>
  lea    (%rax,%r15,1),%rdi
  lea    0x1(%r14),%rax
  cmp    %r14,%r13
  jne    L20
L37:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L130
  mov    -0x60(%rbp),%rax
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L46:
  orq    $0x0,-0x8(%rsp,%rax,1)
  jmp    L58
  nopl   0x0(%rax,%rax,1)
L49:
  movq   $0x0,-0x60(%rbp)
  jmp    L37
L130:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *string_join(const char **strings, const char *sep) {
  assert(strings != NULL);
  assert(sep != NULL);
  size_t strings_count;
  for (strings_count = 0; strings[strings_count]; strings_count++)
    ;
  if (strings_count == 0)
    return NULL;
  size_t lengths[strings_count];
  size_t sep_len = strlen(sep);
  size_t len = 0;
  for (size_t i = 0; i < strings_count; i++) {
    if (!strings[i])
      continue;
    lengths[i] = strlen(strings[i]);
    len += lengths[i];
    if (i < strings_count - 1)
      len += sep_len;
  }
  char *result = malloc(len + 1);
  if (!result)
    return NULL;
  result[len] = 0;
  char *dst = result;
  for (size_t i = 0; i < strings_count; i++) {
    if (!strings[i])
      continue;
    strncpy(dst, strings[i], lengths[i]);
    dst += lengths[i];
    if (i < strings_count - 1) {
      dst = strncpy(dst, sep, sep_len);
      dst += sep_len;
    }
  }
  return result;
}
```