user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<caldat>:
  endbr64
  mov    %rdx,%r8
  cmp    $0x231518,%rdi
  jle    L27
  lea    -0x1c7dd0(%rdi),%rax
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  movsd  D2(%rip),%xmm1
  subsd  %xmm1,%xmm0
  divsd  D41(%rip),%xmm0
  cvttsd2si %xmm0,%rdx
  lea    0x1(%rdx,%rdi,1),%rax
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  mulsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%rdx
  sub    %rdx,%rax
L6:
  lea    0x5f4(%rax),%rdx
  sub    $0x2534ca,%rax
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  subsd  D30(%rip),%xmm0
  divsd  D61(%rip),%xmm0
  addsd  D57(%rip),%xmm0
  cvttsd2si %xmm0,%rax
  lea    (%rax,%rax,8),%r9
  lea    (%rax,%r9,8),%r9
  lea    (%r9,%r9,4),%r9
  pxor   %xmm0,%xmm0
  cvtsi2sd %r9,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %rax,%xmm1
  mulsd  D2(%rip),%xmm1
  addsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%r10
  mov    %rdx,%r9
  sub    %r10,%r9
  pxor   %xmm0,%xmm0
  cvtsi2sd %r9,%xmm0
  movsd  D54(%rip),%xmm1
  divsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%r9
  sub    %r10d,%edx
  pxor   %xmm0,%xmm0
  cvtsi2sd %r9,%xmm0
  mulsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%r10
  sub    %r10d,%edx
  mov    %edx,(%r8)
  lea    -0x1(%r9),%edx
  sub    $0xd,%r9d
  cmp    $0xd,%edx
  cmovge %r9d,%edx
  mov    %edx,(%rsi)
  lea    -0x126b(%rax),%edx
  mov    %edx,(%rcx)
  cmpl   $0x2,(%rsi)
  jle    L16
  sub    $0x126c,%eax
  mov    %eax,(%rcx)
L16:
  mov    (%rcx),%eax
  test   %eax,%eax
  jle    L14
L74:
  test   %rdi,%rdi
  js     L22
L49:
  ret
L27:
  mov    %rdi,%rax
  test   %rdi,%rdi
  jns    L6
  movabs $0xe5aae5e0b9ee9a9b,%rdx
  imul   %rdx
  add    %rdi,%rdx
  sar    $0xf,%rdx
  mov    %rdi,%rax
  sar    $0x3f,%rax
  sub    %rdx,%rax
  add    $0x1,%rax
  imul   $0x8ead,%rax,%rax
  add    %rdi,%rax
  jmp    L6
L14:
  sub    $0x1,%eax
  mov    %eax,(%rcx)
  jmp    L74
L22:
  movabs $0xe5aae5e0b9ee9a9b,%rdx
  mov    %rdi,%rax
  imul   %rdx
  add    %rdi,%rdx
  sar    $0xf,%rdx
  sar    $0x3f,%rdi
  sub    %rdx,%rdi
  add    $0x1,%rdi
  imul   $0xffffff9c,%edi,%edi
  add    %edi,(%rcx)
  jmp    L49
```

tool_calls: name: retrieve_data
arguments: data_label: D2
type: f64
name: retrieve_data
arguments: data_label: D41
type: f64
name: retrieve_data
arguments: data_label: D30
type: f64
name: retrieve_data
arguments: data_label: D61
type: f64
name: retrieve_data
arguments: data_label: D57
type: f64
name: retrieve_data
arguments: data_label: D54
type: f64

tool: D2: 0.25

tool: D41: 36524.25

tool: D30: 122.1

tool: D61: 365.25

tool: D57: 6680

tool: D54: 30.6001

assistant: ```c
void caldat(long julian, int *mm, int *id, int *iyyy) {
  long ja, jalpha, jb, jc, jd, je;
  if (julian >= 2299161) {
    jalpha = (long)(((double)(julian - 1867216) - 0.25) / 36524.25);
    ja = julian + 1 + jalpha - (long)(0.25 * jalpha);
  } else if (julian < 0) {
    ja = julian + 36525 * (1 - julian / 36525);
  } else
    ja = julian;
  jb = ja + 1524;
  jc = (long)(6680.0 + ((double)(jb - 2439870) - 122.1) / 365.25);
  jd = (long)(365 * jc + (0.25 * jc));
  je = (long)((jb - jd) / 30.6001);
  *id = jb - jd - (long)(30.6001 * je);
  *mm = je - 1;
  if (*mm > 12)
    *mm -= 12;
  *iyyy = jc - 4715;
  if (*mm > 2)
    --(*iyyy);
  if (*iyyy <= 0)
    --(*iyyy);
  if (julian < 0)
    *iyyy -= 100 * (1 - julian / 36525);
}
```