user: What is the c source code of the assembly code below:

```asm
<split_file>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  mov    %rsi,%rdi
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x18,%rsp
  mov    %rsi,0x8(%rsp)
  call   <strlen@plt>
  movslq %eax,%r15
  lea    0x8(%r15),%edi
  call   <malloc@plt>
  lea    0x7(%r15),%edi
  mov    %rax,%r12
  call   <malloc@plt>
  mov    0x8(%rsp),%rsi
  mov    %r15d,%edx
  mov    %r12,%rdi
  mov    %rax,%rbp
  call   <strncpy@plt>
  lea    (%r12,%r15,1),%rdi
  mov    $0x7,%edx
  lea    D36(%rip),%rsi
  call   <strncpy@plt>
  mov    0x8(%rsp),%rsi
  mov    %r15d,%edx
  mov    %rbp,%rdi
  movb   $0x0,0x7(%r12,%r15,1)
  call   <strncpy@plt>
  lea    0x0(%rbp,%r15,1),%rdi
  mov    $0x6,%edx
  lea    D50(%rip),%rsi
  call   <strncpy@plt>
  movb   $0x0,0x6(%rbp,%r15,1)
  mov    %rbp,%rdx
  mov    %r12,%rsi
  lea    D21(%rip),%rdi
  lea    D2(%rip),%r15
  call   <printf@plt>
  mov    %r15,%rsi
  mov    %r12,%rdi
  call   <fopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L2
L14:
  mov    %r13,%rsi
  mov    %ebx,%ecx
  xor    %edx,%edx
  mov    %r14,%rdi
  call   <copy_chunked@plt>
  mov    %r13,%rdi
  call   <fclose@plt>
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <fopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L18
L7:
  lea    0x8(%rbx),%edx
  mov    %r13,%rsi
  mov    $0xffffffff,%ecx
  mov    %r14,%rdi
  call   <copy_chunked@plt>
  mov    %r13,%rdi
  call   <fclose@plt>
  mov    %r12,%rdi
  call   <free@plt>
  add    $0x18,%rsp
  mov    %rbp,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10d0 <free@plt>
  nopl   (%rax)
L2:
  mov    %r12,%rsi
  lea    D29(%rip),%rdi
  call   <fatal@plt>
  jmp    L14
  nopl   0x0(%rax)
L18:
  mov    %rbp,%rsi
  lea    D37(%rip),%rdi
  call   <fatal@plt>
  jmp    L7
```

tool_calls: name: disassemble_data
arguments: data_label: D36
type_guessed: string
name: disassemble_data
arguments: data_label: D50
type_guessed: string
name: disassemble_data
arguments: data_label: D21
type_guessed: string
name: disassemble_data
arguments: data_label: D2
type_guessed: string
name: disassemble_data
arguments: data_label: D29
type_guessed: string
name: disassemble_data
arguments: data_label: D37
type_guessed: string

tool: D36: .kernel

tool: D50: .image

tool: D21: Kernel path: %s
Image path: %s


tool: D2: wb

tool: D29: Could not open kernel file for writing: %s


tool: D37: Could not open image file for writng: %s


assistant: ```c
void split_file(FILE *in_file, char *filename, int64_t offset) {
  int path_len = strlen(filename);
  char *kernel_name = malloc(path_len + 1 + 7);
  char *image_name = malloc(path_len + 1 + 6);
  strncpy(kernel_name, filename, path_len);
  strncpy(kernel_name + path_len, ".kernel", 7);
  kernel_name[path_len + 7] = 0;
  strncpy(image_name, filename, path_len);
  strncpy(image_name + path_len, ".image", 6);
  image_name[path_len + 6] = 0;
  printf("Kernel path: %s\nImage path: %s\n", kernel_name, image_name);
  FILE *kernel_file = fopen(kernel_name, "wb");
  if (!kernel_file)
    fatal("Could not open kernel file for writing: %s\n", kernel_name);
  copy_chunked(in_file, kernel_file, 0, offset);
  fclose(kernel_file);
  FILE *image_file = fopen(image_name, "wb");
  if (!image_file)
    fatal("Could not open image file for writng: %s\n", image_name);
  copy_chunked(in_file, image_file, offset + 8, -1);
  fclose(image_file);
  free(kernel_name);
  free(image_name);
}
```