user: Please show me the C implementation that matches the assembly code listed below:

```asm
<archive_extract>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %rsi,%r13
  mov    %rdi,%rsi
  push   %r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  sub    $0xaa8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xa98(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rdx
  lea    0x610(%rsp),%r15
  mov    %rdx,%rdi
  mov    %rdx,0x8(%rsp)
  lea    0x210(%rsp),%r12
  lea    0x410(%rsp),%rbx
  call   <strcpy@plt>
  mov    0x8(%rsp),%rdi
  call   <wfile_make_absolute@plt>
  mov    %r13,%rsi
  mov    %r15,%rdi
  call   <wfile_basespec@plt>
  mov    %r12,%rdi
  call   <wfile_abstmpnam@plt>
  mov    %r12,%rdi
  call   <wfile_makedir@plt>
  xor    %eax,%eax
  call   <wfile_get_wd@plt>
  mov    %rbx,%rdi
  mov    %rax,%rsi
  call   <strcpy@plt>
  mov    %r12,%rdi
  call   <wfile_set_wd@plt>
  mov    %r14,%rdi
  lea    0x810(%rsp),%r14
  call   <wfile_ext@plt>
  lea    D39(%rip),%rsi
  mov    %eax,%edi
  call   <stricmp@plt>
  mov    0x8(%rsp),%rdx
  mov    %r13,%rcx
  test   %eax,%eax
  jne    L13
  lea    D24(%rip),%rsi
  mov    %r14,%rdi
  call   <sprintf@plt>
L16:
  mov    %r14,%rdi
  call   <system@plt>
  mov    %rbx,%rdi
  call   <wfile_set_wd@plt>
  mov    %rbp,%rdi
  mov    %r15,%rdx
  mov    %r12,%rsi
  call   <wfile_fullname@plt>
  mov    %rbp,%rdi
  call   <wfile_status@plt>
  cmp    $0x1,%eax
  je     L21
  lea    D0(%rip),%rdi
  mov    %r14,%rsi
  call   <printf@plt>
  mov    $0xa,%edi
  call   <exit@plt>
L21:
  mov    0xa98(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L14
  add    $0xaa8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L13:
  lea    D35(%rip),%rsi
  mov    %r14,%rdi
  call   <sprintf@plt>
  jmp    L16
L14:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D39
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D24
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D0
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D35
type_guessed: string

tool: D39: 7z

tool: D24: 7z -r e "%s" "%s" 1> nul 2> nul

tool: D0: Internal error executing command '%s'!


tool: D35: unzip -o -j "%s" "%s" 1> nul 2> nul

assistant: ```c
int archive_extract(char *archfile, char *file_to_extract, char *tempname) {
  char archname_full[512];
  char tempdir[512];
  char cwd[512];
  char basefile[512];
  char cmd[512 + 128];
  strcpy(archname_full, archfile);
  wfile_make_absolute(archname_full);
  wfile_basespec(basefile, file_to_extract);
  wfile_abstmpnam(tempdir);
  wfile_makedir(tempdir);
  strcpy(cwd, wfile_get_wd());
  wfile_set_wd(tempdir);
  if (!stricmp(wfile_ext(archfile), "7z"))
    sprintf(cmd, "7z -r e \"%s\" \"%s\" 1> nul 2> nul", archname_full, file_to_extract);
  else
    sprintf(cmd, "unzip -o -j \"%s\" \"%s\" 1> nul 2> nul", archname_full, file_to_extract);
  system(cmd);
  wfile_set_wd(cwd);
  wfile_fullname(tempname, tempdir, basefile);
  if (wfile_status(tempname) != 1) {
    printf("Internal error executing command '%s'!\n", cmd);
    exit(10);
  }
  return (1);
}
```