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

```asm
<generic_partition>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  push   %r13
  mov    %rcx,%r13
  mov    %rdx,%rcx
  push   %r12
  imul   %r13,%rcx
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  lea    (%rdi,%rcx,1),%r14
  sub    $0x68,%rsp
  mov    %rcx,0x30(%rsp)
  lea    -0x1(%rsi),%rcx
  mov    %rdx,0x10(%rsp)
  mov    %r8,0x18(%rsp)
  mov    %rcx,0x20(%rsp)
  mov    %r13d,0x2c(%rsp)
  mov    %r13d,0x3c(%rsp)
  cmp    %rsi,%rdx
  jbe    L2
  lea    -0x4(%r13),%ecx
  mov    %r13,%r12
  mov    %ecx,%edx
  mov    %ecx,0x44(%rsp)
  imul   %rsi,%r12
  shr    $0x2,%edx
  lea    0x1(%rdx),%ebx
  mov    %edx,0x5c(%rsp)
  mov    %ebx,%eax
  mov    %ebx,0x38(%rsp)
  shr    $0x2,%eax
  sub    $0x1,%eax
  add    $0x1,%rax
  shl    $0x4,%rax
  mov    %rax,0x48(%rsp)
  mov    %ebx,%eax
  and    $0xfffffffc,%eax
  mov    %eax,0x58(%rsp)
  shl    $0x2,%rax
  mov    %rax,0x50(%rsp)
  mov    %ebx,%eax
  shl    $0x2,%rax
  mov    %rax,0x8(%rsp)
  lea    0x0(,%rdx,4),%eax
  sub    %eax,%ecx
  mov    %ecx,0x40(%rsp)
  jmp    L116
  nopl   0x0(%rax)
L337:
  add    $0x1,%rbp
  add    %r13,%r12
  cmp    %rbp,0x10(%rsp)
  je     L154
L116:
  lea    (%r15,%r12,1),%rbx
  mov    0x18(%rsp),%rax
  mov    %r14,%rsi
  mov    %rbx,%rdi
  call   *%rax
  test   %eax,%eax
  jg     L337
  addq   $0x1,0x20(%rsp)
  mov    0x20(%rsp),%rsi
  imul   %r13,%rsi
  cmpl   $0x3,0x3c(%rsp)
  lea    (%r15,%rsi,1),%rax
  jbe    L29
  lea    0x10(%r12),%rdi
  lea    0x10(%rsi),%r8
  cmp    %rsi,%rdi
  setle  %dil
  cmp    %r8,%r12
  setge  %r8b
  or     %r8b,%dil
  je     L146
  mov    0x44(%rsp),%edx
  cmp    $0x3,%edx
  jbe    L146
  cmp    $0xb,%edx
  jbe    L158
  mov    0x48(%rsp),%rdx
  xor    %edi,%edi
  nopw   0x0(%rax,%rax,1)
L287:
  movdqu (%rbx,%rdi,1),%xmm0
  movdqu (%rax,%rdi,1),%xmm1
  movups %xmm1,(%rbx,%rdi,1)
  movups %xmm0,(%rax,%rdi,1)
  add    $0x10,%rdi
  cmp    %rdx,%rdi
  jne    L287
  mov    0x50(%rsp),%rcx
  mov    0x58(%rsp),%edx
  lea    (%rbx,%rcx,1),%r8
  lea    (%rax,%rcx,1),%rdi
  mov    0x8(%rsp),%rcx
  lea    (%rbx,%rcx,1),%r9
  cmp    %edx,0x38(%rsp)
  je     L23
  mov    %edx,%r9d
L171:
  mov    0x38(%rsp),%r11d
  sub    %r9d,%r11d
  cmp    %r9d,0x5c(%rsp)
  je     L9
  shl    $0x2,%r9
  mov    0x8(%rsp),%rcx
  lea    (%r12,%r9,1),%r10
  add    %r9,%rsi
  add    %r15,%rsi
  add    %r15,%r10
  mov    (%r10),%r9
  movq   (%rsi),%xmm0
  movq   %xmm0,(%r10)
  mov    %r9,(%rsi)
  mov    %r11d,%esi
  and    $0xfffffffe,%esi
  mov    %esi,%r9d
  shl    $0x2,%r9
  add    %r9,%r8
  add    %r9,%rdi
  lea    (%rbx,%rcx,1),%r9
  cmp    %esi,%r11d
  je     L23
L9:
  mov    (%rdi),%r9d
  mov    (%r8),%esi
  mov    0x8(%rsp),%rdx
  mov    %r9d,(%r8)
  mov    %esi,(%rdi)
  lea    (%rbx,%rdx,1),%r9
L23:
  mov    0x40(%rsp),%esi
  mov    %r9,%rbx
  add    0x8(%rsp),%rax
L299:
  test   %esi,%esi
  je     L337
  movzbl (%rbx),%edi
  movzbl (%rax),%r8d
  mov    %r8b,(%rbx)
  mov    %dil,(%rax)
  sub    $0x1,%esi
  je     L337
  movzbl 0x1(%rbx),%edi
  movzbl 0x1(%rax),%r8d
  mov    %r8b,0x1(%rbx)
  mov    %dil,0x1(%rax)
  cmp    $0x1,%esi
  je     L337
  movzbl 0x2(%rbx),%esi
  movzbl 0x2(%rax),%edi
  add    $0x1,%rbp
  add    %r13,%r12
  mov    %dil,0x2(%rbx)
  mov    %sil,0x2(%rax)
  cmp    %rbp,0x10(%rsp)
  jne    L116
  nopl   0x0(%rax,%rax,1)
L154:
  mov    0x20(%rsp),%rbp
  add    $0x1,%rbp
L2:
  mov    %rbp,%rsi
  imul   %r13,%rsi
  lea    (%r15,%rsi,1),%rcx
  cmp    $0x3,%r13d
  jbe    L339
  mov    0x30(%rsp),%rdx
  lea    0x10(%rsi),%rdi
  sub    $0x4,%r13d
  lea    0x10(%rdx),%rax
  cmp    %rsi,%rax
  setle  %al
  cmp    %rdx,%rdi
  setle  %dil
  or     %dil,%al
  je     L301
  cmp    $0x3,%r13d
  jbe    L301
  mov    %r13d,%r11d
  shr    $0x2,%r11d
  lea    0x1(%r11),%r8d
  cmp    $0xb,%r13d
  jbe    L102
  mov    %r8d,%edi
  xor    %eax,%eax
  shr    $0x2,%edi
  shl    $0x4,%rdi
L11:
  movdqu (%rcx,%rax,1),%xmm0
  movdqu (%r14,%rax,1),%xmm2
  movups %xmm2,(%rcx,%rax,1)
  movups %xmm0,(%r14,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%rdi
  jne    L11
  mov    %r8d,%ebx
  and    $0xfffffffc,%ebx
  mov    %ebx,%r10d
  lea    0x0(,%r10,4),%rax
  lea    (%r14,%rax,1),%rdi
  add    %rcx,%rax
  cmp    %ebx,%r8d
  je     L97
  sub    %ebx,%r8d
  cmp    %ebx,%r11d
  je     L139
L186:
  shl    $0x2,%r10
  add    %r10,%rsi
  add    0x30(%rsp),%r10
  lea    (%r15,%r10,1),%r9
  add    %r15,%rsi
  mov    (%rsi),%r10
  mov    (%r9),%r11
  mov    %r11,(%rsi)
  mov    %r10,(%r9)
  mov    %r8d,%r9d
  and    $0xfffffffe,%r9d
  mov    %r9d,%esi
  shl    $0x2,%rsi
  add    %rsi,%rdi
  add    %rsi,%rax
  cmp    %r8d,%r9d
  je     L97
L139:
  mov    (%rax),%esi
  mov    (%rdi),%r8d
  mov    %r8d,(%rax)
  mov    %esi,(%rdi)
L97:
  mov    %r13d,%esi
  shr    $0x2,%esi
  lea    0x1(%rsi),%eax
  shl    $0x2,%esi
  sub    %esi,%r13d
  shl    $0x2,%rax
  mov    %r13d,0x2c(%rsp)
  add    %rax,%rcx
  add    %rax,%r14
L339:
  mov    0x2c(%rsp),%eax
  test   %eax,%eax
  je     L67
  movzbl (%rcx),%eax
  movzbl (%r14),%esi
  mov    %sil,(%rcx)
  mov    %al,(%r14)
  mov    0x2c(%rsp),%eax
  sub    $0x1,%eax
  je     L67
  movzbl 0x1(%rcx),%esi
  movzbl 0x1(%r14),%edi
  mov    %dil,0x1(%rcx)
  mov    %sil,0x1(%r14)
  cmp    $0x1,%eax
  je     L67
  movzbl 0x2(%rcx),%eax
  movzbl 0x2(%r14),%esi
  mov    %sil,0x2(%rcx)
  mov    %al,0x2(%r14)
L67:
  add    $0x68,%rsp
  mov    %ebp,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L146:
  mov    0x8(%rsp),%rcx
  mov    %rax,%rsi
  lea    (%rbx,%rcx,1),%r9
  nopl   0x0(%rax)
L71:
  mov    (%rsi),%ecx
  mov    (%rbx),%edx
  add    $0x4,%rbx
  add    $0x4,%rsi
  mov    %ecx,-0x4(%rbx)
  mov    %edx,-0x4(%rsi)
  cmp    %rbx,%r9
  jne    L71
  jmp    L23
  nopl   0x0(%rax)
L29:
  mov    0x2c(%rsp),%esi
  jmp    L299
  nopl   0x0(%rax)
L301:
  mov    %r13d,%eax
  mov    %rcx,%rsi
  shr    $0x2,%eax
  add    $0x1,%eax
  lea    (%r14,%rax,4),%r9
  mov    %r14,%rax
  nopl   0x0(%rax,%rax,1)
L226:
  mov    (%rsi),%edx
  mov    (%rax),%edi
  add    $0x4,%rax
  add    $0x4,%rsi
  mov    %edi,-0x4(%rsi)
  mov    %edx,-0x4(%rax)
  cmp    %r9,%rax
  jne    L226
  jmp    L97
L158:
  mov    %rax,%rdi
  mov    %rbx,%r8
  xor    %r9d,%r9d
  jmp    L171
L102:
  mov    %rcx,%rax
  mov    %r14,%rdi
  xor    %r10d,%r10d
  jmp    L186
```

assistant: ```c
int generic_partition(void *array, size_t p, size_t r, size_t size, int (*compare)(const void *, const void *)) {
  unsigned char *a = (unsigned char *)array;
  unsigned char *x = &a[r * size];
  size_t i = p - 1;
  int temp, k;
  unsigned char *ptr1, *ptr2;
  for (size_t j = p; j < r; ++j) {
    if (compare(&a[j * size], x) <= 0) {
      ++i;
      k = size;
      ptr1 = &a[j * size];
      ptr2 = &a[i * size];
      while (k >= sizeof(int)) {
        temp = *(int *)ptr1;
        *(int *)ptr1 = *(int *)ptr2;
        *(int *)ptr2 = temp;
        k -= sizeof(int);
        ptr1 += sizeof(int);
        ptr2 += sizeof(int);
      }
      while (k) {
        temp = *ptr1;
        *ptr1 = *ptr2;
        *ptr2 = temp;
        --k;
        ++ptr1;
        ++ptr2;
      }
    }
  }
  ++i;
  k = size;
  ptr1 = &a[i * size];
  while (k >= sizeof(int)) {
    temp = *(int *)ptr1;
    *(int *)ptr1 = *(int *)x;
    *(int *)x = temp;
    k -= sizeof(int);
    ptr1 += sizeof(int);
    x += sizeof(int);
  }
  while (k) {
    temp = *ptr1;
    *ptr1 = *x;
    *x = temp;
    --k;
    ++ptr1;
    ++x;
  }
  return i;
}
```