user: Demonstrate the C code that generates the assembly output below:

```asm
<WriteLog>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    $0x1,%r13d
  push   %r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %edi,%ebx
  lea    D115(%rip),%rdi
  sub    $0xf8,%rsp
  mov    %rsi,0x10(%rsp)
  mov    %edx,0x1c(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xe8(%rsp)
  xor    %eax,%eax
  call   <getenv@plt>
  test   %rax,%rax
  je     L88
  mov    %rax,%rdi
  call   <atoi@plt>
  cmp    %ebx,%eax
  setg   %r13b
  test   %eax,%eax
  sete   %al
  or     %eax,%r13d
L88:
  lea    D19(%rip),%rdi
  call   <getenv@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L137
  call   <atoi@plt>
L137:
  lea    D51(%rip),%rdi
  call   <getenv@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L86
  call   <atoi@plt>
L86:
  lea    0x60(%rsp),%r12
  mov    $0x81,%edx
  xor    %esi,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  lea    D116(%rip),%rdi
  call   <getenv@plt>
  mov    $0x80,%edx
  mov    %rax,%rsi
  test   %rax,%rax
  je     L113
L67:
  mov    %r12,%rdi
  lea    0x40(%rsp),%r12
  lea    0x30(%rsp),%r14
  call   <strncpy@plt>
  mov    $0x20,%edx
  xor    %esi,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    $0x10,%edx
  xor    %esi,%esi
  mov    %r14,%rdi
  call   <memset@plt>
  lea    0x24(%rsp),%rdi
  lea    0x2c(%rsp),%r15
  call   <ftime@plt>
  mov    0x24(%rsp),%ecx
  mov    $0x4,%esi
  mov    %r15,%rdi
  lea    D147(%rip),%rdx
  call   <snprintf@plt>
  lea    0x28(%rsp),%rdi
  call   <localtime@plt>
  lea    D108(%rip),%rdx
  mov    $0x20,%esi
  mov    %r12,%rdi
  mov    %rax,%rcx
  mov    %rax,0x8(%rsp)
  call   <strftime@plt>
  lea    D143(%rip),%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  mov    %r15,%rsi
  mov    %r12,%rdi
  call   <strcat@plt>
  mov    0x8(%rsp),%rcx
  mov    $0x10,%esi
  mov    %r14,%rdi
  lea    D73(%rip),%rdx
  call   <strftime@plt>
  xor    %eax,%eax
  test   %r13b,%r13b
  je     L51
L9:
  mov    0xe8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L48
  add    $0xf8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L51:
  call   <open_log_file@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L45
  mov    0x1c(%rsp),%r8d
  mov    0x10(%rsp),%rcx
  cmp    $0x5,%ebx
  ja     L7
  lea    D37(%rip),%rdx
  movslq (%rdx,%rbx,4),%rax
  add    %rdx,%rax
  notrack jmp *%rax
  nopl   (%rax)
L113:
  lea    D35(%rip),%rsi
  jmp    L67
  nopl   0x0(%rax)
  mov    %r12,%rdx
  lea    D71(%rip),%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  nopl   0x0(%rax)
L37:
  xor    %r12d,%r12d
  mov    %rbp,%rsi
  mov    %r12d,%edi
  call   <va_start@plt>
  mov    %r12d,%edx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <vfprintf@plt>
  mov    %r12d,%edi
  call   <va_end@plt>
  mov    %r13,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  mov    %r13,%rdi
  call   <fflush@plt>
  mov    %r13,%rdi
  call   <fclose@plt>
  xor    %eax,%eax
  jmp    L9
  nopl   0x0(%rax,%rax,1)
  mov    %r12,%rdx
  lea    D0(%rip),%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  jmp    L37
  cs nopw 0x0(%rax,%rax,1)
  mov    %r12,%rdx
  lea    D100(%rip),%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  jmp    L37
  nopl   0x0(%rax)
  mov    %r12,%rdx
  lea    D28(%rip),%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  jmp    L37
  nopl   0x0(%rax)
  mov    %r12,%rdx
  lea    D96(%rip),%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  jmp    L37
L7:
  mov    %r12,%rdx
  lea    D20(%rip),%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  jmp    L37
L45:
  mov    $0xffffffff,%eax
  jmp    L9
L48:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D115
data_type: string
name: extract_symbolic_data
arguments: label: D19
data_type: string
name: extract_symbolic_data
arguments: label: D51
data_type: string
name: extract_symbolic_data
arguments: label: D116
data_type: string
name: extract_symbolic_data
arguments: label: D147
data_type: string
name: extract_symbolic_data
arguments: label: D108
data_type: string
name: extract_symbolic_data
arguments: label: D143
data_type: string
name: extract_symbolic_data
arguments: label: D73
data_type: string
name: extract_symbolic_data
arguments: label: D35
data_type: string
name: extract_symbolic_data
arguments: label: D71
data_type: string
name: extract_symbolic_data
arguments: label: D0
data_type: string
name: extract_symbolic_data
arguments: label: D100
data_type: string
name: extract_symbolic_data
arguments: label: D28
data_type: string
name: extract_symbolic_data
arguments: label: D96
data_type: string
name: extract_symbolic_data
arguments: label: D20
data_type: string

tool: D115: LOG_MODE

tool: D19: LOG_SWITCH_MODE

tool: D51: LOG_SIZE

tool: D116: LOG_FILE_PATH

tool: D147: %03d

tool: D108: %Y-%m-%d %H:%M:%S

tool: D143: :

tool: D73: %Y%m%d%H%M%S

tool: D35: .

tool: D71: [%s][%s][%d][CRITICAL]: 

tool: D0: [%s][%s][%d][ERROR]: 

tool: D100: [%s][%s][%d][WARNING]: 

tool: D28: [%s][%s][%d][INFO]: 

tool: D96: [%s][%s][%d][DEBUG]: 

tool: D20: [%s][%s][%d]: 

assistant: ```c
int WriteLog(int log_mode, char *filename, int line_num, char *fmt, ...) {
  int param_log_mode;
  int param_log_switch_mode;
  int param_log_size;
  char param_log_file_path[128 + 1];
  struct timeb tb;
  char log_time[32];
  char date_time[16];
  char millitm[4];
  struct tm *local_tm;
  char *penv;
  FILE *fp;
  va_list ap;
  penv = getenv("LOG_MODE");
  param_log_mode = penv == NULL ? 0 : atoi(penv);
  if (param_log_mode == 0)
    param_log_mode = 0;
  penv = getenv("LOG_SWITCH_MODE");
  param_log_switch_mode = penv == NULL ? 0 : atoi(penv);
  if (param_log_switch_mode == 0)
    param_log_switch_mode = 1;
  penv = getenv("LOG_SIZE");
  param_log_size = penv == NULL ? 0 : atoi(penv);
  if (param_log_size == 0)
    param_log_size = 5;
  memset(param_log_file_path, 0, sizeof(param_log_file_path));
  penv = getenv("LOG_FILE_PATH");
  if (penv)
    strncpy(param_log_file_path, penv, 128);
  else
    strncpy(param_log_file_path, ".", 128);
  memset(log_time, 0, sizeof(log_time));
  memset(date_time, 0, sizeof(date_time));
  ftime(&tb);
  snprintf(millitm, sizeof(millitm), "%03d", tb.millitm);
  local_tm = localtime(&tb.time);
  strftime(log_time, sizeof(log_time), "%Y-%m-%d %H:%M:%S", local_tm);
  strcat(log_time, ":");
  strcat(log_time, millitm);
  strftime(date_time, sizeof(date_time), "%Y%m%d%H%M%S", local_tm);
  if (param_log_mode == 0 || log_mode < param_log_mode)
    return 0;
  fp = open_log_file();
  if (fp == NULL)
    return -1;
  switch (log_mode) {
  case 1:
    fprintf(fp, "[%s][%s][%d][DEBUG]: ", log_time, filename, line_num);
    break;
  case 2:
    fprintf(fp, "[%s][%s][%d][INFO]: ", log_time, filename, line_num);
    break;
  case 3:
    fprintf(fp, "[%s][%s][%d][WARNING]: ", log_time, filename, line_num);
    break;
  case 4:
    fprintf(fp, "[%s][%s][%d][ERROR]: ", log_time, filename, line_num);
    break;
  case 5:
    fprintf(fp, "[%s][%s][%d][CRITICAL]: ", log_time, filename, line_num);
    break;
  default:
    fprintf(fp, "[%s][%s][%d]: ", log_time, filename, line_num);
    break;
  }
  va_start(ap, fmt);
  vfprintf(fp, fmt, ap);
  va_end(ap);
  fprintf(fp, "\n");
  fflush(fp);
  fclose(fp);
  return 0;
}
```