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

```asm
<fixpos>:
  endbr64
  push   %r15
  mov    %edi,%eax
  mov    %edx,%r15d
  mov    %ecx,%r9d
  push   %r14
  mov    %r8d,%r14d
  push   %r13
  mov    %edi,%r13d
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x18,%rsp
  neg    %r13d
  cmovs  %edi,%r13d
  neg    %r12d
  cmovs  %esi,%r12d
  imul   %esi,%eax
  test   %eax,%eax
  js     L305
  add    %esi,%ebx
  lea    -0x1(%r13),%eax
  xor    %ecx,%ecx
  test   %ebx,%ebx
  movslq %eax,%rbx
  setle  %cl
  imul   $0x66666667,%rbx,%rbx
  sar    $0x1f,%eax
  lea    0x72(%rcx,%rcx,4),%ecx
  sar    $0x21,%rbx
  sub    %eax,%ebx
  lea    -0x1(%r12),%eax
  movslq %eax,%rbp
  sar    $0x1f,%eax
  imul   $0x66666667,%rbp,%rbp
  sar    $0x21,%rbp
  sub    %eax,%ebp
  cmp    %ebp,%ebx
  je     L120
  cmp    $0x35,%r9d
  jg     L302
  add    %ebp,%ebx
  cmp    $0x1,%ebx
  je     L65
  cmp    $0x2,%ebp
  je     L232
  cmp    $0xa,%r12d
  je     L157
  lea    -0xa(%r12),%eax
  lea    -0x5(%r12),%edi
  mov    %r9d,%esi
  mov    $0x20,%ecx
  mov    %eax,%edx
  mov    %r9d,0x4(%rsp)
  neg    %edx
  cmovs  %eax,%edx
  imul   %r8d,%edi
  xor    %eax,%eax
  lea    (%rdi,%r15,1),%edi
  call   <fixcol@plt>
  mov    0x4(%rsp),%r9d
L157:
  sub    $0xa,%r13d
  lea    0x2(%r9),%esi
  mov    %r14d,%r8d
  mov    $0x20,%ecx
  mov    %r13d,%edx
  mov    %r15d,%edi
  neg    %edx
  cmovs  %r13d,%edx
  jmp    L265
  nopl   0x0(%rax,%rax,1)
L305:
  xor    %ecx,%ecx
  test   %esi,%esi
  mov    %r12d,%edx
  mov    %r15d,%edi
  setle  %cl
  lea    0x1(%r9),%esi
  xor    %eax,%eax
  lea    0x72(%rcx,%rcx,4),%ecx
  mov    %esi,0x4(%rsp)
  call   <fixcol@plt>
  cmp    %r12d,%r13d
  jle    L51
  add    %ebp,%ebx
  mov    %ebp,%edi
  mov    0x4(%rsp),%esi
  mov    %r14d,%r8d
  mov    %ebx,%edx
  mov    $0x20,%ecx
  neg    %edx
  cmovs  %ebx,%edx
  imul   %r14d,%edi
  add    %r15d,%edi
L265:
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1050 <fixcol@plt>
  nopl   0x0(%rax)
L302:
  lea    0x0(%rbp,%rbp,4),%r10d
  cmp    %ebp,%ebx
  jge    L0
  mov    %r10d,%eax
  mov    $0xcccccccd,%edi
  lea    (%r9,%rbx,1),%esi
  mov    %ecx,0x8(%rsp)
  sub    %r13d,%eax
  mov    %r10d,0x4(%rsp)
  mov    %eax,%edx
  mov    %r9d,0xc(%rsp)
  neg    %edx
  cmovs  %eax,%edx
  mov    %r13d,%eax
  imul   %rdi,%rax
  shr    $0x22,%rax
  lea    (%rax,%rax,4),%eax
  sub    %eax,%r13d
  xor    %eax,%eax
  imul   %r8d,%r13d
  lea    0x0(%r13,%r15,1),%edi
  call   <fixcol@plt>
  mov    0x4(%rsp),%r10d
  cmp    %r12d,%r10d
  jne    L47
L51:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L120:
  cmp    $0x2,%ebx
  je     L318
  cmp    $0x1,%ebx
  jne    L84
  cmp    $0x35,%r9d
  jle    L142
L71:
  add    $0x1,%r9d
L142:
  mov    %r13d,%eax
  sub    %r12d,%eax
  mov    %eax,%edx
  neg    %edx
  cmovs  %eax,%edx
  cmp    %r12d,%r13d
  jle    L62
  lea    0x0(%rbp,%rbp,4),%eax
  mov    %r14d,%r8d
  mov    $0x20,%ecx
  sub    %eax,%r12d
  mov    %r9d,%esi
  imul   %r14d,%r12d
  lea    (%r12,%r15,1),%edi
  jmp    L265
  nopl   0x0(%rax)
L232:
  cmp    $0xa,%r13d
  jne    L155
L311:
  sub    $0xa,%r12d
  lea    0x2(%r9),%esi
  mov    %r14d,%r8d
  mov    %r15d,%edi
  mov    %r12d,%edx
  neg    %edx
  cmovs  %r12d,%edx
  jmp    L265
  xchg   %ax,%ax
L65:
  test   %ebp,%ebp
  je     L91
  sub    $0x5,%r12d
  mov    %r9d,%esi
  mov    %r15d,%edi
  mov    %ecx,0x8(%rsp)
  mov    %r12d,%edx
  mov    %r9d,0x4(%rsp)
  neg    %edx
  cmovs  %r12d,%edx
  xor    %eax,%eax
  call   <fixcol@plt>
  cmp    $0x5,%r13d
  je     L51
  lea    -0x5(%r13),%eax
  mov    0x4(%rsp),%r9d
  mov    0x8(%rsp),%ecx
  mov    %r14d,%r8d
  mov    %eax,%edx
  neg    %edx
  lea    0x1(%r9),%esi
  cmovs  %eax,%edx
  imul   %r14d,%r13d
  lea    0x0(%r13,%r15,1),%edi
  jmp    L265
  xchg   %ax,%ax
L0:
  sub    %r12d,%r10d
  mov    %r12d,%eax
  mov    $0xcccccccd,%ecx
  mov    %r9d,0x4(%rsp)
  mov    %r10d,%edx
  lea    (%r9,%rbp,1),%esi
  neg    %edx
  cmovs  %r10d,%edx
  imul   %rcx,%rax
  mov    $0x20,%ecx
  shr    $0x22,%rax
  lea    (%rax,%rax,4),%eax
  sub    %eax,%r12d
  xor    %eax,%eax
  imul   %r8d,%r12d
  lea    (%r12,%r15,1),%edi
  call   <fixcol@plt>
  lea    (%rbx,%rbx,4),%eax
  cmp    %r13d,%eax
  je     L51
  sub    %r13d,%eax
  mov    0x4(%rsp),%r9d
  mov    %r14d,%r8d
  mov    $0x20,%ecx
  mov    %eax,%edx
  mov    %r15d,%edi
  neg    %edx
  lea    (%r9,%rbx,1),%esi
  cmovs  %eax,%edx
  jmp    L265
  xchg   %ax,%ax
L91:
  sub    $0x5,%r13d
  mov    $0x20,%ecx
  mov    %r9d,%esi
  mov    %r15d,%edi
  mov    %r13d,%edx
  mov    %r9d,0x4(%rsp)
  neg    %edx
  cmovs  %r13d,%edx
  xor    %eax,%eax
  call   <fixcol@plt>
  cmp    $0x5,%r12d
  je     L51
  lea    -0x5(%r12),%eax
  mov    0x4(%rsp),%r9d
  mov    %r14d,%r8d
  mov    $0x20,%ecx
  mov    %eax,%edx
  neg    %edx
  lea    0x1(%r9),%esi
  cmovs  %eax,%edx
  imul   %r14d,%r12d
  lea    (%r12,%r15,1),%edi
  jmp    L265
  nopl   0x0(%rax,%rax,1)
L84:
  test   %ebx,%ebx
  jne    L212
  cmp    $0x35,%r9d
  jle    L71
  jmp    L142
  nopw   0x0(%rax,%rax,1)
L47:
  sub    %r12d,%r10d
  mov    0xc(%rsp),%r9d
  mov    0x8(%rsp),%ecx
  mov    %r14d,%r8d
  mov    %r10d,%edx
  mov    %r15d,%edi
  neg    %edx
  lea    (%r9,%rbp,1),%esi
  cmovs  %r10d,%edx
  jmp    L265
  nopl   0x0(%rax)
L155:
  lea    -0xa(%r13),%eax
  lea    -0x5(%r13),%edi
  mov    %r9d,%esi
  mov    %ecx,0x8(%rsp)
  mov    %eax,%edx
  mov    %r9d,0x4(%rsp)
  neg    %edx
  cmovs  %eax,%edx
  imul   %r8d,%edi
  xor    %eax,%eax
  lea    (%rdi,%r15,1),%edi
  call   <fixcol@plt>
  mov    0x8(%rsp),%ecx
  mov    0x4(%rsp),%r9d
  jmp    L311
L62:
  lea    (%rbx,%rbx,4),%eax
  mov    %r14d,%r8d
  mov    %r9d,%esi
  sub    %eax,%r13d
  imul   %r14d,%r13d
  lea    0x0(%r13,%r15,1),%edi
  jmp    L265
  nopw   0x0(%rax,%rax,1)
L318:
  add    $0x2,%r9d
  jmp    L142
L212:
  xor    %r9d,%r9d
  jmp    L142
```

assistant: ```c
void fixpos(old, new, r, c, inc) int old, new, r, c, inc;
{
  int o, n, nv;
  int ov, nc;
  char col;
  nc = 0;
  if (old * new >= 0) {
    ov = abs(old);
    nv = abs(new);
    col = (old + new > 0 ? 'r' : 'w');
    o = (ov - 1) / 5;
    n = (nv - 1) / 5;
    if (o == n) {
      if (o == 2)
        nc = c + 2;
      if (o == 1)
        nc = c < 54 ? c : c + 1;
      if (o == 0)
        nc = c < 54 ? c + 1 : c;
      if (ov > nv)
        fixcol(r + inc * (nv - n * 5), nc, abs(ov - nv), ' ', inc);
      else
        fixcol(r + inc * (ov - o * 5), nc, abs(ov - nv), col, inc);
      return;
    } else {
      if (c < 54) {
        if (o + n == 1) {
          if (n) {
            fixcol(r, c, abs(nv - 5), col, inc);
            if (ov != 5)
              fixcol(r + inc * ov, c + 1, abs(ov - 5), col, inc);
          } else {
            fixcol(r, c, abs(ov - 5), ' ', inc);
            if (nv != 5)
              fixcol(r + inc * nv, c + 1, abs(nv - 5), ' ', inc);
          }
          return;
        }
        if (n == 2) {
          if (ov != 10)
            fixcol(r + inc * (ov - 5), c, abs(ov - 10), col, inc);
          fixcol(r, c + 2, abs(nv - 10), col, inc);
        } else {
          if (nv != 10)
            fixcol(r + inc * (nv - 5), c, abs(nv - 10), ' ', inc);
          fixcol(r, c + 2, abs(ov - 10), ' ', inc);
        }
        return;
      }
      if (n > o) {
        fixcol(r + inc * (ov % 5), c + o, abs(5 * n - ov), col, inc);
        if (nv != 5 * n)
          fixcol(r, c + n, abs(5 * n - nv), col, inc);
      } else {
        fixcol(r + inc * (nv % 5), c + n, abs(5 * n - nv), ' ', inc);
        if (ov != 5 * o)
          fixcol(r, c + o, abs(5 * o - ov), ' ', inc);
      }
      return;
    }
  }
  nv = abs(new);
  fixcol(r, c + 1, nv, new > 0 ? 'r' : 'w', inc);
  if (abs(old) <= abs(new))
    return;
  fixcol(r + inc * new, c + 1, abs(old + new), ' ', inc);
}
```