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

```asm
<match_digit>:
  endbr64
  push   %r15
  mov    %rdx,%r15
  mov    $0xa,%edx
  push   %r14
  mov    %rsi,%r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rcx,%rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0x8(%rsp),%rsi
  call   <strtoul@plt>
  mov    %rax,%r13
  cmp    $0x5f5e0ff,%rax
  ja     L165
L132:
  mov    0x8(%rsp),%rdx
  movzbl (%rdx),%eax
  cmp    $0x2f,%al
  jle    L146
  cmp    $0x3a,%al
  je     L154
L42:
  mov    $0x1,%ebx
  nopl   0x0(%rax)
L58:
  movsbl 0x0(%rbp,%rbx,1),%edi
  mov    %ebx,%r12d
  add    $0x1,%rbx
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L58
  cmp    $0x4,%r12d
  je     L106
L74:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L126
  add    $0x28,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L146:
  cmp    $0x2c,%al
  jle    L42
L154:
  movsbl 0x1(%rdx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L42
  mov    0x8(%rsp),%rcx
  mov    %r14,%r8
  mov    %rbp,%rdx
  mov    %r13,%rdi
  movsbl (%rcx),%esi
  call   <match_multi_number@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  je     L42
  jmp    L74
  nopl   (%rax)
L165:
  mov    %r14,%rdi
  call   <nodate@plt>
  test   %rax,%rax
  je     L132
  lea    0x10(%rsp),%rdi
  mov    %r14,%rsi
  mov    %r13,0x10(%rsp)
  call   <gmtime_r@plt>
  test   %rax,%rax
  je     L132
  mov    0x8(%rsp),%r12d
  movl   $0x1,(%rbx)
  sub    %ebp,%r12d
  jmp    L74
  nopw   0x0(%rax,%rax,1)
L106:
  cmp    $0x578,%r13
  ja     L145
  cmpl   $0xffffffff,(%r15)
  jne    L74
  movabs $0x28f5c28f5c28f5c3,%rcx
  mov    %r13,%rdx
  shr    $0x2,%rdx
  mov    %rdx,%rax
  mul    %rcx
  shr    $0x2,%rdx
  imul   $0x3c,%edx,%eax
  lea    (%rdx,%rdx,4),%rdx
  lea    (%rdx,%rdx,4),%rdx
  shl    $0x2,%rdx
  sub    %rdx,%r13
  add    %r13d,%eax
  mov    %eax,(%r15)
  jmp    L74
L145:
  lea    -0x76d(%r13),%rax
  cmp    $0xc6,%rax
  ja     L74
  sub    $0x76c,%r13
  mov    %r13,(%r14)
  jmp    L74
L126:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt) {
  int n;
  char *end;
  unsigned long num;
  num = strtoul(date, &end, 10);
  if (num >= 100000000 && nodate(tm)) {
    time_t time = num;
    if (gmtime_r(&time, tm)) {
      *tm_gmt = 1;
      return end - date;
    }
  }
  switch (*end) {
  case ':':
  case '.':
  case '/':
  case '-':
    if (isdigit(end[1])) {
      int match = match_multi_number(num, *end, date, end, tm);
      if (match)
        return match;
    }
  }
  n = 0;
  do {
    n++;
  } while (isdigit(date[n]));
  if (n == 4) {
    if (num <= 1400 && *offset == -1) {
      unsigned int minutes = num % 100;
      unsigned int hours = num / 100;
      *offset = hours * 60 + minutes;
    } else if (num > 1900 && num < 2100)
      tm->tm_year = num - 1900;
    return n;
  }
  if (n > 2)
    return n;
  if (num > 0 && num < 32 && tm->tm_mday < 0) {
    tm->tm_mday = num;
    return n;
  }
  if (n == 2 && tm->tm_year < 0) {
    if (num < 10 && tm->tm_mday >= 0) {
      tm->tm_year = num + 100;
      return n;
    }
    if (num >= 70) {
      tm->tm_year = num;
      return n;
    }
  }
  if (num > 0 && num < 13 && tm->tm_mon < 0)
    tm->tm_mon = num - 1;
  return n;
}
```