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

```asm
<os_thread_create>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %rcx,%rcx
  je     L104
  mov    %esi,%ebx
  mov    %rdx,%r12
  mov    %rcx,%r13
  mov    %r8,%r14
  cmp    $0x1,%edi
  je     L17
  cmp    $0x2,%edi
  jne    L103
  mov    D46(%rip),%rax
  mov    (%rax),%r15d
L106:
  lea    0x10(%rsp),%rbp
  mov    %rbp,%rdi
  call   <pthread_attr_init@plt>
  test   %eax,%eax
  jne    L5
  test   %r12,%r12
  je     L71
  mov    %r12,%rsi
  mov    %rbp,%rdi
  mov    $0xfffffffd,%r12d
  call   <pthread_attr_setstacksize@plt>
  test   %eax,%eax
  jne    L7
L71:
  mov    D23(%rip),%rax
  mov    %rbp,%rdi
  mov    $0xfffffffc,%r12d
  mov    (%rax),%esi
  call   <pthread_attr_setdetachstate@plt>
  test   %eax,%eax
  jne    L7
  mov    D1(%rip),%rax
  mov    %rbp,%rdi
  mov    $0xfffffffb,%r12d
  mov    (%rax),%esi
  call   <pthread_attr_setinheritsched@plt>
  test   %eax,%eax
  je     L98
L7:
  mov    %rbp,%rdi
  call   <pthread_attr_destroy@plt>
L51:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L148
  add    $0x28,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L103:
  mov    D19(%rip),%rax
  mov    (%rax),%r15d
  jmp    L106
  nopw   0x0(%rax,%rax,1)
L17:
  mov    D41(%rip),%rax
  mov    (%rax),%r15d
  jmp    L106
  nop
L98:
  mov    %r15d,%esi
  mov    %rbp,%rdi
  mov    $0xfffffffa,%r12d
  call   <pthread_attr_setschedpolicy@plt>
  test   %eax,%eax
  jne    L7
  lea    0x14(%rsp),%rsi
  mov    %rbp,%rdi
  mov    %ebx,0x14(%rsp)
  mov    $0xfffffff9,%r12d
  call   <pthread_attr_setschedparam@plt>
  test   %eax,%eax
  jne    L7
  lea    0xc(%rsp),%rdi
  mov    %r14,%rcx
  mov    %r13,%rdx
  mov    %rbp,%rsi
  call   <pthread_create@plt>
  mov    %eax,%r12d
  test   %eax,%eax
  mov    $0xfffffff8,%eax
  cmovne %eax,%r12d
  jmp    L7
  nopw   0x0(%rax,%rax,1)
L5:
  mov    $0xfffffffe,%r12d
  jmp    L51
L104:
  mov    $0xffffffff,%r12d
  jmp    L51
L148:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int os_thread_create(int policy, int priority, size_t stack_size, void *(*start)(void *), void *arg) {
  int ret;
  pthread_t tid;
  pthread_attr_t attr;
  struct sched_param params;
  if (start == NULL) {
    return -1;
  }
  switch (policy) {
  case 1:
    policy = SCHED_FIFO;
    break;
  case 2:
    policy = SCHED_RR;
    break;
  case 0:
  default:
    policy = SCHED_OTHER;
    break;
  }
  ret = pthread_attr_init(&attr);
  if (ret != 0) {
    return -2;
  }
  if (stack_size > 0) {
    ret = pthread_attr_setstacksize(&attr, stack_size);
    if (ret != 0) {
      ret = -3;
      goto out;
    }
  }
  ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
  if (0 != ret) {
    ret = -4;
    goto out;
  }
  ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
  if (0 != ret) {
    ret = -5;
    goto out;
  }
  ret = pthread_attr_setschedpolicy(&attr, policy);
  if (0 != ret) {
    ret = -6;
    goto out;
  }
  params.sched_priority = priority;
  ret = pthread_attr_setschedparam(&attr, &params);
  if (0 != ret) {
    ret = -7;
    goto out;
  }
  ret = pthread_create(&tid, &attr, start, arg);
  if (0 != ret) {
    ret = -8;
    goto out;
  }
out:
  pthread_attr_destroy(&attr);
  return ret;
}
```