user: Translate the below assembly code into C programming language:

```asm
<ccn_filewatch>:
  endbr64
  push   %r15
  pxor   %xmm0,%xmm0
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %r9d,%ebx
  sub    $0x138,%rsp
  mov    %rdi,0x40(%rsp)
  mov    0x170(%rsp),%r12d
  mov    %rsi,0x20(%rsp)
  xor    %esi,%esi
  mov    %rdx,0x58(%rsp)
  mov    $0x80,%edx
  mov    %rcx,0x38(%rsp)
  mov    %r8,0x28(%rsp)
  mov    %r9d,0x4c(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x128(%rsp)
  xor    %eax,%eax
  lea    0xa0(%rsp),%rax
  movaps %xmm0,0x60(%rsp)
  mov    %rax,%rdi
  movaps %xmm0,0x70(%rsp)
  mov    %rax,0x18(%rsp)
  call   <memset@plt>
  lea    0x80(%rsp),%rax
  mov    $0x20,%edx
  xor    %esi,%esi
  mov    %rax,%rdi
  mov    %rax,0x30(%rsp)
  call   <memset@plt>
  mov    D18(%rip),%rax
  mov    (%rax),%edx
  mov    D27(%rip),%rax
  mov    %edx,(%rax)
  test   %ebx,%ebx
  jle    L149
  test   %r12d,%r12d
  jle    L149
  mov    D12(%rip),%rax
  mov    0x40(%rsp),%rdi
  xor    %edx,%edx
  mov    (%rax),%esi
  call   <open@plt>
  mov    %eax,%r15d
  test   %eax,%eax
  js     L149
  lea    0x60(%rsp),%rax
  xor    %ebx,%ebx
  xor    %r13d,%r13d
  movl   $0x0,0x4(%rsp)
  movq   $0x0,0x8(%rsp)
  movl   $0x0,0x48(%rsp)
  mov    %rax,0x50(%rsp)
  nopw   0x0(%rax,%rax,1)
L166:
  mov    0x48(%rsp),%ebp
  mov    0x18(%rsp),%r14
  mov    %r15d,%edi
  and    $0x3,%ebp
  mov    %rbp,%rax
  shl    $0x5,%rax
  add    %rax,%r14
  mov    %rax,0x10(%rsp)
  mov    %r14,%rsi
  call   <fstat@plt>
  cmp    $0xffffffff,%eax
  je     L248
  test   %r13,%r13
  je     L172
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <statchanged@plt>
  test   %rax,%rax
  jne    L172
  add    %r12d,0x4(%rsp)
  mov    0x4(%rsp),%eax
  cmp    %eax,0x4c(%rsp)
  ja     L180
  mov    0x10(%rsp),%rax
  mov    0x58(%rsp),%rdx
  cmp    %rdx,0xa0(%rsp,%rax,1)
  jge    L218
  nopl   0x0(%rax,%rax,1)
L180:
  mov    0x30(%rsp),%rdi
  xor    %esi,%esi
  mov    %r12d,%edx
  call   <poll@plt>
  test   %eax,%eax
  jne    L84
L21:
  lea    (%rbx,%r12,1),%eax
  mov    %rax,%rbx
  imul   $0x10624dd3,%rax,%rax
  shr    $0x26,%rax
  mov    %eax,%r14d
  add    0x8(%rsp),%r14
  cmp    0x28(%rsp),%r14
  jg     L123
  cmp    $0xbb7,%ebx
  jbe    L166
  imul   $0x3e8,%eax,%eax
  mov    0x50(%rsp),%rsi
  mov    0x40(%rsp),%rdi
  sub    %eax,%ebx
  call   <stat@plt>
  test   %eax,%eax
  js     L15
  shl    $0x5,%rbp
  mov    0xa8(%rsp,%rbp,1),%rax
  cmp    %rax,0x68(%rsp)
  jne    L15
  mov    0xb0(%rsp,%rbp,1),%rax
  cmp    %rax,0x70(%rsp)
  jne    L15
  mov    0x20(%rsp),%rdi
  call   <fflush@plt>
  mov    %r14,0x8(%rsp)
  jmp    L166
  nopl   (%rax)
L172:
  mov    0x20(%rsp),%rdi
  mov    %r14,%rsi
  call   <printstat@plt>
  cmpq   $0x0,0x38(%rsp)
  je     L111
  mov    %rbp,%rax
  mov    0x38(%rsp),%rcx
  shl    $0x5,%rax
  cmp    %rcx,0xa0(%rsp,%rax,1)
  jg     L227
L111:
  addl   $0x1,0x48(%rsp)
  mov    %r14,%r13
  movl   $0x0,0x4(%rsp)
  jmp    L180
  nopl   0x0(%rax)
L84:
  xor    %eax,%eax
  call   <abort@plt>
  jmp    L21
  nopl   0x0(%rax)
L248:
  mov    %eax,%r8d
L89:
  mov    %r15d,%edi
  mov    %r8d,0x4(%rsp)
  call   <close@plt>
  mov    0x20(%rsp),%rdi
  call   <fflush@plt>
  mov    0x4(%rsp),%r8d
L162:
  mov    0x128(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L240
  add    $0x138,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L123:
  mov    $0xfffffffd,%r8d
  jmp    L89
  nopl   0x0(%rax,%rax,1)
L15:
  mov    $0xfffffffc,%r8d
  jmp    L89
L227:
  mov    $0xfffffffe,%r8d
  jmp    L89
L218:
  xor    %r8d,%r8d
  jmp    L89
L149:
  mov    $0xffffffff,%r8d
  jmp    L162
L240:
  call   <__stack_chk_fail@plt>
```

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);
}
```