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

```asm
<string_join>:
  endbr64
  push   %r15
  mov    %r8,%r15
  push   %r14
  mov    %rdx,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,0x20(%rsp)
  test   %rsi,%rsi
  je     L133
  mov    %rsi,%rbp
  mov    %rcx,%r13
  lea    -0x1(%rsi),%r12
  xor    %ebx,%ebx
  movq   $0x0,0x10(%rsp)
  nopl   0x0(%rax,%rax,1)
L18:
  mov    0x20(%rsp),%rsi
  mov    0x10(%rsp),%rax
  mov    (%rsi,%rax,8),%rdi
  call   <string_len@plt>
  addq   $0x1,0x10(%rsp)
  cltq
  add    %rax,%rbx
  mov    0x10(%rsp),%rax
  cmp    %rax,%rbp
  jne    L18
  mov    %r14,%rdi
  call   <string_len@plt>
  xor    %edi,%edi
  cltq
  imul   %r12,%rax
  lea    0x1(%rbx,%rax,1),%rax
  cmp    %rax,%r15
  setae  %dil
  call   <assert@plt>
  test   %r12,%r12
  jne    L13
  xor    %ebp,%ebp
  xor    %eax,%eax
L123:
  cltq
  movslq %ebp,%r15
  lea    0x1(%rax),%r14
  nopl   0x0(%rax,%rax,1)
L27:
  mov    0x20(%rsp),%rax
  lea    (%rax,%r12,8),%rbx
  mov    (%rbx),%rdi
  call   <string_len@plt>
  movslq %eax,%rsi
  test   %rsi,%rsi
  je     L48
  xor    %edx,%edx
  add    %r13,%r15
  xchg   %ax,%ax
L1:
  mov    (%rbx),%rcx
  movzbl (%rcx,%rdx,1),%ecx
  mov    %cl,(%r15,%rdx,1)
  add    $0x1,%rdx
  cmp    %rdx,%rsi
  jne    L1
  add    %eax,%ebp
  movslq %ebp,%r15
L48:
  movb   $0x0,0x0(%r13,%r15,1)
  lea    0x1(%r14),%rax
  mov    %r14,%r12
  cmp    0x10(%rsp),%r14
  jae    L66
  mov    %rax,%r14
  jmp    L27
  cs nopw 0x0(%rax,%rax,1)
L13:
  mov    0x10(%rsp),%rax
  mov    0x20(%rsp),%rbx
  cmp    %rax,%r12
  cmova  %rax,%r12
  xor    %ebp,%ebp
  mov    %r12,0x28(%rsp)
  xor    %r12d,%r12d
  nopl   0x0(%rax,%rax,1)
L110:
  mov    (%rbx),%rdi
  call   <string_len@plt>
  movslq %eax,%rdi
  test   %rdi,%rdi
  je     L135
  movslq %ebp,%r15
  xor    %edx,%edx
  add    %r13,%r15
  nopl   0x0(%rax)
L122:
  mov    (%rbx),%rcx
  movzbl (%rcx,%rdx,1),%ecx
  mov    %cl,(%r15,%rdx,1)
  add    $0x1,%rdx
  cmp    %rdx,%rdi
  jne    L122
  add    %ebp,%eax
  mov    %eax,0xc(%rsp)
L29:
  movslq 0xc(%rsp),%rax
  xor    %r15d,%r15d
  mov    %rax,0x18(%rsp)
  jmp    L99
  nopl   0x0(%rax)
L56:
  mov    0x18(%rsp),%rax
  movzbl (%r14,%r15,1),%ecx
  add    %r13,%rax
  mov    %cl,(%rax,%r15,1)
  add    $0x1,%r15
L99:
  mov    0xc(%rsp),%eax
  mov    %r14,%rdi
  lea    (%rax,%r15,1),%ebp
  call   <string_len@plt>
  cmp    %r15d,%eax
  jg     L56
  lea    0x1(%r12),%eax
  add    $0x8,%rbx
  add    $0x1,%r12
  cmp    %r12,0x28(%rsp)
  ja     L110
  cmp    0x10(%rsp),%r12
  jb     L123
L66:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L135:
  mov    %ebp,0xc(%rsp)
  jmp    L29
L133:
  mov    %rdx,%rdi
  call   <string_len@plt>
  xor    %edi,%edi
  movslq %eax,%rdx
  mov    $0x1,%eax
  sub    %rdx,%rax
  cmp    %r15,%rax
  setbe  %dil
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1060 <assert@plt>
```

assistant: ```c
void string_join(char *stringArray[], size_t capacity, char *separator, char *res, size_t maxRes) {
  int i, k, l, pos = 0;
  size_t currentStrLength, totalCharLength = 0;
  for (i = 0; i < capacity; i++) {
    totalCharLength = totalCharLength + string_len(stringArray[i]);
  }
  totalCharLength = totalCharLength + ((capacity - 1) * string_len(separator)) + 1;
  assert(maxRes >= totalCharLength);
  for (i = 0; i < capacity; i++) {
    currentStrLength = string_len(stringArray[i]);
    for (k = 0; k < currentStrLength; k++) {
      res[pos] = stringArray[i][k];
      pos++;
    }
    if (i < capacity - 1) {
      for (l = 0; l < string_len(separator); l++) {
        res[pos] = separator[l];
        pos++;
      }
    } else {
      res[pos] = '\0';
    }
  }
}
```