user: Translate the below assembly code into C programming language:

```asm
<BRBase58EncodeEx>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  mov    %r8,%r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rdi,%r12
  mov    %r8,%rdi
  push   %rbx
  mov    %rcx,%rbx
  sub    $0x58,%rsp
  mov    %rsi,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  call   <strlen@plt>
  xor    %edi,%edi
  cmp    $0x39,%eax
  setg   %dil
  call   <assert@plt>
  test   %r13,%r13
  setne  %dil
  setne  %r15b
  movzbl %dil,%edi
  call   <assert@plt>
  test   %rbx,%rbx
  je     L20
  xor    %r8d,%r8d
  test   %r15b,%r15b
  jne    L90
  jmp    L20
  nopl   0x0(%rax)
L61:
  add    $0x1,%r8
  cmp    %r8,%rbx
  jbe    L22
L90:
  cmpq   $0x0,0x0(%r13,%r8,8)
  je     L61
  movabs $0x28f5c28f5c28f5c3,%rcx
  mov    %rbx,%rdx
  sub    %r8,%rdx
  imul   $0x8a,%rdx,%rdx
  shr    $0x2,%rdx
  mov    %rdx,%rax
  mul    %rcx
  mov    %rsp,%rcx
  shr    $0x2,%rdx
  lea    0x1(%rdx),%r15
  lea    0x0(,%r15,8),%rax
  mov    %rax,-0x50(%rbp)
  add    $0xf,%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L246
L192:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L192
L246:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L208
L8:
  mov    %rsp,%rcx
  lea    0x0(,%r15,8),%eax
  xor    %esi,%esi
  mov    %r8,-0x68(%rbp)
  mov    %eax,%edx
  mov    %rcx,%rdi
  mov    %rcx,-0x60(%rbp)
  mov    %eax,-0x7c(%rbp)
  mov    %rcx,-0x48(%rbp)
  call   <memset@plt>
  mov    -0x68(%rbp),%r8
  mov    -0x60(%rbp),%r10
  cmp    %r8,%rbx
  jbe    L111
  mov    -0x48(%rbp),%rcx
  shl    $0x6,%r15
  mov    %r8,-0x60(%rbp)
  mov    %r10,-0x68(%rbp)
  lea    -0x8(%rcx,%r15,1),%rax
  mov    %r12,-0x70(%rbp)
  mov    %rcx,%r12
  mov    %rax,-0x48(%rbp)
  lea    -0x3c(%rbp),%rax
  mov    %r14,-0x78(%rbp)
  mov    %rax,%r15
  mov    %r8,%r14
  nopw   0x0(%rax,%rax,1)
L16:
  mov    0x0(%r13,%r14,8),%eax
  mov    -0x48(%rbp),%rsi
  nopl   0x0(%rax)
L216:
  mov    (%rsi),%ecx
  mov    %rsi,%rdx
  sub    $0x8,%rsi
  shl    $0x8,%ecx
  add    %eax,%ecx
  movslq %ecx,%rax
  mov    %ecx,%edi
  imul   $0xffffffff8d3dcb09,%rax,%rax
  sar    $0x1f,%edi
  shr    $0x20,%rax
  add    %ecx,%eax
  sar    $0x5,%eax
  sub    %edi,%eax
  imul   $0x3a,%eax,%edi
  sub    %edi,%ecx
  movslq %ecx,%rcx
  mov    %rcx,0x8(%rsi)
  cmp    %rdx,%r12
  jne    L216
  xor    %edx,%edx
  mov    %r15,%rsi
  mov    $0x4,%edi
  add    $0x1,%r14
  mov    %eax,-0x3c(%rbp)
  call   <_var_clean@plt>
  cmp    %r14,%rbx
  ja     L16
  mov    -0x60(%rbp),%r8
  mov    -0x68(%rbp),%r10
  mov    -0x70(%rbp),%r12
  mov    -0x78(%rbp),%r14
L111:
  mov    -0x50(%rbp),%rdx
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L105:
  cmpq   $0x0,(%r10,%rax,8)
  jne    L190
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L105
L190:
  mov    -0x50(%rbp),%rbx
  mov    %rax,%rcx
  neg    %rcx
  lea    0x1(%rbx,%r8,1),%r13
  sub    %rax,%r13
  cmp    -0x58(%rbp),%r13
  setbe  %bl
  test   %r12,%r12
  je     L71
  test   %bl,%bl
  je     L71
  test   %r8,%r8
  je     L284
  add    %r12,%r8
  cs nopw 0x0(%rax,%rax,1)
L50:
  movzbl (%r14),%edx
  add    $0x1,%r12
  mov    %dl,-0x1(%r12)
  cmp    %r8,%r12
  jne    L50
L63:
  mov    -0x50(%rbp),%rdi
  cmp    %rdi,%rax
  jae    L281
  mov    %rax,%rdx
  lea    (%r8,%rcx,1),%rsi
  nopw   0x0(%rax,%rax,1)
L143:
  add    $0x1,%rdx
  mov    -0x8(%r10,%rdx,8),%rcx
  movzbl (%r14,%rcx,1),%ecx
  mov    %cl,-0x1(%rsi,%rdx,1)
  cmp    %rdi,%rdx
  jne    L143
  sub    %rax,%rdx
  add    %rdx,%r8
L281:
  movb   $0x0,(%r8)
  mov    -0x7c(%rbp),%esi
  mov    %r10,%rdi
  call   <mem_clean@plt>
L212:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L126
  lea    -0x28(%rbp),%rsp
  mov    %r13,%rax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L71:
  mov    -0x7c(%rbp),%esi
  mov    %r10,%rdi
  call   <mem_clean@plt>
  test   %r12,%r12
  je     L212
  xor    %eax,%eax
  test   %bl,%bl
  cmove  %rax,%r13
  jmp    L212
L208:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L8
L22:
  movabs $0x28f5c28f5c28f5c3,%rcx
  sub    %r8,%rbx
  mov    %rsp,%rsi
  imul   $0x8a,%rbx,%rdx
  shr    $0x2,%rdx
  mov    %rdx,%rax
  mul    %rcx
  mov    %rdx,%rax
  shr    $0x2,%rax
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rbx
  lea    0xf(%rbx),%rcx
  mov    %rbx,-0x50(%rbp)
  mov    %rcx,%rdx
  and    $0xfffffffffffff000,%rcx
  sub    %rcx,%rsi
  and    $0xfffffffffffffff0,%rdx
  cmp    %rsi,%rsp
  je     L182
L227:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L227
L182:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  je     L295
  orq    $0x0,-0x8(%rsp,%rdx,1)
L295:
  mov    %rsp,%r10
  shl    $0x3,%eax
  xor    %esi,%esi
  mov    %r8,-0x60(%rbp)
  mov    %r10,%rdi
  mov    %eax,%edx
  mov    %r10,-0x48(%rbp)
  mov    %eax,-0x7c(%rbp)
  call   <memset@plt>
  mov    -0x48(%rbp),%r10
  mov    -0x60(%rbp),%r8
  jmp    L111
L284:
  mov    %r12,%r8
  jmp    L63
L126:
  call   <__stack_chk_fail@plt>
L20:
  imul   $0x8a,%rbx,%rax
  mov    $0x64,%ecx
  xor    %edx,%edx
  mov    %rsp,%rsi
  div    %rcx
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rbx
  lea    0xf(%rbx),%rcx
  mov    %rbx,-0x50(%rbp)
  mov    %rcx,%rdx
  and    $0xfffffffffffff000,%rcx
  and    $0xfffffffffffffff0,%rdx
  sub    %rcx,%rsi
L60:
  cmp    %rsi,%rsp
  je     L108
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L60
L108:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  je     L9
  orq    $0x0,-0x8(%rsp,%rdx,1)
L9:
  mov    %rsp,%r10
  shl    $0x3,%eax
  xor    %esi,%esi
  mov    %r10,%rdi
  mov    %eax,%edx
  mov    %r10,-0x48(%rbp)
  mov    %eax,-0x7c(%rbp)
  call   <memset@plt>
  mov    -0x48(%rbp),%r10
  xor    %r8d,%r8d
  jmp    L111
```

assistant: ```c
size_t BRBase58EncodeEx(char *str, size_t strLen, const uint8_t *data, size_t dataLen, const char *alphabet) {
  const char *chars = alphabet;
  assert(strlen(alphabet) >= 58);
  size_t i, j, len, zcount = 0;
  assert(data != NULL);
  while (zcount < dataLen && data && data[zcount] == 0)
    zcount++;
  uint8_t buf[(dataLen - zcount) * 138 / 100 + 1];
  memset(buf, 0, sizeof(buf));
  for (i = zcount; data && i < dataLen; i++) {
    uint32_t carry = data[i];
    for (j = sizeof(buf); j > 0; j--) {
      carry += (uint32_t)buf[j - 1] << 8;
      buf[j - 1] = carry % 58;
      carry /= 58;
    }
    _var_clean(sizeof(*(&carry)), &carry, NULL);
  }
  i = 0;
  while (i < sizeof(buf) && buf[i] == 0)
    i++;
  len = (zcount + sizeof(buf) - i) + 1;
  if (str && len <= strLen) {
    while (zcount-- > 0)
      *(str++) = chars[0];
    while (i < sizeof(buf))
      *(str++) = chars[buf[i++]];
    *str = '\0';
  }
  mem_clean(buf, sizeof(buf));
  return (!str || len <= strLen) ? len : 0;
}
```