user: Converte this assembly snippet into its equivalent C code:

```asm
<k_sum>:
  endbr64
  push   %r15
  mov    %ecx,%r10d
  push   %r14
  push   %r13
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x28,%rsp
  cmp    $0x2,%r9d
  je     L157
  mov    %edx,%r15d
  sub    %r9d,%r15d
  lea    0x1(%r15),%eax
  cmp    %eax,%esi
  jg     L6
  movslq 0x68(%rsp),%rax
  lea    -0x1(%r9),%r13d
  mov    %ecx,0x8(%rsp)
  movslq %esi,%r14
  mov    0x60(%rsp),%rdi
  mov    %r14,%r12
  mov    %esi,%r14d
  lea    (%rdi,%rax,4),%rax
  mov    %rax,(%rsp)
  mov    %r13d,%eax
  mov    %rbp,%r13
  mov    %r15d,%ebp
  mov    %eax,%ebx
  mov    %edx,%r15d
L48:
  mov    0x0(%r13,%r12,4),%r8d
  lea    0x1(%r12),%esi
  cmp    %r12d,%r14d
  jge    L37
  cmp    -0x4(%r13,%r12,4),%r8d
  je     L3
L37:
  mov    (%rsp),%rax
  mov    0x8(%rsp),%ecx
  sub    $0x8,%rsp
  mov    %ebx,%r9d
  mov    %r15d,%edx
  mov    %r13,%rdi
  mov    %r8d,(%rax)
  sub    %r8d,%ecx
  push   0x88(%rsp)
  push   0x88(%rsp)
  push   0x88(%rsp)
  mov    0x88(%rsp),%eax
  lea    0x1(%rax),%r8d
  push   %r8
  mov    $0x4,%r8d
  push   0x88(%rsp)
  call   <k_sum>
  add    $0x30,%rsp
L3:
  add    $0x1,%r12
  lea    -0x1(%r12),%ecx
  cmp    %ecx,%ebp
  jge    L48
L6:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L157:
  cmp    %edx,%esi
  jge    L6
  mov    0x68(%rsp),%eax
  mov    0x60(%rsp),%rdi
  mov    %r8d,%r15d
  movslq 0x68(%rsp),%r13
  lea    0x0(,%r15,4),%r14d
  add    $0x1,%eax
  cltq
  lea    (%rdi,%r13,4),%r8
  lea    (%rdi,%rax,4),%rcx
  jmp    L93
  nopl   0x0(%rax)
L17:
  add    $0x1,%ebx
L156:
  cmp    %ebx,%r12d
  jle    L6
L93:
  movslq %r12d,%rax
  mov    0x0(%rbp,%rax,4),%eax
L56:
  movslq %ebx,%rdx
  mov    0x0(%rbp,%rdx,4),%edx
  add    %edx,%eax
  cmp    %eax,%r10d
  jg     L17
  lea    -0x1(%r12),%r13d
  jge    L130
  mov    %r13d,%r12d
  jmp    L156
  nopl   0x0(%rax)
L130:
  movslq %r12d,%rax
  mov    %edx,(%r8)
  mov    0x70(%rsp),%rdi
  add    $0x1,%ebx
  mov    0x0(%rbp,%rax,4),%eax
  mov    %r10d,0x1c(%rsp)
  mov    %r8,0x10(%rsp)
  mov    %eax,(%rcx)
  mov    0x78(%rsp),%rax
  mov    %rcx,0x8(%rsp)
  movslq (%rax),%rax
  lea    (%rdi,%rax,8),%rdx
  mov    %r14d,%edi
  mov    %rdx,(%rsp)
  call   <malloc@plt>
  mov    (%rsp),%rdx
  mov    0x70(%rsp),%rsi
  mov    %rax,(%rdx)
  mov    0x78(%rsp),%rax
  mov    %r14d,%edx
  movslq (%rax),%rax
  mov    (%rsi,%rax,8),%rdi
  mov    0x60(%rsp),%rsi
  call   <memcpy@plt>
  mov    0x78(%rsp),%rax
  mov    0x10(%rsp),%r8
  mov    0x80(%rsp),%rdi
  mov    0x8(%rsp),%rcx
  movslq (%rax),%rax
  mov    0x1c(%rsp),%r10d
  mov    %r15d,(%rdi,%rax,4)
  mov    0x78(%rsp),%rax
  addl   $0x1,(%rax)
  movslq %ebx,%rax
  jmp    L72
L29:
  mov    0x0(%rbp,%rax,4),%edx
  add    $0x1,%rax
  cmp    -0x8(%rbp,%rax,4),%edx
  jne    L61
L72:
  mov    %eax,%ebx
  cmp    %eax,%r12d
  jg     L29
L61:
  movslq %r13d,%r13
  jmp    L104
  nopw   0x0(%rax,%rax,1)
L84:
  mov    0x0(%rbp,%r13,4),%eax
  sub    $0x1,%r13
  cmp    0x8(%rbp,%r13,4),%eax
  jne    L56
L104:
  mov    %r13d,%r12d
  cmp    %r13d,%ebx
  jl     L84
  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);
    }
  }
}
```