user: 请从给定的汇编指令推导出C源代码:

```asm
<check_patients_waiting>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x120,%rsp
  mov    %rdi,-0x118(%rbp)
  mov    %rsi,-0x120(%rbp)
L0:
  movq   $0x0,-0x78(%rbp)
  mov    -0x78(%rbp),%rax
  mov    %eax,-0x108(%rbp)
  mov    -0x120(%rbp),%rax
  mov    %eax,-0x104(%rbp)
  mov    -0x104(%rbp),%eax
  cmp    -0x108(%rbp),%eax
  je     L1
  movl   $0x24,-0x100(%rbp)
  mov    -0x118(%rbp),%rax
  mov    %eax,-0xfc(%rbp)
  mov    -0xfc(%rbp),%edx
  mov    -0x100(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0xf8(%rbp)
  mov    -0xf8(%rbp),%eax
  mov    %rax,-0x70(%rbp)
  mov    -0x70(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0xf4(%rbp)
  mov    -0x120(%rbp),%rax
  mov    %rax,-0x68(%rbp)
  mov    -0x68(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x60(%rbp)
  cmpl   $0x0,-0xf4(%rbp)
  jle    L21
  movl   $0x24,-0xdc(%rbp)
  mov    -0x118(%rbp),%rax
  mov    %eax,-0xd8(%rbp)
  mov    -0xd8(%rbp),%edx
  mov    -0xdc(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0xd4(%rbp)
  movl   $0x24,-0xd0(%rbp)
  mov    -0x118(%rbp),%rax
  mov    %eax,-0xcc(%rbp)
  mov    -0xcc(%rbp),%edx
  mov    -0xd0(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0xc8(%rbp)
  mov    -0xc8(%rbp),%eax
  mov    %rax,-0x48(%rbp)
  mov    -0x48(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0xc4(%rbp)
  mov    -0xd4(%rbp),%eax
  mov    %rax,-0x40(%rbp)
  mov    -0xc4(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    -0x40(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x60(%rbp),%rax
  mov    %eax,-0xc0(%rbp)
  mov    -0xc0(%rbp),%eax
  add    $0x8,%eax
  mov    %eax,-0xbc(%rbp)
  mov    -0xbc(%rbp),%eax
  mov    %rax,-0x38(%rbp)
  mov    -0x38(%rbp),%rax
  movl   $0x3,(%rax)
  mov    -0x60(%rbp),%rax
  mov    %eax,-0xb8(%rbp)
  mov    -0xb8(%rbp),%eax
  add    $0x4,%eax
  mov    %eax,-0xb4(%rbp)
  mov    -0x60(%rbp),%rax
  mov    %eax,-0xb0(%rbp)
  mov    -0xb0(%rbp),%eax
  add    $0x8,%eax
  mov    %eax,-0xac(%rbp)
  mov    -0xac(%rbp),%eax
  mov    %rax,-0x30(%rbp)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0xa8(%rbp)
  mov    -0x60(%rbp),%rax
  mov    %eax,-0xa4(%rbp)
  mov    -0xa4(%rbp),%eax
  add    $0x4,%eax
  mov    %eax,-0xa0(%rbp)
  mov    -0xa0(%rbp),%eax
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x9c(%rbp)
  mov    -0xb4(%rbp),%eax
  mov    %rax,-0x20(%rbp)
  mov    -0x9c(%rbp),%edx
  mov    -0xa8(%rbp),%eax
  add    %eax,%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,(%rax)
  movl   $0x2c,-0x98(%rbp)
  mov    -0x118(%rbp),%rax
  mov    %eax,-0x94(%rbp)
  mov    -0x94(%rbp),%edx
  mov    -0x98(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x90(%rbp)
  mov    -0x90(%rbp),%eax
  mov    %rax,-0x18(%rbp)
  mov    -0x60(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <removeList@plt>
  movl   $0x38,-0x8c(%rbp)
  mov    -0x118(%rbp),%rax
  mov    %eax,-0x88(%rbp)
  mov    -0x88(%rbp),%edx
  mov    -0x8c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x84(%rbp)
  mov    -0x84(%rbp),%eax
  mov    %rax,-0x10(%rbp)
  mov    -0x60(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <addList@plt>
  jmp    L10
L21:
  mov    -0x60(%rbp),%rax
  mov    %eax,-0xf0(%rbp)
  mov    -0xf0(%rbp),%eax
  add    $0x4,%eax
  mov    %eax,-0xec(%rbp)
  mov    -0x60(%rbp),%rax
  mov    %eax,-0xe8(%rbp)
  mov    -0xe8(%rbp),%eax
  add    $0x4,%eax
  mov    %eax,-0xe4(%rbp)
  mov    -0xe4(%rbp),%eax
  mov    %rax,-0x58(%rbp)
  mov    -0x58(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0xe0(%rbp)
  mov    -0xec(%rbp),%eax
  mov    %rax,-0x50(%rbp)
  mov    -0xe0(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x50(%rbp),%rax
  mov    %edx,(%rax)
L10:
  mov    -0x120(%rbp),%rax
  mov    %eax,-0x80(%rbp)
  mov    -0x80(%rbp),%eax
  add    $0x8,%eax
  mov    %eax,-0x7c(%rbp)
  mov    -0x7c(%rbp),%eax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x120(%rbp)
  jmp    L0
L1:
  nop
  nop
  leave
  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;
  }
}
```