user: Translate the below assembly code into C programming language:

```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)
L68:
  mov    %eax,0x2c(%rsp)
L53:
  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    L268
  mov    0xc(%rsp),%ecx
  mov    %ecx,%eax
  or     %r15d,%eax
  test   $0x3,%al
  jne    L330
  lea    -0x4(%rcx),%eax
  mov    %r15,%rdx
  lea    0x4(%rax),%rdi
  mov    %rbx,%rax
  lea    (%r15,%rdi,1),%rsi
  xchg   %ax,%ax
L161:
  mov    (%rax),%r8d
  mov    (%rdx),%ecx
  add    $0x4,%rdx
  add    $0x4,%rax
  mov    %r8d,-0x4(%rdx)
  mov    %ecx,-0x4(%rax)
  cmp    %rsi,%rdx
  jne    L161
  lea    (%rbx,%rdi,1),%rax
L353:
  lea    (%rsi,%r13,1),%rcx
  lea    (%rax,%r13,1),%rbx
  mov    %rcx,0x10(%rsp)
L268:
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   *%r12
  test   %eax,%eax
  jle    L181
  mov    0x10(%rsp),%r15
  mov    %rbp,%rsi
  mov    %r15,%rdi
  call   *%r12
  test   %eax,%eax
  jle    L93
  mov    0xc(%rsp),%ecx
  mov    %ecx,%eax
  or     %r15d,%eax
  test   $0x3,%al
  jne    L374
  lea    -0x4(%rcx),%eax
  mov    %r15,%rdx
  lea    0x4(%rax),%rdi
  mov    %rbp,%rax
  lea    (%r15,%rdi,1),%rsi
  nop
L86:
  mov    (%rax),%r8d
  mov    (%rdx),%ecx
  add    $0x4,%rdx
  add    $0x4,%rax
  mov    %r8d,-0x4(%rdx)
  mov    %ecx,-0x4(%rax)
  cmp    %rsi,%rdx
  jne    L86
  lea    0x0(%rbp,%rdi,1),%rax
L29:
  lea    (%rsi,%r13,1),%rcx
  lea    (%rax,%r13,1),%rbp
  mov    %rcx,0x10(%rsp)
L93:
  mov    0xc(%rsp),%ecx
  mov    %ecx,%eax
  or     %ebx,%eax
  test   $0x3,%al
  jne    L35
  lea    -0x4(%rcx),%eax
  lea    0x4(%rax),%rdi
  mov    %rbp,%rax
  lea    (%rbx,%rdi,1),%rsi
  nopl   0x0(%rax)
L428:
  mov    (%rax),%ecx
  mov    (%rbx),%edx
  add    $0x4,%rbx
  add    $0x4,%rax
  mov    %ecx,-0x4(%rbx)
  mov    %edx,-0x4(%rax)
  cmp    %rsi,%rbx
  jne    L428
  lea    0x0(%rbp,%rdi,1),%rax
L117:
  lea    (%rsi,%r13,1),%rbx
  lea    (%rax,%r13,1),%rbp
L181:
  mov    0xc(%rsp),%ecx
  add    %r13,%rbp
  mov    %ecx,%eax
  or     %ebx,%eax
  test   $0x3,%al
  jne    L62
  lea    -0x4(%rcx),%edi
  mov    %rbp,%rax
  add    $0x4,%rdi
  lea    (%rbx,%rdi,1),%rsi
  nopl   (%rax)
L335:
  mov    (%rax),%ecx
  mov    (%rbx),%edx
  add    $0x4,%rbx
  add    $0x4,%rax
  mov    %ecx,-0x4(%rbx)
  mov    %edx,-0x4(%rax)
  cmp    %rsi,%rbx
  jne    L335
  add    %rdi,%rbp
L364:
  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)
L6:
  add    %r14,%r15
  mov    %rbp,%rsi
  mov    %r15,%rdi
  call   *%r12
  test   %eax,%eax
  js     L6
L75:
  add    %r13,%rbx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   *%r12
  test   %eax,%eax
  jg     L75
  mov    0xc(%rsp),%ecx
  mov    %ecx,%eax
  or     %r15d,%eax
  and    $0x3,%eax
  cmp    %rbx,%r15
  jae    L412
  test   %eax,%eax
  jne    L288
  lea    -0x4(%rcx),%eax
  lea    0x4(%rax),%rdi
  mov    %rbx,%rax
  lea    (%r15,%rdi,1),%rsi
  nopl   0x0(%rax,%rax,1)
L413:
  mov    (%rax),%ecx
  mov    (%r15),%edx
  add    $0x4,%r15
  add    $0x4,%rax
  mov    %ecx,-0x4(%r15)
  mov    %edx,-0x4(%rax)
  cmp    %rsi,%r15
  jne    L413
  lea    (%rbx,%rdi,1),%rax
L424:
  lea    (%rsi,%r13,1),%r15
  lea    (%rax,%r13,1),%rbx
  jmp    L6
  nop
L288:
  mov    0x24(%rsp),%eax
  mov    %rbx,%rdx
  lea    0x1(%r15,%rax,1),%rdi
  mov    %r15,%rax
  nop
L197:
  movzbl (%rax),%ecx
  movzbl (%rdx),%esi
  add    $0x1,%rax
  add    $0x1,%rdx
  mov    %sil,-0x1(%rax)
  mov    %cl,-0x1(%rdx)
  cmp    %rdi,%rax
  jne    L197
  mov    0x18(%rsp),%rax
  lea    (%r15,%rax,1),%rsi
  add    %rbx,%rax
  jmp    L424
  nopl   0x0(%rax,%rax,1)
L412:
  test   %eax,%eax
  jne    L0
  mov    0xc(%rsp),%eax
  sub    $0x4,%eax
  lea    0x4(%r15,%rax,1),%rax
L365:
  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    L365
L48:
  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    L284
  cmp    $0xa,%eax
  jle    L373
  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    L68
L0:
  mov    0x28(%rsp),%eax
  sub    $0x1,%eax
  lea    0x1(%r15,%rax,1),%rdi
  mov    %r15,%rax
  nopl   0x0(%rax,%rax,1)
L273:
  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    L273
  mov    0x18(%rsp),%rax
  add    %r15,%rax
  jmp    L48
L284:
  cmp    $0xa,%edx
  jle    L97
  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    L53
L62:
  mov    0x28(%rsp),%eax
  sub    $0x1,%eax
  lea    0x1(%rbx,%rax,1),%rsi
  mov    %rbp,%rax
  nopl   0x0(%rax)
L69:
  movzbl (%rbx),%edx
  movzbl (%rax),%ecx
  add    $0x1,%rbx
  add    $0x1,%rax
  mov    %cl,-0x1(%rbx)
  mov    %dl,-0x1(%rax)
  cmp    %rsi,%rbx
  jne    L69
  add    0x18(%rsp),%rbp
  jmp    L364
L35:
  mov    0x28(%rsp),%eax
  mov    %rbp,%rdx
  sub    $0x1,%eax
  lea    0x1(%rbx,%rax,1),%rdi
  mov    %rbx,%rax
  nopl   (%rax)
L131:
  movzbl (%rax),%ecx
  movzbl (%rdx),%esi
  add    $0x1,%rax
  add    $0x1,%rdx
  mov    %sil,-0x1(%rax)
  mov    %cl,-0x1(%rdx)
  cmp    %rdi,%rax
  jne    L131
  mov    0x18(%rsp),%rax
  lea    (%rbx,%rax,1),%rsi
  add    %rbp,%rax
  jmp    L117
L330:
  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)
L238:
  movzbl (%rax),%ecx
  movzbl (%rdx),%esi
  add    $0x1,%rax
  add    $0x1,%rdx
  mov    %sil,-0x1(%rax)
  mov    %cl,-0x1(%rdx)
  cmp    %rdi,%rax
  jne    L238
  mov    0x18(%rsp),%rax
  mov    0x10(%rsp),%rsi
  add    %rax,%rsi
  add    %rbx,%rax
  jmp    L353
L97:
  cmpl   $0xa,0x20(%rsp)
  jle    L236
  mov    %rcx,0x10(%rsp)
  jmp    L53
L373:
  cmp    $0xa,%edx
  jle    L236
  mov    %edx,0x20(%rsp)
  jmp    L53
L374:
  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)
L417:
  movzbl (%rax),%ecx
  movzbl (%rdx),%esi
  add    $0x1,%rax
  add    $0x1,%rdx
  mov    %sil,-0x1(%rax)
  mov    %cl,-0x1(%rdx)
  cmp    %rdi,%rax
  jne    L417
  mov    0x18(%rsp),%rax
  mov    0x10(%rsp),%rsi
  add    %rax,%rsi
  add    %rbp,%rax
  jmp    L29
L236:
  mov    0x2c(%rsp),%eax
  test   %eax,%eax
  je     L382
  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    L68
L382:
  mov    0x1b8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L159
  add    $0x1c8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L159:
  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;
        }
      }
    }
  }
}
```