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

```asm
<addDay>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x38,%rsp
  mov    %rdi,%r12
  mov    %esi,%ebx
  mov    %fs:0x28,%rax
  mov    %rax,0x2028(%rsp)
  xor    %eax,%eax
  cmp    $0x22,%esi
  jg     L87
L13:
  mov    %r12,%rdi
  call   <grabYear@plt>
  mov    %rax,%r13
  mov    %r12,%rdi
  call   <grabMonth@plt>
  mov    %rax,%rbp
  mov    %r12,%rdi
  call   <grabDay@plt>
  mov    %rax,0x8(%rsp)
  mov    %r12,%rdi
  call   <grabHour@plt>
  mov    %rax,%r14
  mov    %r12,%rdi
  call   <grabMinute@plt>
  mov    %rax,%r15
  mov    %r12,%rdi
  call   <grabLSB@plt>
  mov    %eax,%esi
  mov    %rbp,%rax
  and    $0xfffffffffffffffd,%rax
  cmp    $0x1,%rax
  je     L84
  cmp    $0xc,%rbp
  ja     L80
  mov    $0x1,%eax
  mov    %ebp,%ecx
  shl    %cl,%rax
  test   $0x15a0,%eax
  je     L111
L84:
  movslq %ebx,%rbx
  add    0x8(%rsp),%rbx
  cmp    $0x1f,%rbx
  jbe    L48
  cmp    $0xc,%rbp
  sete   %al
  movzbl %al,%eax
  add    %rax,%r13
  lea    0x1(%rbp),%rcx
  movabs $0xaaaaaaaaaaaaaaab,%rdx
  mov    %rcx,%rax
  mul    %rdx
  shr    $0x3,%rdx
  lea    (%rdx,%rdx,2),%rax
  shl    $0x2,%rax
  sub    %rax,%rcx
  mov    %rcx,%rbp
  mov    $0x1,%eax
  cmove  %rax,%rbp
L48:
  movabs $0x842108421084211,%rdx
  mov    %rbx,%rax
  mul    %rdx
  mov    %rbx,%rax
  sub    %rdx,%rax
  shr    %rax
  lea    (%rdx,%rax,1),%r8
  shr    $0x4,%r8
  mov    %r8,%rax
  shl    $0x5,%rax
  sub    %r8,%rax
  sub    %rax,%rbx
  mov    %rbx,%r8
  mov    $0x1f,%eax
  cmove  %rax,%r8
L95:
  lea    0x20(%rsp),%rbx
  push   %rsi
  push   %r15
  mov    %r14,%r9
  mov    %rbp,%rcx
  mov    %r13,%rdx
  lea    D31(%rip),%rsi
  mov    %rbx,%rdi
  call   <sprintf@plt>
  lea    0x28(%rsp),%rdx
  lea    D18(%rip),%rsi
  mov    %rbx,%rdi
  call   <sscanf@plt>
  mov    0x28(%rsp),%rax
  add    $0x10,%rsp
  mov    0x2028(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L104
  add    $0x2038,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L87:
  lea    D30(%rip),%rdi
  call   <printf@plt>
  lea    D36(%rip),%rdi
  call   <printf@plt>
  jmp    L13
L111:
  test   $0xa50,%eax
  je     L80
  movslq %ebx,%rbx
  add    0x8(%rsp),%rbx
  cmp    $0x1f,%rbx
  sbb    $0xffffffffffffffff,%rbp
  movabs $0x8888888888888889,%rdx
  mov    %rbx,%rax
  mul    %rdx
  mov    %rdx,%r8
  shr    $0x4,%r8
  and    $0xfffffffffffffff0,%rdx
  sub    %r8,%rdx
  add    %rdx,%rdx
  sub    %rdx,%rbx
  mov    %rbx,%r8
  mov    $0x1e,%eax
  cmove  %rax,%r8
  jmp    L95
L80:
  test   $0x3,%r13b
  jne    L97
  movslq %ebx,%rbx
  add    0x8(%rsp),%rbx
  cmp    $0x1e,%rbx
  sbb    $0xffffffffffffffff,%rbp
  movabs $0x1a7b9611a7b9611b,%rdx
  mov    %rbx,%rax
  mul    %rdx
  mov    %rbx,%rax
  sub    %rdx,%rax
  shr    %rax
  lea    (%rdx,%rax,1),%r8
  shr    $0x4,%r8
  lea    0x0(,%r8,8),%rax
  sub    %r8,%rax
  lea    (%r8,%rax,4),%rax
  sub    %rax,%rbx
  mov    %rbx,%r8
  mov    $0x1d,%eax
  cmove  %rax,%r8
  jmp    L95
L97:
  movslq %ebx,%rbx
  add    0x8(%rsp),%rbx
  cmp    $0x1d,%rbx
  sbb    $0xffffffffffffffff,%rbp
  mov    %rbx,%rdx
  shr    $0x2,%rdx
  movabs $0x4924924924924925,%rcx
  mov    %rdx,%rax
  mul    %rcx
  shr    %rdx
  lea    0x0(,%rdx,8),%rax
  sub    %rdx,%rax
  shl    $0x2,%rax
  sub    %rax,%rbx
  mov    %rbx,%r8
  mov    $0x1c,%eax
  cmove  %rax,%r8
  jmp    L95
L104:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D31
datatype: string
name: unpack_data
arguments: label: D18
datatype: string
name: unpack_data
arguments: label: D30
datatype: string
name: unpack_data
arguments: label: D36
datatype: string

tool: D31: %lu%02lu%02lu%02lu%02lu%d

tool: D18: %lu

tool: D30: Warning: This function only supports a max of 30 days


tool: D36: You may improve this feature later. :)


assistant: ```c
unsigned long addDay(unsigned long encoding, int days) {
  if (days > 34) {
    printf("Warning: This function only supports a max of 30 days\n");
    printf("You may improve this feature later. :)\n");
  }
  char buf[8192];
  unsigned long encoding2;
  unsigned long y, m, d, h, min;
  int b;
  y = grabYear(encoding);
  m = grabMonth(encoding);
  d = grabDay(encoding);
  h = grabHour(encoding);
  min = grabMinute(encoding);
  b = grabLSB(encoding);
  if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) {
    if (d + days > 31) {
      if (m == 12)
        y++;
      m = (m + 1) % 12;
      if (m == 0)
        m = 1;
    }
    d = (d + days) % 31;
    if (d == 0)
      d = 31;
  } else if (m == 4 || m == 6 || m == 9 || m == 11) {
    if (d + days > 30)
      m++;
    d = (d + days) % 30;
    if (d == 0)
      d = 30;
  } else {
    if (y % 4 == 0) {
      if (d + days > 29)
        m++;
      d = (d + days) % 29;
      if (d == 0)
        d = 29;
    } else {
      if (d + days > 28)
        m++;
      d = (d + days) % 28;
      if (d == 0)
        d = 28;
    }
  }
  sprintf(buf, "%lu%02lu%02lu%02lu%02lu%d", y, m, d, h, min, b);
  sscanf(buf, "%lu", &encoding2);
  return encoding2;
}
```