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

```asm
<ratt>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  movq   $0x0,-0x8(%rbp)
  mov    -0x24(%rbp),%eax
  lea    0x7(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x3,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x24(%rbp),%eax
  cltd
  shr    $0x1d,%edx
  add    %edx,%eax
  and    $0x7,%eax
  sub    %edx,%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x10(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x18(%rbp)
  jmp    L2
L30:
  mov    -0x18(%rbp),%eax
  lea    0x0(,%rax,8),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%rdx
  mov    %rdx,%rax
  or     %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%eax
  lea    0x0(,%rax,8),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  mov    -0x30(%rbp),%rdx
  mov    %eax,%ecx
  shr    %cl,%rdx
  mov    %rdx,%rax
  and    $0x1,%eax
  test   %rax,%rax
  jne    L106
  addl   $0x1,-0x18(%rbp)
L2:
  cmpl   $0x7,-0x18(%rbp)
  jle    L30
  jmp    L75
L106:
  nop
L75:
  mov    -0x10(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x18(%rbp)
  jmp    L28
L142:
  mov    -0x18(%rbp),%eax
  lea    0x0(,%rax,8),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%rdx
  mov    %rdx,%rax
  or     %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%eax
  lea    0x0(,%rax,8),%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  mov    -0x30(%rbp),%rdx
  mov    %eax,%ecx
  shr    %cl,%rdx
  mov    %rdx,%rax
  and    $0x1,%eax
  test   %rax,%rax
  jne    L58
  subl   $0x1,-0x18(%rbp)
L28:
  cmpl   $0x0,-0x18(%rbp)
  jns    L142
  jmp    L62
L58:
  nop
L62:
  mov    -0xc(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x14(%rbp)
  jmp    L125
L27:
  mov    -0x10(%rbp),%eax
  lea    0x0(,%rax,8),%edx
  mov    -0x14(%rbp),%eax
  add    %edx,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%rdx
  mov    %rdx,%rax
  or     %rax,-0x8(%rbp)
  mov    -0x10(%rbp),%eax
  lea    0x0(,%rax,8),%edx
  mov    -0x14(%rbp),%eax
  add    %edx,%eax
  mov    -0x30(%rbp),%rdx
  mov    %eax,%ecx
  shr    %cl,%rdx
  mov    %rdx,%rax
  and    $0x1,%eax
  test   %rax,%rax
  jne    L15
  addl   $0x1,-0x14(%rbp)
L125:
  cmpl   $0x7,-0x14(%rbp)
  jle    L27
  jmp    L65
L15:
  nop
L65:
  mov    -0xc(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x14(%rbp)
  jmp    L29
L130:
  mov    -0x10(%rbp),%eax
  lea    0x0(,%rax,8),%edx
  mov    -0x14(%rbp),%eax
  add    %edx,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%rdx
  mov    %rdx,%rax
  or     %rax,-0x8(%rbp)
  mov    -0x10(%rbp),%eax
  lea    0x0(,%rax,8),%edx
  mov    -0x14(%rbp),%eax
  add    %edx,%eax
  mov    -0x30(%rbp),%rdx
  mov    %eax,%ecx
  shr    %cl,%rdx
  mov    %rdx,%rax
  and    $0x1,%eax
  test   %rax,%rax
  jne    L87
  subl   $0x1,-0x14(%rbp)
L29:
  cmpl   $0x0,-0x14(%rbp)
  jns    L130
  jmp    L109
L87:
  nop
L109:
  mov    -0x8(%rbp),%rax
  pop    %rbp
  ret
```

assistant: ```c
uint64_t ratt(int sq, uint64_t block) {
  uint64_t result = 0ULL;
  int rk = sq / 8, fl = sq % 8, r, f;
  for (r = rk + 1; r <= 7; r++) {
    result |= (1ULL << (fl + r * 8));
    if (block & (1ULL << (fl + r * 8)))
      break;
  }
  for (r = rk - 1; r >= 0; r--) {
    result |= (1ULL << (fl + r * 8));
    if (block & (1ULL << (fl + r * 8)))
      break;
  }
  for (f = fl + 1; f <= 7; f++) {
    result |= (1ULL << (f + rk * 8));
    if (block & (1ULL << (f + rk * 8)))
      break;
  }
  for (f = fl - 1; f >= 0; f--) {
    result |= (1ULL << (f + rk * 8));
    if (block & (1ULL << (f + rk * 8)))
      break;
  }
  return result;
}
```