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

```asm
<check_patients_waiting>:
  endbr64
  push   %r14
  lea    0x24(%rdi),%r14d
  push   %r13
  mov    %esi,%r13d
  push   %r12
  lea    0x2c(%rdi),%r12d
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  test   %esi,%esi
  je     L25
  nopl   (%rax)
L21:
  mov    (%r14),%eax
  mov    (%rsi),%rbp
  test   %eax,%eax
  jg     L10
  mov    0x8(%r13d),%rsi
  addl   $0x1,0x4(%ebp)
  mov    %esi,%r13d
  test   %esi,%esi
  jne    L21
L25:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L10:
  sub    $0x1,%eax
  mov    %r12d,%edi
  mov    %rbp,%rsi
  mov    %eax,(%r14)
  movl   $0x3,0x8(%ebp)
  addl   $0x3,0x4(%ebp)
  call   <removeList@plt>
  mov    %rbp,%rsi
  lea    0x38(%rbx),%edi
  call   <addList@plt>
  mov    0x8(%r13d),%rsi
  mov    %esi,%r13d
  test   %esi,%esi
  jne    L21
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
void check_patients_waiting(struct Village *village, struct List *list) {
  int i;
  struct Patient *p;
  void *__cil_tmp5;
  unsigned int __cil_tmp6;
  unsigned int __cil_tmp7;
  unsigned int __cil_tmp8;
  unsigned int __cil_tmp9;
  unsigned int __cil_tmp10;
  unsigned int __cil_tmp11;
  unsigned int __cil_tmp12;
  unsigned int __cil_tmp13;
  unsigned int __cil_tmp14;
  unsigned int __cil_tmp15;
  unsigned int __cil_tmp16;
  int __cil_tmp17;
  unsigned int __cil_tmp18;
  unsigned int __cil_tmp19;
  unsigned int __cil_tmp20;
  unsigned int __cil_tmp21;
  unsigned int __cil_tmp22;
  unsigned int __cil_tmp23;
  int __cil_tmp24;
  unsigned int __cil_tmp25;
  unsigned int __cil_tmp26;
  int __cil_tmp27;
  unsigned int __cil_tmp28;
  unsigned int __cil_tmp29;
  unsigned int __cil_tmp30;
  struct List *__cil_tmp31;
  unsigned int __cil_tmp32;
  unsigned int __cil_tmp33;
  unsigned int __cil_tmp34;
  struct List *__cil_tmp35;
  unsigned int __cil_tmp36;
  unsigned int __cil_tmp37;
  unsigned int __cil_tmp38;
  unsigned int __cil_tmp39;
  int __cil_tmp40;
  unsigned int __cil_tmp41;
  unsigned int __cil_tmp42;
  int *mem_43;
  struct Patient **mem_44;
  int *mem_45;
  int *mem_46;
  int *mem_47;
  int *mem_48;
  int *mem_49;
  int *mem_50;
  int *mem_51;
  int *mem_52;
  struct List **mem_53;
  {
    {
      while (1) {
      while_5_continue:;
        {
          __cil_tmp5 = (void *)0;
          __cil_tmp6 = (unsigned int)__cil_tmp5;
          __cil_tmp7 = (unsigned int)list;
          if (__cil_tmp7 != __cil_tmp6) {
          } else {
            goto while_5_break;
          }
        }
        __cil_tmp8 = 32 + 4;
        __cil_tmp9 = (unsigned int)village;
        __cil_tmp10 = __cil_tmp9 + __cil_tmp8;
        mem_43 = (int *)__cil_tmp10;
        i = *mem_43;
        mem_44 = (struct Patient **)list;
        p = *mem_44;
        if (i > 0) {
          {
            __cil_tmp11 = 32 + 4;
            __cil_tmp12 = (unsigned int)village;
            __cil_tmp13 = __cil_tmp12 + __cil_tmp11;
            __cil_tmp14 = 32 + 4;
            __cil_tmp15 = (unsigned int)village;
            __cil_tmp16 = __cil_tmp15 + __cil_tmp14;
            mem_45 = (int *)__cil_tmp16;
            __cil_tmp17 = *mem_45;
            mem_46 = (int *)__cil_tmp13;
            *mem_46 = __cil_tmp17 - 1;
            __cil_tmp18 = (unsigned int)p;
            __cil_tmp19 = __cil_tmp18 + 8;
            mem_47 = (int *)__cil_tmp19;
            *mem_47 = 3;
            __cil_tmp20 = (unsigned int)p;
            __cil_tmp21 = __cil_tmp20 + 4;
            __cil_tmp22 = (unsigned int)p;
            __cil_tmp23 = __cil_tmp22 + 8;
            mem_48 = (int *)__cil_tmp23;
            __cil_tmp24 = *mem_48;
            __cil_tmp25 = (unsigned int)p;
            __cil_tmp26 = __cil_tmp25 + 4;
            mem_49 = (int *)__cil_tmp26;
            __cil_tmp27 = *mem_49;
            mem_50 = (int *)__cil_tmp21;
            *mem_50 = __cil_tmp27 + __cil_tmp24;
            __cil_tmp28 = 32 + 12;
            __cil_tmp29 = (unsigned int)village;
            __cil_tmp30 = __cil_tmp29 + __cil_tmp28;
            __cil_tmp31 = (struct List *)__cil_tmp30;
            removeList(__cil_tmp31, p);
            __cil_tmp32 = 32 + 24;
            __cil_tmp33 = (unsigned int)village;
            __cil_tmp34 = __cil_tmp33 + __cil_tmp32;
            __cil_tmp35 = (struct List *)__cil_tmp34;
            addList(__cil_tmp35, p);
          }
        } else {
          __cil_tmp36 = (unsigned int)p;
          __cil_tmp37 = __cil_tmp36 + 4;
          __cil_tmp38 = (unsigned int)p;
          __cil_tmp39 = __cil_tmp38 + 4;
          mem_51 = (int *)__cil_tmp39;
          __cil_tmp40 = *mem_51;
          mem_52 = (int *)__cil_tmp37;
          *mem_52 = __cil_tmp40 + 1;
        }
        __cil_tmp41 = (unsigned int)list;
        __cil_tmp42 = __cil_tmp41 + 8;
        mem_53 = (struct List **)__cil_tmp42;
        list = *mem_53;
      }
    while_5_break:;
    }
    return;
  }
}
```