user: What is the c source code of the assembly code below?

```asm
<my_initgroups>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %esi,-0x4c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rbx
  mov    D19(%rip),%rax
  mov    (%rax),%eax
  add    $0x1,%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x38(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r10
  mov    $0x0,%r11d
  movslq %eax,%rdx
  mov    %rdx,%r8
  mov    $0x0,%r9d
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L7:
  cmp    %rdx,%rsp
  je     L52
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L7
L52:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L39
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L39:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x30(%rbp)
  movl   $0x0,-0x3c(%rbp)
  movl   $0x0,-0x40(%rbp)
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <getpwnam@plt>
  mov    %rax,-0x28(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  je     L49
  mov    D19(%rip),%rax
  mov    (%rax),%eax
  mov    -0x30(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <getgroups@plt>
  mov    %eax,-0x3c(%rbp)
  mov    -0x3c(%rbp),%eax
  add    $0x1,%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  je     L49
  jmp    L9
L88:
  mov    -0x40(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x30(%rbp),%rax
  mov    -0x40(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%eax
  mov    %eax,(%rcx)
  addl   $0x1,-0x40(%rbp)
L9:
  mov    -0x40(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L88
  mov    -0x40(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    -0x4c(%rbp),%eax
  mov    %eax,(%rdx)
  mov    -0x3c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x20(%rbp),%rax
  mov    %rax,%rsi
  mov    %edx,%edi
  call   <setgroups@plt>
  cmp    $0xffffffff,%eax
  je     L49
  mov    $0x0,%eax
  jmp    L20
L49:
  mov    $0xffffffff,%eax
L20:
  mov    %rbx,%rsp
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L33
  call   <__stack_chk_fail@plt>
L33:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
int my_initgroups(const char *user, gid_t group) {
  struct passwd *pwd;
  gid_t *grouplist, read_grouplist[NGROUPS_MAX + 1];
  int num_groups = 0, i = 0;
  pwd = getpwnam(user);
  if (pwd != NULL) {
    num_groups = getgroups(NGROUPS_MAX, read_grouplist);
    grouplist = malloc((num_groups + 1) * sizeof(gid_t));
    if (grouplist != NULL) {
      for (; i < num_groups; i++) {
        grouplist[i] = read_grouplist[i];
      }
      grouplist[i] = group;
      if (setgroups(num_groups + 1, grouplist) != -1) {
        return 0;
      }
    }
  }
  return -1;
}
```