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

```asm
<addBinary>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x18(%rbp)
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x14(%rbp)
  mov    -0x18(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jle    L47
  mov    -0x18(%rbp),%eax
  add    $0x1,%eax
  jmp    L45
L47:
  mov    -0x14(%rbp),%eax
  add    $0x1,%eax
L45:
  mov    %eax,-0x28(%rbp)
  mov    -0x28(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x28(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x28(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x28(%rbp)
  mov    -0x18(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x14(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x20(%rbp)
  jmp    L59
L95:
  cmpl   $0x0,-0x24(%rbp)
  js     L10
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  jmp    L21
L10:
  mov    $0x0,%eax
L21:
  mov    %eax,-0x10(%rbp)
  cmpl   $0x0,-0x20(%rbp)
  js     L55
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  jmp    L77
L55:
  mov    $0x0,%eax
L77:
  mov    %eax,-0xc(%rbp)
  mov    -0x10(%rbp),%eax
  mov    %eax,%edx
  mov    -0xc(%rbp),%eax
  xor    %eax,%edx
  mov    -0x1c(%rbp),%eax
  xor    %edx,%eax
  lea    0x30(%rax),%ecx
  mov    -0x28(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x28(%rbp)
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
  mov    -0x1c(%rbp),%edx
  mov    -0x10(%rbp),%eax
  add    %eax,%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  cmp    $0x1,%eax
  setg   %al
  movzbl %al,%eax
  mov    %eax,-0x1c(%rbp)
  subl   $0x1,-0x24(%rbp)
  subl   $0x1,-0x20(%rbp)
L59:
  cmpl   $0x0,-0x1c(%rbp)
  jne    L95
  cmpl   $0x0,-0x24(%rbp)
  jns    L95
  cmpl   $0x0,-0x20(%rbp)
  jns    L95
  movl   $0x0,-0x24(%rbp)
  mov    -0x28(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x20(%rbp)
  jmp    L107
L67:
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x29(%rbp)
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    -0x24(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  movzbl -0x29(%rbp),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x24(%rbp)
  subl   $0x1,-0x20(%rbp)
L107:
  mov    -0x24(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L67
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *addBinary(char *a, char *b) {
  int len1 = strlen(a);
  int len2 = strlen(b);
  int len = len1 > len2 ? len1 + 1 : len2 + 1;
  char *result = malloc(len + 1);
  result[len] = '\0';
  result[len - 1] = '\0';
  int i, j, carry = 0;
  len = 0;
  for (i = len1 - 1, j = len2 - 1; carry || i >= 0 || j >= 0; i--, j--) {
    int na = i >= 0 ? a[i] - '0' : 0;
    int nb = j >= 0 ? b[j] - '0' : 0;
    result[len++] = (na ^ nb ^ carry) + '0';
    carry = carry + na + nb >= 2 ? 1 : 0;
  }
  for (i = 0, j = len - 1; i < j; i++, j--) {
    char c = result[i];
    result[i] = result[j];
    result[j] = c;
  }
  return result;
}
```