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

```asm
<FindResourceFile>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x590,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x588(%rsp)
  xor    %eax,%eax
  call   <IsResourceInFile@plt>
  test   %eax,%eax
  je     L157
L9:
  mov    $0x1,%eax
L97:
  mov    0x588(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L74
  add    $0x590,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  xchg   %ax,%ax
L157:
  lea    0x10(%rsp),%r12
  mov    %rbp,%rsi
  mov    %r12,%rdi
  mov    %r12,%r13
  call   <strcpy@plt>
  mov    $0x2f,%esi
  mov    %r12,%rdi
  call   <strrchr@plt>
  test   %rax,%rax
  je     L129
  lea    0x1(%rax),%r13
  mov    %r13,%rax
  sub    %r12,%rax
  add    %rax,%rbp
L129:
  lea    D4(%rip),%rsi
  mov    %r13,%rdi
  call   <strcpy@plt>
  mov    %r13,%rdi
  mov    %rbp,%rsi
  call   <strcat@plt>
  mov    %r12,%rdi
  call   <IsResourceInFile@plt>
  test   %eax,%eax
  jne    L9
  mov    %r12,%rdi
  mov    $0x2f,%esi
  call   <strrchr@plt>
  movsbl 0x1(%rax),%edi
  mov    %rax,%rbp
  lea    0x1(%rax),%r13
  test   %dil,%dil
  je     L18
  mov    %r13,%rbx
  jmp    L156
  xchg   %ax,%ax
L86:
  movsbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  je     L18
L156:
  call   <isupper@plt>
  test   %rax,%rax
  je     L86
  movsbl (%rbx),%edi
  add    $0x1,%rbx
  call   <tolower@plt>
  mov    %al,-0x1(%rbx)
  movsbl (%rbx),%edi
  test   %dil,%dil
  jne    L156
L18:
  mov    $0x2e,%esi
  mov    %r13,%rdi
  call   <strchr@plt>
  mov    %rax,%r14
  test   %rax,%rax
  je     L58
L152:
  mov    %r14,%rbx
  sub    %r13,%rbx
  cmp    $0x8,%rbx
  jg     L98
  mov    %r14,%rdi
  call   <strlen@plt>
  cmp    $0x4,%eax
  jle    L4
  lea    0x8(%rsp),%r13
  mov    $0x7,%edx
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <strncpy@plt>
  movb   $0x0,0xc(%rsp)
  cmp    $0x6,%rbx
  jg     L24
L32:
  mov    $0x317e,%eax
  lea    0x2(%r14),%rdi
  mov    %r13,%rsi
  mov    %ax,(%r14)
  call   <strcpy@plt>
L4:
  mov    %r12,%rdi
  call   <IsResourceInFile@plt>
  jmp    L97
  xchg   %ax,%ax
L98:
  lea    0x8(%rsp),%r13
  mov    $0x7,%edx
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <strncpy@plt>
  movb   $0x0,0xc(%rsp)
L24:
  lea    0x7(%rbp),%r14
  jmp    L32
L58:
  mov    %r13,%rdi
  call   <strlen@plt>
  movslq %eax,%r14
  add    %r13,%r14
  jmp    L152
L74:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D4
type_guessed: string

tool: D4: resource.frk/

assistant: ```c
int FindResourceFile(char *filename) {
  char *spt, *pt, *dpt;
  char buffer[1400];
  if (IsResourceInFile(filename))
    return (1);
  strcpy(buffer, filename);
  spt = strrchr(buffer, '/');
  if (spt == NULL) {
    spt = buffer;
    pt = filename;
  } else {
    ++spt;
    pt = filename + (spt - buffer);
  }
  strcpy(spt, "resource.frk/");
  strcat(spt, pt);
  if (IsResourceInFile(buffer))
    return (1);
  spt = strrchr(buffer, '/') + 1;
  for (pt = spt; *pt; ++pt)
    if (isupper(*pt))
      *pt = tolower(*pt);
  dpt = strchr(spt, '.');
  if (dpt == NULL)
    dpt = spt + strlen(spt);
  if (dpt - spt > 8 || strlen(dpt) > 4) {
    char exten[8];
    strncpy(exten, dpt, 7);
    exten[4] = '\0';
    if (dpt - spt > 6)
      dpt = spt + 6;
    *dpt++ = '~';
    *dpt++ = '1';
    strcpy(dpt, exten);
  }
  return (IsResourceInFile(buffer));
}
```