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

```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     L15
  mov    %esi,%ebx
  lea    0x4(%rsp),%rdx
  mov    $0x20,%esi
  call   <libewf_split_string@plt>
  cmpl   $0x6,0x4(%rsp)
  mov    %rax,%rbp
  jne    L15
  mov    $0x14,%edi
  call   <libewf_header_value_string_alloc@plt>
  mov    %rax,%r12
  cmp    $0x2,%ebx
  je     L134
  cmp    $0x1,%ebx
  je     L162
L72:
  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     L166
  mov    0x18(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,0xb(%r12)
  mov    0x18(%rbp),%rax
  movzbl 0x1(%rax),%eax
L123:
  mov    %al,0xc(%r12)
  movb   $0x3a,0xd(%r12)
  mov    0x20(%rbp),%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  je     L170
  mov    0x20(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,0xe(%r12)
  mov    0x20(%rbp),%rax
  movzbl 0x1(%rax),%eax
L24:
  mov    %al,0xf(%r12)
  movb   $0x3a,0x10(%r12)
  mov    0x28(%rbp),%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  je     L133
  mov    0x28(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,0x11(%r12)
  mov    0x28(%rbp),%rax
  movzbl 0x1(%rax),%eax
L112:
  mov    %al,0x12(%r12)
  mov    0x4(%rsp),%eax
  movb   $0x0,0x13(%r12)
  test   %eax,%eax
  jle    L161
  xor    %ebx,%ebx
  nopw   0x0(%rax,%rax,1)
L3:
  mov    0x0(%rbp,%rbx,8),%rdi
  add    $0x1,%rbx
  call   <free@plt>
  cmp    %ebx,0x4(%rsp)
  jg     L3
  jmp    L161
  cs nopw 0x0(%rax,%rax,1)
L15:
  xor    %r12d,%r12d
L161:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L194
  add    $0x10,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L166:
  movb   $0x30,0xb(%r12)
  mov    0x18(%rbp),%rax
  movzbl (%rax),%eax
  jmp    L123
  nopw   0x0(%rax,%rax,1)
L133:
  movb   $0x30,0x11(%r12)
  mov    0x28(%rbp),%rax
  movzbl (%rax),%eax
  jmp    L112
  nopw   0x0(%rax,%rax,1)
L170:
  movb   $0x30,0xe(%r12)
  mov    0x20(%rbp),%rax
  movzbl (%rax),%eax
  jmp    L24
  nopw   0x0(%rax,%rax,1)
L134:
  mov    0x8(%rbp),%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  je     L165
  mov    0x8(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,(%r12)
  mov    0x8(%rbp),%rax
  movzbl 0x1(%rax),%eax
L143:
  mov    %al,0x1(%r12)
  movb   $0x2f,0x2(%r12)
  mov    0x10(%rbp),%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  je     L183
  mov    0x10(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,0x3(%r12)
  mov    0x10(%rbp),%rax
  movzbl 0x1(%rax),%eax
  mov    %al,0x4(%r12)
  jmp    L72
L162:
  mov    0x10(%rbp),%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  je     L25
  mov    0x10(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,(%r12)
  mov    0x10(%rbp),%rax
  movzbl 0x1(%rax),%eax
L153:
  mov    %al,0x1(%r12)
  movb   $0x2f,0x2(%r12)
  mov    0x8(%rbp),%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  je     L10
  mov    0x8(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,0x3(%r12)
  mov    0x8(%rbp),%rax
  movzbl 0x1(%rax),%eax
  mov    %al,0x4(%r12)
  jmp    L72
L25:
  movb   $0x30,(%r12)
  mov    0x10(%rbp),%rax
  movzbl (%rax),%eax
  jmp    L153
L165:
  movb   $0x30,(%r12)
  mov    0x8(%rbp),%rax
  movzbl (%rax),%eax
  jmp    L143
L183:
  movb   $0x30,0x3(%r12)
  mov    0x10(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,0x4(%r12)
  jmp    L72
L10:
  movb   $0x30,0x3(%r12)
  mov    0x8(%rbp),%rax
  movzbl (%rax),%eax
  mov    %al,0x4(%r12)
  jmp    L72
L194:
  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);
}
```