user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<Partition>:
  endbr64
  push   %r15
  mov    %rdi,%r8
  mov    %esi,%r15d
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdx,0x8(%rsp)
  test   %esi,%esi
  jle    L46
  lea    -0x1(%rsi),%eax
  cmp    $0x2,%eax
  jbe    L139
  mov    %esi,%edx
  mov    %rdi,%rax
  pxor   %xmm0,%xmm0
  shr    $0x2,%edx
  sub    $0x1,%edx
  shl    $0x4,%rdx
  lea    0x10(%rdi,%rdx,1),%rdx
  nopl   0x0(%rax)
L57:
  movdqu (%rax),%xmm2
  add    $0x10,%rax
  paddd  %xmm2,%xmm0
  cmp    %rax,%rdx
  jne    L57
  movdqa %xmm0,%xmm1
  mov    %r15d,%eax
  psrldq $0x8,%xmm1
  and    $0xfffffffc,%eax
  paddd  %xmm1,%xmm0
  movdqa %xmm0,%xmm1
  psrldq $0x4,%xmm1
  paddd  %xmm1,%xmm0
  movd   %xmm0,%r14d
  test   $0x3,%r15b
  je     L6
L75:
  movslq %eax,%rdx
  lea    0x0(,%rdx,4),%rcx
  add    (%r8,%rdx,4),%r14d
  lea    0x1(%rax),%edx
  cmp    %edx,%r15d
  jle    L6
  add    $0x2,%eax
  add    0x4(%r8,%rcx,1),%r14d
  cmp    %eax,%r15d
  jle    L6
  add    0x8(%r8,%rcx,1),%r14d
L6:
  mov    %r14d,%ebx
  shr    $0x1f,%ebx
  add    %r14d,%ebx
  sar    %ebx
  lea    0x1(%rbx),%r12d
  mov    %r12d,%r13d
L20:
  lea    0x1(%r15),%edx
  mov    %r8,0x18(%rsp)
  mov    %edx,%edi
  mov    %edx,0x10(%rsp)
  imul   %r13d,%edi
  shl    $0x2,%edi
  call   <malloc@plt>
  mov    0x10(%rsp),%edx
  mov    0x18(%rsp),%r8
  mov    %rax,%rbp
  imul   %r12d,%edx
  test   %edx,%edx
  jle    L89
  movslq %edx,%rax
  xor    %esi,%esi
  mov    %rbp,%rdi
  mov    %r8,0x18(%rsp)
  lea    0x0(,%rax,4),%rdx
  mov    %rax,0x10(%rsp)
  call   <memset@plt>
  mov    0x18(%rsp),%r8
L2:
  movl   $0x1,0x0(%rbp)
  test   %r15d,%r15d
  jle    L109
  cmp    $0xffffffff,%r14d
  jl     L109
  movslq %r12d,%r14
  lea    -0x1(%r15),%eax
  mov    %rbp,%r11
  mov    %r13d,%r10d
  shl    $0x2,%r14
  lea    0x4(%r8,%rax,4),%r15
  xor    %r9d,%r9d
  nopl   (%rax)
L126:
  mov    %r10d,%ecx
  mov    %r11,%rdx
  xor    %eax,%eax
  nopl   0x0(%rax,%rax,1)
L71:
  mov    (%rdx),%edi
  test   %edi,%edi
  jne    L5
  mov    (%r8),%edi
  cmp    %eax,%edi
  jg     L29
  mov    %eax,%esi
  sub    %edi,%esi
  add    %r9d,%esi
  movslq %esi,%rsi
  mov    0x0(%rbp,%rsi,4),%esi
  test   %esi,%esi
  je     L29
  nop
L5:
  movslq %ecx,%rsi
  movl   $0x1,0x0(%rbp,%rsi,4)
L29:
  add    $0x1,%eax
  add    $0x4,%rdx
  add    $0x1,%ecx
  cmp    %ebx,%eax
  jle    L71
  add    $0x4,%r8
  add    %r12d,%r9d
  add    %r14,%r11
  add    %r13d,%r10d
  cmp    %r8,%r15
  jne    L126
L109:
  lea    D3(%rip),%rdi
  call   <printf@plt>
  mov    0x8(%rsp),%rax
  mov    %rbp,(%rax)
  mov    0x10(%rsp),%rax
  mov    -0x4(%rbp,%rax,4),%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L46:
  mov    $0x1,%r13d
  mov    $0x1,%r12d
  xor    %ebx,%ebx
  xor    %r14d,%r14d
  jmp    L20
L89:
  movslq %edx,%rax
  mov    %rax,0x10(%rsp)
  jmp    L2
L139:
  xor    %eax,%eax
  xor    %r14d,%r14d
  jmp    L75
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D3
data_type: string

tool: D3: 


assistant: ```c
int Partition(int *a, int dim, int **mat) {
  int s, i, j, *m;
  for (i = 0, s = 0; i < dim; i++)
    s += a[i];
  s /= 2;
  m = (int *)malloc(sizeof(int) * (dim + 1) * (s + 1));
  for (i = 0; i < (dim + 1) * (s + 1); i++)
    m[i] = 0;
  m[0] = 1;
  for (i = 1; i < dim + 1; i++) {
    for (j = 0; j < s + 1; j++) {
      if (m[(i - 1) * (s + 1) + j])
        m[i * (s + 1) + j] = 1;
      else if (j >= a[i - 1] && m[(i - 1) * (s + 1) + (j - a[i - 1])])
        m[i * (s + 1) + j] = 1;
    }
  }
  printf("\n");
  *mat = m;
  return m[(dim + 1) * (s + 1) - 1];
}
```