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

```asm
<become_user>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    -0x8(%rbp),%rax
  mov    0x10(%rax),%rdx
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <initgroups@plt>
  cmp    $0xffffffff,%eax
  jne    L15
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rsi
  lea    D22(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <perr@plt>
L15:
  mov    -0x8(%rbp),%rax
  mov    0x10(%rax),%rax
  mov    %rax,%rdi
  call   <setegid@plt>
  cmp    $0xffffffff,%eax
  je     L24
  mov    -0x8(%rbp),%rax
  mov    0x10(%rax),%rax
  mov    %rax,%rdi
  call   <setgid@plt>
  cmp    $0xffffffff,%eax
  jne    L43
L24:
  mov    -0x8(%rbp),%rax
  mov    0x10(%rax),%rax
  mov    %rax,%rsi
  lea    D48(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <perr@plt>
L43:
  mov    $0x0,%eax
  call   <setsid@plt>
  cmp    $0xffffffff,%eax
  jne    L61
  lea    D14(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <perr@plt>
L61:
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <setlogin@plt>
  cmp    $0xffffffff,%eax
  jne    L38
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rsi
  lea    D11(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <perr@plt>
L38:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <setuid@plt>
  cmp    $0xffffffff,%eax
  je     L66
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <seteuid@plt>
  cmp    $0xffffffff,%eax
  jne    L77
L66:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rsi
  lea    D39(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <perr@plt>
L77:
  mov    -0x8(%rbp),%rax
  mov    0x8(%rax),%rax
  mov    %rax,%rdi
  call   <chdir@plt>
  cmp    $0xffffffff,%eax
  jne    L23
  lea    D16(%rip),%rax
  mov    %rax,%rdi
  call   <chdir@plt>
L23:
  nop
  leave
  ret
```

tool_calls: name: read_data
arguments: data_label: D22
datatype: string
name: read_data
arguments: data_label: D48
datatype: string
name: read_data
arguments: data_label: D14
datatype: string
name: read_data
arguments: data_label: D11
datatype: string
name: read_data
arguments: data_label: D39
datatype: string
name: read_data
arguments: data_label: D16
datatype: string

tool: D22: Cannot init group list for `%s'

tool: D48: Cannot change primary group to %lu

tool: D14: Cannot create a session

tool: D11: Cannot set login name to `%s'

tool: D39: Cannot set user id to %lu

tool: D16: /

assistant: ```c
void become_user(struct passwd *pentry, uid_t uid) {
  if (initgroups(pentry->pw_name, pentry->pw_gid) == -1)
    perr("Cannot init group list for `%s'", pentry->pw_name);
  if (setegid(pentry->pw_gid) == -1 || setgid(pentry->pw_gid) == -1)
    perr("Cannot change primary group to %lu", (unsigned long)pentry->pw_gid);
  if (setsid() == -1)
    perr("Cannot create a session");
  if (setlogin(pentry->pw_name) == -1)
    perr("Cannot set login name to `%s'", pentry->pw_name);
  if (setuid(uid) == -1 || seteuid(uid) == -1)
    perr("Cannot set user id to %lu", (unsigned long)uid);
  if (chdir(pentry->pw_dir) == -1)
    (void)chdir("/");
}
```