user: Demonstrate the C code that generates the assembly output below:

```asm
<substr>:
  endbr64
  test   %rdi,%rdi
  je     L111
  push   %r13
  push   %r12
  movslq %edx,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x8,%rsp
  call   <strlen@plt>
  lea    0x1(%rax),%edi
  mov    %eax,%r13d
  call   <malloc@plt>
  test   %ebx,%ebx
  mov    %rax,%rdx
  mov    %rax,%r8
  lea    -0x1(%r13,%rbx,1),%eax
  cmovs  %eax,%ebx
  test   %ebx,%ebx
  js     L123
  cmp    %r13d,%ebx
  jg     L123
  lea    (%rbx,%r12,1),%edi
  cmp    %edi,%ebx
  jge    L61
  movslq %ebx,%rsi
  mov    %rdx,%rcx
  lea    -0x1(%r12),%eax
  mov    %r12d,%r9d
  lea    0x1(%rbp,%rsi,1),%r10
  sub    %r10,%rcx
  cmp    $0xe,%rcx
  jbe    L4
  cmp    $0x6,%eax
  jbe    L4
  cmp    $0xe,%eax
  jbe    L14
  mov    %r12d,%eax
  mov    %rsi,%rcx
  shr    $0x4,%eax
  sub    %rdx,%rcx
  sub    $0x1,%eax
  add    %rbp,%rcx
  shl    $0x4,%rax
  lea    0x10(%rdx,%rax,1),%r9
  mov    %rdx,%rax
  nopl   0x0(%rax)
L75:
  movdqu (%rax,%rcx,1),%xmm0
  add    $0x10,%rax
  movups %xmm0,-0x10(%rax)
  cmp    %r9,%rax
  jne    L75
  mov    %r12d,%ecx
  and    $0xfffffff0,%ecx
  lea    (%rcx,%rbx,1),%eax
  cmp    %ecx,%r12d
  je     L61
  mov    %r12d,%r9d
  sub    %ecx,%r9d
  lea    -0x1(%r9),%r10d
  cmp    $0x6,%r10d
  jbe    L6
L142:
  add    %rbp,%rsi
  mov    (%rsi,%rcx,1),%rsi
  mov    %rsi,(%rdx,%rcx,1)
  mov    %r9d,%ecx
  and    $0xfffffff8,%ecx
  add    %ecx,%eax
  cmp    %ecx,%r9d
  je     L61
L6:
  movslq %eax,%rcx
  movzbl 0x0(%rbp,%rcx,1),%esi
  mov    %eax,%ecx
  sub    %ebx,%ecx
  movslq %ecx,%rcx
  mov    %sil,(%rdx,%rcx,1)
  lea    0x1(%rax),%ecx
  cmp    %ecx,%edi
  jle    L61
  movslq %ecx,%rsi
  sub    %ebx,%ecx
  movzbl 0x0(%rbp,%rsi,1),%esi
  movslq %ecx,%rcx
  mov    %sil,(%rdx,%rcx,1)
  lea    0x2(%rax),%ecx
  cmp    %ecx,%edi
  jle    L61
  movslq %ecx,%rsi
  sub    %ebx,%ecx
  movzbl 0x0(%rbp,%rsi,1),%esi
  movslq %ecx,%rcx
  mov    %sil,(%rdx,%rcx,1)
  lea    0x3(%rax),%ecx
  cmp    %ecx,%edi
  jle    L61
  movslq %ecx,%rsi
  sub    %ebx,%ecx
  movzbl 0x0(%rbp,%rsi,1),%esi
  movslq %ecx,%rcx
  mov    %sil,(%rdx,%rcx,1)
  lea    0x4(%rax),%ecx
  cmp    %ecx,%edi
  jle    L61
  movslq %ecx,%rsi
  sub    %ebx,%ecx
  movzbl 0x0(%rbp,%rsi,1),%esi
  movslq %ecx,%rcx
  mov    %sil,(%rdx,%rcx,1)
  lea    0x5(%rax),%ecx
  cmp    %ecx,%edi
  jle    L61
  movslq %ecx,%rsi
  sub    %ebx,%ecx
  add    $0x6,%eax
  movzbl 0x0(%rbp,%rsi,1),%esi
  movslq %ecx,%rcx
  mov    %sil,(%rdx,%rcx,1)
  cmp    %eax,%edi
  jle    L61
  movslq %eax,%rcx
  sub    %ebx,%eax
  movzbl 0x0(%rbp,%rcx,1),%ecx
  cltq
  mov    %cl,(%rdx,%rax,1)
L61:
  movb   $0x0,(%rdx,%r12,1)
  add    $0x8,%rsp
  mov    %r8,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L123:
  add    $0x8,%rsp
  xor    %r8d,%r8d
  pop    %rbx
  mov    %r8,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L4:
  sub    %rdx,%rsi
  lea    0x1(%rdx,%rax,1),%rdi
  mov    %rdx,%rax
  add    %rsi,%rbp
  cs nopw 0x0(%rax,%rax,1)
L198:
  movzbl 0x0(%rbp,%rax,1),%ecx
  add    $0x1,%rax
  mov    %cl,-0x1(%rax)
  cmp    %rdi,%rax
  jne    L198
  jmp    L61
L14:
  mov    %ebx,%eax
  xor    %ecx,%ecx
  jmp    L142
  nopl   0x0(%rax)
L111:
  xor    %eax,%eax
  ret
```

assistant: ```c
char *substr(char *str, int offset, int len) {
  int slen, start, i;
  char *nstr;
  if (str == NULL)
    return NULL;
  else
    slen = strlen(str);
  nstr = (char *)malloc(sizeof(char) * slen + 1);
  if (offset >= 0)
    start = offset;
  else
    start = slen + offset - 1;
  if ((start < 0) || (start > slen))
    return NULL;
  for (i = start; i < start + len; i++)
    nstr[i - start] = str[i];
  nstr[len] = '\0';
  return nstr;
}
```