user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<ms_doy2md>:
  endbr64
  sub    $0x48,%rsp
  movdqa D3(%rip),%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    -0x708(%rdi),%eax
  movaps %xmm0,(%rsp)
  cmp    $0xc80,%eax
  ja     L13
  mov    %esi,%r8d
  test   $0x3,%dil
  jne    L253
  imul   $0xc28f5c29,%edi,%eax
  add    $0x51eb850,%eax
  ror    $0x2,%eax
  cmp    $0x28f5c28,%eax
  jbe    L253
  movl   $0x1d,0x4(%rsp)
  mov    $0x1,%eax
L166:
  cmp    $0x1,%eax
  sbb    %eax,%eax
  add    $0x16e,%eax
  cmp    %r8d,%eax
  jl     L121
  test   %r8d,%r8d
  jle    L121
  lea    -0x1f(%r8),%eax
  test   %eax,%eax
  jle    L295
  mov    %eax,%r8d
  sub    0x4(%rsp),%r8d
  test   %r8d,%r8d
  jle    L24
  lea    -0x1f(%r8),%eax
  test   %eax,%eax
  jle    L291
  lea    -0x3d(%r8),%esi
  test   %esi,%esi
  jle    L216
  lea    -0x5c(%r8),%eax
  test   %eax,%eax
  jle    L241
  lea    -0x7a(%r8),%esi
  test   %esi,%esi
  jle    L275
  lea    -0x99(%r8),%eax
  test   %eax,%eax
  jle    L237
  lea    -0xb8(%r8),%esi
  test   %esi,%esi
  jle    L181
  lea    -0xd6(%r8),%eax
  test   %eax,%eax
  jle    L178
  lea    -0xf5(%r8),%esi
  test   %esi,%esi
  jle    L154
  sub    $0x113,%r8d
  test   %r8d,%r8d
  jle    L29
  xor    %eax,%eax
  cmp    $0x1f,%r8d
  jle    L8
L324:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L133
  add    $0x48,%rsp
  ret
  xchg   %ax,%ax
L253:
  imul   $0xc28f5c29,%edi,%edi
  xor    %eax,%eax
  add    $0x51eb850,%edi
  ror    $0x4,%edi
  cmp    $0xa3d70a,%edi
  ja     L166
  movl   $0x1d,0x4(%rsp)
  mov    $0x1,%eax
  jmp    L166
L295:
  mov    $0x1,%eax
  nopl   0x0(%rax)
L211:
  mov    %eax,(%rdx)
  xor    %eax,%eax
  mov    %r8d,(%rcx)
  jmp    L324
L24:
  mov    %eax,%r8d
  mov    $0x2,%eax
  jmp    L211
L8:
  mov    $0xc,%eax
  jmp    L211
L291:
  mov    $0x3,%eax
  jmp    L211
L216:
  mov    %eax,%r8d
  mov    $0x4,%eax
  jmp    L211
L241:
  mov    %esi,%r8d
  mov    $0x5,%eax
  jmp    L211
L275:
  mov    %eax,%r8d
  mov    $0x6,%eax
  jmp    L211
L237:
  mov    %esi,%r8d
  mov    $0x7,%eax
  jmp    L211
L181:
  mov    %eax,%r8d
  mov    $0x8,%eax
  jmp    L211
L178:
  mov    %esi,%r8d
  mov    $0x9,%eax
  jmp    L211
L154:
  mov    %eax,%r8d
  mov    $0xa,%eax
  jmp    L211
L29:
  mov    %esi,%r8d
  mov    $0xb,%eax
  jmp    L211
L121:
  mov    %r8d,%edx
  lea    D13(%rip),%rsi
  mov    $0x2,%edi
  call   <ms_log@plt>
  mov    $0xffffffff,%eax
  jmp    L324
L13:
  mov    %edi,%edx
  lea    D28(%rip),%rsi
  mov    $0x2,%edi
  call   <ms_log@plt>
  mov    $0xffffffff,%eax
  jmp    L324
L133:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D3
datatype: byte[16]
name: unpack_data
arguments: label: D13
datatype: string
name: unpack_data
arguments: label: D28
datatype: string

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

tool: D13: ms_doy2md(): day-of-year (%d) is out of range


tool: D28: ms_doy2md(): year (%d) is out of range


assistant: ```c
int ms_doy2md(int year, int jday, int *month, int *mday) {
  int idx;
  int leap;
  int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  if (year < 1800 || year > 5000) {
    ms_log(2, "ms_doy2md(): year (%d) is out of range\n", year);
    return -1;
  }
  leap = (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) ? 1 : 0;
  if (leap)
    days[1]++;
  if (jday > 365 + leap || jday <= 0) {
    ms_log(2, "ms_doy2md(): day-of-year (%d) is out of range\n", jday);
    return -1;
  }
  for (idx = 0; idx < 12; idx++) {
    jday -= days[idx];
    if (jday <= 0) {
      *month = idx + 1;
      *mday = days[idx] + jday;
      break;
    }
  }
  return 0;
}
```