user: Converte this assembly snippet into its equivalent C code:

```asm
<string_join>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    %r8,-0x58(%rbp)
  movl   $0x0,-0x24(%rbp)
  movq   $0x0,-0x20(%rbp)
  movl   $0x0,-0x30(%rbp)
  jmp    L14
L34:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <string_len@plt>
  cltq
  add    %rax,-0x20(%rbp)
  addl   $0x1,-0x30(%rbp)
L14:
  mov    -0x30(%rbp),%eax
  cltq
  cmp    %rax,-0x40(%rbp)
  ja     L34
  mov    -0x40(%rbp),%rax
  lea    -0x1(%rax),%rbx
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <string_len@plt>
  cltq
  imul   %rax,%rbx
  mov    %rbx,%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  add    $0x1,%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x58(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  setae  %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  movl   $0x0,-0x30(%rbp)
  jmp    L71
L28:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <string_len@plt>
  cltq
  mov    %rax,-0x18(%rbp)
  movl   $0x0,-0x2c(%rbp)
  jmp    L52
L37:
  mov    -0x30(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x2c(%rbp),%eax
  cltq
  add    %rdx,%rax
  mov    -0x24(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x50(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x24(%rbp)
  addl   $0x1,-0x2c(%rbp)
L52:
  mov    -0x2c(%rbp),%eax
  cltq
  cmp    %rax,-0x18(%rbp)
  ja     L37
  mov    -0x30(%rbp),%eax
  cltq
  mov    -0x40(%rbp),%rdx
  sub    $0x1,%rdx
  cmp    %rdx,%rax
  jae    L91
  movl   $0x0,-0x28(%rbp)
  jmp    L84
L51:
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    -0x24(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x50(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x24(%rbp)
  addl   $0x1,-0x28(%rbp)
L84:
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <string_len@plt>
  cmp    %eax,-0x28(%rbp)
  jl     L51
  jmp    L74
L91:
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L74:
  addl   $0x1,-0x30(%rbp)
L71:
  mov    -0x30(%rbp),%eax
  cltq
  cmp    %rax,-0x40(%rbp)
  ja     L28
  nop
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

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';
    }
  }
}
```