user: Converte this assembly snippet into its equivalent C code:

```asm
<floyd_steinberg_dither>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x44(%rbp)
  movl   $0x90,-0x24(%rbp)
  movl   $0x90,-0x20(%rbp)
  movl   $0x0,-0x2c(%rbp)
  jmp    L13
L33:
  movl   $0x0,-0x28(%rbp)
  jmp    L0
L39:
  mov    -0x2c(%rbp),%edx
  mov    -0x28(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <index@plt>
  mov    %eax,%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <extract_grey@plt>
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x7f,-0x1c(%rbp)
  jle    L36
  mov    $0xff,%eax
  jmp    L57
L36:
  mov    $0x0,%eax
L57:
  mov    %eax,-0x18(%rbp)
  mov    -0x2c(%rbp),%edx
  mov    -0x28(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <index@plt>
  mov    %eax,%ecx
  mov    -0x18(%rbp),%edx
  mov    -0x40(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <set_bw@plt>
  mov    -0x1c(%rbp),%eax
  sub    -0x18(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%edx
  mov    %edx,%eax
  shl    $0x3,%eax
  sub    %edx,%eax
  lea    0xf(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x4,%eax
  mov    %eax,%ebx
  mov    -0x28(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x2c(%rbp),%eax
  mov    %eax,%esi
  mov    %edx,%edi
  call   <index@plt>
  mov    %eax,%ecx
  mov    -0x38(%rbp),%rax
  mov    %ebx,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <add_grey@plt>
  mov    -0x14(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  lea    0xf(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x4,%eax
  mov    %eax,%ebx
  mov    -0x2c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x28(%rbp),%eax
  sub    $0x1,%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <index@plt>
  mov    %eax,%ecx
  mov    -0x38(%rbp),%rax
  mov    %ebx,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <add_grey@plt>
  mov    -0x14(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  lea    0xf(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x4,%eax
  mov    %eax,%ebx
  mov    -0x2c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x28(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <index@plt>
  mov    %eax,%ecx
  mov    -0x38(%rbp),%rax
  mov    %ebx,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <add_grey@plt>
  mov    -0x14(%rbp),%eax
  lea    0xf(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x4,%eax
  mov    %eax,%ebx
  mov    -0x2c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x28(%rbp),%eax
  add    $0x1,%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <index@plt>
  mov    %eax,%ecx
  mov    -0x38(%rbp),%rax
  mov    %ebx,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <add_grey@plt>
  addl   $0x1,-0x28(%rbp)
L0:
  mov    -0x28(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L39
  addl   $0x1,-0x2c(%rbp)
L13:
  mov    -0x2c(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L33
  nop
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
void floyd_steinberg_dither(unsigned char *grey, unsigned char *bw, int num_pixels) {
  int w = 144;
  int h = 144;
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      int g = extract_grey(grey, index(x, y));
      int n = g > 127 ? 255 : 0;
      set_bw(bw, index(x, y), n);
      int error = g - n;
      add_grey(grey, index(x + 1, y), (7 * error) / 16);
      add_grey(grey, index(x - 1, y + 1), (3 * error) / 16);
      add_grey(grey, index(x, y + 1), (5 * error) / 16);
      add_grey(grey, index(x + 1, y + 1), (1 * error) / 16);
    }
  }
}
```