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

```asm
<partition_sort>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1b8,%rsp
  mov    %rdx,%r15
  mov    %rcx,%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x1a8(%rsp)
  xor    %eax,%eax
  mov    %rdi,0xa0(%rsp)
  mov    %esi,0x20(%rsp)
  movl   $0x1,0x18(%rsp)
  mov    %edx,%eax
  mov    %edx,0x10(%rsp)
  sub    $0x1,%eax
  mov    %eax,0x1c(%rsp)
  mov    %rdx,%rax
  neg    %rax
  mov    %rax,(%rsp)
  jmp    L385
L179:
  lea    -0x1(%r15),%eax
  lea    0x1(%r14,%rax,1),%rdi
  mov    %rbx,%rdx
  mov    %r14,%rax
L19:
  movzbl (%rax),%ecx
  add    $0x1,%rax
  movzbl (%rdx),%esi
  mov    %sil,-0x1(%rax)
  add    $0x1,%rdx
  mov    %cl,-0x1(%rdx)
  cmp    %rdi,%rax
  jne    L19
  lea    -0x1(%r15),%eax
  add    $0x1,%rax
  lea    (%r14,%rax,1),%rsi
  add    %rbx,%rax
L40:
  mov    (%rsp),%rdx
  lea    (%rsi,%rdx,1),%r14
  lea    (%rax,%rdx,1),%rbx
L384:
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   *%r13
  test   %eax,%eax
  jle    L38
  mov    %rbp,%rsi
  mov    %r14,%rdi
  call   *%r13
  test   %eax,%eax
  jle    L267
  mov    %r15d,%eax
  or     %r14d,%eax
  test   $0x3,%al
  jne    L117
  lea    -0x4(%r15),%eax
  lea    0x4(%rax),%rsi
  lea    (%r14,%rsi,1),%rdi
  mov    %rbp,%rax
L406:
  mov    (%r14),%edx
  mov    (%rax),%ecx
  mov    %ecx,(%r14)
  mov    %edx,(%rax)
  add    $0x4,%r14
  add    $0x4,%rax
  cmp    %rdi,%r14
  jne    L406
  lea    0x0(%rbp,%rsi,1),%rax
  jmp    L206
L117:
  lea    -0x1(%r15),%eax
  lea    0x1(%r14,%rax,1),%rdi
  mov    %rbp,%rdx
  mov    %r14,%rax
L232:
  movzbl (%rax),%ecx
  add    $0x1,%rax
  movzbl (%rdx),%esi
  mov    %sil,-0x1(%rax)
  add    $0x1,%rdx
  mov    %cl,-0x1(%rdx)
  cmp    %rdi,%rax
  jne    L232
  lea    -0x1(%r15),%eax
  add    $0x1,%rax
  lea    (%r14,%rax,1),%rdi
  add    %rbp,%rax
L206:
  mov    (%rsp),%rdx
  lea    (%rdi,%rdx,1),%r14
  lea    (%rax,%rdx,1),%rbp
L267:
  mov    %r15d,%eax
  or     %ebx,%eax
  test   $0x3,%al
  jne    L228
  lea    -0x4(%r15),%eax
  lea    0x4(%rax),%rdi
  lea    (%rbx,%rdi,1),%rsi
  mov    %rbp,%rax
L330:
  mov    (%rbx),%edx
  mov    (%rax),%ecx
  mov    %ecx,(%rbx)
  mov    %edx,(%rax)
  add    $0x4,%rbx
  add    $0x4,%rax
  cmp    %rsi,%rbx
  jne    L330
  lea    0x0(%rbp,%rdi,1),%rax
  jmp    L284
L228:
  lea    -0x1(%r15),%eax
  lea    0x1(%rbx,%rax,1),%rdi
  mov    %rbp,%rdx
  mov    %rbx,%rax
L92:
  movzbl (%rax),%ecx
  add    $0x1,%rax
  movzbl (%rdx),%esi
  mov    %sil,-0x1(%rax)
  add    $0x1,%rdx
  mov    %cl,-0x1(%rdx)
  cmp    %rdi,%rax
  jne    L92
  lea    -0x1(%r15),%eax
  add    $0x1,%rax
  lea    (%rbx,%rax,1),%rsi
  add    %rbp,%rax
L284:
  mov    (%rsp),%rdi
  lea    (%rsi,%rdi,1),%rbx
  lea    (%rax,%rdi,1),%rbp
L38:
  add    (%rsp),%rbp
  mov    %r15d,%eax
  or     %ebx,%eax
  test   $0x3,%al
  jne    L101
  lea    -0x4(%r15),%edi
  add    $0x4,%rdi
  lea    (%rbx,%rdi,1),%rsi
  mov    %rbp,%rax
L370:
  mov    (%rbx),%edx
  mov    (%rax),%ecx
  mov    %ecx,(%rbx)
  mov    %edx,(%rax)
  add    $0x4,%rbx
  add    $0x4,%rax
  cmp    %rsi,%rbx
  jne    L370
  add    %rdi,%rbp
  jmp    L45
L101:
  lea    -0x1(%r15),%eax
  lea    0x1(%rbx,%rax,1),%rsi
  mov    %rbp,%rax
L6:
  movzbl (%rbx),%edx
  add    $0x1,%rbx
  movzbl (%rax),%ecx
  mov    %cl,-0x1(%rbx)
  add    $0x1,%rax
  mov    %dl,-0x1(%rax)
  cmp    %rsi,%rbx
  jne    L6
  lea    -0x1(%r15),%eax
  lea    0x1(%rbp,%rax,1),%rbp
L45:
  mov    (%rsp),%rax
  lea    0x0(%rbp,%rax,1),%r12
  mov    %r12,%rbp
  mov    %r14,%rbx
  jmp    L138
L183:
  mov    0x8(%rsp),%rax
  lea    (%rbx,%rax,1),%rdi
  mov    %rbp,%rdx
  mov    %rbx,%rax
L399:
  movzbl (%rax),%ecx
  add    $0x1,%rax
  movzbl (%rdx),%esi
  mov    %sil,-0x1(%rax)
  add    $0x1,%rdx
  mov    %cl,-0x1(%rdx)
  cmp    %rdi,%rax
  jne    L399
  mov    0x8(%rsp),%rax
  lea    (%rbx,%rax,1),%rsi
  add    %rbp,%rax
L252:
  mov    (%rsp),%rcx
  lea    (%rsi,%rcx,1),%rbx
  lea    (%rax,%rcx,1),%rbp
L138:
  add    %r15,%rbx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   *%r13
  test   %eax,%eax
  js     L138
L127:
  add    (%rsp),%rbp
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   *%r13
  test   %eax,%eax
  jg     L127
  cmp    %rbp,%rbx
  jae    L265
  mov    0x10(%rsp),%ecx
  mov    %ecx,%eax
  or     %ebx,%eax
  test   $0x3,%al
  jne    L183
  lea    -0x4(%rcx),%eax
  lea    0x4(%rax),%rdi
  lea    (%rbx,%rdi,1),%rsi
  mov    %rbp,%rax
L88:
  mov    (%rbx),%edx
  mov    (%rax),%ecx
  mov    %ecx,(%rbx)
  mov    %edx,(%rax)
  add    $0x4,%rbx
  add    $0x4,%rax
  cmp    %rsi,%rbx
  jne    L88
  lea    0x0(%rbp,%rdi,1),%rax
  jmp    L252
L265:
  mov    %r15d,%eax
  or     %ebx,%eax
  test   $0x3,%al
  jne    L209
  lea    -0x4(%r15),%eax
  lea    0x4(%rbx,%rax,1),%rax
L410:
  mov    (%rbx),%edx
  mov    (%r12),%ecx
  mov    %ecx,(%rbx)
  mov    %edx,(%r12)
  add    $0x4,%rbx
  add    $0x4,%r12
  cmp    %rax,%rbx
  jne    L410
L323:
  mov    (%rsp),%rdi
  lea    (%rax,%rdi,1),%rcx
  mov    %rcx,%rax
  sub    %r14,%rax
  mov    $0x0,%edx
  div    %r15
  lea    -0x1(%rax),%edx
  sub    %eax,0x14(%rsp)
  mov    0x14(%rsp),%eax
  cmp    %eax,%edx
  jle    L100
  cmp    $0xa,%eax
  jle    L423
  mov    0x18(%rsp),%edi
  movslq %edi,%rax
  mov    %r14,0xa0(%rsp,%rax,8)
  mov    %edx,0x20(%rsp,%rax,4)
  mov    %rcx,%r14
  lea    0x1(%rdi),%eax
  mov    %eax,0x18(%rsp)
L36:
  mov    0x14(%rsp),%edi
  mov    %edi,%eax
  sar    %eax
  imul   %r15d,%eax
  movslq %eax,%rbx
  add    %r14,%rbx
  mov    %eax,%ebp
  sub    %r15d,%ebp
  test   $0x1,%dil
  cmovne %eax,%ebp
  movslq %ebp,%rbp
  add    %rbx,%rbp
  mov    %rbx,%rsi
  mov    %r14,%rdi
  call   *%r13
  test   %eax,%eax
  jle    L384
  mov    %r15d,%eax
  or     %r14d,%eax
  test   $0x3,%al
  jne    L179
  lea    -0x4(%r15),%eax
  lea    0x4(%rax),%rdi
  lea    (%r14,%rdi,1),%rsi
  mov    %rbx,%rax
L185:
  mov    (%r14),%edx
  mov    (%rax),%ecx
  mov    %ecx,(%r14)
  mov    %edx,(%rax)
  add    $0x4,%r14
  add    $0x4,%rax
  cmp    %rsi,%r14
  jne    L185
  lea    (%rbx,%rdi,1),%rax
  jmp    L40
L209:
  lea    -0x1(%r15),%eax
  lea    0x1(%rbx,%rax,1),%rsi
  mov    %rbx,%rax
L275:
  movzbl (%rax),%edx
  add    $0x1,%rax
  movzbl (%r12),%ecx
  mov    %cl,-0x1(%rax)
  add    $0x1,%r12
  mov    %dl,-0x1(%r12)
  cmp    %rsi,%rax
  jne    L275
  lea    -0x1(%r15),%eax
  lea    0x1(%rbx,%rax,1),%rax
  jmp    L323
L423:
  cmp    $0xa,%edx
  jle    L146
  mov    %edx,0x14(%rsp)
  jmp    L36
L100:
  cmp    $0xa,%edx
  jle    L303
  mov    0x18(%rsp),%edi
  movslq %edi,%rax
  mov    %rcx,0xa0(%rsp,%rax,8)
  mov    0x14(%rsp),%ecx
  mov    %ecx,0x20(%rsp,%rax,4)
  mov    %edx,0x14(%rsp)
  lea    0x1(%rdi),%eax
  mov    %eax,0x18(%rsp)
  jmp    L36
L303:
  cmpl   $0xa,0x14(%rsp)
  jle    L146
  mov    %rcx,%r14
  jmp    L36
L146:
  cmpl   $0x0,0x18(%rsp)
  je     L237
L385:
  subl   $0x1,0x18(%rsp)
  mov    0x18(%rsp),%eax
  cltq
  mov    0xa0(%rsp,%rax,8),%r14
  mov    0x20(%rsp,%rax,4),%eax
  mov    %eax,0x14(%rsp)
  mov    0x1c(%rsp),%eax
  add    $0x1,%rax
  mov    %rax,0x8(%rsp)
  jmp    L36
L237:
  mov    0x1a8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L280
  add    $0x1b8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L280:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void partition_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) {
  int stackpointer = 1;
  void *basestack[32];
  int sizestack[32];
  basestack[0] = base;
  sizestack[0] = nmemb;
  while (stackpointer != 0) {
    char *b = (char *)basestack[--stackpointer];
    int n = sizestack[stackpointer];
    for (;;) {
      int halfn = (n >> 1) * size;
      char *bmid = b + halfn;
      char *btop;
      if ((n & 1) == 0)
        halfn -= size;
      btop = bmid + halfn;
      if ((*compar)(b, bmid) > 0) {
        int xsize = size;
        if (((xsize | (int)b) & 0x3) == 0) {
          do {
            int temp = *(int *)b;
            *(int *)b = *(int *)bmid;
            *(int *)bmid = temp;
            b += 4;
            bmid += 4;
            xsize -= 4;
            ;
          } while (xsize != 0);
        } else {
          do {
            char temp = *b;
            *b++ = *bmid;
            *bmid++ = temp;
            xsize--;
          } while (xsize != 0);
        }
        b -= size;
        bmid -= size;
      };
      if ((*compar)(bmid, btop) > 0) {
        if ((*compar)(b, btop) > 0) {
          int xsize = size;
          if (((xsize | (int)b) & 0x3) == 0) {
            do {
              int temp = *(int *)b;
              *(int *)b = *(int *)btop;
              *(int *)btop = temp;
              b += 4;
              btop += 4;
              xsize -= 4;
              ;
            } while (xsize != 0);
          } else {
            do {
              char temp = *b;
              *b++ = *btop;
              *btop++ = temp;
              xsize--;
            } while (xsize != 0);
          }
          b -= size;
          btop -= size;
        };
        {
          int xsize = size;
          if (((xsize | (int)bmid) & 0x3) == 0) {
            do {
              int temp = *(int *)bmid;
              *(int *)bmid = *(int *)btop;
              *(int *)btop = temp;
              bmid += 4;
              btop += 4;
              xsize -= 4;
              ;
            } while (xsize != 0);
          } else {
            do {
              char temp = *bmid;
              *bmid++ = *btop;
              *btop++ = temp;
              xsize--;
            } while (xsize != 0);
          }
          bmid -= size;
          btop -= size;
        };
      }
      {
        char *l;
        char *r = btop - size;
        char *pivot;
        int s1, s2;
        {
          int xsize = size;
          if (((xsize | (int)bmid) & 0x3) == 0) {
            do {
              int temp = *(int *)bmid;
              *(int *)bmid = *(int *)r;
              *(int *)r = temp;
              bmid += 4;
              r += 4;
              xsize -= 4;
              ;
            } while (xsize != 0);
          } else {
            do {
              char temp = *bmid;
              *bmid++ = *r;
              *r++ = temp;
              xsize--;
            } while (xsize != 0);
          }
          bmid -= size;
          r -= size;
        };
        l = b;
        pivot = r;
        for (;;) {
          do
            l += size;
          while ((*compar)(l, pivot) < 0);
          do
            r -= size;
          while ((*compar)(r, pivot) > 0);
          if (r <= l)
            break;
          {
            int xsize = size;
            if (((xsize | (int)l) & 0x3) == 0) {
              do {
                int temp = *(int *)l;
                *(int *)l = *(int *)r;
                *(int *)r = temp;
                l += 4;
                r += 4;
                xsize -= 4;
                ;
              } while (xsize != 0);
            } else {
              do {
                char temp = *l;
                *l++ = *r;
                *r++ = temp;
                xsize--;
              } while (xsize != 0);
            }
            l -= size;
            r -= size;
          };
        }
        {
          int xsize = size;
          if (((xsize | (int)l) & 0x3) == 0) {
            do {
              int temp = *(int *)l;
              *(int *)l = *(int *)pivot;
              *(int *)pivot = temp;
              l += 4;
              pivot += 4;
              xsize -= 4;
              ;
            } while (xsize != 0);
          } else {
            do {
              char temp = *l;
              *l++ = *pivot;
              *pivot++ = temp;
              xsize--;
            } while (xsize != 0);
          }
          l -= size;
          pivot -= size;
        };
        s1 = ((l - b) / size) - 1;
        s2 = n - s1 - 1;
        if (s1 > s2) {
          if (s2 > 10) {
            (basestack[stackpointer] = (void *)(b), sizestack[stackpointer++] = (s1));
            b = l;
            n = s2;
          } else if (s1 > 10)
            n = s1;
          else
            break;
        } else {
          if (s1 > 10) {
            (basestack[stackpointer] = (void *)(l), sizestack[stackpointer++] = (s2));
            n = s1;
          } else if (s2 > 10) {
            b = l;
            n = s2;
          } else
            break;
        }
      }
    }
  }
}
```