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    L37
  movsbl 0x6(%rdi),%r8d
L37:
  xor    %eax,%eax
  test   %esi,%esi
  js     L154
  movzbl 0x1(%rdi),%eax
  movzbl 0x2(%rdi),%r11d
  imul   $0x16d,%esi,%edx
  movdqa D28(%rip),%xmm1
  movdqa D25(%rip),%xmm0
  movzbl 0x3(%rdi),%r10d
  movzbl 0x4(%rdi),%r9d
  movaps %xmm1,0x10(%rsp)
  movdqa D30(%rip),%xmm1
  movzbl 0x5(%rdi),%edi
  movaps %xmm0,(%rsp)
  movaps %xmm1,0x20(%rsp)
  cmp    $0x2,%esi
  jg     L117
L24:
  movsbl %al,%esi
  cmp    $0x1,%al
  jle    L67
  lea    -0x2(%rsi),%eax
  lea    -0x1(%rsi),%ebx
  cmp    $0x2,%eax
  jbe    L131
  mov    %ebx,%eax
  shr    $0x2,%eax
  cmp    $0x1,%eax
  je     L163
  cmp    $0x2,%eax
  je     L40
  movdqa D29(%rip),%xmm0
L163:
  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     L104
L73:
  lea    -0x1(%rax),%ebx
  movslq %ebx,%rbx
  add    (%rsp,%rbx,4),%edx
  lea    0x1(%rax),%ebx
  cmp    %ebx,%esi
  jle    L104
  movslq %eax,%rbp
  add    $0x2,%eax
  add    (%rsp,%rbp,4),%edx
  cmp    %eax,%esi
  jle    L104
  movslq %ebx,%rbx
  add    (%rsp,%rbx,4),%edx
L104:
  and    $0x3,%ecx
  jne    L67
  cmp    $0x2,%esi
  setg   %al
  cmp    $0x1,%al
  sbb    $0xffffffff,%edx
L67:
  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    0x30(%r8),%edx
  cmp    $0x64,%edx
  jbe    L114
L154:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L38
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  ret
  xchg   %ax,%ax
L117:
  mov    %ecx,%ebx
  lea    -0x42(%rcx),%esi
  sub    $0x45,%ebx
  cmovns %ebx,%esi
  sar    $0x2,%esi
  add    %esi,%edx
  jmp    L24
  nopl   (%rax)
L114:
  imul   $0x384,%r8d,%r8d
  add    %r8d,%eax
  jmp    L154
L131:
  mov    $0x1,%eax
  jmp    L73
  xchg   %ax,%ax
L40:
  movdqa D0(%rip),%xmm0
  jmp    L163
L38:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D28
type_guessed: byte[16]
name: unpack_data
arguments: label: D25
type_guessed: byte[16]
name: unpack_data
arguments: label: D30
type_guessed: byte[16]
name: unpack_data
arguments: label: D29
type_guessed: byte[16]
name: unpack_data
arguments: label: D0
type_guessed: byte[16]

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

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

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

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

tool: {"D0": [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 (-48 <= tz && tz <= 52)
      crtime += tz * 15 * 60;
  }
  return crtime;
}
```