user: Please show me the C implementation that matches the assembly code listed below:

```asm
<int_factor>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  movq   $0x0,(%rax)
  jmp    L64
L62:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rcx
  mov    -0x28(%rbp),%rdx
  mov    %rcx,(%rdx)
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movq   $0x2,(%rax)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdx
  shr    $0x3f,%rdx
  add    %rdx,%rax
  sar    %rax
  mov    %rax,-0x18(%rbp)
L64:
  mov    -0x18(%rbp),%rax
  and    $0x1,%eax
  test   %rax,%rax
  je     L62
  jmp    L95
L76:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rcx
  mov    -0x28(%rbp),%rdx
  mov    %rcx,(%rdx)
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movq   $0x3,(%rax)
  mov    -0x18(%rbp),%rcx
  movabs $0x5555555555555556,%rdx
  mov    %rcx,%rax
  imul   %rdx
  sar    $0x3f,%rcx
  mov    %rdx,%rax
  sub    %rcx,%rax
  mov    %rax,-0x18(%rbp)
L95:
  mov    -0x18(%rbp),%rcx
  movabs $0x5555555555555556,%rdx
  mov    %rcx,%rax
  imul   %rdx
  mov    %rcx,%rsi
  sar    $0x3f,%rsi
  mov    %rdx,%rax
  sub    %rsi,%rax
  mov    %rax,%rdx
  add    %rdx,%rdx
  add    %rax,%rdx
  mov    %rcx,%rax
  sub    %rdx,%rax
  test   %rax,%rax
  je     L76
  movq   $0x1,-0x10(%rbp)
L9:
  mov    -0x10(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  add    %rax,%rax
  sub    $0x1,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  cqto
  idivq  -0x8(%rbp)
  mov    %rdx,%rax
  test   %rax,%rax
  jne    L92
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rcx
  mov    -0x28(%rbp),%rdx
  mov    %rcx,(%rdx)
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    -0x8(%rbp),%rax
  mov    %rax,(%rdx)
  mov    -0x18(%rbp),%rax
  cqto
  idivq  -0x8(%rbp)
  mov    %rax,-0x18(%rbp)
L92:
  mov    -0x8(%rbp),%rax
  imul   %rax,%rax
  cmp    %rax,-0x18(%rbp)
  jl     L15
  mov    -0x10(%rbp),%rdx
  mov    %rdx,%rax
  add    %rax,%rax
  add    %rdx,%rax
  add    %rax,%rax
  add    $0x1,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  cqto
  idivq  -0x8(%rbp)
  mov    %rdx,%rax
  test   %rax,%rax
  jne    L58
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rcx
  mov    -0x28(%rbp),%rdx
  mov    %rcx,(%rdx)
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    -0x8(%rbp),%rax
  mov    %rax,(%rdx)
  mov    -0x18(%rbp),%rax
  cqto
  idivq  -0x8(%rbp)
  mov    %rax,-0x18(%rbp)
L58:
  mov    -0x8(%rbp),%rax
  imul   %rax,%rax
  cmp    %rax,-0x18(%rbp)
  jl     L18
  addq   $0x1,-0x10(%rbp)
  jmp    L9
L15:
  nop
  jmp    L67
L18:
  nop
L67:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rcx
  mov    -0x28(%rbp),%rdx
  mov    %rcx,(%rdx)
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    -0x18(%rbp),%rax
  mov    %rax,(%rdx)
  nop
  pop    %rbp
  ret
```

assistant: ```c
void int_factor(long n, long *divisors, long *nd) {
  long p, k, kmax;
  *nd = 0;
  while (n % 2 == 0) {
    divisors[(*nd)++] = 2;
    n /= 2;
  }
  while (n % 3 == 0) {
    divisors[(*nd)++] = 3;
    n /= 3;
  }
  for (k = 1;; k++) {
    p = 6 * k - 1;
    if (n % p == 0) {
      divisors[(*nd)++] = p;
      n /= p;
    }
    if (p * p > n)
      break;
    p = 6 * k + 1;
    if (n % p == 0) {
      divisors[(*nd)++] = p;
      n /= p;
    }
    if (p * p > n)
      break;
  }
  divisors[(*nd)++] = n;
}
```