user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<libewf_convert_date_header_value>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x4(%rsp)
  test   %rdi,%rdi
  je     L66
  mov    %esi,%ebx
  lea    0x4(%rsp),%rdx
  mov    $0x20,%esi
  call   <libewf_split_string@plt>
  cmpl   $0x6,0x4(%rsp)
  mov    %rax,%rbp
  jne    L66
  mov    $0x14,%edi
  call   <libewf_header_value_string_alloc@plt>
  mov    %rax,%r12
  cmp    $0x2,%ebx
  je     L237
  cmp    $0x1,%ebx
  je     L129
L34:
  movb   $0x2f,0x5(%r12)
  mov    0x0(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,0x6(%r12)
  mov    0x0(%rbp),%rax
  movzbl 0x1(%rax),%eax
  mov    %al,0x7(%r12)
  mov    0x0(%rbp),%rax
  movzbl 0x2(%rax),%eax
  mov    %al,0x8(%r12)
  mov    0x0(%rbp),%rax
  movzbl 0x3(%rax),%eax
  movb   $0x20,0xa(%r12)
  mov    %al,0x9(%r12)
  mov    0x18(%rbp),%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  je     L142
  mov    0x18(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,0xb(%r12)
  mov    0x18(%rbp),%rax
  movzbl 0x1(%rax),%eax
L38:
  mov    %al,0xc(%r12)
  movb   $0x3a,0xd(%r12)
  mov    0x20(%rbp),%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  je     L134
  mov    0x20(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,0xe(%r12)
  mov    0x20(%rbp),%rax
  movzbl 0x1(%rax),%eax
L210:
  mov    %al,0xf(%r12)
  movb   $0x3a,0x10(%r12)
  mov    0x28(%rbp),%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  je     L128
  mov    0x28(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,0x11(%r12)
  mov    0x28(%rbp),%rax
  movzbl 0x1(%rax),%eax
L27:
  mov    %al,0x12(%r12)
  mov    0x4(%rsp),%eax
  movb   $0x0,0x13(%r12)
  test   %eax,%eax
  jle    L215
  xor    %ebx,%ebx
  nopw   0x0(%rax,%rax,1)
L179:
  mov    0x0(%rbp,%rbx,8),%rdi
  add    $0x1,%rbx
  call   <free@plt>
  cmp    %ebx,0x4(%rsp)
  jg     L179
  jmp    L215
  cs nopw 0x0(%rax,%rax,1)
L66:
  xor    %r12d,%r12d
L215:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L213
  add    $0x10,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L142:
  movb   $0x30,0xb(%r12)
  mov    0x18(%rbp),%rax
  movzbl (%rax),%eax
  jmp    L38
  nopw   0x0(%rax,%rax,1)
L128:
  movb   $0x30,0x11(%r12)
  mov    0x28(%rbp),%rax
  movzbl (%rax),%eax
  jmp    L27
  nopw   0x0(%rax,%rax,1)
L134:
  movb   $0x30,0xe(%r12)
  mov    0x20(%rbp),%rax
  movzbl (%rax),%eax
  jmp    L210
  nopw   0x0(%rax,%rax,1)
L237:
  mov    0x8(%rbp),%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  je     L204
  mov    0x8(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,(%r12)
  mov    0x8(%rbp),%rax
  movzbl 0x1(%rax),%eax
L119:
  mov    %al,0x1(%r12)
  movb   $0x2f,0x2(%r12)
  mov    0x10(%rbp),%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  je     L25
  mov    0x10(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,0x3(%r12)
  mov    0x10(%rbp),%rax
  movzbl 0x1(%rax),%eax
  mov    %al,0x4(%r12)
  jmp    L34
L129:
  mov    0x10(%rbp),%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  je     L188
  mov    0x10(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,(%r12)
  mov    0x10(%rbp),%rax
  movzbl 0x1(%rax),%eax
L105:
  mov    %al,0x1(%r12)
  movb   $0x2f,0x2(%r12)
  mov    0x8(%rbp),%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  je     L239
  mov    0x8(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,0x3(%r12)
  mov    0x8(%rbp),%rax
  movzbl 0x1(%rax),%eax
  mov    %al,0x4(%r12)
  jmp    L34
L188:
  movb   $0x30,(%r12)
  mov    0x10(%rbp),%rax
  movzbl (%rax),%eax
  jmp    L105
L204:
  movb   $0x30,(%r12)
  mov    0x8(%rbp),%rax
  movzbl (%rax),%eax
  jmp    L119
L25:
  movb   $0x30,0x3(%r12)
  mov    0x10(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,0x4(%r12)
  jmp    L34
L239:
  movb   $0x30,0x3(%r12)
  mov    0x8(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,0x4(%r12)
  jmp    L34
L213:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *libewf_convert_date_header_value(char *header_value, uint8_t date_format) {
  char **date_elements;
  char *date_string;
  uint32_t date_element_count = 0;
  uint32_t date_element_iterator = 0;
  if (header_value == NULL) {
    return (NULL);
  }
  date_elements = libewf_split_string(header_value, ' ', &date_element_count);
  if (date_element_count != 6) {
    return (NULL);
  }
  date_string = libewf_header_value_string_alloc(20);
  if (date_format == 0x02) {
    if (strlen(date_elements[1]) == 1) {
      date_string[0] = '0';
      date_string[1] = date_elements[1][0];
    } else {
      date_string[0] = date_elements[1][0];
      date_string[1] = date_elements[1][1];
    }
    date_string[2] = '/';
    if (strlen(date_elements[2]) == 1) {
      date_string[3] = '0';
      date_string[4] = date_elements[2][0];
    } else {
      date_string[3] = date_elements[2][0];
      date_string[4] = date_elements[2][1];
    }
  } else if (date_format == 0x01) {
    if (strlen(date_elements[2]) == 1) {
      date_string[0] = '0';
      date_string[1] = date_elements[2][0];
    } else {
      date_string[0] = date_elements[2][0];
      date_string[1] = date_elements[2][1];
    }
    date_string[2] = '/';
    if (strlen(date_elements[1]) == 1) {
      date_string[3] = '0';
      date_string[4] = date_elements[1][0];
    } else {
      date_string[3] = date_elements[1][0];
      date_string[4] = date_elements[1][1];
    }
  }
  date_string[5] = '/';
  date_string[6] = date_elements[0][0];
  date_string[7] = date_elements[0][1];
  date_string[8] = date_elements[0][2];
  date_string[9] = date_elements[0][3];
  date_string[10] = ' ';
  if (strlen(date_elements[3]) == 1) {
    date_string[11] = '0';
    date_string[12] = date_elements[3][0];
  } else {
    date_string[11] = date_elements[3][0];
    date_string[12] = date_elements[3][1];
  }
  date_string[13] = ':';
  if (strlen(date_elements[4]) == 1) {
    date_string[14] = '0';
    date_string[15] = date_elements[4][0];
  } else {
    date_string[14] = date_elements[4][0];
    date_string[15] = date_elements[4][1];
  }
  date_string[16] = ':';
  if (strlen(date_elements[5]) == 1) {
    date_string[17] = '0';
    date_string[18] = date_elements[5][0];
  } else {
    date_string[17] = date_elements[5][0];
    date_string[18] = date_elements[5][1];
  }
  date_string[19] = '\0';
  while (date_element_iterator < date_element_count) {
    free(date_elements[date_element_iterator]);
    date_element_iterator++;
  }
  return (date_string);
}
```