user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<stable_sqrt_sort_build_blocks>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%rcx
  mov    %esi,0x14(%rsp)
  mov    %edx,0x18(%rsp)
  cmp    $0x1,%esi
  jle    L89
  mov    %esi,%edi
  mov    $0x1,%eax
L147:
  mov    -0x8(%rcx,%rax,8),%rsi
  mov    (%rcx,%rax,8),%rdx
  mov    (%rdx),%ebx
  cmp    %ebx,(%rsi)
  setg   %sil
  movzbl %sil,%esi
  lea    -0x1(%rsi,%rax,1),%edx
  movslq %edx,%rdx
  mov    (%rcx,%rdx,8),%rdx
  mov    %rdx,-0x18(%rcx,%rax,8)
  mov    %eax,%edx
  sub    %esi,%edx
  movslq %edx,%rdx
  mov    (%rcx,%rdx,8),%rdx
  mov    %rdx,-0x10(%rcx,%rax,8)
  add    $0x2,%rax
  cmp    %eax,%edi
  jg     L147
L89:
  mov    0x14(%rsp),%eax
  test   $0x1,%al
  je     L73
  cltq
  shl    $0x3,%rax
  mov    -0x8(%rcx,%rax,1),%rdx
  mov    %rdx,-0x18(%rcx,%rax,1)
L73:
  lea    -0x10(%rcx),%rax
  mov    %rax,0x8(%rsp)
  cmpl   $0x2,0x18(%rsp)
  jle    L2
  mov    $0x2,%r13d
  mov    0x14(%rsp),%eax
  sub    $0x1,%eax
  mov    %eax,0x1c(%rsp)
  jmp    L82
L67:
  mov    $0x0,%ebx
  jmp    L63
L106:
  cmp    %ebx,%eax
  jle    L129
  movslq %ebx,%rcx
  mov    0x8(%rsp),%rdi
  lea    (%rdi,%rcx,8),%rax
  mov    0x1c(%rsp),%edx
  sub    %ebx,%edx
  add    %rcx,%rdx
  lea    0x8(%rdi,%rdx,8),%rsi
  movslq %ebp,%rcx
  neg    %rcx
  shl    $0x3,%rcx
L80:
  mov    (%rax),%rdx
  mov    %rdx,(%rax,%rcx,1)
  add    $0x8,%rax
  cmp    %rsi,%rax
  jne    L80
L129:
  movslq %ebp,%rbp
  shl    $0x3,%rbp
  sub    %rbp,0x8(%rsp)
  cmp    0x18(%rsp),%r13d
  jge    L2
L82:
  mov    %r13d,%ebp
  add    %r13d,%r13d
  mov    0x14(%rsp),%r14d
  sub    %r13d,%r14d
  js     L67
  movslq %r13d,%rax
  shl    $0x3,%rax
  mov    %rax,(%rsp)
  mov    0x8(%rsp),%r12
  mov    $0x0,%ebx
  mov    %ebp,%r15d
  neg    %r15d
L56:
  mov    %r15d,%ecx
  mov    %ebp,%edx
  mov    %ebp,%esi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <stable_sqrt_sort_merge_left_with_x_buf@plt>
  add    %r13d,%ebx
  add    (%rsp),%r12
  cmp    %ebx,%r14d
  jge    L56
L63:
  mov    0x14(%rsp),%eax
  mov    %eax,%edx
  sub    %ebx,%edx
  cmp    %ebp,%edx
  jle    L106
  mov    %ebp,%ecx
  neg    %ecx
  sub    %ebp,%edx
  movslq %ebx,%rbx
  mov    0x8(%rsp),%rax
  lea    (%rax,%rbx,8),%rdi
  mov    %ebp,%esi
  mov    $0x0,%eax
  call   <stable_sqrt_sort_merge_left_with_x_buf@plt>
  jmp    L129
L2:
  mov    0x18(%rsp),%edi
  lea    (%rdi,%rdi,1),%r12d
  mov    0x14(%rsp),%eax
  cltd
  idiv   %r12d
  mov    0x14(%rsp),%ebx
  sub    %edx,%ebx
  cmp    %edx,%edi
  jl     L46
  movslq %ebx,%rax
  movslq %edi,%rcx
  add    %rax,%rcx
  mov    0x8(%rsp),%rsi
  lea    (%rsi,%rcx,8),%rdi
  movslq %edx,%rdx
  shl    $0x3,%rdx
  lea    (%rsi,%rax,8),%rsi
  call   <memcpy@plt>
L17:
  test   %ebx,%ebx
  jle    L19
  mov    %r12d,%r13d
  neg    %r13d
  movslq %r13d,%r13
  shl    $0x3,%r13
  movslq %ebx,%rax
  movslq %r12d,%rdx
  sub    %rdx,%rax
  mov    0x8(%rsp),%rdi
  lea    (%rdi,%rax,8),%rbp
  mov    0x18(%rsp),%r14d
L95:
  sub    %r12d,%ebx
  mov    %r14d,%ecx
  mov    %r14d,%edx
  mov    %r14d,%esi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <stable_sqrt_sort_merge_right@plt>
  add    %r13,%rbp
  test   %ebx,%ebx
  jg     L95
L19:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L46:
  mov    0x18(%rsp),%esi
  sub    %esi,%edx
  movslq %ebx,%rax
  mov    0x8(%rsp),%rdi
  lea    (%rdi,%rax,8),%rdi
  mov    %esi,%ecx
  mov    $0x0,%eax
  call   <stable_sqrt_sort_merge_right@plt>
  jmp    L17
```

assistant: ```c
void stable_sqrt_sort_build_blocks(int **arr, int L, int K) {
  int m, u, h, p0, p1, rest, restk, p;
  for (m = 1; m < L; m += 2) {
    u = 0;
    if ((*(*(arr + (m - 1))) - *(*(arr + m))) > 0) {
      u = 1;
    }
    arr[m - 3] = arr[m - 1 + u];
    arr[m - 2] = arr[m - u];
  }
  if (L % 2) {
    arr[L - 3] = arr[L - 1];
  }
  arr -= 2;
  for (h = 2; h < K; h *= 2) {
    p0 = 0;
    p1 = L - 2 * h;
    while (p0 <= p1) {
      stable_sqrt_sort_merge_left_with_x_buf(arr + p0, h, h, -h);
      p0 += 2 * h;
    }
    rest = L - p0;
    if (rest > h) {
      stable_sqrt_sort_merge_left_with_x_buf(arr + p0, h, rest - h, -h);
    } else {
      for (; p0 < L; p0++) {
        arr[p0 - h] = arr[p0];
      }
    }
    arr -= h;
  }
  restk = L % (2 * K);
  p = L - restk;
  if (restk <= K) {
    memcpy((arr + p + K), (arr + p), (restk) * sizeof(int *));
  } else {
    stable_sqrt_sort_merge_right(arr + p, K, restk - K, K);
  }
  while (p > 0) {
    p -= 2 * K;
    stable_sqrt_sort_merge_right(arr + p, K, K, K);
  }
}
```