user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<chunk_creation_servers>:
  endbr64
  push   %r15
  push   %r14
  mov    %esi,%r14d
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rsi
  call   <matocsserv_getservers_wrandom@plt>
  mov    %eax,%r13d
  test   %eax,%eax
  jne    L12
  mov    0xc(%rsp),%edx
  xor    %eax,%eax
  test   %edx,%edx
  setg   %al
  mov    %eax,(%rbx)
L348:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L68
  add    $0x28,%rsp
  mov    %r13d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L12:
  mov    %r14d,%edi
  call   <labelset_get_create_mode@plt>
  mov    %r14d,%edi
  mov    %eax,%ebp
  call   <labelset_get_create_goal@plt>
  cmp    %eax,%r13d
  jge    L234
  mov    0xc(%rsp),%edx
  add    %r13d,%edx
  cmp    %eax,%edx
  jge    L100
L234:
  movl   $0x0,(%rbx)
  mov    %r14d,%edi
  call   <labelset_has_create_labels@plt>
  test   %rax,%rax
  je     L348
  mov    %r14d,%edi
  lea    0x10(%rsp),%rsi
  call   <labelset_get_create_labelmasks@plt>
  mov    %r13d,%edi
  shr    $0x1f,%edi
  mov    %eax,%r14d
  add    %r13d,%edi
  sar    %edi
  cmp    $0x1,%r13d
  jle    L278
  lea    -0x1(%r13),%r15d
  movslq %r15d,%rax
  lea    (%r12,%rax,4),%rdx
  xor    %eax,%eax
  nopl   0x0(%rax,%rax,1)
L38:
  mov    (%rdx),%esi
  mov    (%r12,%rax,4),%ecx
  sub    $0x4,%rdx
  mov    %esi,(%r12,%rax,4)
  add    $0x1,%rax
  mov    %ecx,0x4(%rdx)
  cmp    %eax,%edi
  jg     L38
  mov    0x10(%rsp),%rdx
  mov    %r14d,%edi
  mov    %r12,%rcx
  mov    %r13d,%esi
  call   <do_perfect_match@plt>
  mov    %rax,%rdi
  cmp    $0x2,%ebp
  je     L277
L126:
  test   %r14d,%r14d
  jle    L275
  lea    0x0(%r13,%r14,1),%r10d
  movslq %r14d,%r8
  xor    %ecx,%ecx
  xor    %esi,%esi
  movslq %r10d,%rax
  lea    -0x4(%rdi,%rax,4),%r11
  jmp    L139
  nopl   0x0(%rax,%rax,1)
L352:
  add    $0x1,%esi
L13:
  add    $0x1,%rcx
  cmp    %rcx,%r8
  je     L263
L139:
  mov    (%rdi,%rcx,4),%eax
  mov    %ecx,%r9d
  test   %eax,%eax
  jns    L352
  test   %r13d,%r13d
  jle    L263
  mov    %r11,%rdx
  mov    %r10d,%eax
  jmp    L97
  nopl   0x0(%rax,%rax,1)
L288:
  sub    $0x4,%rdx
  cmp    %eax,%r14d
  je     L263
L97:
  mov    (%rdx),%r15d
  sub    $0x1,%eax
  test   %r15d,%r15d
  jns    L288
  mov    %eax,(%rdi,%rcx,4)
  mov    %r9d,(%rdx)
  mov    (%rdi,%rcx,4),%r9d
  test   %r9d,%r9d
  jns    L13
  nopl   0x0(%rax,%rax,1)
L263:
  cmp    %r14d,%esi
  jge    L275
  cmp    $0x1,%ebp
  jne    L275
  add    0xc(%rsp),%esi
  cmp    %r14d,%esi
  jge    L100
L275:
  lea    -0x1(%r13),%eax
  test   %eax,%eax
  jle    L348
L336:
  xor    %edx,%edx
  movslq %r14d,%r8
  xor    %ecx,%ecx
  xchg   %ax,%ax
L170:
  add    %r8,%rcx
  lea    (%rdi,%rcx,4),%rcx
  nopw   0x0(%rax,%rax,1)
L149:
  mov    (%rcx),%esi
  test   %esi,%esi
  js     L175
  add    $0x1,%edx
  add    $0x4,%rcx
  cmp    %eax,%edx
  jl     L149
L257:
  cmp    $0x2,%ebp
  jne    L348
L95:
  mov    %edx,%r13d
  cmp    %edx,%r14d
  jle    L348
  mov    0xc(%rsp),%eax
  add    %edx,%eax
  cmp    %r14d,%eax
  jl     L348
  nopl   (%rax)
L100:
  movl   $0x1,(%rbx)
  xor    %r13d,%r13d
  jmp    L348
  cs nopw 0x0(%rax,%rax,1)
L175:
  cmp    %edx,%eax
  jle    L257
  movslq %eax,%rcx
  add    %r8,%rcx
  lea    (%rdi,%rcx,4),%rcx
  jmp    L52
L148:
  sub    $0x1,%eax
  sub    $0x4,%rcx
  cmp    %edx,%eax
  je     L257
L52:
  mov    (%rcx),%esi
  test   %esi,%esi
  js     L148
  lea    (%r14,%rdx,1),%r9d
  movslq %r9d,%r9
  lea    (%rdi,%r9,4),%r9
  mov    (%r9),%r10d
  mov    %esi,(%r9)
  movslq %eax,%rsi
  lea    (%r12,%rsi,4),%rsi
  mov    %r10d,(%rcx)
  movslq %edx,%rcx
  mov    (%rsi),%r11d
  lea    (%r12,%rcx,4),%r9
  mov    (%r9),%r10d
  mov    %r11d,(%r9)
  mov    %r10d,(%rsi)
  cmp    %edx,%eax
  jg     L170
  jmp    L257
  nopl   0x0(%rax)
L277:
  mov    %r15d,%eax
  jmp    L336
L278:
  mov    0x10(%rsp),%rdx
  mov    %eax,%edi
  mov    %r12,%rcx
  mov    %r13d,%esi
  call   <do_perfect_match@plt>
  xor    %edx,%edx
  mov    %rax,%rdi
  cmp    $0x2,%ebp
  jne    L126
  jmp    L95
L68:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
uint16_t chunk_creation_servers(uint16_t csids[10000], uint8_t lsetid, uint8_t *olflag) {
  int32_t *matching;
  uint32_t **labelmasks;
  uint8_t labelcnt;
  uint8_t create_mode;
  uint16_t servcount;
  uint16_t goodlabelscount;
  uint16_t overloaded;
  uint32_t i, j;
  int32_t x;
  servcount = matocsserv_getservers_wrandom(csids, &overloaded);
  if (servcount == 0) {
    *olflag = (overloaded > 0) ? 1 : 0;
    return 0;
  }
  create_mode = labelset_get_create_mode(lsetid);
  labelcnt = labelset_get_create_goal(lsetid);
  if (servcount < labelcnt && servcount + overloaded >= labelcnt) {
    *olflag = 1;
    return 0;
  } else {
    *olflag = 0;
  }
  if (labelset_has_create_labels(lsetid)) {
    labelcnt = labelset_get_create_labelmasks(lsetid, &labelmasks);
    for (i = 0; i < servcount / 2; i++) {
      x = csids[i];
      csids[i] = csids[servcount - 1 - i];
      csids[servcount - 1 - i] = x;
    }
    matching = do_perfect_match(labelcnt, servcount, labelmasks, csids);
    if (create_mode != 2) {
      goodlabelscount = 0;
      for (i = 0; i < labelcnt; i++) {
        if (matching[i] < 0) {
          for (j = 0; j < servcount; j++) {
            if (matching[labelcnt + servcount - j - 1] < 0) {
              matching[i] = labelcnt + servcount - j - 1;
              matching[labelcnt + servcount - j - 1] = i;
              break;
            }
          }
        } else {
          goodlabelscount++;
        }
        if (matching[i] < 0) {
          break;
        }
      }
      if (create_mode == 1) {
        if (goodlabelscount < labelcnt && goodlabelscount + overloaded >= labelcnt) {
          *olflag = 1;
          return 0;
        }
      }
    }
    i = 0;
    j = servcount - 1;
    while (i < j) {
      while (i < j && matching[labelcnt + i] >= 0) {
        i++;
      }
      while (i < j && matching[labelcnt + j] < 0) {
        j--;
      }
      if (i < j) {
        x = matching[labelcnt + i];
        matching[labelcnt + i] = matching[labelcnt + j];
        matching[labelcnt + j] = x;
        x = csids[i];
        csids[i] = csids[j];
        csids[j] = x;
      }
    }
    if (create_mode == 2) {
      if (i < labelcnt && i + overloaded >= labelcnt) {
        *olflag = 1;
        return 0;
      }
      return i;
    }
  }
  return servcount;
}
```