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

```asm
<tst_calendar>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x78,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %rsi,0x10(%rsp)
  mov    %rdx,0x18(%rsp)
  mov    %rcx,0x20(%rsp)
  mov    %r9,0x28(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x68(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x48(%rsp)
  cmp    %r9,%r8
  jge    L47
  lea    0x60(%rsp),%r15
  lea    0x48(%rsp),%r14
  mov    %r15,%rax
  lea    0x44(%rsp),%r12
  lea    0x40(%rsp),%rbp
  mov    %r14,%r15
  lea    0x3c(%rsp),%rbx
  mov    %r8,%r14
  mov    %rax,%r13
  jmp    L16
  nopw   0x0(%rax,%rax,1)
L63:
  lea    0x58(%rsp),%rdx
  lea    0x50(%rsp),%rsi
  mov    %r13,%rcx
  mov    %r14,%rdi
  movq   $0x0,0x50(%rsp)
  movq   $0x0,0x58(%rsp)
  movq   $0x0,0x60(%rsp)
  call   <jdn_to_gr@plt>
  mov    0x60(%rsp),%edx
  mov    0x58(%rsp),%esi
  mov    %r12,%r9
  mov    0x50(%rsp),%edi
  mov    0x20(%rsp),%rax
  mov    %rbp,%r8
  mov    %rbx,%rcx
  call   *%rax
  mov    0x44(%rsp),%edx
  mov    0x40(%rsp),%esi
  lea    0x54(%rsp),%rcx
  mov    0x18(%rsp),%rax
  lea    0x64(%rsp),%r9
  lea    0x5c(%rsp),%r8
  mov    0x3c(%rsp),%edi
  call   *%rax
  mov    0x50(%rsp),%esi
  mov    0x54(%rsp),%r8d
  mov    0x58(%rsp),%edx
  mov    0x5c(%rsp),%r9d
  mov    0x60(%rsp),%ecx
  mov    0x64(%rsp),%eax
  cmp    %r8d,%esi
  jne    L84
  cmp    %r9d,%edx
  jne    L84
  cmp    %eax,%ecx
  jne    L84
  add    $0x1,%r14
  cmp    %r14,0x28(%rsp)
  je     L47
L16:
  mov    0x10(%rsp),%rax
  mov    %r12,%rcx
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    %r14,%rdi
  call   *%rax
  mov    0x40(%rsp),%edx
  mov    0x44(%rsp),%ecx
  mov    %r15,%rdi
  mov    0x3c(%rsp),%esi
  mov    0x8(%rsp),%rax
  call   *%rax
  mov    0x48(%rsp),%rdx
  cmp    %r14,%rdx
  je     L63
  mov    0x44(%rsp),%r9d
  mov    0x40(%rsp),%r8d
  mov    %r14d,%esi
  xor    %eax,%eax
  mov    0x3c(%rsp),%ecx
  lea    D8(%rip),%rdi
  call   <printf@plt>
  jmp    L94
  nopl   (%rax)
L84:
  sub    $0x8,%rsp
  lea    D19(%rip),%rdi
  push   %rax
  xor    %eax,%eax
  call   <printf@plt>
  pop    %rax
  pop    %rdx
L94:
  mov    $0xffffffff,%eax
L88:
  mov    0x68(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L73
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L47:
  xor    %eax,%eax
  jmp    L88
L73:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D8
type_infered: string
name: read_data
arguments: data_tag: D19
type_infered: string

tool: D8: JDN conversion failed! %d != %d for %+04d-%02d-%02d


tool: D19: Gregorian to calendar conversion failed! %04d-%02d-%02d != %04d-%02d-%02d!


assistant: ```c
int tst_calendar(void (*cal_to_jdn)(uint32_t *, int16_t, uint8_t, uint16_t), void (*jdn_to_cal)(uint32_t, int16_t *, uint8_t *, uint16_t *), void (*cal_to_gr)(int16_t, uint8_t, uint16_t, int16_t *, uint8_t *, uint16_t *), void (*gr_to_cal)(int16_t, uint8_t, uint16_t, int16_t *, uint8_t *, uint16_t *), uint32_t min_jd, uint32_t max_jd) {
  uint32_t jdn = 0;
  uint32_t jdn2 = 0;
  for (jdn = min_jd; jdn < max_jd; ++jdn) {
    int16_t year;
    uint8_t month;
    uint16_t day;
    (*jdn_to_cal)(jdn, &year, &month, &day);
    (*cal_to_jdn)(&jdn2, year, month, day);
    if (jdn != jdn2) {
      printf("JDN conversion failed! %d != %d for %+04d-%02d-%02d\n", jdn, jdn2, year, month, day);
      return -1;
    }
    int16_t gy[2] = {0, 0};
    uint8_t gm[2] = {0, 0};
    uint16_t gd[2] = {0, 0};
    jdn_to_gr(jdn, &gy[0], &gm[0], &gd[0]);
    (*gr_to_cal)(gy[0], gm[0], gd[0], &year, &month, &day);
    (*cal_to_gr)(year, month, day, &gy[1], &gm[1], &gd[1]);
    if (gy[0] != gy[1] || gm[0] != gm[1] || gd[0] != gd[1]) {
      printf("Gregorian to calendar conversion failed! "
             "%04d-%02d-%02d != %04d-%02d-%02d!\n",
             gy[0], gm[0], gd[0], gy[1], gm[1], gd[1]);
      return -1;
    }
  }
  return 0;
}
```