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

```asm
<ecc200placement>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  sub    $0x28,%rsp
  test   %esi,%esi
  jle    L259
  test   %edx,%edx
  jle    L259
  movslq %edx,%r14
  mov    %rdi,%rcx
  xor    %ebx,%ebx
  shl    $0x2,%r14
  xchg   %ax,%ax
L237:
  mov    %rcx,%rdi
  mov    %r14,%rdx
  xor    %esi,%esi
  add    $0x1,%ebx
  call   <memset@plt>
  mov    %rax,%rcx
  add    %r14,%rcx
  cmp    %ebx,%ebp
  jne    L237
L259:
  mov    %r12d,%eax
  lea    -0x2(%r12,%r12,1),%r14d
  xor    %r8d,%r8d
  mov    $0x4,%ebx
  and    $0x3,%eax
  mov    $0x1,%r9d
  mov    %eax,0x1c(%rsp)
  mov    %r12d,%eax
  sar    $0x1f,%eax
  shr    $0x1d,%eax
  lea    (%r12,%rax,1),%edx
  and    $0x7,%edx
  sub    %eax,%edx
  mov    %r12d,%eax
  and    $0x7,%eax
  mov    %edx,0x14(%rsp)
  mov    %eax,0x18(%rsp)
  mov    %r12d,%eax
  neg    %eax
  lea    0x2(%rax,%rax,1),%r15d
  mov    %r15d,0x10(%rsp)
  mov    %r14d,%r15d
  mov    %r8d,%r14d
  nopl   0x0(%rax)
L178:
  cmp    %ebp,%ebx
  jne    L228
  test   %r14d,%r14d
  jne    L228
  lea    0x1(%r9),%r14d
  mov    %r9d,%ecx
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    %r13,%rdi
  call   <ecc200placementcornerA@plt>
  mov    %r14d,%r9d
  xor    %r14d,%r14d
L9:
  mov    %ebx,%r11d
  mov    %r15d,0xc(%rsp)
  mov    %r12d,%edx
  mov    0x10(%rsp),%r15d
  imul   %r12d,%r11d
  mov    %ebp,%r12d
  add    %r14d,%r11d
  mov    %r11d,%ebp
  jmp    L104
  nopw   0x0(%rax,%rax,1)
L149:
  mov    %ebx,%esi
  lea    0x2(%r14),%eax
  add    %r15d,%ebp
  sub    $0x2,%esi
  js     L313
L141:
  cmp    %eax,%edx
  jle    L313
  mov    %eax,%r14d
  mov    %esi,%ebx
L104:
  cmp    %r12d,%ebx
  jge    L149
  test   %r14d,%r14d
  js     L149
  movslq %ebp,%rax
  mov    0x0(%r13,%rax,4),%edi
  test   %edi,%edi
  jne    L149
  lea    0x1(%r9),%eax
  mov    %r12d,%esi
  mov    %r14d,%r8d
  mov    %ebx,%ecx
  mov    %r13,%rdi
  mov    %edx,0x8(%rsp)
  add    %r15d,%ebp
  mov    %eax,0x4(%rsp)
  call   <ecc200placementblock@plt>
  mov    %ebx,%esi
  mov    0x4(%rsp),%r9d
  mov    0x8(%rsp),%edx
  lea    0x2(%r14),%eax
  sub    $0x2,%esi
  jns    L141
L313:
  sub    $0x1,%ebx
  add    $0x5,%r14d
  mov    0xc(%rsp),%r15d
  mov    %ebx,%r11d
  imul   %edx,%r11d
  add    %r14d,%r11d
  mov    %r11d,%ebp
  jmp    L82
  nopl   0x0(%rax,%rax,1)
L299:
  lea    0x2(%rbx),%eax
  lea    -0x2(%r14),%esi
  add    %r15d,%ebp
  cmp    %eax,%r12d
  jle    L285
L263:
  test   %esi,%esi
  js     L285
  mov    %esi,%r14d
  mov    %eax,%ebx
L82:
  test   %ebx,%ebx
  js     L299
  cmp    %edx,%r14d
  jge    L299
  movslq %ebp,%rax
  mov    0x0(%r13,%rax,4),%esi
  test   %esi,%esi
  jne    L299
  lea    0x1(%r9),%eax
  mov    %r12d,%esi
  mov    %r14d,%r8d
  mov    %ebx,%ecx
  mov    %r13,%rdi
  mov    %edx,0x8(%rsp)
  add    %r15d,%ebp
  mov    %eax,0x4(%rsp)
  call   <ecc200placementblock@plt>
  lea    0x2(%rbx),%eax
  mov    0x8(%rsp),%edx
  lea    -0x2(%r14),%esi
  mov    0x4(%rsp),%r9d
  cmp    %eax,%r12d
  jg     L263
  nopl   0x0(%rax)
L285:
  mov    %r12d,%ebp
  add    $0x5,%ebx
  mov    %edx,%r12d
  sub    $0x1,%r14d
  cmp    %ebx,%ebp
  jg     L178
  cmp    %r14d,%edx
  jg     L178
  imul   %edx,%ebp
  movslq %ebp,%rax
  lea    -0x4(%r13,%rax,4),%rdx
  mov    (%rdx),%ecx
  test   %ecx,%ecx
  jne    L97
  sub    %r12d,%ebp
  movslq %ebp,%rax
  movl   $0x1,-0x8(%r13,%rax,4)
  movl   $0x1,(%rdx)
L97:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L228:
  lea    -0x2(%rbp),%eax
  cmp    %ebx,%eax
  je     L186
L69:
  lea    0x4(%rbp),%eax
  cmp    %ebx,%eax
  jne    L9
  cmp    $0x2,%r14d
  jne    L9
  mov    0x18(%rsp),%r8d
  test   %r8d,%r8d
  jne    L9
  lea    0x1(%r9),%eax
  mov    %r9d,%ecx
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    %r13,%rdi
  mov    %eax,0x4(%rsp)
  call   <ecc200placementcornerD@plt>
  mov    0x4(%rsp),%r9d
  jmp    L9
  nopl   0x0(%rax)
L186:
  test   %r14d,%r14d
  jne    L69
  mov    0x1c(%rsp),%eax
  test   %eax,%eax
  jne    L230
  cmpl   $0x4,0x14(%rsp)
  jne    L9
L89:
  lea    0x1(%r9),%eax
  mov    %r9d,%ecx
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    %r13,%rdi
  mov    %eax,0x4(%rsp)
  call   <ecc200placementcornerC@plt>
  mov    0x4(%rsp),%r9d
  jmp    L9
L230:
  lea    0x1(%r9),%eax
  mov    %r9d,%ecx
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    %r13,%rdi
  mov    %eax,0x4(%rsp)
  call   <ecc200placementcornerB@plt>
  cmpl   $0x4,0x14(%rsp)
  mov    0x4(%rsp),%r9d
  jne    L9
  jmp    L89
```

assistant: ```c
void ecc200placement(int *array, int NR, int NC) {
  int r, c, p;
  for (r = 0; r < NR; r++)
    for (c = 0; c < NC; c++)
      array[r * NC + c] = 0;
  p = 1;
  r = 4;
  c = 0;
  do {
    if (r == NR && !c)
      ecc200placementcornerA(array, NR, NC, p++);
    if (r == NR - 2 && !c && NC % 4)
      ecc200placementcornerB(array, NR, NC, p++);
    if (r == NR - 2 && !c && (NC % 8) == 4)
      ecc200placementcornerC(array, NR, NC, p++);
    if (r == NR + 4 && c == 2 && !(NC % 8))
      ecc200placementcornerD(array, NR, NC, p++);
    do {
      if (r < NR && c >= 0 && !array[r * NC + c])
        ecc200placementblock(array, NR, NC, r, c, p++);
      r -= 2;
      c += 2;
    } while (r >= 0 && c < NC);
    r++;
    c += 3;
    do {
      if (r >= 0 && c < NC && !array[r * NC + c])
        ecc200placementblock(array, NR, NC, r, c, p++);
      r += 2;
      c -= 2;
    } while (r < NR && c >= 0);
    r += 3;
    c++;
  } while (r < NR || c < NC);
  if (!array[NR * NC - 1])
    array[NR * NC - 1] = array[NR * NC - NC - 2] = 1;
}
```