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

```asm
<picnic>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,0xc(%rsp)
  mov    %esi,%r13d
  mov    %rdx,0x10(%rsp)
  test   %esi,%esi
  jne    L91
L115:
  mov    %r13d,%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L91:
  mov    %edi,%ebx
  movslq %edi,%r14
  mov    %r14,0x18(%rsp)
  lea    0x0(,%r14,8),%rdi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %ebx,%ebx
  jle    L119
  lea    0x0(,%r14,4),%r15
  mov    %rax,%rbp
  mov    %ebx,%ebx
  lea    (%rax,%rbx,8),%r14
  shl    $0x2,%rbx
L121:
  mov    %r15,%rdi
  call   <malloc@plt>
  mov    %rbp,%rcx
  mov    %rax,0x0(%rbp)
  mov    $0x0,%eax
L18:
  mov    (%rcx),%rdx
  movl   $0x0,(%rdx,%rax,1)
  add    $0x4,%rax
  cmp    %rbx,%rax
  jne    L18
  add    $0x8,%rbp
  cmp    %r14,%rbp
  jne    L121
  add    %r13d,%r13d
  test   %r13d,%r13d
  jle    L123
L82:
  mov    0x10(%rsp),%rsi
  mov    %rsi,%rax
  sub    $0x1,%r13d
  shr    %r13d
  mov    %r13d,%edx
  lea    0x8(%rsi,%rdx,8),%rsi
L33:
  movslq (%rax),%rdx
  movslq 0x4(%rax),%rcx
  mov    (%r12,%rdx,8),%rdx
  movl   $0x1,(%rdx,%rcx,4)
  movslq 0x4(%rax),%rdx
  movslq (%rax),%rcx
  mov    (%r12,%rdx,8),%rdx
  movl   $0x1,(%rdx,%rcx,4)
  add    $0x8,%rax
  cmp    %rsi,%rax
  jne    L33
  mov    0x18(%rsp),%rdi
  shl    $0x2,%rdi
  call   <malloc@plt>
  mov    %rax,%rdi
  cmpl   $0x0,0xc(%rsp)
  jle    L78
L36:
  mov    %rdi,%rdx
  mov    0xc(%rsp),%eax
  lea    (%rdi,%rax,4),%rcx
L19:
  movl   $0x0,(%rdx)
  add    $0x4,%rdx
  cmp    %rcx,%rdx
  jne    L19
  mov    %r12,%rdx
  mov    0xc(%rsp),%r15d
  mov    %r15d,%esi
  mov    $0x0,%eax
  call   <take_friend@plt>
  mov    %eax,%r13d
  mov    %r12,%rbx
  mov    %r15d,%eax
  lea    (%r12,%rax,8),%rbp
L46:
  mov    (%rbx),%rdi
  call   <free@plt>
  add    $0x8,%rbx
  cmp    %rbx,%rbp
  jne    L46
L0:
  mov    %r12,%rdi
  call   <free@plt>
  jmp    L115
L119:
  add    %r13d,%r13d
  test   %r13d,%r13d
  jg     L82
  mov    0x18(%rsp),%rdi
  shl    $0x2,%rdi
  call   <malloc@plt>
  mov    %rax,%rdi
L78:
  mov    %r12,%rdx
  mov    0xc(%rsp),%esi
  mov    $0x0,%eax
  call   <take_friend@plt>
  mov    %eax,%r13d
  jmp    L0
L123:
  mov    0x18(%rsp),%rdi
  shl    $0x2,%rdi
  call   <malloc@plt>
  mov    %rax,%rdi
  jmp    L36
```

assistant: ```c
int picnic(int student_count, int friendship_count, int *friendships) {
  if (friendship_count == 0) {
    return 0;
  }
  int **grouped_friendships = (int **)malloc(sizeof(int *) * student_count);
  int i = 0;
  int j = 0;
  for (i = 0; i < student_count; i++) {
    grouped_friendships[i] = (int *)malloc(sizeof(int) * (student_count));
    for (j = 0; j < student_count; j++) {
      grouped_friendships[i][j] = 0;
    }
  }
  for (i = 0; i < 2 * friendship_count; i += 2) {
    grouped_friendships[friendships[i]][friendships[i + 1]] = 1;
    grouped_friendships[friendships[i + 1]][friendships[i]] = 1;
  }
  int *taken = (int *)malloc(sizeof(int) * student_count);
  for (i = 0; i < student_count; i++) {
    taken[i] = 0;
  }
  int result = take_friend(taken, student_count, grouped_friendships);
  for (i = 0; i < student_count; i++) {
    free(grouped_friendships[i]);
  }
  free(grouped_friendships);
  return result;
}
```