user: Translate the below assembly code into C programming language:

```asm
<run_perf_test>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %esi,-0x38(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rbx
  mov    -0x34(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x28(%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
L99:
  cmp    %rdx,%rsp
  je     L37
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L99
L37:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L0
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L0:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x20(%rbp)
  movl   $0x0,-0x2c(%rbp)
  jmp    L67
L64:
  call   <fork@plt>
  mov    %eax,%ecx
  mov    -0x20(%rbp),%rax
  mov    -0x2c(%rbp),%edx
  movslq %edx,%rdx
  mov    %ecx,(%rax,%rdx,4)
  mov    -0x20(%rbp),%rax
  mov    -0x2c(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%eax
  test   %eax,%eax
  jne    L39
  mov    -0x38(%rbp),%edx
  mov    -0x2c(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <loop@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  jmp    L58
L39:
  mov    -0x20(%rbp),%rax
  mov    -0x2c(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%eax
  cmp    $0xffffffff,%eax
  jne    L58
  mov    -0x2c(%rbp),%eax
  mov    %eax,%esi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L58:
  addl   $0x1,-0x2c(%rbp)
L67:
  mov    -0x2c(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L64
  movl   $0x0,-0x2c(%rbp)
  jmp    L46
L27:
  mov    -0x20(%rbp),%rax
  mov    -0x2c(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%eax
  lea    -0x30(%rbp),%rcx
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <waitpid@plt>
  mov    -0x20(%rbp),%rdx
  mov    -0x2c(%rbp),%ecx
  movslq %ecx,%rcx
  mov    (%rdx,%rcx,4),%edx
  cmp    %edx,%eax
  sete   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  mov    -0x30(%rbp),%eax
  test   %eax,%eax
  sete   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  addl   $0x1,-0x2c(%rbp)
L46:
  mov    -0x2c(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L27
  mov    %rbx,%rsp
  nop
  mov    -0x18(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L97
  call   <__stack_chk_fail@plt>
L97:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: parse_data
arguments: tag: D9
datatype: string

tool: D9: couldn't spawn #%d process


assistant: ```c
void run_perf_test(int tasks, int flags) {
  pid_t pid[tasks];
  int i;
  for (i = 0; i < tasks; i++) {
    pid[i] = fork();
    if (pid[i] == 0) {
      loop(i, flags);
      exit(0);
    } else if (pid[i] == -1) {
      printf("couldn't spawn #%d process\n", i);
      exit(1);
    }
  }
  for (i = 0; i < tasks; i++) {
    int status;
    assert(waitpid(pid[i], &status, 0) == pid[i]);
    assert(status == 0);
  }
}
```