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

```asm
<fairCandySwap>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x61000(%rsp),%r11
L31:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L31
  sub    $0xaa8,%rsp
  mov    %esi,0x8(%rsp)
  mov    %rdi,%rbp
  mov    $0x4,%esi
  mov    %rdx,%rbx
  mov    $0x2,%edi
  mov    %ecx,%r14d
  mov    %fs:0x28,%rax
  mov    %rax,0x61a98(%rsp)
  xor    %eax,%eax
  movl   $0x2,(%r8)
  call   <calloc@plt>
  mov    0x8(%rsp),%r9d
  mov    %rax,%r13
  test   %r9d,%r9d
  jle    L160
  lea    -0x1(%r9),%edx
  lea    0x4(%rbp),%r8
  mov    %rbp,%rax
  xor    %r12d,%r12d
  mov    %rdx,%rcx
  lea    (%r8,%rdx,4),%rdx
  nopw   0x0(%rax,%rax,1)
L42:
  add    (%rax),%r12d
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L42
  test   %r14d,%r14d
  jle    L132
L158:
  xor    %eax,%eax
  xor    %edx,%edx
  nopl   0x0(%rax)
L50:
  add    (%rbx,%rax,4),%edx
  add    $0x1,%rax
  cmp    %eax,%r14d
  jg     L50
  mov    %r9d,0x8(%rsp)
  cmp    %edx,%r12d
  je     L107
  add    %r12d,%edx
  lea    0x10(%rsp),%rdi
  xor    %esi,%esi
  mov    %edx,%r15d
  shr    $0x1f,%r15d
  add    %edx,%r15d
  mov    $0x61a84,%edx
  sar    %r15d
  mov    %r15d,%r10d
  sub    %r12d,%r10d
  mov    %r10d,(%rsp)
  call   <memset@plt>
  mov    0x8(%rsp),%r9d
  test   %r9d,%r9d
  jle    L128
  mov    (%rsp),%r10d
  lea    -0x1(%r9),%ecx
  lea    0x4(%rbp),%r8
L103:
  mov    %rbp,%rax
  lea    (%r8,%rcx,4),%rcx
  nopw   0x0(%rax,%rax,1)
L79:
  mov    (%rax),%edx
  add    %r10d,%edx
  cmp    $0x186a0,%edx
  ja     L51
  movslq %edx,%rdx
  movl   $0x1,0x10(%rsp,%rdx,4)
L51:
  add    $0x4,%rax
  cmp    %rcx,%rax
  jne    L79
  test   %r14d,%r14d
  jle    L107
L128:
  lea    -0x1(%r14),%edx
  mov    %rbx,%rax
  lea    0x4(%rbx,%rdx,4),%rsi
  nopw   0x0(%rax,%rax,1)
L96:
  movslq (%rax),%rcx
  mov    %rcx,%rdx
  mov    0x10(%rsp,%rcx,4),%ecx
  test   %ecx,%ecx
  je     L20
  sub    %r15d,%edx
  add    %r12d,%edx
  mov    %edx,0x0(%r13)
  mov    (%rax),%edx
  mov    %edx,0x4(%r13)
L20:
  add    $0x4,%rax
  cmp    %rax,%rsi
  jne    L96
L107:
  mov    0x61a98(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  add    $0x61aa8,%rsp
  mov    %r13,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L160:
  xor    %r12d,%r12d
  test   %r14d,%r14d
  jg     L158
  jmp    L107
  xchg   %ax,%ax
L132:
  test   %r12d,%r12d
  je     L107
  mov    %r12d,%r15d
  lea    0x10(%rsp),%rdi
  mov    $0x61a84,%edx
  xor    %esi,%esi
  shr    $0x1f,%r15d
  mov    %ecx,0xc(%rsp)
  add    %r12d,%r15d
  mov    %r8,(%rsp)
  sar    %r15d
  mov    %r15d,%r10d
  sub    %r12d,%r10d
  mov    %r10d,0x8(%rsp)
  call   <memset@plt>
  mov    0x8(%rsp),%r10d
  mov    (%rsp),%r8
  mov    0xc(%rsp),%ecx
  jmp    L103
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int *fairCandySwap(int *A, int ASize, int *B, int BSize, int *returnSize) {
  *returnSize = 2;
  int *res = (int *)calloc(2, sizeof(int));
  int countA = 0, countB = 0;
  int i = 0, j = 0;
  for (i = 0; i < ASize; i++) {
    countA += A[i];
  }
  for (j = 0; j < BSize; j++) {
    countB += B[j];
  }
  if (countA == countB) {
    return res;
  }
  int average = (countA + countB) / 2;
  int padA = average - countA;
  int record[100001] = {0};
  for (i = 0; i < ASize; i++) {
    int k = A[i] + padA;
    if (k >= 0 && k <= 100000) {
      record[k] = 1;
    }
  }
  for (j = 0; j < BSize; j++) {
    if (record[B[j]]) {
      res[0] = B[j] - average + countA;
      res[1] = B[j];
    }
  }
  return res;
}
```