user: Translate the below assembly code into C programming language:

```asm
<extract>:
  endbr64
  push   %r14
  push   %r13
  mov    %rdi,%r13
  mov    $0x3e8,%edi
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1e0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x1d8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  call   <malloc@plt>
  mov    %r13,%rsi
  mov    %rbp,%rdi
  mov    %rax,%r12
  call   <strcpy@plt>
  cmpb   $0x0,(%rsp)
  je     L143
  lea    0x1(%rsp),%r13
  xor    %ebx,%ebx
  mov    %r13,%rax
  nopl   0x0(%rax,%rax,1)
L189:
  add    $0x1,%rax
  movslq %ebx,%r14
  add    $0x1,%ebx
  cmpb   $0x0,-0x1(%rax)
  jne    L189
  mov    %rbp,%rdi
  call   <strrev@plt>
  mov    %rbp,%rdi
  lea    0x0(%r13,%r14,1),%rdx
  movabs $0xffffdffffffff7fe,%rcx
  nopw   0x0(%rax,%rax,1)
L31:
  movzbl (%rdi),%eax
  sub    $0x2f,%eax
  cmp    $0x2d,%al
  ja     L174
  bt     %rax,%rcx
  jb     L174
  movb   $0x5f,(%rdi)
L174:
  add    $0x1,%rdi
  cmp    %rdi,%rdx
  jne    L31
  cmp    $0x32,%ebx
  jle    L168
  movzbl 0x30(%rsp),%eax
  movdqa (%rsp),%xmm0
  movb   $0x0,0x101(%rsp)
  lea    0xd0(%rsp),%r13
  movdqa 0x10(%rsp),%xmm1
  movdqa 0x20(%rsp),%xmm2
  mov    %al,0x100(%rsp)
  movaps %xmm0,0xd0(%rsp)
  movaps %xmm1,0xe0(%rsp)
  movaps %xmm2,0xf0(%rsp)
L155:
  lea    D7(%rip),%rdi
  call   <getenv@plt>
  lea    D13(%rip),%rsi
  mov    %rax,%rbp
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <strcpy@plt>
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  mov    0x1d8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L15
  add    $0x1e0,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L143:
  mov    %rbp,%rdi
  call   <strrev@plt>
L168:
  movzbl (%rsp),%edx
  mov    $0x1,%eax
  lea    -0x1(%rsp),%rdi
  xor    %esi,%esi
  lea    0xcf(%rsp),%r8
  test   %dl,%dl
  je     L43
  nopl   0x0(%rax)
L89:
  mov    %dl,(%r8,%rax,1)
  lea    -0x1(%rax),%ecx
  mov    %eax,%esi
  add    $0x1,%rax
  movzbl (%rdi,%rax,1),%edx
  test   %dl,%dl
  jne    L89
  lea    0xd0(%rsp),%r13
  cmp    $0x31,%esi
  jg     L97
L43:
  mov    $0x32,%eax
  mov    $0x1,%edx
  lea    0xd0(%rsp),%r13
  movabs $0x3030303030303030,%rdi
  sub    %esi,%eax
  cmp    $0x31,%esi
  cmovg  %rdx,%rax
  movslq %esi,%rdx
  add    %r13,%rdx
  mov    %eax,%ecx
  cmp    $0x8,%eax
  jae    L77
  test   $0x4,%al
  jne    L99
  test   %ecx,%ecx
  jne    L142
L139:
  mov    $0x31,%ecx
  xor    %eax,%eax
  sub    %esi,%ecx
  cmp    $0x31,%esi
  cmovg  %eax,%ecx
  add    %esi,%ecx
L97:
  movslq %ecx,%rcx
  movb   $0x0,0xd0(%rsp,%rcx,1)
  jmp    L155
L77:
  lea    0x8(%rdx),%r8
  mov    %rdi,(%rdx)
  and    $0xfffffffffffffff8,%r8
  mov    %rdi,-0x8(%rax,%rdx,1)
  sub    %r8,%rdx
  lea    (%rax,%rdx,1),%ecx
  and    $0xfffffff8,%ecx
  cmp    $0x8,%ecx
  jb     L139
  and    $0xfffffff8,%ecx
  xor    %eax,%eax
L147:
  mov    %eax,%edx
  add    $0x8,%eax
  mov    %rdi,(%r8,%rdx,1)
  cmp    %ecx,%eax
  jb     L147
  jmp    L139
L142:
  movb   $0x30,(%rdx)
  test   $0x2,%cl
  je     L139
  mov    $0x3030,%eax
  mov    %ax,-0x2(%rdx,%rcx,1)
  jmp    L139
L99:
  movl   $0x30303030,(%rdx)
  movl   $0x30303030,-0x4(%rdx,%rcx,1)
  jmp    L139
L15:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D7
data_type: string
name: read_data
arguments: data_label: D13
data_type: string

tool: D7: HOME

tool: D13: /

assistant: ```c
char *extract(char locn[]) {
  int len = 0, i = 0, j;
  char g[255], l[200];
  char *gen = (char *)malloc(sizeof(char) * 1000);
  strcpy(l, locn);
  for (i = 0; l[i] != '\0'; i++)
    ;
  len = i;
  strrev(l);
  for (i = 0; i < len; i++) {
    if (l[i] == ':' || l[i] == '/' || l[i] == '\\')
      l[i] = '_';
  }
  if (len > 50) {
    for (i = 0; i < 50; i++)
      g[i] = l[i];
    g[i - 1] = '\0';
  } else {
    i = 0;
    while (l[i]) {
      g[i] = l[i];
      i++;
    }
    j = i;
    while (j < 50)
      g[j++] = '0';
    g[j - 1] = '\0';
  }
  if (0)
    strcpy(gen, "C:\\filing\\");
  else {
    char *home1 = getenv("HOME");
    strcat(home1, "/");
    strcpy(gen, home1);
  }
  strcat(gen, g);
  return gen;
}
```