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

```asm
<transpose>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    -0x3c(%rbp),%eax
  cltq
  add    %eax,%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mallocate@plt>
  cltq
  mov    %rax,%r15
  mov    $0x0,%ebx
  jmp    L110
L48:
  movslq %ebx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%r12
  test   %r12,%r12
  je     L14
  jmp    L65
L21:
  mov    %r12,%rax
  lea    0x2(%rax),%r12
  movzwl (%rax),%eax
  movswq %ax,%rax
  add    %rax,%rax
  add    %r15,%rax
  movzwl (%rax),%edx
  add    $0x1,%edx
  mov    %dx,(%rax)
L65:
  movzwl (%r12),%eax
  test   %ax,%ax
  jns    L21
L14:
  add    $0x1,%ebx
L110:
  cmp    -0x3c(%rbp),%ebx
  jl     L48
  mov    -0x3c(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mallocate@plt>
  cltq
  mov    %rax,-0x48(%rbp)
  mov    -0x3c(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mallocate@plt>
  cltq
  mov    %rax,%r14
  mov    $0x0,%ebx
  jmp    L70
L98:
  movslq %ebx,%rax
  add    %rax,%rax
  add    %r15,%rax
  movzwl (%rax),%eax
  movswl %ax,%r13d
  test   %r13d,%r13d
  jle    L148
  lea    0x1(%r13),%eax
  cltq
  add    %eax,%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <mallocate@plt>
  cltq
  mov    %rax,%r12
  movslq %ebx,%rax
  shl    $0x3,%rax
  add    -0x48(%rbp),%rax
  mov    %r12,(%rax)
  movslq %ebx,%rax
  shl    $0x3,%rax
  add    %r14,%rax
  mov    %r12,(%rax)
  movslq %r13d,%rax
  add    %rax,%rax
  add    %r12,%rax
  movw   $0xffff,(%rax)
L148:
  add    $0x1,%ebx
L70:
  cmp    -0x3c(%rbp),%ebx
  jl     L98
  test   %r15,%r15
  je     L86
  mov    %r15,%rdi
  call   <free@plt>
L86:
  mov    $0x0,%ebx
  jmp    L37
L41:
  movslq %ebx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%r12
  test   %r12,%r12
  je     L111
  jmp    L96
L139:
  mov    %r12,%rax
  lea    0x2(%rax),%r12
  movzwl (%rax),%eax
  movswq %ax,%rax
  shl    $0x3,%rax
  lea    (%r14,%rax,1),%rdx
  mov    (%rdx),%rax
  lea    0x2(%rax),%rcx
  mov    %rcx,(%rdx)
  mov    %ebx,%edx
  mov    %dx,(%rax)
L96:
  movzwl (%r12),%eax
  test   %ax,%ax
  jns    L139
L111:
  add    $0x1,%ebx
L37:
  cmp    -0x3c(%rbp),%ebx
  jl     L41
  test   %r14,%r14
  je     L26
  mov    %r14,%rdi
  call   <free@plt>
L26:
  mov    -0x48(%rbp),%rax
  add    $0x28,%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

assistant: ```c
short **transpose(short **R, int n) {
  register short **new_R;
  register short **temp_R;
  register short *nedges;
  register short *sp;
  register int i;
  register int k;
  nedges = ((short *)mallocate((unsigned)((n) * sizeof(short))));
  for (i = 0; i < n; i++) {
    sp = R[i];
    if (sp) {
      while (*sp >= 0)
        nedges[*sp++]++;
    }
  }
  new_R = ((short **)mallocate((unsigned)((n) * sizeof(short *))));
  temp_R = ((short **)mallocate((unsigned)((n) * sizeof(short *))));
  for (i = 0; i < n; i++) {
    k = nedges[i];
    if (k > 0) {
      sp = ((short *)mallocate((unsigned)((k + 1) * sizeof(short))));
      new_R[i] = sp;
      temp_R[i] = sp;
      sp[k] = -1;
    }
  }
  {
    if (nedges)
      free(nedges);
  };
  for (i = 0; i < n; i++) {
    sp = R[i];
    if (sp) {
      while (*sp >= 0)
        *temp_R[*sp++]++ = i;
    }
  }
  {
    if (temp_R)
      free(temp_R);
  };
  return (new_R);
}
```