user: 请从给定的汇编指令推导出C源代码:

```asm
<jerasure_smart_bitmatrix_to_schedule>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %edi,%r12d
  mov    %edi,0x24(%rsp)
  mov    %esi,%ebp
  mov    %edx,%r14d
  mov    %rcx,0x30(%rsp)
  mov    %edi,%eax
  imul   %esi,%eax
  imul   %edx,%eax
  imul   %edx,%eax
  lea    0x8(,%rax,8),%edi
  call   <malloc@plt>
  mov    %rax,0x18(%rsp)
  imul   %r14d,%ebp
  movslq %ebp,%rbx
  mov    %rbx,0x8(%rsp)
  lea    0x0(,%rbp,4),%ebx
  mov    %ebx,%edi
  call   <malloc@plt>
  mov    %rax,0x48(%rsp)
  mov    %ebx,%edi
  call   <malloc@plt>
  mov    %rax,0x10(%rsp)
  mov    %ebx,%edi
  call   <malloc@plt>
  mov    %rax,%r15
  mov    %ebx,%edi
  call   <malloc@plt>
  mov    %rax,0x38(%rsp)
  imul   %r14d,%r12d
  mov    %r12d,%r13d
  lea    0x1(%r12),%r12d
  mov    %r12d,0x58(%rsp)
  test   %ebp,%ebp
  jle    L189
  mov    %rax,%rdx
  lea    -0x1(%r13),%eax
  lea    0x4(,%rax,4),%r8
  mov    0x48(%rsp),%rsi
  mov    %rsi,%rcx
  mov    0x30(%rsp),%rax
  mov    $0x0,%edi
  mov    $0x0,%ebx
  mov    0x10(%rsp),%r11
  sub    %rsi,%r11
  mov    %r15,%r10
  sub    %rsi,%r10
  sub    %rsi,%rdx
  mov    %rdx,%r9
  mov    %r14d,0x28(%rsp)
  mov    %r8,%r14
  jmp    L251
L136:
  add    $0x4,%rcx
  cmp    %esi,%ebp
  je     L86
  mov    %esi,%edi
L251:
  lea    (%rax,%r14,1),%rsi
  mov    %ebx,%edx
  test   %r13d,%r13d
  jle    L244
L190:
  add    (%rax),%edx
  add    $0x4,%rax
  cmp    %rsi,%rax
  jne    L190
  mov    %rsi,%rax
L244:
  mov    %edx,(%rcx)
  movl   $0xffffffff,(%r11,%rcx,1)
  lea    0x1(%rdi),%esi
  mov    %esi,(%r10,%rcx,1)
  lea    -0x1(%rdi),%r8d
  mov    %r8d,(%r9,%rcx,1)
  cmp    %r12d,%edx
  jge    L136
  mov    %edx,%r12d
  mov    %edi,0x20(%rsp)
  jmp    L136
L86:
  mov    0x28(%rsp),%r14d
L189:
  mov    0x8(%rsp),%rax
  movl   $0xffffffff,-0x4(%r15,%rax,4)
  movl   $0x0,0x44(%rsp)
  mov    $0x0,%r12d
  jmp    L230
L31:
  mov    (%r15,%rdx,4),%eax
  mov    %eax,0x44(%rsp)
  cmp    $0xffffffff,%eax
  je     L288
  cltq
  mov    0x38(%rsp),%rbx
  movl   $0xffffffff,(%rbx,%rax,4)
  jmp    L288
L234:
  mov    $0x14,%edi
  call   <malloc@plt>
  movslq %r12d,%rdx
  mov    0x18(%rsp),%rsi
  lea    (%rsi,%rdx,8),%rcx
  mov    %rax,(%rcx)
  mov    0x8(%rsp),%esi
  mov    %esi,0x10(%rax)
  mov    (%rcx),%rsi
  mov    %ebp,%eax
  cltd
  idiv   %r14d
  mov    %eax,(%rsi)
  mov    (%rcx),%rax
  mov    %edx,0x4(%rax)
  mov    (%rcx),%rsi
  mov    0x20(%rsp),%eax
  cltd
  idiv   %r14d
  add    0x24(%rsp),%eax
  mov    %eax,0x8(%rsi)
  mov    (%rcx),%rax
  mov    %edx,0xc(%rax)
  add    $0x1,%r12d
  movl   $0x1,0x8(%rsp)
L248:
  add    $0x1,%rbp
  cmp    %r15,%rbp
  je     L185
L267:
  cmpl   $0x0,(%rbx,%rbp,4)
  je     L248
  jmp    L234
L185:
  mov    0x28(%rsp),%r15
  mov    0x40(%rsp),%r13d
L242:
  mov    0x44(%rsp),%r8d
  cmp    $0xffffffff,%r8d
  je     L321
  mov    0x58(%rsp),%r9d
  mov    0x20(%rsp),%eax
  mov    %r13d,%edi
  mov    0x48(%rsp),%r11
  mov    %r12d,0x8(%rsp)
  mov    %eax,%r12d
  mov    0x24(%rsp),%r10d
  mov    0x30(%rsp),%rbp
  jmp    L149
L25:
  mov    $0x14,%edi
  call   <malloc@plt>
  movslq %r12d,%rdx
  mov    0x18(%rsp),%rsi
  lea    (%rsi,%rdx,8),%rcx
  mov    %rax,(%rcx)
  movl   $0x0,0x10(%rax)
  mov    (%rcx),%rsi
  mov    0x0(%rbp),%eax
  cltd
  idiv   %r14d
  mov    0x24(%rsp),%edi
  add    %edi,%eax
  mov    %eax,(%rsi)
  mov    (%rcx),%rsi
  mov    0x0(%rbp),%eax
  cltd
  idiv   %r14d
  mov    %edx,0x4(%rsi)
  mov    (%rcx),%rsi
  mov    0x20(%rsp),%eax
  cltd
  idiv   %r14d
  mov    %edx,0x40(%rsp)
  add    %edi,%eax
  mov    %eax,0x28(%rsp)
  mov    %eax,0x8(%rsi)
  mov    (%rcx),%rax
  mov    %edx,0xc(%rax)
  add    $0x1,%r12d
  imul   0x0(%rbp),%edi
  mov    %edi,%eax
  imul   %r14d,%eax
  cltq
  test   %r13d,%r13d
  jle    L242
  mov    %r13d,%esi
  mov    0x30(%rsp),%rdi
  lea    (%rdi,%rax,4),%rax
  mov    $0x0,%ebp
  mov    %r15,0x50(%rsp)
  mov    %r13d,0x5c(%rsp)
  mov    %rsi,%r13
  mov    %rax,%r15
  jmp    L254
L24:
  add    $0x1,%rbp
  cmp    %r13,%rbp
  je     L49
L254:
  mov    %ebp,0x8(%rsp)
  mov    (%r15,%rbp,4),%edi
  cmp    %edi,(%rbx,%rbp,4)
  je     L24
  mov    $0x14,%edi
  call   <malloc@plt>
  movslq %r12d,%rdx
  mov    0x18(%rsp),%rdi
  lea    (%rdi,%rdx,8),%rcx
  mov    %rax,(%rcx)
  movl   $0x1,0x10(%rax)
  mov    (%rcx),%rsi
  mov    0x8(%rsp),%eax
  cltd
  idiv   %r14d
  mov    %eax,(%rsi)
  mov    (%rcx),%rax
  mov    %edx,0x4(%rax)
  mov    (%rcx),%rax
  mov    0x28(%rsp),%edi
  mov    %edi,0x8(%rax)
  mov    (%rcx),%rax
  mov    0x40(%rsp),%edi
  mov    %edi,0xc(%rax)
  add    $0x1,%r12d
  jmp    L24
L49:
  mov    0x50(%rsp),%r15
  mov    0x5c(%rsp),%r13d
  jmp    L242
L106:
  mov    $0x1,%ecx
  jmp    L165
L325:
  mov    (%r15,%rax,4),%r8d
  cmp    $0xffffffff,%r8d
  je     L61
L149:
  mov    %r10d,%eax
  imul   %r8d,%eax
  imul   %r14d,%eax
  cltq
  test   %r13d,%r13d
  jle    L106
  lea    0x0(%rbp,%rax,4),%rsi
  mov    $0x0,%eax
  mov    $0x1,%ecx
L105:
  mov    (%rbx,%rax,4),%edx
  xor    (%rsi,%rax,4),%edx
  add    %edx,%ecx
  add    $0x1,%rax
  cmp    %rdi,%rax
  jne    L105
L165:
  movslq %r8d,%rax
  lea    (%r11,%rax,4),%rdx
  cmp    %ecx,(%rdx)
  jle    L300
  mov    0x10(%rsp),%rsi
  mov    %r12d,(%rsi,%rax,4)
  mov    %ecx,(%rdx)
L300:
  mov    (%rdx),%edx
  cmp    %r9d,%edx
  jge    L325
  mov    %edx,%r9d
  mov    %r8d,0x20(%rsp)
  jmp    L325
L61:
  mov    0x8(%rsp),%r12d
L230:
  movslq 0x20(%rsp),%rdx
  lea    0x0(,%rdx,4),%rbp
  mov    0x38(%rsp),%rax
  lea    (%rax,%rbp,1),%rcx
  mov    (%rcx),%eax
  cmp    $0xffffffff,%eax
  je     L31
  mov    (%r15,%rdx,4),%edx
  cltq
  mov    %edx,(%r15,%rax,4)
  cmp    $0xffffffff,%edx
  je     L288
  mov    (%rcx),%eax
  movslq %edx,%rdx
  mov    0x38(%rsp),%rbx
  mov    %eax,(%rbx,%rdx,4)
L288:
  mov    0x24(%rsp),%eax
  imul   0x20(%rsp),%eax
  imul   %r14d,%eax
  cltq
  mov    0x30(%rsp),%rbx
  lea    (%rbx,%rax,4),%rbx
  add    0x10(%rsp),%rbp
  cmpl   $0xffffffff,0x0(%rbp)
  jne    L25
  test   %r13d,%r13d
  jle    L242
  mov    %r13d,%eax
  mov    $0x0,%ebp
  movl   $0x0,0x8(%rsp)
  mov    %r15,0x28(%rsp)
  mov    %r13d,0x40(%rsp)
  mov    %rax,%r15
  jmp    L267
L321:
  mov    $0x14,%edi
  call   <malloc@plt>
  mov    %rax,%rdx
  movslq %r12d,%rax
  mov    0x18(%rsp),%rbx
  mov    %rdx,(%rbx,%rax,8)
  movl   $0xffffffff,(%rdx)
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  mov    0x48(%rsp),%rdi
  call   <free@plt>
  mov    0x38(%rsp),%rdi
  call   <free@plt>
  mov    %r15,%rdi
  call   <free@plt>
  mov    %rbx,%rax
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int **jerasure_smart_bitmatrix_to_schedule(int k, int m, int w, int *bitmatrix) {
  int **operations;
  int op;
  int i, j;
  int *diff, *from, *b1, *flink, *blink;
  int *ptr, no, row;
  int optodo;
  int bestrow, bestdiff, top;
  operations = (int **)malloc(sizeof(int *) * (k * m * w * w + 1));
  op = 0;
  diff = (int *)malloc(sizeof(int) * (m * w));
  from = (int *)malloc(sizeof(int) * (m * w));
  flink = (int *)malloc(sizeof(int) * (m * w));
  blink = (int *)malloc(sizeof(int) * (m * w));
  ptr = bitmatrix;
  bestdiff = k * w + 1;
  top = 0;
  for (i = 0; i < m * w; i++) {
    no = 0;
    for (j = 0; j < k * w; j++) {
      no += *ptr;
      ptr++;
    }
    diff[i] = no;
    from[i] = -1;
    flink[i] = i + 1;
    blink[i] = i - 1;
    if (no < bestdiff) {
      bestdiff = no;
      bestrow = i;
    }
  }
  flink[m * w - 1] = -1;
  while (top != -1) {
    row = bestrow;
    if (blink[row] == -1) {
      top = flink[row];
      if (top != -1)
        blink[top] = -1;
    } else {
      flink[blink[row]] = flink[row];
      if (flink[row] != -1) {
        blink[flink[row]] = blink[row];
      }
    }
    ptr = bitmatrix + row * k * w;
    if (from[row] == -1) {
      optodo = 0;
      for (j = 0; j < k * w; j++) {
        if (ptr[j]) {
          operations[op] = (int *)malloc(sizeof(int) * (5));
          operations[op][4] = optodo;
          operations[op][0] = j / w;
          operations[op][1] = j % w;
          operations[op][2] = k + row / w;
          operations[op][3] = row % w;
          optodo = 1;
          op++;
        }
      }
    } else {
      operations[op] = (int *)malloc(sizeof(int) * (5));
      operations[op][4] = 0;
      operations[op][0] = k + from[row] / w;
      operations[op][1] = from[row] % w;
      operations[op][2] = k + row / w;
      operations[op][3] = row % w;
      op++;
      b1 = bitmatrix + from[row] * k * w;
      for (j = 0; j < k * w; j++) {
        if (ptr[j] ^ b1[j]) {
          operations[op] = (int *)malloc(sizeof(int) * (5));
          operations[op][4] = 1;
          operations[op][0] = j / w;
          operations[op][1] = j % w;
          operations[op][2] = k + row / w;
          operations[op][3] = row % w;
          optodo = 1;
          op++;
        }
      }
    }
    bestdiff = k * w + 1;
    for (i = top; i != -1; i = flink[i]) {
      no = 1;
      b1 = bitmatrix + i * k * w;
      for (j = 0; j < k * w; j++)
        no += (ptr[j] ^ b1[j]);
      if (no < diff[i]) {
        from[i] = row;
        diff[i] = no;
      }
      if (diff[i] < bestdiff) {
        bestdiff = diff[i];
        bestrow = i;
      }
    }
  }
  operations[op] = (int *)malloc(sizeof(int) * (5));
  operations[op][0] = -1;
  free(from);
  free(diff);
  free(blink);
  free(flink);
  return operations;
}
```