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

```asm
<substring>:
  endbr64
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x8,%rsp
  call   <strlen@plt>
  test   %ebx,%ebx
  js     L58
  cmp    %ebx,%eax
  jle    L58
  xor    %edx,%edx
  test   %ebx,%ebx
  cmovns %ebx,%edx
  cmp    %edx,%ebp
  jl     L58
  cmp    %ebp,%eax
  jle    L58
  mov    %ebp,%r13d
  mov    $0x1,%esi
  sub    %ebx,%r13d
  lea    0x2(%r13),%edi
  call   <calloc@plt>
  movslq %ebx,%rdx
  lea    0x1(%r12,%rdx,1),%rsi
  mov    %rax,%rcx
  mov    %rax,%r8
  sub    %rsi,%rax
  cmp    $0xe,%rax
  jbe    L102
  cmp    $0x6,%r13d
  jbe    L102
  lea    0x1(%r13),%r9d
  cmp    %ebp,%ebx
  mov    $0x1,%esi
  cmovle %r9d,%esi
  cmp    $0xe,%r13d
  jbe    L143
  mov    %esi,%edi
  mov    %rdx,%r10
  mov    %rcx,%rax
  shr    $0x4,%edi
  sub    %rcx,%r10
  shl    $0x4,%rdi
  add    %r12,%r10
  add    %rcx,%rdi
  nopl   0x0(%rax,%rax,1)
L87:
  movdqu (%rax,%r10,1),%xmm0
  add    $0x10,%rax
  movups %xmm0,-0x10(%rax)
  cmp    %rdi,%rax
  jne    L87
  mov    %esi,%eax
  and    $0xfffffff0,%eax
  mov    %eax,%r11d
  lea    (%rbx,%rax,1),%r10d
  cmp    %eax,%esi
  je     L67
L65:
  sub    %eax,%esi
  lea    -0x1(%rsi),%edi
  cmp    $0x6,%edi
  jbe    L32
  mov    %eax,%edi
  lea    (%r12,%rdx,1),%rax
  mov    (%rax,%rdi,1),%rax
  mov    %rax,(%rcx,%rdi,1)
  mov    %esi,%eax
  and    $0xfffffff8,%eax
  add    %eax,%r10d
  add    %eax,%r11d
  cmp    %eax,%esi
  je     L67
L32:
  movslq %r10d,%rax
  movzbl (%r12,%rax,1),%edx
  movslq %r11d,%rax
  mov    %dl,(%rcx,%rax,1)
  lea    0x1(%r10),%eax
  lea    0x1(%r11),%edx
  cmp    %eax,%ebp
  jl     L67
  cltq
  movslq %edx,%rdx
  movzbl (%r12,%rax,1),%eax
  mov    %al,(%rcx,%rdx,1)
  lea    0x2(%r10),%eax
  lea    0x2(%r11),%edx
  cmp    %eax,%ebp
  jl     L67
  cltq
  movslq %edx,%rdx
  movzbl (%r12,%rax,1),%eax
  mov    %al,(%rcx,%rdx,1)
  lea    0x3(%r10),%eax
  lea    0x3(%r11),%edx
  cmp    %eax,%ebp
  jl     L67
  cltq
  movslq %edx,%rdx
  movzbl (%r12,%rax,1),%eax
  mov    %al,(%rcx,%rdx,1)
  lea    0x4(%r10),%eax
  lea    0x4(%r11),%edx
  cmp    %eax,%ebp
  jl     L67
  cltq
  movslq %edx,%rdx
  movzbl (%r12,%rax,1),%eax
  mov    %al,(%rcx,%rdx,1)
  lea    0x5(%r10),%eax
  lea    0x5(%r11),%edx
  cmp    %eax,%ebp
  jl     L67
  cltq
  movslq %edx,%rdx
  add    $0x6,%r10d
  add    $0x6,%r11d
  movzbl (%r12,%rax,1),%eax
  mov    %al,(%rcx,%rdx,1)
  cmp    %r10d,%ebp
  jl     L67
  movslq %r10d,%r10
  movslq %r11d,%r11
  movzbl (%r12,%r10,1),%eax
  mov    %al,(%rcx,%r11,1)
L67:
  cmp    %ebp,%ebx
  mov    $0x1,%eax
  cmovg  %eax,%r9d
  mov    %r8,%rax
  movslq %r9d,%r9
  movb   $0x0,(%rcx,%r9,1)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  xchg   %ax,%ax
L58:
  add    $0x8,%rsp
  xor    %r8d,%r8d
  pop    %rbx
  mov    %r8,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L102:
  mov    %rcx,%rsi
  mov    %rdx,%rax
  sub    %rdx,%rsi
  nopl   0x0(%rax)
L119:
  movzbl (%r12,%rax,1),%edx
  mov    %dl,(%rsi,%rax,1)
  add    $0x1,%rax
  cmp    %eax,%ebp
  jge    L119
  lea    0x1(%r13),%r9d
  jmp    L67
L143:
  mov    %ebx,%r10d
  xor    %eax,%eax
  xor    %r11d,%r11d
  jmp    L65
```

assistant: ```c
char *substring(char *pStr, int start, int end) {
  int len = strlen(pStr);
  int i, j;
  char *pRes = NULL;
  if (start < 0 || start >= len || end < 0 || end >= len || end < start)
    return NULL;
  pRes = (char *)calloc(end - start + 2, sizeof(char));
  j = 0;
  for (i = start; i <= end; i++) {
    pRes[j] = pStr[i];
    j++;
  }
  pRes[j] = '\0';
  return pRes;
}
```