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

```asm
<resolve>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rbp,%r13
  sub    $0x18,%rsp
  call   <strlen@plt>
  test   %eax,%eax
  je     L129
  mov    %rbp,%rdi
  mov    %rax,%rbx
  mov    %eax,%r14d
  mov    %r12,%r13
  call   <strlen@plt>
  test   %eax,%eax
  je     L129
  movslq %ebx,%r15
  movzbl 0x0(%rbp),%edx
  movzbl -0x1(%r12,%r15,1),%ecx
  lea    -0x1(%r15),%r9
  cmp    $0x1,%eax
  jle    L88
  cmp    $0x5c,%dl
  je     L113
  cmp    $0x5c,%cl
  je     L5
  add    %eax,%ebx
  mov    %eax,%r8d
L135:
  lea    0x2(%rbx),%edi
  mov    %r8d,0x8(%rsp)
  movslq %ebx,%rbx
  call   <malloc@plt>
  mov    %r14d,%edx
  mov    %r12,%rsi
  mov    %rax,%r13
  mov    %rax,%rdi
  call   <memcpy@plt>
  movb   $0x5c,0x0(%r13,%r15,1)
  mov    0x8(%rsp),%edx
  mov    %rbp,%rsi
  lea    0x1(%r13,%r15,1),%rdi
  call   <memcpy@plt>
  movb   $0x0,0x1(%r13,%rbx,1)
L129:
  add    $0x18,%rsp
  mov    %r13,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L113:
  cmpb   $0x5c,0x1(%rbp)
  je     L43
  add    $0x1,%rbp
  lea    -0x1(%rax),%r8d
  mov    $0x1,%esi
L9:
  movzbl 0x0(%rbp),%edx
  cmp    $0x5c,%cl
  je     L108
L34:
  add    %r14d,%eax
  sub    %esi,%eax
  movslq %eax,%rbx
  cmp    $0x5c,%dl
  jne    L135
  lea    0x1(%rbx),%edi
  mov    %r8d,0x8(%rsp)
  call   <malloc@plt>
  mov    %r14d,%edx
  mov    %r12,%rsi
  mov    %rax,%rdi
  mov    %rax,%r13
  call   <memcpy@plt>
  mov    0x8(%rsp),%edx
  lea    0x0(%r13,%r15,1),%rdi
  mov    %rbp,%rsi
  call   <memcpy@plt>
  movb   $0x0,0x0(%r13,%rbx,1)
  jmp    L129
  nopl   0x0(%rax)
L88:
  mov    %eax,%r8d
  xor    %esi,%esi
  jmp    L9
  nop
L5:
  mov    %eax,%r8d
  xor    %esi,%esi
L108:
  lea    -0x1(%rbx),%r14d
  mov    %r9,%r15
  jmp    L34
  xchg   %ax,%ax
L43:
  cmp    $0x2,%eax
  jne    L12
  cmp    $0x5c,%cl
  jne    L129
  mov    %r12,%rdi
  mov    %r9,0x8(%rsp)
  call   <strdup@plt>
  mov    0x8(%rsp),%r9
  mov    %rax,%r13
  movb   $0x0,(%rax,%r9,1)
  jmp    L129
L12:
  add    $0x2,%rbp
  lea    -0x2(%rax),%r8d
  mov    $0x2,%esi
  jmp    L9
```

assistant: ```c
char *resolve(const char *parent, const char *child) {
  char *c;
  char *theChars;
  int parentEnd, childStart, len;
  int pn = (int)strlen(parent);
  int cn = (int)strlen(child);
  if (pn == 0)
    return (char *)child;
  if (cn == 0)
    return (char *)parent;
  c = (char *)child;
  childStart = 0;
  parentEnd = pn;
  if ((cn > 1) && (c[0] == '\\')) {
    if (c[1] == '\\') {
      childStart = 2;
    } else {
      childStart = 1;
    }
    if (cn == childStart) {
      if (parent[pn - 1] == '\\') {
        char *str = strdup(parent);
        str[pn - 1] = '\0';
        return str;
      }
      return (char *)parent;
    }
  }
  if (parent[pn - 1] == '\\')
    parentEnd--;
  len = parentEnd + cn - childStart;
  if (child[childStart] == '\\') {
    theChars = (char *)malloc(len + 1);
    memcpy(theChars, parent, parentEnd);
    memcpy(theChars + parentEnd, child + childStart, (cn - childStart));
    theChars[len] = '\0';
  } else {
    theChars = (char *)malloc(len + 2);
    memcpy(theChars, parent, parentEnd);
    theChars[parentEnd] = '\\';
    memcpy(theChars + parentEnd + 1, child + childStart, (cn - childStart));
    theChars[len + 1] = '\0';
  }
  return theChars;
}
```