user: Converte this assembly snippet into its equivalent C code:

```asm
<WriteLog>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x1d0,%rsp
  mov    %edi,-0x1b4(%rbp)
  mov    %rsi,-0x1c0(%rbp)
  mov    %edx,-0x1b8(%rbp)
  mov    %rcx,-0x1c8(%rbp)
  mov    %r8,-0x90(%rbp)
  mov    %r9,-0x88(%rbp)
  test   %al,%al
  je     L214
  movaps %xmm0,-0x80(%rbp)
  movaps %xmm1,-0x70(%rbp)
  movaps %xmm2,-0x60(%rbp)
  movaps %xmm3,-0x50(%rbp)
  movaps %xmm4,-0x40(%rbp)
  movaps %xmm5,-0x30(%rbp)
  movaps %xmm6,-0x20(%rbp)
  movaps %xmm7,-0x10(%rbp)
L214:
  mov    %fs:0x28,%rax
  mov    %rax,-0xb8(%rbp)
  xor    %eax,%eax
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x198(%rbp)
  cmpq   $0x0,-0x198(%rbp)
  je     L182
  mov    -0x198(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  jmp    L172
L182:
  mov    $0x0,%eax
L172:
  mov    %eax,-0x1a8(%rbp)
  cmpl   $0x0,-0x1a8(%rbp)
  jne    L209
  movl   $0x0,-0x1a8(%rbp)
L209:
  lea    D154(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x198(%rbp)
  cmpq   $0x0,-0x198(%rbp)
  je     L234
  mov    -0x198(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  jmp    L101
L234:
  mov    $0x0,%eax
L101:
  mov    %eax,-0x1a4(%rbp)
  cmpl   $0x0,-0x1a4(%rbp)
  jne    L204
  movl   $0x1,-0x1a4(%rbp)
L204:
  lea    D135(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x198(%rbp)
  cmpq   $0x0,-0x198(%rbp)
  je     L75
  mov    -0x198(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  jmp    L154
L75:
  mov    $0x0,%eax
L154:
  mov    %eax,-0x1a0(%rbp)
  cmpl   $0x0,-0x1a0(%rbp)
  jne    L37
  movl   $0x5,-0x1a0(%rbp)
L37:
  lea    -0x140(%rbp),%rax
  mov    $0x81,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  lea    D50(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,-0x198(%rbp)
  cmpq   $0x0,-0x198(%rbp)
  je     L26
  mov    -0x198(%rbp),%rcx
  lea    -0x140(%rbp),%rax
  mov    $0x80,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  jmp    L32
L26:
  lea    -0x140(%rbp),%rax
  mov    $0x80,%edx
  lea    D92(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
L32:
  lea    -0x160(%rbp),%rax
  mov    $0x20,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  lea    -0x170(%rbp),%rax
  mov    $0x10,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  lea    -0x17c(%rbp),%rax
  mov    %rax,%rdi
  call   <ftime@plt>
  mov    -0x17c(%rbp),%edx
  lea    -0x174(%rbp),%rax
  mov    %edx,%ecx
  lea    D18(%rip),%rdx
  mov    $0x4,%esi
  mov    %rax,%rdi
  call   <snprintf@plt>
  lea    -0x17c(%rbp),%rax
  add    $0x4,%rax
  mov    %rax,%rdi
  call   <localtime@plt>
  mov    %rax,-0x190(%rbp)
  mov    -0x190(%rbp),%rdx
  lea    -0x160(%rbp),%rax
  mov    %rdx,%rcx
  lea    D81(%rip),%rdx
  mov    $0x20,%esi
  mov    %rax,%rdi
  call   <strftime@plt>
  lea    -0x160(%rbp),%rax
  lea    D27(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  lea    -0x174(%rbp),%rdx
  lea    -0x160(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x190(%rbp),%rdx
  lea    -0x170(%rbp),%rax
  mov    %rdx,%rcx
  lea    D156(%rip),%rdx
  mov    $0x10,%esi
  mov    %rax,%rdi
  call   <strftime@plt>
  cmpl   $0x0,-0x1a8(%rbp)
  je     L50
  mov    -0x1b4(%rbp),%eax
  cmp    -0x1a8(%rbp),%eax
  jge    L42
L50:
  mov    $0x0,%eax
  jmp    L64
L42:
  mov    $0x0,%eax
  call   <open_log_file@plt>
  mov    %rax,-0x188(%rbp)
  cmpq   $0x0,-0x188(%rbp)
  jne    L161
  mov    $0xffffffff,%eax
  jmp    L64
L161:
  cmpl   $0x5,-0x1b4(%rbp)
  ja     L59
  mov    -0x1b4(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  lea    D168(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D168(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    -0x1b8(%rbp),%esi
  mov    -0x1c0(%rbp),%rcx
  lea    -0x160(%rbp),%rdx
  mov    -0x188(%rbp),%rax
  mov    %esi,%r8d
  lea    D24(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  jmp    L23
  mov    -0x1b8(%rbp),%esi
  mov    -0x1c0(%rbp),%rcx
  lea    -0x160(%rbp),%rdx
  mov    -0x188(%rbp),%rax
  mov    %esi,%r8d
  lea    D128(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  jmp    L23
  mov    -0x1b8(%rbp),%esi
  mov    -0x1c0(%rbp),%rcx
  lea    -0x160(%rbp),%rdx
  mov    -0x188(%rbp),%rax
  mov    %esi,%r8d
  lea    D79(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  jmp    L23
  mov    -0x1b8(%rbp),%esi
  mov    -0x1c0(%rbp),%rcx
  lea    -0x160(%rbp),%rdx
  mov    -0x188(%rbp),%rax
  mov    %esi,%r8d
  lea    D113(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  jmp    L23
  mov    -0x1b8(%rbp),%esi
  mov    -0x1c0(%rbp),%rcx
  lea    -0x160(%rbp),%rdx
  mov    -0x188(%rbp),%rax
  mov    %esi,%r8d
  lea    D152(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  jmp    L23
L59:
  mov    -0x1b8(%rbp),%esi
  mov    -0x1c0(%rbp),%rcx
  lea    -0x160(%rbp),%rdx
  mov    -0x188(%rbp),%rax
  mov    %esi,%r8d
  lea    D88(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  nop
L23:
  mov    -0x1c8(%rbp),%rdx
  mov    -0x19c(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <va_start@plt>
  mov    -0x19c(%rbp),%edx
  mov    -0x1c8(%rbp),%rcx
  mov    -0x188(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <vfprintf@plt>
  mov    -0x19c(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
  mov    -0x188(%rbp),%rax
  mov    %rax,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  mov    -0x188(%rbp),%rax
  mov    %rax,%rdi
  call   <fflush@plt>
  mov    -0x188(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0x0,%eax
L64:
  mov    -0xb8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L9
  call   <__stack_chk_fail@plt>
L9:
  leave
  ret
```

tool_calls: name: parse_data
arguments: tag: D20
type_infered: string
name: parse_data
arguments: tag: D154
type_infered: string
name: parse_data
arguments: tag: D135
type_infered: string
name: parse_data
arguments: tag: D50
type_infered: string
name: parse_data
arguments: tag: D92
type_infered: string
name: parse_data
arguments: tag: D18
type_infered: string
name: parse_data
arguments: tag: D81
type_infered: string
name: parse_data
arguments: tag: D27
type_infered: string
name: parse_data
arguments: tag: D156
type_infered: string
name: parse_data
arguments: tag: D24
type_infered: string
name: parse_data
arguments: tag: D128
type_infered: string
name: parse_data
arguments: tag: D79
type_infered: string
name: parse_data
arguments: tag: D113
type_infered: string
name: parse_data
arguments: tag: D152
type_infered: string
name: parse_data
arguments: tag: D88
type_infered: string

tool: D20: LOG_MODE

tool: D154: LOG_SWITCH_MODE

tool: D135: LOG_SIZE

tool: D50: LOG_FILE_PATH

tool: D92: .

tool: D18: %03d

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

tool: D27: :

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

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

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

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

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

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

tool: D88: [%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;
}
```