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

```asm
<save_makefile_scala>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  lea    D88(%rip),%rdi
  push   %rbx
  sub    $0xc18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xc08(%rsp)
  xor    %eax,%eax
  lea    0x400(%rsp),%r12
  lea    0x600(%rsp),%rbx
  mov    %r12,%rsi
  lea    0x800(%rsp),%r13
  lea    0xa00(%rsp),%r14
  call   <get_setting@plt>
  lea    0x200(%rsp),%rsi
  lea    D86(%rip),%rdi
  xor    %eax,%eax
  call   <get_setting@plt>
  mov    %rbx,%rsi
  lea    D71(%rip),%rdi
  xor    %eax,%eax
  call   <get_setting@plt>
  mov    %r13,%rsi
  lea    D0(%rip),%rdi
  xor    %eax,%eax
  call   <get_setting@plt>
  xor    %eax,%eax
  mov    %r14,%rsi
  lea    D67(%rip),%rdi
  call   <get_setting@plt>
  cmpl   $0x6c616373,0x200(%rsp)
  je     L42
L33:
  mov    0xc08(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L46
  add    $0xc18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L42:
  cmpw   $0x61,0x204(%rsp)
  jne    L33
  xor    %eax,%eax
  mov    %r12,%rdi
  call   <is_library@plt>
  test   %eax,%eax
  jne    L33
  lea    D83(%rip),%r12
  mov    %rbp,%rdi
  mov    %r12,%rsi
  call   <empty_makefile_section@plt>
  cmp    $0x1,%eax
  je     L22
L18:
  lea    D14(%rip),%r12
  xor    %eax,%eax
  mov    %rbp,%rdi
  mov    %r12,%rsi
  call   <empty_makefile_section@plt>
  cmp    $0x1,%eax
  jne    L33
  mov    %rsp,%r15
  sub    $0x8,%rsp
  mov    %r13,%r9
  mov    %rbx,%r8
  push   %r14
  mov    $0x2f,%ecx
  mov    %r13,%rdx
  mov    %r15,%rdi
  lea    D59(%rip),%rsi
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    %r15,%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <add_makefile_entry_to_file@plt>
  mov    %r15,%rsp
  jmp    L33
  nopl   0x0(%rax)
L22:
  mov    %rsp,%r15
  sub    $0x8,%rsp
  mov    %r13,%r9
  mov    %rbx,%r8
  push   %r14
  mov    $0x2f,%ecx
  mov    %r13,%rdx
  mov    %r15,%rdi
  lea    D11(%rip),%rsi
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    %r15,%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <add_makefile_entry_to_file@plt>
  mov    %r15,%rsp
  jmp    L18
L46:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D88
data_type: string
name: unpack_data
arguments: data_label: D86
data_type: string
name: unpack_data
arguments: data_label: D71
data_type: string
name: unpack_data
arguments: data_label: D0
data_type: string
name: unpack_data
arguments: data_label: D67
data_type: string
name: unpack_data
arguments: data_label: D83
data_type: string
name: unpack_data
arguments: data_label: D14
data_type: string
name: unpack_data
arguments: data_label: D59
data_type: string
name: unpack_data
arguments: data_label: D11
data_type: string

tool: D88: project name

tool: D86: project type

tool: D71: compile

tool: D0: source dir

tool: D67: build dir

tool: D83: all

tool: D14: debug

tool: D59: scalac -g %s%c*.scala %s -sourcepath %s -d %s

tool: D11: scalac %s%c*.scala %s -sourcepath %s -d %s

assistant: ```c
void save_makefile_scala(char *filename) {
  char str[512];
  char project_type[512];
  char project_name[512];
  char compile_args[512];
  char sourcedir[512];
  char build_dir[512];
  get_setting("project name", project_name);
  get_setting("project type", project_type);
  get_setting("compile", compile_args);
  get_setting("source dir", sourcedir);
  get_setting("build dir", build_dir);
  if (strcmp(project_type, "scala") == 0) {
    if (is_library(project_name) == 0) {
      if (empty_makefile_section(filename, "all") == 1) {
        sprintf(str, "scalac %s%c*.scala %s -sourcepath %s -d %s", sourcedir, '/', compile_args, sourcedir, build_dir);
        add_makefile_entry_to_file(filename, "all", str);
      }
      if (empty_makefile_section(filename, "debug") == 1) {
        sprintf(str, "scalac -g %s%c*.scala %s -sourcepath %s -d %s", sourcedir, '/', compile_args, sourcedir, build_dir);
        add_makefile_entry_to_file(filename, "debug", str);
      }
    } else {
    }
  }
}
```