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

```asm
<save_makefile_scala>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xc20,%rsp
  mov    %rdi,-0xc18(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x810(%rbp),%rax
  mov    %rax,%rsi
  lea    D24(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <get_setting@plt>
  lea    -0xa10(%rbp),%rax
  mov    %rax,%rsi
  lea    D72(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <get_setting@plt>
  lea    -0x610(%rbp),%rax
  mov    %rax,%rsi
  lea    D78(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <get_setting@plt>
  lea    -0x410(%rbp),%rax
  mov    %rax,%rsi
  lea    D53(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <get_setting@plt>
  lea    -0x210(%rbp),%rax
  mov    %rax,%rsi
  lea    D19(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <get_setting@plt>
  lea    -0xa10(%rbp),%rax
  lea    D105(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L12
  lea    -0x810(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <is_library@plt>
  test   %eax,%eax
  jne    L12
  mov    -0xc18(%rbp),%rax
  lea    D107(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <empty_makefile_section@plt>
  cmp    $0x1,%eax
  jne    L3
  lea    -0x410(%rbp),%rdi
  lea    -0x610(%rbp),%rsi
  lea    -0x410(%rbp),%rdx
  lea    -0xc10(%rbp),%rax
  sub    $0x8,%rsp
  lea    -0x210(%rbp),%rcx
  push   %rcx
  mov    %rdi,%r9
  mov    %rsi,%r8
  mov    $0x2f,%ecx
  lea    D82(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  add    $0x10,%rsp
  lea    -0xc10(%rbp),%rdx
  mov    -0xc18(%rbp),%rax
  lea    D107(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <add_makefile_entry_to_file@plt>
L3:
  mov    -0xc18(%rbp),%rax
  lea    D43(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <empty_makefile_section@plt>
  cmp    $0x1,%eax
  jne    L12
  lea    -0x410(%rbp),%rdi
  lea    -0x610(%rbp),%rsi
  lea    -0x410(%rbp),%rdx
  lea    -0xc10(%rbp),%rax
  sub    $0x8,%rsp
  lea    -0x210(%rbp),%rcx
  push   %rcx
  mov    %rdi,%r9
  mov    %rsi,%r8
  mov    $0x2f,%ecx
  lea    D80(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  add    $0x10,%rsp
  lea    -0xc10(%rbp),%rdx
  mov    -0xc18(%rbp),%rax
  lea    D43(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <add_makefile_entry_to_file@plt>
L12:
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L37
  call   <__stack_chk_fail@plt>
L37:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D24
type_infered: string
name: retrieve_data
arguments: tag: D72
type_infered: string
name: retrieve_data
arguments: tag: D78
type_infered: string
name: retrieve_data
arguments: tag: D53
type_infered: string
name: retrieve_data
arguments: tag: D19
type_infered: string
name: retrieve_data
arguments: tag: D105
type_infered: string
name: retrieve_data
arguments: tag: D107
type_infered: string
name: retrieve_data
arguments: tag: D82
type_infered: string
name: retrieve_data
arguments: tag: D43
type_infered: string
name: retrieve_data
arguments: tag: D80
type_infered: string

tool: D24: project name

tool: D72: project type

tool: D78: compile

tool: D53: source dir

tool: D19: build dir

tool: D105: scala

tool: D107: all

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

tool: D43: debug

tool: D80: scalac -g %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 {
    }
  }
}
```