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

```asm
<iso_date>:
  endbr64
  push   %rbp
  mov    %esi,%r9d
  xor    %r8d,%r8d
  push   %rbx
  sub    $0x48,%rsp
  movsbl (%rdi),%ecx
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    -0x46(%rcx),%esi
  test   %r9d,%r9d
  jne    L132
  movsbl 0x6(%rdi),%r8d
L132:
  xor    %eax,%eax
  test   %esi,%esi
  js     L9
  movzbl 0x1(%rdi),%eax
  movzbl 0x2(%rdi),%r11d
  imul   $0x16d,%esi,%edx
  movdqa D14(%rip),%xmm1
  movdqa D7(%rip),%xmm0
  movzbl 0x3(%rdi),%r10d
  movzbl 0x4(%rdi),%r9d
  movaps %xmm1,0x10(%rsp)
  movdqa D20(%rip),%xmm1
  movzbl 0x5(%rdi),%edi
  movaps %xmm0,(%rsp)
  movaps %xmm1,0x20(%rsp)
  cmp    $0x2,%esi
  jg     L141
L0:
  movsbl %al,%esi
  cmp    $0x1,%al
  jle    L62
  lea    -0x2(%rsi),%eax
  lea    -0x1(%rsi),%ebx
  cmp    $0x2,%eax
  jbe    L38
  mov    %ebx,%eax
  shr    $0x2,%eax
  cmp    $0x1,%eax
  je     L11
  cmp    $0x2,%eax
  je     L118
  movdqa D32(%rip),%xmm0
L11:
  movdqa %xmm0,%xmm1
  mov    %ebx,%ebp
  psrldq $0x8,%xmm1
  and    $0xfffffffc,%ebp
  paddd  %xmm1,%xmm0
  movdqa %xmm0,%xmm1
  psrldq $0x4,%xmm1
  paddd  %xmm1,%xmm0
  movd   %xmm0,%eax
  add    %eax,%edx
  lea    0x1(%rbp),%eax
  cmp    %ebx,%ebp
  je     L103
L90:
  lea    -0x1(%rax),%ebx
  movslq %ebx,%rbx
  add    (%rsp,%rbx,4),%edx
  lea    0x1(%rax),%ebx
  cmp    %ebx,%esi
  jle    L103
  movslq %eax,%rbp
  add    $0x2,%eax
  add    (%rsp,%rbp,4),%edx
  cmp    %eax,%esi
  jle    L103
  movslq %ebx,%rbx
  add    (%rsp,%rbx,4),%edx
L103:
  and    $0x3,%ecx
  jne    L62
  cmp    $0x2,%esi
  setg   %al
  cmp    $0x1,%al
  sbb    $0xffffffff,%edx
L62:
  movsbl %r11b,%eax
  lea    -0x1(%rdx,%rax,1),%eax
  lea    (%rax,%rax,2),%edx
  movsbl %r10b,%eax
  lea    (%rax,%rdx,8),%eax
  movsbl %r9b,%edx
  imul   $0x3c,%eax,%eax
  add    %edx,%eax
  movsbl %dil,%edx
  imul   $0x3c,%eax,%eax
  add    %edx,%eax
  lea    0x34(%r8),%edx
  cmp    $0x68,%edx
  jbe    L52
L9:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L128
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  ret
  xchg   %ax,%ax
L141:
  mov    %ecx,%ebx
  lea    -0x42(%rcx),%esi
  sub    $0x45,%ebx
  cmovns %ebx,%esi
  sar    $0x2,%esi
  add    %esi,%edx
  jmp    L0
  nopl   (%rax)
L52:
  imul   $0xfffffc7c,%r8d,%r8d
  add    %r8d,%eax
  jmp    L9
L38:
  mov    $0x1,%eax
  jmp    L90
  xchg   %ax,%ax
L118:
  movdqa D5(%rip),%xmm0
  jmp    L11
L128:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D14
data_type: byte[16]
name: retrieve_data
arguments: data_tag: D7
data_type: byte[16]
name: retrieve_data
arguments: data_tag: D20
data_type: byte[16]
name: retrieve_data
arguments: data_tag: D32
data_type: byte[16]
name: retrieve_data
arguments: data_tag: D5
data_type: byte[16]

tool: {"D14": [0x1f,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x1f,0x00,0x00,0x00]}

tool: {"D7": [0x1f,0x00,0x00,0x00,0x1c,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x1e,0x00,0x00,0x00]}

tool: {"D20": [0x1e,0x00,0x00,0x00,0x1f,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x1f,0x00,0x00,0x00]}

tool: {"D32": [0x5c,0x00,0x00,0x00,0x59,0x00,0x00,0x00,0x5c,0x00,0x00,0x00,0x5c,0x00,0x00,0x00]}

tool: {"D5": [0x3e,0x00,0x00,0x00,0x3a,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x3d,0x00,0x00,0x00]}

assistant: ```c
int iso_date(char *p, int flag) {
  int year, month, day, hour, minute, second, tz;
  int crtime, days, i;
  year = p[0] - 70;
  month = p[1];
  day = p[2];
  hour = p[3];
  minute = p[4];
  second = p[5];
  if (flag == 0)
    tz = p[6];
  else
    tz = 0;
  if (year < 0) {
    crtime = 0;
  } else {
    int monlen[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    days = year * 365;
    if (year > 2)
      days += (year + 1) / 4;
    for (i = 1; i < month; i++)
      days += monlen[i - 1];
    if (((year + 2) % 4) == 0 && month > 2)
      days++;
    days += day - 1;
    crtime = ((((days * 24) + hour) * 60 + minute) * 60) + second;
    if (tz & 0x80)
      tz |= (-1 << 8);
    if (-52 <= tz && tz <= 52)
      crtime -= tz * 15 * 60;
  }
  return crtime;
}
```