user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<appaserver_link_get_tail_half>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  mov    %rcx,%r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %r9,%r12
  push   %rbp
  mov    %r8d,%ebp
  push   %rbx
  sub    $0x1a8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x198(%rsp)
  xor    %eax,%eax
  mov    0x1e0(%rsp),%rbx
  movb   $0x0,0x90(%rsp)
  test   %rdx,%rdx
  je     L46
  cmpb   $0x0,(%rdx)
  jne    L48
L46:
  test   %r14,%r14
  je     L79
  cmpb   $0x0,(%r14)
  jne    L30
L79:
  test   %r12,%r12
  je     L23
  cmpb   $0x0,(%r12)
  jne    L26
L23:
  test   %ebp,%ebp
  jne    L16
  movb   $0x0,0x110(%rsp)
  lea    0x110(%rsp),%r14
L56:
  movb   $0x0,0x10(%rsp)
  lea    0x10(%rsp),%r12
  test   %r15,%r15
  je     L71
  lea    D76(%rip),%r8
  mov    %r15,%rcx
  mov    %r12,%rdi
  xor    %eax,%eax
  lea    D39(%rip),%rdx
  lea    D77(%rip),%rsi
  call   <sprintf@plt>
L71:
  test   %rbx,%rbx
  lea    D108(%rip),%rax
  mov    %r12,%rdx
  mov    %r14,%r9
  cmove  %rax,%rbx
  lea    0x90(%rsp),%r8
  mov    %r13,%rcx
  cmpb   $0x0,0x90(%rsp)
  lea    D100(%rip),%rax
  lea    D93(%rip),%r12
  cmove  %rax,%r8
  sub    $0x8,%rsp
  mov    %r12,%rdi
  xor    %eax,%eax
  push   %rbx
  lea    D12(%rip),%rsi
  call   <sprintf@plt>
  pop    %rax
  pop    %rdx
  mov    0x198(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L41
  add    $0x1a8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L26:
  lea    0x110(%rsp),%r14
  mov    %r12,%rdx
  lea    D91(%rip),%rsi
  xor    %eax,%eax
  mov    %r14,%rdi
  call   <sprintf@plt>
  jmp    L56
  nopl   0x0(%rax)
L30:
  lea    0x90(%rsp),%rdi
  mov    %rdi,0x8(%rsp)
  call   <strlen@plt>
  mov    0x8(%rsp),%rdi
  mov    %r14,%rdx
  lea    D91(%rip),%rsi
  cltq
  add    %rax,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  jmp    L79
  nopw   0x0(%rax,%rax,1)
L48:
  lea    0x90(%rsp),%rdi
  lea    D91(%rip),%rsi
  call   <sprintf@plt>
  jmp    L46
  nopl   0x0(%rax)
L16:
  lea    0x110(%rsp),%r14
  mov    %ebp,%edx
  lea    D56(%rip),%rsi
  xor    %eax,%eax
  mov    %r14,%rdi
  call   <sprintf@plt>
  jmp    L56
L41:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D76
type_infered: string
name: read_data
arguments: label: D39
type_infered: string
name: read_data
arguments: label: D77
type_infered: string
name: read_data
arguments: label: D108
type_infered: string
name: read_data
arguments: label: D100
type_infered: string
name: read_data
arguments: label: D12
type_infered: string
name: read_data
arguments: label: D91
type_infered: string
name: read_data
arguments: label: D56
type_infered: string

tool: D76: data

tool: D39: appaserver

tool: D77: /%s/%s/%s/

tool: D108: null

tool: 

tool: D12: %s%s%s%s.%s

tool: D91: _%s

tool: D56: _%d

assistant: ```c
char *appaserver_link_get_tail_half(char *application_name, char *filename_stem, char *begin_date_string, char *end_date_string, pid_t process_id, char *session, char *extension) {
  static char tail_half[512];
  char application_part[128];
  char date_part[128];
  char key_part[128];
  *date_part = '\0';
  if (begin_date_string && *begin_date_string) {
    sprintf(date_part, "_%s", begin_date_string);
  }
  if (end_date_string && *end_date_string) {
    sprintf(date_part + strlen(date_part), "_%s", end_date_string);
  }
  if (session && *session) {
    sprintf(key_part, "_%s", session);
  } else if (process_id) {
    sprintf(key_part, "_%d", process_id);
  } else {
    *key_part = '\0';
  }
  *application_part = '\0';
  if (application_name) {
    sprintf(application_part, "/%s/%s/%s/", "appaserver", application_name, "data");
  }
  sprintf(tail_half, "%s%s%s%s.%s", application_part, filename_stem, (*date_part) ? date_part : "", key_part, (extension) ? extension : "null");
  return tail_half;
}
```