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

```asm
<time_string_to_seconds>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %rdi,%r12
  mov    %rsi,%r13
  mov    %rdx,%r14
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    D0(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L21
  mov    %eax,%ebp
  movzbl (%r12),%edi
  mov    %r12,%rbx
  test   %dil,%dil
  je     L40
L199:
  movsbl %dil,%edi
  call   <isspace@plt>
  test   %rax,%rax
  jne    L31
  add    $0x1,%rbx
  movzbl (%rbx),%edi
  test   %dil,%dil
  jne    L199
L40:
  lea    D14(%rip),%rax
  mov    %rax,(%r14)
  mov    $0x0,%eax
L160:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L8
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L31:
  movzbl (%rbx),%edi
  test   %dil,%dil
  je     L40
L112:
  movsbl %dil,%edi
  call   <isspace@plt>
  test   %rax,%rax
  je     L131
  add    $0x1,%rbx
  movzbl (%rbx),%edi
  test   %dil,%dil
  jne    L112
  jmp    L40
L131:
  movzbl (%rbx),%eax
  test   %al,%al
  je     L40
  cmp    $0x2f,%al
  je     L30
L107:
  add    $0x1,%rbx
  movzbl (%rbx),%eax
  test   %al,%al
  je     L81
  cmp    $0x2f,%al
  jne    L107
L81:
  test   %al,%al
  je     L40
L30:
  lea    0x1(%rbx),%rdx
  movzbl 0x1(%rbx),%eax
  test   %al,%al
  je     L183
  cmp    $0x2f,%al
  je     L183
L228:
  add    $0x1,%rdx
  movzbl (%rdx),%eax
  test   %al,%al
  je     L183
  cmp    $0x2f,%al
  jne    L228
L183:
  test   %al,%al
  je     L40
  lea    0x1(%rdx),%rbx
  movzbl 0x1(%rdx),%edi
  test   %dil,%dil
  je     L21
L124:
  movsbl %dil,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L154
  add    $0x1,%rbx
  add    $0x1,%ebp
  movzbl (%rbx),%edi
  test   %dil,%dil
  jne    L124
L154:
  cmp    $0x4,%ebp
  lea    D13(%rip),%rax
  cmove  %rax,%r13
L21:
  lea    0x4(%rsp),%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <strptime@plt>
  test   %eax,%eax
  je     L40
  lea    0x4(%rsp),%rdi
  call   <mktime@plt>
  jmp    L160
L8:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D0
type_infered: string
name: unpack_data
arguments: label: D14
type_infered: string
name: unpack_data
arguments: label: D13
type_infered: string

tool: D0: %T%t%D

tool: D14: Time string does not match expected format.

tool: D13: %T%t%m/%d/%Y

assistant: ```c
time_t time_string_to_seconds(char *string, const char *format, const char **error) {
  struct tm otm;
  if (!strcmp(format, "%T%t%D")) {
    char *finder;
    int year_digits = 0;
    for (finder = string; *finder != '\0' && !isspace(*finder); finder++)
      ;
    if (*finder == '\0') {
      goto timeformat_err;
    }
    for (; *finder != '\0' && isspace(*finder); finder++)
      ;
    if (*finder == '\0') {
      goto timeformat_err;
    }
    for (; *finder != '\0' && *finder != '/'; finder++)
      ;
    if (*finder == '\0') {
      goto timeformat_err;
    }
    finder++;
    for (; *finder != '\0' && *finder != '/'; finder++)
      ;
    if (*finder == '\0') {
      goto timeformat_err;
    }
    finder++;
    for (; *finder != '\0' && isdigit(*finder); finder++, year_digits++)
      ;
    if (year_digits == 4) {
      format = "%T%t%m/%d/%Y";
    }
  }
  if (!strptime(string, format, &otm))
    goto timeformat_err;
  return mktime(&otm);
timeformat_err:
  *error = "Time string does not match expected format.";
  return 0;
}
```