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

```asm
<Substring>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %edx,-0x64(%rbp)
  mov    %ecx,-0x68(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rbx
  mov    -0x60(%rbp),%rax
  mov    %rax,%rdi
  call   <GetStringLength@plt>
  mov    %eax,-0x4c(%rbp)
  cmpl   $0x0,-0x4c(%rbp)
  jle    L95
  cmpl   $0x0,-0x64(%rbp)
  js     L95
  cmpl   $0x0,-0x68(%rbp)
  jle    L95
  mov    -0x64(%rbp),%edx
  mov    -0x68(%rbp),%eax
  add    %edx,%eax
  cmp    %eax,-0x4c(%rbp)
  jge    L44
L95:
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <ReturnNullMallocStack@plt>
  jmp    L81
L44:
  mov    -0x68(%rbp),%eax
  lea    D3(%rip),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <GetStackSize@plt>
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x48(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r14
  mov    $0x0,%r15d
  movslq %eax,%rdx
  mov    %rdx,%r12
  mov    $0x0,%r13d
  cltq
  mov    $0x10,%edx
  sub    $0x1,%rdx
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L68:
  cmp    %rdx,%rsp
  je     L61
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L68
L61:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L98
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L98:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x40(%rbp)
  movl   $0x0,-0x50(%rbp)
  movl   $0x0,-0x50(%rbp)
  jmp    L72
L17:
  mov    -0x64(%rbp),%edx
  mov    -0x50(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%ecx
  mov    -0x40(%rbp),%rdx
  mov    -0x50(%rbp),%eax
  cltq
  mov    %cl,(%rdx,%rax,1)
  addl   $0x1,-0x50(%rbp)
L72:
  mov    -0x50(%rbp),%eax
  cmp    -0x68(%rbp),%eax
  jl     L17
  mov    -0x40(%rbp),%rdx
  mov    -0x50(%rbp),%eax
  cltq
  movb   $0x0,(%rdx,%rax,1)
  mov    -0x68(%rbp),%edx
  mov    -0x40(%rbp),%rcx
  mov    -0x58(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <ReturnOutputMallocStack@plt>
L81:
  mov    %rbx,%rsp
  mov    -0x38(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L60
  call   <__stack_chk_fail@plt>
L60:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

tool_calls: name: unpack_data
arguments: tag: D3
type: string

tool: D3: char

assistant: ```c
char *Substring(char *output, char *input, const int start, const int length) {
  int length0 = GetStringLength(input);
  if (length0 < 1 || start < 0 || length < 1 || start + length > length0) {
    return ReturnNullMallocStack(output);
  }
  char output2[GetStackSize(length, "char")];
  int i = 0;
  for (i = 0; i < length; i++) {
    output2[i] = input[start + i];
  }
  output2[i] = '\0';
  return ReturnOutputMallocStack(output, output2, length);
}
```