user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<k_sum>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%r12
  mov    %esi,%ebx
  mov    %edx,%ebp
  mov    %ecx,%r15d
  cmp    $0x2,%r9d
  je     L28
  mov    %edx,%r14d
  sub    %r9d,%r14d
  lea    0x1(%r14),%eax
  cmp    %eax,%esi
  jg     L49
  movslq 0x68(%rsp),%rax
  mov    0x60(%rsp),%rsi
  lea    (%rsi,%rax,4),%rax
  mov    %rax,0x8(%rsp)
  movslq %ebx,%r13
  lea    -0x1(%r9),%eax
  mov    %eax,0x10(%rsp)
  jmp    L162
L28:
  mov    %r8d,%r13d
  cmp    %edx,%esi
  jge    L49
  mov    0x68(%rsp),%eax
  add    $0x1,%eax
  movslq 0x68(%rsp),%rdx
  mov    0x60(%rsp),%rdi
  lea    (%rdi,%rdx,4),%rsi
  mov    %rsi,0x8(%rsp)
  cltq
  lea    (%rdi,%rax,4),%rax
  mov    %rax,0x10(%rsp)
  lea    0x0(,%r8,4),%r14d
  jmp    L80
L123:
  jge    L154
  sub    $0x1,%ebp
L127:
  cmp    %ebx,%ebp
  jle    L49
L80:
  movslq %ebx,%rax
  mov    (%r12,%rax,4),%ecx
  movslq %ebp,%rax
  lea    (%r12,%rax,4),%rdx
  mov    %ecx,%eax
  add    (%rdx),%eax
  cmp    %eax,%r15d
  jle    L123
  add    $0x1,%ebx
  jmp    L127
L154:
  mov    0x8(%rsp),%rax
  mov    %ecx,(%rax)
  mov    (%rdx),%eax
  mov    0x10(%rsp),%rsi
  mov    %eax,(%rsi)
  mov    0x78(%rsp),%rax
  movslq (%rax),%rax
  mov    0x70(%rsp),%rdi
  lea    (%rdi,%rax,8),%rax
  mov    %rax,0x18(%rsp)
  mov    %r14d,%edi
  call   <malloc@plt>
  mov    0x18(%rsp),%rsi
  mov    %rax,(%rsi)
  mov    0x78(%rsp),%rax
  movslq (%rax),%rax
  mov    0x70(%rsp),%rdi
  mov    (%rdi,%rax,8),%rdi
  mov    %r14d,%edx
  mov    0x60(%rsp),%rsi
  call   <memcpy@plt>
  mov    0x78(%rsp),%rax
  movslq (%rax),%rax
  mov    0x80(%rsp),%rsi
  mov    %r13d,(%rsi,%rax,4)
  mov    0x78(%rsp),%rax
  addl   $0x1,(%rax)
  lea    0x1(%rbx),%eax
  cltq
L102:
  mov    %eax,%ebx
  cmp    %eax,%ebp
  jle    L25
  mov    (%r12,%rax,4),%edx
  add    $0x1,%rax
  cmp    -0x8(%r12,%rax,4),%edx
  je     L102
L25:
  lea    -0x1(%rbp),%eax
  cltq
L33:
  mov    %eax,%ebp
  cmp    %eax,%ebx
  jge    L49
  mov    (%r12,%rax,4),%edx
  sub    $0x1,%rax
  cmp    0x8(%r12,%rax,4),%edx
  je     L33
  jmp    L80
L40:
  add    $0x1,%r13
  lea    -0x1(%r13),%eax
  cmp    %eax,%r14d
  jl     L49
L162:
  cmp    %r13d,%ebx
  jge    L147
  mov    -0x4(%r12,%r13,4),%eax
  cmp    %eax,(%r12,%r13,4)
  je     L40
L147:
  mov    (%r12,%r13,4),%eax
  mov    0x8(%rsp),%rdi
  mov    %eax,(%rdi)
  mov    %r15d,%ecx
  sub    %eax,%ecx
  lea    0x1(%r13),%esi
  sub    $0x8,%rsp
  push   0x88(%rsp)
  push   0x88(%rsp)
  push   0x88(%rsp)
  mov    0x88(%rsp),%eax
  add    $0x1,%eax
  push   %rax
  push   0x88(%rsp)
  mov    0x40(%rsp),%r9d
  mov    $0x4,%r8d
  mov    %ebp,%edx
  mov    %r12,%rdi
  call   <k_sum>
  add    $0x30,%rsp
  jmp    L40
L49:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void k_sum(int *nums, int low, int high, int target, int total, int k, int *stack, int len, int **results, int *count, int *col_sizes) {
  int i;
  if (k == 2) {
    while (low < high) {
      int sum = nums[low] + nums[high];
      if (sum < target) {
        low++;
      } else if (sum > target) {
        high--;
      } else {
        stack[len++] = nums[low];
        stack[len++] = nums[high];
        results[*count] = malloc(total * sizeof(int));
        memcpy(results[*count], stack, total * sizeof(int));
        col_sizes[*count] = total;
        (*count)++;
        len -= 2;
        while (++low < high && nums[low] == nums[low - 1]) {
        }
        while (--high > low && nums[high] == nums[high + 1]) {
        }
      }
    }
  } else {
    for (i = low; i <= high - k + 1; i++) {
      if (i > low && nums[i] == nums[i - 1])
        continue;
      stack[len] = nums[i];
      k_sum(nums, i + 1, high, target - nums[i], 4, k - 1, stack, len + 1, results, count, col_sizes);
    }
  }
}
```