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

```asm
<partition_sort>:
  endbr64
  push   %r15
  xor    %eax,%eax
  push   %r14
  mov    %rdx,%r14
  push   %r13
  mov    %r14,%r13
  push   %r12
  mov    %rcx,%r12
  neg    %r13
  push   %rbp
  push   %rbx
  sub    $0x1c8,%rsp
  mov    %rdi,0x10(%rsp)
  mov    %fs:0x28,%rdx
  mov    %rdx,0x1b8(%rsp)
  xor    %edx,%edx
  lea    -0x1(%r14),%edx
  mov    %rdi,0xb0(%rsp)
  lea    0x1(%rdx),%rcx
  mov    %esi,0x20(%rsp)
  mov    %esi,0x30(%rsp)
  mov    %r14d,0x28(%rsp)
  mov    %r14d,0xc(%rsp)
  mov    %rcx,0x18(%rsp)
L370:
  mov    %eax,0x2c(%rsp)
L110:
  mov    0x20(%rsp),%ecx
  mov    0x28(%rsp),%edi
  mov    0x10(%rsp),%r15
  mov    %ecx,%eax
  sar    %eax
  imul   %edi,%eax
  movslq %eax,%rbp
  sub    %edi,%eax
  and    $0x1,%ecx
  mov    %r15,%rdi
  cltq
  lea    (%r15,%rbp,1),%rbx
  cmove  %rax,%rbp
  mov    %rbx,%rsi
  add    %rbx,%rbp
  call   *%r12
  test   %eax,%eax
  jle    L261
  mov    0xc(%rsp),%ecx
  mov    %ecx,%eax
  or     %r15d,%eax
  test   $0x3,%al
  jne    L231
  lea    -0x4(%rcx),%eax
  mov    %r15,%rdx
  lea    0x4(%rax),%rdi
  mov    %rbx,%rax
  lea    (%r15,%rdi,1),%rsi
  xchg   %ax,%ax
L211:
  mov    (%rax),%r8d
  mov    (%rdx),%ecx
  add    $0x4,%rdx
  add    $0x4,%rax
  mov    %r8d,-0x4(%rdx)
  mov    %ecx,-0x4(%rax)
  cmp    %rsi,%rdx
  jne    L211
  lea    (%rbx,%rdi,1),%rax
L201:
  lea    (%rsi,%r13,1),%rcx
  lea    (%rax,%r13,1),%rbx
  mov    %rcx,0x10(%rsp)
L261:
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   *%r12
  test   %eax,%eax
  jle    L176
  mov    0x10(%rsp),%r15
  mov    %rbp,%rsi
  mov    %r15,%rdi
  call   *%r12
  test   %eax,%eax
  jle    L407
  mov    0xc(%rsp),%ecx
  mov    %ecx,%eax
  or     %r15d,%eax
  test   $0x3,%al
  jne    L233
  lea    -0x4(%rcx),%eax
  mov    %r15,%rdx
  lea    0x4(%rax),%rdi
  mov    %rbp,%rax
  lea    (%r15,%rdi,1),%rsi
  nop
L302:
  mov    (%rax),%r8d
  mov    (%rdx),%ecx
  add    $0x4,%rdx
  add    $0x4,%rax
  mov    %r8d,-0x4(%rdx)
  mov    %ecx,-0x4(%rax)
  cmp    %rsi,%rdx
  jne    L302
  lea    0x0(%rbp,%rdi,1),%rax
L340:
  lea    (%rsi,%r13,1),%rcx
  lea    (%rax,%r13,1),%rbp
  mov    %rcx,0x10(%rsp)
L407:
  mov    0xc(%rsp),%ecx
  mov    %ecx,%eax
  or     %ebx,%eax
  test   $0x3,%al
  jne    L198
  lea    -0x4(%rcx),%eax
  lea    0x4(%rax),%rdi
  mov    %rbp,%rax
  lea    (%rbx,%rdi,1),%rsi
  nopl   0x0(%rax)
L158:
  mov    (%rax),%ecx
  mov    (%rbx),%edx
  add    $0x4,%rbx
  add    $0x4,%rax
  mov    %ecx,-0x4(%rbx)
  mov    %edx,-0x4(%rax)
  cmp    %rsi,%rbx
  jne    L158
  lea    0x0(%rbp,%rdi,1),%rax
L154:
  lea    (%rsi,%r13,1),%rbx
  lea    (%rax,%r13,1),%rbp
L176:
  mov    0xc(%rsp),%ecx
  add    %r13,%rbp
  mov    %ecx,%eax
  or     %ebx,%eax
  test   $0x3,%al
  jne    L222
  lea    -0x4(%rcx),%edi
  mov    %rbp,%rax
  add    $0x4,%rdi
  lea    (%rbx,%rdi,1),%rsi
  nopl   (%rax)
L46:
  mov    (%rax),%ecx
  mov    (%rbx),%edx
  add    $0x4,%rbx
  add    $0x4,%rax
  mov    %ecx,-0x4(%rbx)
  mov    %edx,-0x4(%rax)
  cmp    %rsi,%rbx
  jne    L46
  add    %rdi,%rbp
L95:
  mov    0x28(%rsp),%eax
  add    %r13,%rbp
  mov    0x10(%rsp),%r15
  mov    %rbp,%rbx
  sub    $0x1,%eax
  mov    %eax,0x24(%rsp)
  nopl   0x0(%rax,%rax,1)
L121:
  add    %r14,%r15
  mov    %rbp,%rsi
  mov    %r15,%rdi
  call   *%r12
  test   %eax,%eax
  js     L121
L369:
  add    %r13,%rbx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   *%r12
  test   %eax,%eax
  jg     L369
  mov    0xc(%rsp),%ecx
  mov    %ecx,%eax
  or     %r15d,%eax
  and    $0x3,%eax
  cmp    %rbx,%r15
  jae    L185
  test   %eax,%eax
  jne    L102
  lea    -0x4(%rcx),%eax
  lea    0x4(%rax),%rdi
  mov    %rbx,%rax
  lea    (%r15,%rdi,1),%rsi
  nopl   0x0(%rax,%rax,1)
L387:
  mov    (%rax),%ecx
  mov    (%r15),%edx
  add    $0x4,%r15
  add    $0x4,%rax
  mov    %ecx,-0x4(%r15)
  mov    %edx,-0x4(%rax)
  cmp    %rsi,%r15
  jne    L387
  lea    (%rbx,%rdi,1),%rax
L414:
  lea    (%rsi,%r13,1),%r15
  lea    (%rax,%r13,1),%rbx
  jmp    L121
  nop
L102:
  mov    0x24(%rsp),%eax
  mov    %rbx,%rdx
  lea    0x1(%r15,%rax,1),%rdi
  mov    %r15,%rax
  nop
L47:
  movzbl (%rax),%ecx
  movzbl (%rdx),%esi
  add    $0x1,%rax
  add    $0x1,%rdx
  mov    %sil,-0x1(%rax)
  mov    %cl,-0x1(%rdx)
  cmp    %rdi,%rax
  jne    L47
  mov    0x18(%rsp),%rax
  lea    (%r15,%rax,1),%rsi
  add    %rbx,%rax
  jmp    L414
  nopl   0x0(%rax,%rax,1)
L185:
  test   %eax,%eax
  jne    L173
  mov    0xc(%rsp),%eax
  sub    $0x4,%eax
  lea    0x4(%r15,%rax,1),%rax
L408:
  mov    0x0(%rbp),%ecx
  mov    (%r15),%edx
  add    $0x4,%r15
  add    $0x4,%rbp
  mov    %ecx,-0x4(%r15)
  mov    %edx,-0x4(%rbp)
  cmp    %rax,%r15
  jne    L408
L131:
  mov    0x10(%rsp),%rbx
  lea    (%rax,%r13,1),%rcx
  xor    %edx,%edx
  mov    %rcx,%rax
  sub    %rbx,%rax
  div    %r14
  sub    %eax,0x20(%rsp)
  lea    -0x1(%rax),%edx
  mov    0x20(%rsp),%eax
  cmp    %eax,%edx
  jle    L151
  cmp    $0xa,%eax
  jle    L57
  movslq 0x2c(%rsp),%rax
  mov    %rcx,0x10(%rsp)
  mov    %rbx,0xb0(%rsp,%rax,8)
  mov    %edx,0x30(%rsp,%rax,4)
  lea    0x1(%rax),%eax
  jmp    L370
L173:
  mov    0x28(%rsp),%eax
  sub    $0x1,%eax
  lea    0x1(%r15,%rax,1),%rdi
  mov    %r15,%rax
  nopl   0x0(%rax,%rax,1)
L106:
  movzbl (%rax),%edx
  movzbl 0x0(%rbp),%ecx
  add    $0x1,%rax
  add    $0x1,%rbp
  mov    %cl,-0x1(%rax)
  mov    %dl,-0x1(%rbp)
  cmp    %rdi,%rax
  jne    L106
  mov    0x18(%rsp),%rax
  add    %r15,%rax
  jmp    L131
L151:
  cmp    $0xa,%edx
  jle    L72
  movslq 0x2c(%rsp),%rax
  mov    %rcx,0xb0(%rsp,%rax,8)
  mov    0x20(%rsp),%ecx
  mov    %edx,0x20(%rsp)
  mov    %ecx,0x30(%rsp,%rax,4)
  lea    0x1(%rax),%eax
  mov    %eax,0x2c(%rsp)
  jmp    L110
L222:
  mov    0x28(%rsp),%eax
  sub    $0x1,%eax
  lea    0x1(%rbx,%rax,1),%rsi
  mov    %rbp,%rax
  nopl   0x0(%rax)
L2:
  movzbl (%rbx),%edx
  movzbl (%rax),%ecx
  add    $0x1,%rbx
  add    $0x1,%rax
  mov    %cl,-0x1(%rbx)
  mov    %dl,-0x1(%rax)
  cmp    %rsi,%rbx
  jne    L2
  add    0x18(%rsp),%rbp
  jmp    L95
L198:
  mov    0x28(%rsp),%eax
  mov    %rbp,%rdx
  sub    $0x1,%eax
  lea    0x1(%rbx,%rax,1),%rdi
  mov    %rbx,%rax
  nopl   (%rax)
L18:
  movzbl (%rax),%ecx
  movzbl (%rdx),%esi
  add    $0x1,%rax
  add    $0x1,%rdx
  mov    %sil,-0x1(%rax)
  mov    %cl,-0x1(%rdx)
  cmp    %rdi,%rax
  jne    L18
  mov    0x18(%rsp),%rax
  lea    (%rbx,%rax,1),%rsi
  add    %rbp,%rax
  jmp    L154
L231:
  mov    0x28(%rsp),%eax
  mov    0x10(%rsp),%rcx
  mov    %rbx,%rdx
  sub    $0x1,%eax
  lea    0x1(%rcx,%rax,1),%rdi
  mov    %rcx,%rax
  nopw   0x0(%rax,%rax,1)
L356:
  movzbl (%rax),%ecx
  movzbl (%rdx),%esi
  add    $0x1,%rax
  add    $0x1,%rdx
  mov    %sil,-0x1(%rax)
  mov    %cl,-0x1(%rdx)
  cmp    %rdi,%rax
  jne    L356
  mov    0x18(%rsp),%rax
  mov    0x10(%rsp),%rsi
  add    %rax,%rsi
  add    %rbx,%rax
  jmp    L201
L72:
  cmpl   $0xa,0x20(%rsp)
  jle    L238
  mov    %rcx,0x10(%rsp)
  jmp    L110
L57:
  cmp    $0xa,%edx
  jle    L238
  mov    %edx,0x20(%rsp)
  jmp    L110
L233:
  mov    0x28(%rsp),%eax
  mov    0x10(%rsp),%rcx
  mov    %rbp,%rdx
  sub    $0x1,%eax
  lea    0x1(%rcx,%rax,1),%rdi
  mov    %rcx,%rax
  nopl   (%rax)
L157:
  movzbl (%rax),%ecx
  movzbl (%rdx),%esi
  add    $0x1,%rax
  add    $0x1,%rdx
  mov    %sil,-0x1(%rax)
  mov    %cl,-0x1(%rdx)
  cmp    %rdi,%rax
  jne    L157
  mov    0x18(%rsp),%rax
  mov    0x10(%rsp),%rsi
  add    %rax,%rsi
  add    %rbp,%rax
  jmp    L340
L238:
  mov    0x2c(%rsp),%eax
  test   %eax,%eax
  je     L288
  sub    $0x1,%eax
  movslq %eax,%rdx
  mov    0xb0(%rsp,%rdx,8),%rcx
  mov    %rcx,0x10(%rsp)
  mov    0x30(%rsp,%rdx,4),%ecx
  mov    %ecx,0x20(%rsp)
  jmp    L370
L288:
  mov    0x1b8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L330
  add    $0x1c8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L330:
  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;
        }
      }
    }
  }
}
```