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

```asm
<main>:
  endbr64
  push   %r15
  lea    D196(%rip),%rcx
  lea    D215(%rip),%rdx
  push   %r14
  push   %r13
  push   %r12
  lea    D190(%rip),%r12
  push   %rbp
  lea    D100(%rip),%rbp
  push   %rbx
  sub    $0x118,%rsp
  movdqa D118(%rip),%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x108(%rsp)
  lea    D88(%rip),%rax
  mov    %rcx,0x50(%rsp)
  lea    0x50(%rsp),%r13
  lea    D143(%rip),%rcx
  mov    %rdx,0x40(%rsp)
  lea    0x30(%rsp),%rbx
  mov    %rcx,0x58(%rsp)
  mov    %rdx,0x60(%rsp)
  movaps %xmm0,0xd0(%rsp)
  movaps %xmm0,0xe0(%rsp)
  mov    %rax,0x38(%rsp)
  lea    D174(%rip),%rax
  mov    %rax,0x48(%rsp)
  mov    %rax,0x68(%rsp)
  movabs $0x656d616e65736162,%rax
  mov    %rax,0xc7(%rsp)
  mov    $0xa,%eax
  mov    %ax,0x104(%rsp)
  lea    0xd0(%rsp),%rax
  mov    %rax,%rdi
  mov    %rax,0x20(%rsp)
  xor    %eax,%eax
  movaps %xmm0,0xf0(%rsp)
  movq   $0x2,0x78(%rsp)
  movq   $0x3,0x80(%rsp)
  movq   $0x4,0x88(%rsp)
  movq   $0x1,0x98(%rsp)
  movq   $0x2,0xa0(%rsp)
  movq   $0x3,0xa8(%rsp)
  movq   $0x4,0xb0(%rsp)
  movb   $0x0,0xcf(%rsp)
  movl   $0x3d3d3d3d,0x100(%rsp)
  call   <printf@plt>
  lea    D149(%rip),%rdi
  call   <puts@plt>
  mov    %r13,0x28(%rsp)
L50:
  mov    %r12,%rdi
  add    $0x8,%rbx
  call   <G_get_num_decimals@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  mov    %eax,%edx
  xor    %eax,%eax
  call   <printf@plt>
  cmp    %r13,%rbx
  je     L4
  mov    (%rbx),%r12
  jmp    L50
  nopl   0x0(%rax)
L4:
  mov    0x20(%rsp),%rdi
  xor    %eax,%eax
  lea    0x70(%rsp),%r12
  xor    %ebx,%ebx
  lea    0xb8(%rsp),%r14
  lea    D24(%rip),%rbp
  call   <printf@plt>
  lea    D178(%rip),%rdi
  call   <puts@plt>
  lea    0x90(%rsp),%rax
  mov    %r12,0x18(%rsp)
  mov    %rax,0x10(%rsp)
  mov    %r14,0x8(%rsp)
  mov    %r12,(%rsp)
L37:
  mov    0x10(%rsp),%r12
  xor    %r15d,%r15d
L91:
  mov    D248(%rip),%rax
  mov    %r15,%rsi
  mov    %rbx,%rdi
  add    $0x8,%r12
  movq   %rax,%xmm0
  call   <G_double_to_basename_format@plt>
  mov    %r15,%rdx
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  mov    %rax,%rcx
  mov    %rax,%r13
  mov    D248(%rip),%rax
  movq   %rax,%xmm0
  mov    $0x1,%eax
  call   <printf@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    D123(%rip),%rax
  mov    %r15,%rsi
  mov    %rbx,%rdi
  movq   %rax,%xmm0
  call   <G_double_to_basename_format@plt>
  mov    %r15,%rdx
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  mov    %rax,%rcx
  mov    %rax,%r13
  mov    D123(%rip),%rax
  movq   %rax,%xmm0
  mov    $0x1,%eax
  call   <printf@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  cmp    %r12,%r14
  je     L99
  mov    (%r12),%r15
  jmp    L91
  nopl   (%rax)
L99:
  addq   $0x8,(%rsp)
  mov    (%rsp),%rax
  cmp    0x10(%rsp),%rax
  je     L28
  mov    (%rax),%rbx
  jmp    L37
  nopl   0x0(%rax,%rax,1)
L28:
  mov    0x20(%rsp),%rbx
  xor    %eax,%eax
  lea    0xc7(%rsp),%rbp
  lea    D32(%rip),%r12
  lea    D161(%rip),%r15
  mov    %rbx,%rdi
  call   <printf@plt>
  lea    D22(%rip),%rdi
  call   <puts@plt>
  xor    %eax,%eax
  call   <G_get_basename_separator@plt>
  lea    D189(%rip),%rdi
  mov    %rax,%rsi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %rbx,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D82(%rip),%rdi
  call   <puts@plt>
  mov    0x28(%rsp),%rdi
  mov    $0x4,%esi
  call   <G_join_basename_strings@plt>
  lea    D222(%rip),%rdi
  mov    %rax,%rsi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %rbx,%rdi
  xor    %eax,%eax
  xor    %ebx,%ebx
  call   <printf@plt>
  lea    D218(%rip),%rdi
  call   <puts@plt>
L90:
  mov    0x10(%rsp),%r13
  xor    %r14d,%r14d
  mov    %r13,%r9
L29:
  mov    D248(%rip),%rax
  mov    %r14,%rdx
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  mov    %r9,(%rsp)
  movq   %rax,%xmm0
  call   <G_generate_basename@plt>
  mov    %r14,%rcx
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  mov    %rax,%r8
  mov    %rax,%r13
  mov    D248(%rip),%rax
  mov    %r12,%rdi
  movq   %rax,%xmm0
  mov    $0x1,%eax
  call   <printf@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    %r14,%rdx
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  mov    D123(%rip),%rax
  movq   %rax,%xmm0
  call   <G_generate_basename@plt>
  mov    %r14,%rcx
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  mov    %rax,%r8
  mov    %rax,%r13
  mov    D123(%rip),%rax
  mov    %r12,%rdi
  movq   %rax,%xmm0
  mov    $0x1,%eax
  call   <printf@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    %r15,%rdi
  call   <puts@plt>
  mov    (%rsp),%r9
  add    $0x8,%r9
  cmp    %r9,0x8(%rsp)
  je     L33
  mov    (%r9),%r14
  jmp    L29
  nopl   0x0(%rax)
L33:
  addq   $0x8,0x18(%rsp)
  mov    0x18(%rsp),%rax
  cmp    0x10(%rsp),%rax
  je     L47
  mov    (%rax),%rbx
  jmp    L90
  nopw   0x0(%rax,%rax,1)
L47:
  mov    0x108(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L74
  add    $0x118,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L74:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D196
data_type: string
name: disassemble_data
arguments: tag: D215
data_type: string
name: disassemble_data
arguments: tag: D190
data_type: string
name: disassemble_data
arguments: tag: D100
data_type: string
name: disassemble_data
arguments: tag: D118
data_type: byte[16]
name: disassemble_data
arguments: tag: D88
data_type: string
name: disassemble_data
arguments: tag: D143
data_type: string
name: disassemble_data
arguments: tag: D174
data_type: string
name: disassemble_data
arguments: tag: D149
data_type: string
name: disassemble_data
arguments: tag: D24
data_type: string
name: disassemble_data
arguments: tag: D178
data_type: string
name: disassemble_data
arguments: tag: D248
data_type: f64
name: disassemble_data
arguments: tag: D123
data_type: f64
name: disassemble_data
arguments: tag: D32
data_type: string
name: disassemble_data
arguments: tag: D161
data_type: string
name: disassemble_data
arguments: tag: D22
data_type: string
name: disassemble_data
arguments: tag: D189
data_type: string
name: disassemble_data
arguments: tag: D82
data_type: string
name: disassemble_data
arguments: tag: D222
data_type: string
name: disassemble_data
arguments: tag: D218
data_type: string

tool: D196: basename

tool: D215: 12345.

tool: D190: 12345.6789

tool: D100: Number of decimals in %s => %zu


tool: {"D118": [0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d,0x3d]}

tool: D88: 12345.67

tool: D143: 12345.6

tool: D174: 12345

tool: D149: 

Test G_get_num_decimals

tool: D24: number: %10f, ndigits: %zu, ndecimals: %zu result => %s


tool: D178: 

Test G_double_to_basename_format

tool: D248: 12.3456789

tool: D123: 0.987654321

tool: D32: basename: %s, number: %10f, ndigits: %zu, decimals: %zu result => %s


tool: D161: =======================================================

tool: D22: 

Test G_get_basename_separator

tool: D189: The basename separator is: %s


tool: D82: 

G_join_basename_strings

tool: D222: result join strings: %s
**

tool: D218: 

Test G_get_format_name

assistant: ```c
int main() {
  int i, j, n;
  const char *decimals_strings[4] = {"12345.6789", "12345.67", "12345.", "12345"};
  const char *strings[4] = {"basename", "12345.6", "12345.", "12345"};
  int len_decimals_strings = 4;
  size_t ndigits[] = {0, 2, 3, 4};
  int len_ndigits = 4;
  size_t ndecimals[] = {0, 1, 2, 3, 4};
  int len_ndecimals = 5;
  const char basename[] = "basename";
  const char SEP[] = "====================================================\n";
  double numbers[] = {12.34567890, 0.987654321};
  int len_numbers = 2;
  char *result;
  printf(SEP);
  printf("\n\nTest G_get_num_decimals\n");
  for (i = 0; i < len_decimals_strings; i++) {
    printf("Number of decimals in %s => %zu\n", decimals_strings[i], G_get_num_decimals(decimals_strings[i]));
  }
  printf(SEP);
  printf("\n\nTest G_double_to_basename_format\n");
  for (i = 0; i < len_ndigits; i++) {
    for (j = 0; j < len_ndecimals; j++) {
      for (n = 0; n < len_numbers; n++) {
        result = G_double_to_basename_format(numbers[n], ndigits[i], ndecimals[j]);
        printf("number: %10f, ndigits: %zu, ndecimals: %zu result => %s\n", numbers[n], ndigits[i], ndecimals[j], result);
        free(result);
      }
      printf("\n");
    }
  }
  printf(SEP);
  printf("\n\nTest G_get_basename_separator\n");
  printf("The basename separator is: %s\n", G_get_basename_separator());
  printf(SEP);
  printf("\n\nG_join_basename_strings\n");
  printf("result join strings: %s\n**", G_join_basename_strings(strings, 4));
  printf(SEP);
  printf("\n\nTest G_get_format_name\n");
  for (i = 0; i < len_ndigits; i++) {
    for (j = 0; j < len_ndecimals; j++) {
      for (n = 0; n < len_numbers; n++) {
        result = G_generate_basename(basename, numbers[n], ndigits[i], ndecimals[j]);
        printf("basename: %s, number: %10f, ndigits: %zu, decimals: %zu result => %s\n", basename, numbers[n], ndigits[i], ndecimals[j], result);
        free(result);
      }
      printf("=======================================================\n");
    }
  }
  return 0;
}
```