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

```asm
<ccn_filewatch>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x130,%rsp
  mov    %rdi,-0x108(%rbp)
  mov    %rsi,-0x110(%rbp)
  mov    %rdx,-0x118(%rbp)
  mov    %rcx,-0x120(%rbp)
  mov    %r8,-0x128(%rbp)
  mov    %r9d,-0x12c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0xffffffff,-0xf0(%rbp)
  movl   $0x0,-0x100(%rbp)
  movl   $0x0,-0xfc(%rbp)
  movl   $0x4,-0xec(%rbp)
  movq   $0x0,-0xd8(%rbp)
  movq   $0x0,-0xe8(%rbp)
  movq   $0x0,-0xd0(%rbp)
  movq   $0x0,-0xc8(%rbp)
  movq   $0x0,-0xc0(%rbp)
  movq   $0x0,-0xb8(%rbp)
  movq   $0x0,-0xe0(%rbp)
  movl   $0x0,-0xf8(%rbp)
  movl   $0x0,-0xf4(%rbp)
  lea    -0x90(%rbp),%rax
  mov    $0x80,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  lea    -0xb0(%rbp),%rax
  mov    $0x20,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    D14(%rip),%rax
  mov    (%rax),%edx
  mov    D24(%rip),%rax
  mov    %edx,(%rax)
  cmpl   $0x0,0x10(%rbp)
  jg     L48
  mov    $0xffffffff,%eax
  jmp    L21
L48:
  cmpl   $0x0,-0x12c(%rbp)
  jg     L79
  mov    $0xffffffff,%eax
  jmp    L21
L79:
  mov    D3(%rip),%rax
  mov    (%rax),%ecx
  mov    -0x108(%rbp),%rax
  mov    $0x0,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <open@plt>
  mov    %eax,-0xf0(%rbp)
  cmpl   $0x0,-0xf0(%rbp)
  jns    L204
  mov    $0xffffffff,%eax
  jmp    L21
L204:
  movl   $0x0,-0xfc(%rbp)
L170:
  mov    -0xfc(%rbp),%eax
  mov    $0x0,%edx
  divl   -0xec(%rbp)
  lea    -0x90(%rbp),%rax
  mov    %edx,%edx
  shl    $0x5,%rdx
  add    %rdx,%rax
  mov    %rax,-0xd8(%rbp)
  mov    -0xd8(%rbp),%rdx
  mov    -0xf0(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <fstat@plt>
  mov    %eax,-0x100(%rbp)
  cmpl   $0xffffffff,-0x100(%rbp)
  je     L18
  cmpq   $0x0,-0xe8(%rbp)
  je     L43
  mov    -0xd8(%rbp),%rdx
  mov    -0xe8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <statchanged@plt>
  test   %rax,%rax
  je     L63
L43:
  mov    -0xd8(%rbp),%rdx
  mov    -0x110(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <printstat@plt>
  mov    -0xd8(%rbp),%rax
  mov    %rax,-0xe8(%rbp)
  movl   $0x0,-0xf4(%rbp)
  cmpq   $0x0,-0x120(%rbp)
  je     L61
  mov    -0xd8(%rbp),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x120(%rbp)
  jge    L61
  movl   $0xfffffffe,-0x100(%rbp)
  jmp    L59
L61:
  addl   $0x1,-0xfc(%rbp)
  jmp    L35
L63:
  mov    0x10(%rbp),%eax
  add    %eax,-0xf4(%rbp)
  mov    -0x12c(%rbp),%eax
  cmp    %eax,-0xf4(%rbp)
  jb     L35
  mov    -0xd8(%rbp),%rax
  mov    (%rax),%rax
  cmp    %rax,-0x118(%rbp)
  jg     L35
  movl   $0x0,-0x100(%rbp)
  jmp    L59
L35:
  lea    -0xb0(%rbp),%rax
  mov    0x10(%rbp),%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <poll@plt>
  mov    %eax,-0x100(%rbp)
  cmpl   $0x0,-0x100(%rbp)
  je     L128
  mov    $0x0,%eax
  call   <abort@plt>
L128:
  mov    0x10(%rbp),%eax
  add    %eax,-0xf8(%rbp)
  mov    -0xf8(%rbp),%eax
  mov    %eax,%eax
  imul   $0x10624dd3,%rax,%rax
  shr    $0x20,%rax
  shr    $0x6,%eax
  mov    %eax,%edx
  mov    -0xe0(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x128(%rbp)
  jge    L89
  movl   $0xfffffffd,-0x100(%rbp)
  jmp    L59
L89:
  cmpl   $0xbb7,-0xf8(%rbp)
  jbe    L170
  mov    -0xf8(%rbp),%eax
  mov    %eax,%eax
  imul   $0x10624dd3,%rax,%rax
  shr    $0x20,%rax
  shr    $0x6,%eax
  mov    %eax,%eax
  add    %rax,-0xe0(%rbp)
  mov    -0xf8(%rbp),%eax
  mov    %eax,%edx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  shr    $0x6,%edx
  imul   $0x3e8,%edx,%edx
  sub    %edx,%eax
  mov    %eax,-0xf8(%rbp)
  lea    -0xd0(%rbp),%rdx
  mov    -0x108(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <stat@plt>
  mov    %eax,-0x100(%rbp)
  cmpl   $0x0,-0x100(%rbp)
  js     L51
  mov    -0xc8(%rbp),%rdx
  mov    -0xd8(%rbp),%rax
  mov    0x8(%rax),%rax
  cmp    %rax,%rdx
  jne    L51
  mov    -0xc0(%rbp),%rdx
  mov    -0xd8(%rbp),%rax
  mov    0x10(%rax),%rax
  cmp    %rax,%rdx
  je     L16
L51:
  movl   $0xfffffffc,-0x100(%rbp)
  jmp    L59
L16:
  mov    -0x110(%rbp),%rax
  mov    %rax,%rdi
  call   <fflush@plt>
  jmp    L170
L18:
  nop
L59:
  mov    -0xf0(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    -0x110(%rbp),%rax
  mov    %rax,%rdi
  call   <fflush@plt>
  mov    -0x100(%rbp),%eax
L21:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L107
  call   <__stack_chk_fail@plt>
L107:
  leave
  ret
```

assistant: ```c
int ccn_filewatch(const char *path, FILE *out, off_t minsize, off_t maxsize, time_t maxsec, int msecstable, int msecpoll) {
  int fd = -1;
  int res = 0;
  unsigned i = 0;
  const unsigned int nbuf = 4;
  struct stat stats[4];
  struct stat *curr = NULL;
  struct stat *prev = NULL;
  struct stat statname = {0};
  struct pollfd dummy[1];
  time_t elapsed = 0;
  unsigned elapsedms = 0;
  unsigned stablems = 0;
  memset(stats, 0, sizeof(stats));
  memset(dummy, 0, sizeof(dummy));
  errno = EINVAL;
  if (msecpoll < 1)
    return (-1);
  if (msecstable < 1)
    return (-1);
  fd = open(path, O_RDONLY, 0);
  if (fd < 0)
    return (-1);
  for (i = 0;;) {
    curr = &(stats[i % nbuf]);
    res = fstat(fd, curr);
    if (res == -1)
      break;
    if (prev == NULL || statchanged(prev, curr)) {
      printstat(out, curr);
      prev = curr;
      stablems = 0;
      if (maxsize != 0 && curr->st_size > maxsize) {
        res = -2;
        break;
      }
      i++;
    } else {
      stablems += msecpoll;
      if (stablems >= msecstable && curr->st_size >= minsize) {
        res = 0;
        break;
      }
    }
    res = poll(dummy, 0, msecpoll);
    if (res != 0)
      abort();
    elapsedms += msecpoll;
    if (elapsed + elapsedms / 1000 > maxsec) {
      res = -3;
      break;
    }
    if (elapsedms >= 3000) {
      elapsed += elapsedms / 1000;
      elapsedms %= 1000;
      res = stat(path, &statname);
      if (res < 0 || statname.st_dev != curr->st_dev || statname.st_ino != curr->st_ino) {
        res = -4;
        break;
      }
      fflush(out);
    }
  }
  close(fd);
  fflush(out);
  return (res);
}
```