user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<os_alloc_assoc_set_pid>:
  endbr64
  push   %r14
  push   %r13
  mov    %edi,%r13d
  push   %r12
  push   %rbp
  mov    %esi,%ebp
  xor    %esi,%esi
  push   %rbx
  sub    $0x120,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x118(%rsp)
  xor    %eax,%eax
  lea    0x8(%rsp),%rdi
  movl   $0x0,0x4(%rsp)
  call   <_pqos_cap_get@plt>
  mov    0x8(%rsp),%rdi
  lea    0x4(%rsp),%rsi
  call   <resctrl_alloc_get_grps_num@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  jne    L92
  cmp    %ebp,0x4(%rsp)
  jbe    L54
  xor    %eax,%eax
  call   <resctrl_lock_exclusive@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  je     L74
L92:
  mov    0x118(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L87
  add    $0x120,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopw   0x0(%rax,%rax,1)
L74:
  lea    0x10(%rsp),%r14
  mov    $0x100,%edx
  mov    %r13d,%edi
  mov    %r14,%rsi
  call   <resctrl_mon_assoc_get_pid@plt>
  mov    %eax,%ebx
  test   %eax,%eax
  je     L64
  cmp    $0x3,%eax
  je     L64
  mov    %r13d,%edx
  lea    D2(%rip),%rsi
  mov    $0x2,%edi
  call   <log_printf@plt>
  mov    %ebp,%esi
  mov    %r13d,%edi
  call   <resctrl_alloc_assoc_set_pid@plt>
  mov    %eax,%r12d
L81:
  xor    %eax,%eax
  call   <resctrl_lock_release@plt>
  jmp    L92
  nopw   0x0(%rax,%rax,1)
L64:
  mov    %ebp,%esi
  mov    %r13d,%edi
  call   <resctrl_alloc_assoc_set_pid@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  jne    L81
  test   %ebx,%ebx
  jne    L81
  mov    %r14,%rsi
  mov    %r13d,%edi
  call   <resctrl_mon_assoc_set_pid@plt>
  test   %eax,%eax
  je     L81
  mov    %r13d,%edx
  lea    D14(%rip),%rsi
  mov    $0x2,%edi
  call   <log_printf@plt>
  jmp    L81
  nopw   0x0(%rax,%rax,1)
L54:
  mov    %r13d,%edx
  lea    D20(%rip),%rsi
  mov    $0x4,%edi
  mov    $0x2,%r12d
  call   <log_printf@plt>
  jmp    L92
L87:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D2
datatype: string
name: parse_data
arguments: label: D14
datatype: string
name: parse_data
arguments: label: D20
datatype: string

tool: D2: WARN: Failed to obtain monitoring group assignment for task %d


tool: D14: WARN: Could not assign task %d back to monitoring group


tool: D20: ERROR: COS out of bounds for task %d


assistant: ```c
int os_alloc_assoc_set_pid(const pid_t task, const unsigned class_id) {
  int ret;
  unsigned max_cos = 0;
  int ret_mon;
  char mon_group[256];
  const struct pqos_cap *cap;
  _pqos_cap_get(&cap, NULL);
  ret = resctrl_alloc_get_grps_num(cap, &max_cos);
  if (ret != 0)
    return ret;
  if (class_id >= max_cos) {
    log_printf((1 << 2),
               "ERROR: "
               "COS out of bounds for task %d\n",
               (int)task);
    return 2;
  }
  ret = resctrl_lock_exclusive();
  if (ret != 0)
    return ret;
  ret_mon = resctrl_mon_assoc_get_pid(task, mon_group, sizeof(mon_group));
  if (ret_mon != 0 && ret_mon != 3)
    log_printf((1 << 1),
               "WARN: "
               "Failed to obtain monitoring group assignment for "
               "task %d\n",
               task);
  ret = resctrl_alloc_assoc_set_pid(task, class_id);
  if (ret != 0)
    goto os_alloc_assoc_set_pid_exit;
  if (ret_mon == 0) {
    ret_mon = resctrl_mon_assoc_set_pid(task, mon_group);
    if (ret_mon != 0)
      log_printf((1 << 1),
                 "WARN: "
                 "Could not assign task %d back to monitoring "
                 "group\n",
                 task);
  }
os_alloc_assoc_set_pid_exit:
  resctrl_lock_release();
  return ret;
}
```