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

```asm
<maxflow_setup_backedges>:
  endbr64
  test   %edi,%edi
  jle    L125
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%r9d
  mov    %rsi,%rax
  mov    %rdx,%rcx
  mov    %edi,%esi
  mov    $0x0,%edx
L228:
  mov    %edx,(%rcx,%rdx,4)
  add    $0x1,%rdx
  cmp    %rsi,%rdx
  jne    L228
  mov    $0x0,%r11d
  jmp    L195
L134:
  mov    %r12d,0x0(%rbp)
  mov    %ebx,(%r10)
  cmp    $0x2,%r8d
  jle    L105
L302:
  mov    %esi,%r8d
  sub    $0x1,%esi
  mov    %esi,%edx
  shr    $0x1f,%edx
  add    %esi,%edx
  sar    %edx
  mov    %edx,%esi
  movslq %edx,%rdx
  lea    (%rcx,%rdx,4),%rbp
  mov    0x0(%rbp),%ebx
  lea    (%rbx,%rbx,1),%edi
  movslq %edi,%rdi
  mov    0x4(%rax,%rdi,4),%r14d
  movslq %r8d,%rdx
  lea    (%rcx,%rdx,4),%r10
  mov    (%r10),%r12d
  lea    (%r12,%r12,1),%edx
  movslq %edx,%rdx
  mov    0x4(%rax,%rdx,4),%r13d
  cmp    %r13d,%r14d
  jl     L134
  jne    L105
  mov    (%rax,%rdx,4),%edx
  cmp    %edx,(%rax,%rdi,4)
  jl     L134
L105:
  add    $0x1,%r11d
  cmp    %r11d,%r9d
  je     L273
L195:
  mov    %r11d,%esi
  test   %r11d,%r11d
  jg     L302
  jmp    L105
L273:
  sub    $0x1,%r9d
  movslq %r9d,%rbx
  mov    %rbx,-0x8(%rsp)
  jmp    L93
L234:
  mov    $0x1,%r9d
  mov    $0x0,%esi
L274:
  movslq %esi,%rsi
  lea    (%rcx,%rsi,4),%r10
  mov    (%r10),%r8d
  lea    (%r8,%r8,1),%esi
  movslq %esi,%rsi
  mov    0x4(%rax,%rsi,4),%ebx
  movslq %r9d,%r9
  lea    (%rcx,%r9,4),%rdi
  mov    (%rdi),%r9d
  lea    (%r9,%r9,1),%edx
  movslq %edx,%rdx
  mov    0x4(%rax,%rdx,4),%r11d
  cmp    %r11d,%ebx
  jl     L1
  jne    L232
  mov    (%rax,%rdx,4),%ebx
  cmp    %ebx,(%rax,%rsi,4)
  jge    L232
L1:
  mov    %r9d,(%r10)
  mov    %r8d,(%rdi)
L232:
  subq   $0x1,-0x8(%rsp)
L93:
  mov    (%rcx),%edx
  mov    -0x8(%rsp),%rbx
  mov    (%rcx,%rbx,4),%esi
  mov    %esi,(%rcx)
  mov    %edx,(%rcx,%rbx,4)
  mov    %ebx,%r14d
  cmp    $0x1,%ebx
  jle    L187
  cmp    $0x2,%ebx
  jle    L234
  mov    $0x2,%edx
  mov    $0x1,%r9d
  mov    $0x0,%esi
  jmp    L79
L171:
  mov    (%rax,%rdi,4),%r15d
  cmp    %r15d,(%rax,%rsi,4)
  jl     L34
  jmp    L59
L249:
  mov    (%rax,%rsi,4),%esi
  cmp    %esi,(%rax,%rdi,4)
  jge    L70
L284:
  mov    %r13d,(%rbx)
  mov    %r11d,(%r10)
  mov    %edx,%esi
L145:
  lea    (%rsi,%rsi,1),%edx
  lea    0x1(%rdx),%r9d
  add    $0x2,%edx
  cmp    %r14d,%r9d
  jge    L232
  cmp    %r14d,%edx
  jge    L274
L79:
  movslq %esi,%rsi
  lea    (%rcx,%rsi,4),%rbx
  mov    (%rbx),%r11d
  lea    (%r11,%r11,1),%esi
  movslq %esi,%rsi
  mov    0x4(%rax,%rsi,4),%r10d
  movslq %r9d,%rdi
  lea    (%rcx,%rdi,4),%rbp
  mov    0x0(%rbp),%r12d
  lea    (%r12,%r12,1),%edi
  movslq %edi,%rdi
  mov    0x4(%rax,%rdi,4),%r8d
  cmp    %r8d,%r10d
  jl     L34
  je     L171
L59:
  movslq %edx,%r13
  mov    (%rcx,%r13,4),%r13d
  add    %r13d,%r13d
  movslq %r13d,%r13
  mov    0x4(%rax,%r13,4),%r15d
  cmp    %r15d,%r10d
  jl     L34
  jne    L232
  mov    (%rax,%r13,4),%r15d
  cmp    %r15d,(%rax,%rsi,4)
  jge    L232
L34:
  movslq %edx,%rsi
  lea    (%rcx,%rsi,4),%r10
  mov    (%r10),%r13d
  lea    0x0(%r13,%r13,1),%esi
  movslq %esi,%rsi
  mov    0x4(%rax,%rsi,4),%r15d
  cmp    %r15d,%r8d
  jl     L284
  je     L249
L70:
  mov    %r12d,(%rbx)
  mov    %r11d,0x0(%rbp)
  mov    %r9d,%esi
  jmp    L145
L187:
  cmpl   $0x1,-0x8(%rsp)
  je     L232
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L125:
  ret
```

assistant: ```c
void maxflow_setup_backedges(int ne, const int *edges, int *backedges) {
  int i, n;
  for (i = 0; i < ne; i++)
    backedges[i] = i;
  n = 0;
  while (n < ne) {
    n++;
    i = n - 1;
    while (i > 0) {
      int p = (((i)-1) / 2);
      if (((edges[2 * (backedges[p]) + 1] < edges[2 * (backedges[i]) + 1]) || (edges[2 * (backedges[p]) + 1] == edges[2 * (backedges[i]) + 1] && edges[2 * (backedges[p])] < edges[2 * (backedges[i])]))) {
        do {
          int swaptmp = (backedges[p]);
          (backedges[p]) = (backedges[i]);
          (backedges[i]) = swaptmp;
        } while (0);
        i = p;
      } else
        break;
    }
  }
  while (n > 0) {
    n--;
    do {
      int swaptmp = (backedges[0]);
      (backedges[0]) = (backedges[n]);
      (backedges[n]) = swaptmp;
    } while (0);
    i = 0;
    while (1) {
      int lc, rc;
      lc = (2 * (i) + 1);
      rc = (2 * (i) + 2);
      if (lc >= n)
        break;
      if (rc >= n) {
        if (((edges[2 * (backedges[i]) + 1] < edges[2 * (backedges[lc]) + 1]) || (edges[2 * (backedges[i]) + 1] == edges[2 * (backedges[lc]) + 1] && edges[2 * (backedges[i])] < edges[2 * (backedges[lc])])))
          do {
            int swaptmp = (backedges[i]);
            (backedges[i]) = (backedges[lc]);
            (backedges[lc]) = swaptmp;
          } while (0);
        break;
      } else {
        if (((edges[2 * (backedges[i]) + 1] < edges[2 * (backedges[lc]) + 1]) || (edges[2 * (backedges[i]) + 1] == edges[2 * (backedges[lc]) + 1] && edges[2 * (backedges[i])] < edges[2 * (backedges[lc])])) || ((edges[2 * (backedges[i]) + 1] < edges[2 * (backedges[rc]) + 1]) || (edges[2 * (backedges[i]) + 1] == edges[2 * (backedges[rc]) + 1] && edges[2 * (backedges[i])] < edges[2 * (backedges[rc])]))) {
          if (((edges[2 * (backedges[lc]) + 1] < edges[2 * (backedges[rc]) + 1]) || (edges[2 * (backedges[lc]) + 1] == edges[2 * (backedges[rc]) + 1] && edges[2 * (backedges[lc])] < edges[2 * (backedges[rc])]))) {
            do {
              int swaptmp = (backedges[i]);
              (backedges[i]) = (backedges[rc]);
              (backedges[rc]) = swaptmp;
            } while (0);
            i = rc;
          } else {
            do {
              int swaptmp = (backedges[i]);
              (backedges[i]) = (backedges[lc]);
              (backedges[lc]) = swaptmp;
            } while (0);
            i = lc;
          }
        } else {
          break;
        }
      }
    }
  }
}
```