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

```asm
<normalizePath>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  test   %esi,%esi
  je     L121
  mov    %rdi,%r13
  mov    %esi,%r12d
  lea    0x1(%rsi),%edi
  mov    %edx,%ebx
  cmp    $0x2,%edx
  jle    L174
  call   <malloc@plt>
  mov    %ebx,%edx
  mov    %r13,%rsi
  movl   $0x0,0x4(%rsp)
  mov    %rax,%rdi
  mov    %rax,%r14
  call   <memcpy@plt>
  add    %ebx,0x4(%rsp)
L176:
  cmp    %ebx,%r12d
  jg     L220
  jmp    L170
  nopl   0x0(%rax)
L81:
  movslq 0x4(%rsp),%rax
  lea    0x1(%rax),%edx
  mov    %edx,0x4(%rsp)
  mov    %bl,(%r14,%rax,1)
  mov    %r15d,%ebx
  cmp    %r12d,%ebx
  jge    L170
L220:
  lea    0x1(%rbx),%r15d
  movslq %ebx,%rbx
  movsbl 0x0(%r13,%rbx,1),%edi
  mov    %edi,%ebx
  call   <isSlash@plt>
  test   %rax,%rax
  je     L81
  cmp    %r15d,%r12d
  jle    L150
  movslq %r15d,%rbp
  mov    %r15d,%ebx
  add    %r13,%rbp
  jmp    L29
  nopl   (%rax)
L222:
  add    $0x1,%ebx
  add    $0x1,%rbp
  cmp    %ebx,%r12d
  je     L46
L29:
  movsbl 0x0(%rbp),%edi
  call   <isSlash@plt>
  test   %rax,%rax
  jne    L222
L106:
  movslq 0x4(%rsp),%rax
  cmp    %ebx,%r12d
  je     L4
  lea    0x1(%rax),%edx
  mov    %edx,0x4(%rsp)
  movb   $0x5c,(%r14,%rax,1)
  cmp    %r12d,%ebx
  jl     L220
L170:
  movslq 0x4(%rsp),%rax
L82:
  movb   $0x0,(%r14,%rax,1)
L121:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L197
  add    $0x18,%rsp
  mov    %r14,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L174:
  call   <malloc@plt>
  lea    0x4(%rsp),%rcx
  mov    %r12d,%esi
  mov    %r13,%rdi
  mov    %rax,%rdx
  movl   $0x0,0x4(%rsp)
  mov    %rax,%r14
  call   <normalizePrefix@plt>
  mov    %eax,%ebx
  jmp    L176
L150:
  mov    %r15d,%ebx
  jmp    L106
  nopw   0x0(%rax,%rax,1)
L46:
  movslq 0x4(%rsp),%rax
L4:
  cmp    $0x2,%eax
  je     L33
  test   %eax,%eax
  jne    L226
  movl   $0x1,0x4(%rsp)
  movb   $0x5c,(%r14)
  movslq 0x4(%rsp),%rax
  jmp    L82
L33:
  cmpb   $0x3a,0x1(%r14)
  jne    L82
  movl   $0x3,0x4(%rsp)
  movb   $0x5c,0x2(%r14)
  movslq 0x4(%rsp),%rax
  jmp    L82
L226:
  cmp    $0x1,%eax
  jne    L82
  movsbl (%r14),%edi
  call   <isSlash@plt>
  test   %rax,%rax
  movslq 0x4(%rsp),%rax
  je     L82
  lea    0x1(%rax),%edx
  mov    %edx,0x4(%rsp)
  movb   $0x5c,(%r14,%rax,1)
  movslq 0x4(%rsp),%rax
  jmp    L82
L197:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *normalizePath(const char *path, int len, int off) {
  int src;
  char *sb;
  int sbLen;
  if (len == 0)
    return (char *)path;
  if (off < 3)
    off = 0;
  sb = (char *)malloc(len + 1);
  sbLen = 0;
  if (off == 0) {
    src = normalizePrefix(path, len, sb, &sbLen);
  } else {
    src = off;
    memcpy(sb + sbLen, path, off);
    sbLen += off;
  }
  while (src < len) {
    char c = path[src++];
    if (isSlash(c)) {
      while ((src < len) && isSlash(path[src]))
        src++;
      if (src == len) {
        if ((sbLen == 2) && (sb[1] == ':')) {
          sb[sbLen++] = '\\';
          break;
        }
        if (sbLen == 0) {
          sb[sbLen++] = '\\';
          break;
        }
        if ((sbLen == 1) && (isSlash(sb[0]))) {
          sb[sbLen++] = '\\';
          break;
        }
        break;
      } else {
        sb[sbLen++] = '\\';
      }
    } else {
      sb[sbLen++] = c;
    }
  }
  sb[sbLen] = '\0';
  return sb;
}
```